flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 12 Sep 2013, 22:09
You are printing the two bytes of the "jmp start" instruction. Your data follows after the jmp.
You might want to consider initialising SI to point to the data before using it. Code: ;... start: mov si,msg loop: mov al, [ds:si] cmp al, 0 je done mov ah, 0eh int 10h inc si jmp loop ;... |
|||
![]() |
|
MHajduk 12 Sep 2013, 22:17
Or just do something like that:
Code: org 100h jmp start ; jump over data declaration msg: db "Hello, World!", 0 start: mov al, [ds:si+2] ; <--- a small change here cmp al, 0 je done mov ah, 0eh int 10h inc si jmp start done: mov ax, 4C00h int 21h |
|||
![]() |
|
Mahmoud899 13 Sep 2013, 11:42
Thank you guys, problem solved
|
|||
![]() |
|
Mahmoud899 13 Sep 2013, 12:39
Hello, I am writing a very simple assembly program that adds 2 numbers and then moves their total to a defined variable that I have created
Code: format MZ entry .code:start segment .code start: mov ax, .data mov ds, ax mov al, data1 mov bl, data2 add al, bl mov total, al mov ah, 4CH int 21H segment .data data1 db 52H data2 db 29H total db ? when I assemble the program I get the following error: F2_1.asm[11]: mov total, al error: invalid operand. How is that possible, it should be possible that you could move data from general purpose registers to a user defined variable. How can I fix that error thank you |
|||
![]() |
|
system error 13 Sep 2013, 12:49
Mahmoud899
mov al, data1 ;transfers the ADDRESS mov al, [data1] ;transfers the VALUE Every time you want to transfer data from or to memory (like your variables), use the brackets like [data] or [ds:data]. Without the brackets, the address is transferred instead. |
|||
![]() |
|
system error 13 Sep 2013, 13:06
Download "emu8086" so that you can see how your instructions behave against the registers in step-by-step manner. It has direct support of FASM syntax. Start with a simpler flat memory model like org. It provides you with a natural transition to flat 32-bit programming.
|
|||
![]() |
|
Mahmoud899 13 Sep 2013, 13:21
I tried your suggestion and edited the code and inserted square brackets around data1 and data2 and I am still getting the same problem in the same line. I have tried it on the EMU8086 and it also gave me the same error. I am also using 16-bit programming not 32-bit
|
|||
![]() |
|
system error 13 Sep 2013, 13:30
[total]
|
|||
![]() |
|
Mahmoud899 13 Sep 2013, 13:51
excellent it worked. Thanks for the help
|
|||
![]() |
|
shutdownall 13 Sep 2013, 15:12
What about overflow / carry flag ?
You should interprete this. Try to add 0FFh and 80h and see what happens ... ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.