flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
LocoDelAssembly 04 May 2006, 23:52
place the following code before any string definition:
Code: struc db [chars] { common . db chars .size = $ - . } Then you can use it this way: mov cx, PideNumDIgits.size [edit]I see a bug in your code, you must place the the function number in AH, not AL, so use "mov ax, $1300" or "mov ah, $13". Also check http://www.ctyme.com/intr/rb-0210.htm to see what you prefer in AL, maybe you want to use "mov ax, $1301"[edit] |
|||
![]() |
|
saigon 12 Jun 2006, 19:01
@locodelassembly: Is there any other way?
I thought something like this, but it doesn't work: mov cx, $-chars Can you help me get that to work? Thanks! EDIT: Ofcourse it doesn't work, because $ means "here", so I can't do that.. |
|||
![]() |
|
LocoDelAssembly 12 Jun 2006, 19:56
Here an example for DOS
Code: struc db [chars] { common . db chars .size = $ - . } struc String [chars] ; As Turbo Pascal { common .size db 0 .chars db chars store $ - .chars at .size } STDOUT equ 1 org 100h mov ah, $40 mov bx, STDOUT mov cx, message.size mov dx, message int $21 mov ah, $40 mov bx, STDOUT mov cl, [pascalMessage.size] mov dx, pascalMessage.chars int $21 xor ax, ax int $16 int $20 message db "Hello World!!", 13, 10 pascalMessage String "And now a Pascal hello world!!", 13, 10 You can see a new Pascal-style string. Why do you need a different way? Regards PS: The db struc in my source is the same that the one explained in the FASM's manual, I think [edit]Changed "STDOUT equ 2" 2 to "STDOUT equ 1". 2 is STDERR...[/edit] Last edited by LocoDelAssembly on 12 Jun 2006, 20:53; edited 1 time in total |
|||
![]() |
|
saigon 12 Jun 2006, 20:20
Nice example!
I wanted to have the size stored only for one string instead for all of them. |
|||
![]() |
|
RedGhost 16 Jun 2006, 08:47
saigon wrote: Nice example! Code: name db 'xxx', 0 name.size = $-name _________________ redghost.ca |
|||
![]() |
|
vbVeryBeginner 16 Jun 2006, 10:34
[unrelated]
if you guys like the font MAD_DËMON used, check here http://www.dafont.com/font.php?file=bitstream_vera_mono i just knew this font from MAD_DËMON through pm, thanks! |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.