Hi George,
...
> ;macro for writing on the screen in 640x480 mode
> ;1- # of chars 2- line 3- column
> ;4- color 5- var where text is stored
> %macro writemsg 5
> mov cx,%1
> mov bx,0
> mov dh,%2
> mov dl,%3
> mov byte [color],%4
> lmsg:
> call cursor
> mov al,[bx+%5]
> call character
> inc bx
> inc dl
> loop lmsg
>
> mov ah,08h
> int 21h
> mov ah,0
> mov al,[last_mode]
> int 10h
> %endmacro
>
> i'm tried to run this macro like this:
> writemsg 23 1 27 white graphtitle
> and like this
> writemsg 23,1,27,white,graphtitle
The second way is correct - it won't work without the commas.
> graphtitle, last_mode and and color are defined on the data segment. cursor
> and character are labels defined at the end of the code segment, and they have
> a ret at their ends.
That all sounds okay.
> our teacher told us to run nams like this:
> nasm16 -f obj -o %1.obj -l %1.lst filename.asm
Why in the world are you using nasm16??? Because your teacher told you to, I suppose... Why in the world does your teacher... Never mind, when you finish the course, get a better build of Nasm (*any* of 'em!). Nasm16 is for 286s!
> and then link it with freelink
I'm not familiar with that. I assume it does what it's supposed to. Not part of your problem, in any case.
> the error i'm getting is when running nasm on the file:
> parser : instruction expected
>
> this happens at the line where i try to run the macro.
With the invocation without the commas, I'd expect that, but with the commas... I dunno. Your macro, and the invocation *with* the commas look okay to me... not that I'm any expert on Nasm's macros...
> i used this code before, but not as a macro, and it worked just fine.
I don't see why you want to do this as a macro, but it oughtta work!
> can anyone
> give me some help? i'm lost here. maybe i can post the whole code if needed.
> thanks a lot in advance.
I don't see where the problem is, I'm afraid. Maybe someone else can spot it. If you can't figure it out, post the whole code - hard to actually try out "partial" code... and I suspect the problem is something very minor... It basically looks okay to me.
Best,
Frank