flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Macroinstructions > Problem on second use of print text macro | 
| Author | 
 | 
| revolution 11 Feb 2006, 15:06 The first instantiation of the macro will print "haha" and then RETurn to the caller (BIOS) so ANY code you place after your macro will not be executed. Try this:     Code: org 0x7c00 use16 mov ax, 0x0000 mov ds, ax start: macro print String{ local .Printer local .Nextchar local .Done local .a .Printer: mov si, .a mov ah, 0Eh jmp .Nextchar .Nextchar: lodsb or al, al jz .Done int 10h jmp .Nextchar jmp .Done .a db String,10,13,0 .Done: } print "haha" print "akimbo" ret times 505-($-start) db 0 ;512 bytes dw 0xaa55 BTW: does the follwing line really compile properly? Code: times 505-($-start) db 0 512 bytes | |||
|  11 Feb 2006, 15:06 | 
 | 
| oscar 11 Feb 2006, 22:46 it does....but it may not actually be 512 bytes...i saw it in an example i was looking at and i never actaully figured out if stuff in the bootsector HAS to be 512 bytes or if it can be less than that.
 point being it compiles for me...sould be Code: times 505-($-start) db 0 ;512 bytes (the 512 bytes was a comment) anyway, Thanks heaps, i had the idea that "ret " just returned you to where you were in the main program (kind of like an exit in BASIC). i can't beleive i spent 2 days trying to figure out something so simple | |||
|  11 Feb 2006, 22:46 | 
 | 
| Tomasz Grysztar 12 Feb 2006, 06:24 oscar: I think you are using the macro where what you wanted was actually the procedure. The fact that you used "called" terminology and "ret" instruction seems to confirm it. | |||
|  12 Feb 2006, 06:24 | 
 | 
| revolution 12 Feb 2006, 10:42 Quote: i never actaully figured out if stuff in the bootsector HAS to be 512 bytes or if it can be less than that. | |||
|  12 Feb 2006, 10:42 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.