8086-emulator-web
8086-emulator-web copied to clipboard
Statements not working
MOV AX,2000H MOV BX,2002H ADD AX,BX
i wrote this code and this not working in the compiler
Hello, @Jyo561 thanks for using the 8086 emulator web. As for your question, we would recommend referring to the instruction page, we tried to keep the syntax simple and somewhat similar to assemblers like gas/nasm ; along with that we made some decisions which we thought would be helpful for beginners when coding to avoid accidental errors, and some syntax was changed due to conflicts in the parser. As a result, the syntax for this can be different from the syntax of emu8086 in some places, for example, whenever you want to access memory for data, you have to specify if you want to access byte memory or word memory; this prevents accidentally using incorrect size values or registers.
For accessing the memory it starts with 0 and use byte [0] for accessing the first element for example.
You can also check the examples
I am not getting how to apply indirect addressing mode in it?
Hope this helps
vals:
DB 0x3 ; declaration of the numbers
DB 0x2
start:
MOV SI, 0
MOV AH, byte [SI]
INC SI
MOV BH, byte [SI]
ADD AH, BH
and can u suggest how change values in the memory location just like we do in Emu8086
MOV byte [address] , value
here value can be number, register,etc
Note : Memory location starts from index 0
thanks but i was asking if we can directly change values in the memory section like if the code is MOV AX,byte [0x5004] so how can we put the values directly in the memory location by going to the set address so as to be accessed by AX
So if you run
start:
MOV byte [0], 8
Then you will notice in memory the first element will be 8
And to access it
Use SI
Hope this answers your question if not do let us know
Can we put data to 5000 address using DB? how to use hexadecimal in emulator?
The memory is based on an index starting from 0 and not the actual address you can read the note for the reason.
When you use DB it will by default store the date starting from first index.
But you can represent the index in decimal or hexadecimal
eg:
MOV byte [0xA], 7
This will store number 7 in the 10th index. Same way in place of 7 you can use hexadecimal.
@Jyo561 Apart from what @Vatsalsoni13 has suggested, if you want a way to store data at "compile" time, you can use the set directive.
DB 0x75 ;this will be stored at mem loc 0
set 0x100 ; this will set the DS to 0x100
DB 0x57 ; this will be stored at 0x100 * 0x10 = 0x1000
DB 0x88 ; this will be stored at 0x1001
You can check this works by compiling and setting the mem location to the * 0x10 value. (Note that the set input for memory takes hex values)
Hope this helps :)
set 0x2000 DW 0x0004 DW 0x0012; declaration of the numbers DW 0x0014 DW 0x0016 DW 0x0018 set 0x0000 //why this line is not working
start: MOV SI,0x2000 MOV CX,word [SI] MOV BX,CX MOV AX,0x0000 INC SI INC SI BACK:ADD AX,word [SI] JNC SKIP INC DX SKIP:INC SI INC SI DEC CX JNZ BACK
INC SI INC SI MOV word [SI],DX INC SI INC SI MOV word [SI],AX DIV BX INC SI INC SI MOV word [SI],DX INC SI INC SI MOV word [SI],AX DIV BX HLT
The program is fine but I guess you have miscalculated the address, after set 0x2000 the address for DW 0x0004 will be 0x2000 * 0x10 which goes out of the range of memory
Here is what you can do use set in the program
eg
set 0x1
DW 0x0004 ;will be saved in the 1st row(note we are using 0-based indexing)
how to write this piece of Code ARR: DB 0x25,0x38,0x0AA,0x0F,0x12,0x22