I can't seem to run my code in emu8086. Can anybody take a look at my code and figure out what's wrong?
org 100h
variable1 db 9h
variable2 db 5
variable3 db 1342h
ret
mov ax, variable1
mov bl, variable2
mov cx, variable3
I can't seem to run my code in emu8086. Can anybody take a look at my code and figure out what's wrong?
org 100h
variable1 db 9h
variable2 db 5
variable3 db 1342h
ret
mov ax, variable1
mov bl, variable2
mov cx, variable3
You got these problems in your code:
ret
before your code
ret
will return from subroutine so program will not go after this instruction unless stack has been tampered with.
missing start address
you got org 100h
but placed variables there... you code starts after them but you do not have any label to jump to ...
data types mish-mash
db
means 8 bit value and dw
means 16 bit value. Some compilers check this if used by 8 bit or 16 bit access... so if you use mov ax,variable1
which is 16 bit <- 8 bit
compiler throws an error or warning or whatever.
no background info
as we do not know what you want to do we can only guess. for example
mov ax,variable1
means you want to access memory at variable1
like
mov ax,[cs:variable1]
or just get the offset. Also we do not know your compiler syntax ...
I would change your program to:
org 100h
mov ax, variable1
mov bl, variable2
mov cx, variable3
ret
variable1 dw 9h
variable2 db 5
variable3 dw 1342h
or:
org 100h
variable1 dw 9h
variable2 db 5
variable3 dw 1342h
start:
mov ax, variable1
mov bl, variable2
mov cx, variable3
ret
the first is used by call 100h
and the second by call start
. Not sure how labels are defined in your compiler syntax however so the start:
line may look a bit different.