-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More examples related to memory based addressing #22
Comments
Hey!
Very happy to hear that you are finding this useful , thank you!
There are some limitations of this projects, but some issues might be bugs as well, so if you find any, please feel free to open issues 👍 To increment the memory address you can use the INC command as well : From what we understood from your question, we have written a simple program , which might be similar to what you are looking for :
In case you meant something different, please let us know we'll try to help as much as we can.
We have some demo examples in to core library repository at https://github.com/YJDoc2/8086-Emulator/tree/master/examples You can also take a look at the instructions page https://yjdoc2.github.io/8086-emulator-web/help which explains supported syntax of each instruction. Hope this helps, |
Thanks a lot for your reply. The examples are really helpful.
I wrote a crude way to check if a number is prime or not. If you find this
program correct, you may include this in your examples.
Thank you very much for your help.
Regards,
Swagat
…On Thu, Feb 24, 2022 at 6:26 PM YJDoc2 ***@***.***> wrote:
Hey!
This is a very useful project.
Very happy to hear that you are finding this useful , thank you!
It works most of the time.
There are some limitations of this projects, but some issues might be bugs
as well, so if you find any, please feel free to open issues 👍
To increment the memory address you can use the INC command as well : INC
SI
From what we understood from your question, we have written a simple
program , which might be similar to what you are looking for :
; Program to add two word length numbers
val1:
DB 0x16
DB 0xFC
val2:
DB 0x97
DB 0x84
; actual entry point of the program
start:
MOV SI, OFFSET val1
MOV DI, OFFSET val2
;Lower
MOV AL, byte [SI]
INC SI
MOV BL, byte [DI]
INC DI
ADC AL,BL
DAA
MOV DL, AL
;higher
MOV AL, byte [SI]
INC SI
MOV BL, byte [DI]
INC DI
ADC AL,BL
MOV DH, AL
In case you meant something different, please let us know we'll try to
help as much as we can.
It would be a great idea to include more examples to explain various
capabilities of this emulator
We have some demo examples in to core library repository at
https://github.com/YJDoc2/8086-Emulator/tree/master/examples
You can also take a look at the instructions page
https://yjdoc2.github.io/8086-emulator-web/help which explains supported
syntax of each instruction.
Hope this helps,
Let know if you have any other issues or doubts :)
—
Reply to this email directly, view it on GitHub
<#22 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHBTDYS2DTTI2VKIZ5YVLLU4ZZ5DANCNFSM5PHBIW4Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Hey @swagatk ,
I would be happy to include the example, but I am not able to find it. Have you attached it to the message or have you put it in some separate repository/gist? Also, if you would be fine with it, can you tell in which university/college and for which course are you using this for teaching? I am just curious as to how useful this is for it 😅 😅 Thanks :) |
I did attach a file. In any case, I am copying the code below:
I am teaching an "Embedded System" course to undergraduate students at Edge
Hill University in the UK.
Thanks & Regards,
Swagat
----------------------------------------------------------------------------
; checking if a given number is prime or not
; it should work for any decimal number between 0 and 255.
start:
MOV DL, 0 ; used for compare with 0
MOV DH, 1 ; used for compare with 1
MOV CL, 15 ; enter the number (n) for checking prime-ness
MOV CH, CL ; CH <-- CL
loop1: DEC CH ; start with CH = n-1 as divisor
CMP CH, DH ; continue until CH = 1
JZ skip ; if CH == 1, jump to skip (end loop)
MOV AL, CL ; copy the value from CL TO AL everytime
MOV AH, 0x00 ; clear remainder everytime before division
DIV CH ; AL / CH, check remainder in AH
CMP AH, DL ; if remainder (AH) is not zero, jump to loop1
JNZ loop1
MOV BL, 0 ; BL=0 Indicates the number is not prime
HLT
skip: MOV BL, 1 ; BL=1 Indicates the number is prime
HLT
…On Mon, Mar 7, 2022 at 5:41 PM YJDoc2 ***@***.***> wrote:
Hey @swagatk <https://github.com/swagatk> ,
Apologies for the late reply 😓
I wrote a crude way to check if a number is prime or not. If you find this
program correct, you may include this in your examples.
I would be happy to include the example, but I am not able to find it.
Have you attached it to the message or have you put it in some separate
repository/gist?
Also, if you would be fine with it, can you tell in which
university/college and for which course are you using this for teaching? I
am just curious as to how useful this is for it 😅 😅
Thanks :)
—
Reply to this email directly, view it on GitHub
<#22 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHBTDYETHTJERBRNGDBUY3U6Y5VTANCNFSM5PHBIW4Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hello @swagatk,
Thanks a lot for your contribution, we appreciate it :) |
Also to add another thing, we will be adding the example under MIT + Apache 2.0 dual license, same as the emulator-8086 repository : https://github.com/YJDoc2/8086-Emulator/#license . In case you have any issue with this, let us know. Otherwise, feel free to close this issue :) |
Hi All,
This is a very useful project. It works most of the time. It would be a great idea to include more examples to explain various capabilities of this emulator - memory addressing, loading and storing values into the memory etc. For instance, I am trying to load a set of bytes from the memory and then perform add with carry on these bytes as mentioned in this example.
My question is how can I load a series of bytes from the memory using data segment register or SI/DI registers. In other words, how can increment the memory addresses. One would be to use addresses directly [01], [02] etc. But it will be good to increment the BP register to go to the next address. In short, It would really help if you can create a tutorial on this providing more examples.
thanks for this great work. really appreciate for your effort. I am using this software to teach my students.
Regards,
Swagat
The text was updated successfully, but these errors were encountered: