flat assembler
Message board for the users of flat assembler.
Index
> Main > Problem with [text] or text |
Author |
|
Matrix 27 Oct 2004, 06:21
Hy freeze
comments by me, hope i have answered your question. |
|||
27 Oct 2004, 06:21 |
|
freeze 27 Oct 2004, 07:14
Matrix wrote: Hy freeze thank you Matrix, but ... Code: org 256 ; offset addressing by 256 bytes mov ah,9 ; value 9 in ah mov dx,[address_of_text] int 21h ; dos function call ah=9h int 20h ; exit to dos text db 'hello world$' ; declare byte array with end symbol for dos function address_of_text db 'text$' can't be compiled maybe it should Code: org 256 mov ah,9 mov dx,[address_of_text] int 21h int 20h text db 'hello world$' address_of_text dw text I could understand this if I assume that 'mov ah,9' needs an address as an input, while 'mov ah,2' needs an ascii code as an input, right? |
|||
27 Oct 2004, 07:14 |
|
Matrix 27 Oct 2004, 09:50
Helo there,
yeah, you're right, i see you're getting it. if you wnna put address of string to dx you needn't declare its offset first however i used to do it somtimes even with procedures, this way you can use an index instead of variable name. You're on the right track if you write a vesatest program for example which indexes the messages to be written. Code: org 256 ; offset addressing by 256 bytes mov ah,9 ; value 9 in ah mov dx,address_of_text int 21h ; dos function call ah=9h int 20h ; exit to dos text db 'hello world$' ; declare byte array with end symbol for dos function address_of_text db 'text$' this is another thing but you didn't mean this i think: Code: org 256 ; offset addressing by 256 bytes mov ah,9 ; value 9 in ah mov dx,address_of_text mov cx,[difference] add dx,cx int 21h ; dos function call ah=9h int 20h ; exit to dos text db 'hello world$' ; declare byte array with end symbol for dos function address_of_text: db 'Your message here$' address_of_text2: db 'Hy , how could this be? $' difference: dw address_of_text2-address_of_text however you can force using [] with strings like: Code: org 256 ; offset addressing by 256 bytes mov ah,9 ; value 9 in ah mov dx,word [address_of_text-2] int 21h ; dos function call ah=9h int 20h ; exit to dos text db 'hello world$' ; declare byte array with end symbol for dos function pre_address_of_text dw address_of_text address_of_text db 'text$' |
|||
27 Oct 2004, 09:50 |
|
vid 27 Oct 2004, 11:11
hey, seems like from my tutorial
well, your code seems right, but name of variable should describe contents of variable, so "address_of_text" should hold ADDRESS of text, not text itself. |
|||
27 Oct 2004, 11:11 |
|
freeze 28 Oct 2004, 00:42
Thank you Matrix
m(_ _)m now I can understand it. |
|||
28 Oct 2004, 00:42 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.