flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
LocoDelAssembly 23 Sep 2008, 23:32
Try with "Font.bits equ context\#.canvas.bits" (note the slash I added)
|
|||
![]() |
|
karl 23 Sep 2008, 23:49
![]() thanks, ya, that works. so the # tells the preprocessor the it must replace the scanned word with it's macro value. but if there was no "context" value, why wasn't there an error? does the # just split up the string, and the preprocessor just checks if there is a replace for both "context" and ".canvas.bits", otherwise it moves on? |
|||
![]() |
|
karl 24 Sep 2008, 00:35
the backslash isn't working in another part of the code.
Code: mov edx,[Font.window] cmp ecx,Font.window \#.height*Font.window \#.width*3 becomes Code: mov edx,[Win.canvas] cmp ecx,Font.window.height*Font.window.width*3 if I put in another slash I get Code: mov edx,[Win.canvas] cmp ecx,Win.canvas#.height*Win.canvas#.width*3 which gives the error "extra characters on line". this preprocessor stuff melts my brain. thanks again. Last edited by karl on 28 Sep 2008, 12:27; edited 1 time in total |
|||
![]() |
|
LocoDelAssembly 24 Sep 2008, 01:25
Yes, it used to do the same to my brain but I found the cure, it is called Understanding flat assembler, that article clearly explains how the slash thing works and some other interesting things that maybe are not well covered in the manual.
BTW, I will move this thread to Macroinstructions forum since it belongs to there. |
|||
![]() |
|
karl 24 Sep 2008, 18:18
hey. ya, i read that doc. still melts my brain. i do understand, the slash tells the processor to skip the symbol. i'm gonna try read the doc again, more slowly. sorry for the lazy questions. was a late night.
thanks, once again. |
|||
![]() |
|
LocoDelAssembly 24 Sep 2008, 18:25
If you can't get it work post your complete macro code and the intended behavior so I can try to fix it.
|
|||
![]() |
|
karl 25 Sep 2008, 15:53
![]() |
|||
![]() |
|
karl 27 Sep 2008, 16:17
ok well can't get this error to work so here goes
this is the main program that I send to fasm: Code: ; Font experiment ; by karl penzhorn, 12 September 2008 include 'Library\Font\App.txt' include 'Library\Font\Window.txt' Window Win Win.Size 300,300 Win.Clear 0xAA include 'Library\Font\Font.txt' Font Text Text.Path 'FASM.exe' Text.Attach Win Text.Centre Text.Blit 'Hi there!' Win.EventLoop App.Start and this is the Font.txt include: Code: ; by karl penzhorn, 12 september 2008 include 'Memory.txt' include 'File.txt' macro Font name { macro name#.Path path \{ File font.file String name,path Memory font.data,10000 font.file.Path name font.file.ReadBytes font.data,10000 \} macro name#.Attach context \{ Font.bits equ context\#.canvas.bits Font.window equ context \} macro name#.Centre \{\} macro name#.Blit text \{ local loop mov edx,[\#Font.bits\#] mov ecx,0 loop: mov al,[\#font.data\#+ecx] mov byte[edx+ecx],al inc ecx cmp ecx,10000 jne loop Font.window\#.Flush \} } fasm is giving the error 'illegal instruction' saying 'Font.window.Flush'. So it's not replacing Font.window with Win. does it make sense what i'm doing with the code? when i call 'Text.Attach Win', it assigns Font.window to Win. but it's not replacing it when I try to call Win.Flush. thanks in advance. again. |
|||
![]() |
|
LocoDelAssembly 27 Sep 2008, 17:06
mmmh, it should be expanded with what "context" was, right? Try this too see what happens
Code: macro name#.Blit text \{ local loop mov edx,[\#Font.bits\#] mov ecx,0 loop: mov al,[\#font.data\#+ecx] mov byte[edx+ecx],al inc ecx cmp ecx,10000 jne loop ; "match" to get actual value of Font.window equate match window, Font.window \\{window\\#.Flush\\} \} |
|||
![]() |
|
karl 27 Sep 2008, 17:11
ok yes that works.
why did it work with the equates before (ie. Font.bits) but not Font.window? |
|||
![]() |
|
LocoDelAssembly 27 Sep 2008, 18:30
Because font.bits is not used as a macroinstruction call so it is converted to its actual value before passing it to the assembler layer.
BTW, using "mov edx,[Font.bits]" instead of "mov edx,[\#Font.bits\#]" doesn't work? Note that it should since the # are for concatenation of symbols but you are not concatenating nothing there (because "[" and "]" are symbol separators so the # has no effect here actually and is not needed anyway). |
|||
![]() |
|
karl 27 Sep 2008, 19:19
ok what about if I do this
Code: macro name#.Attach context \{ name#.Window equ context \} macro name#.Centre \{\} macro name#.Blit text \{ local loop mov edx,[name#.Window\#.canvas.bits] mov ecx,0 loop: mov al,[name#.data+ecx] mov byte[edx+ecx],al inc ecx cmp ecx,10000 jne loop match window, name#.Window \\{window\\#.Flush\\} \} "mov edx,[name#.Window\#.canvas.bits]" is replaced with "mov edx,[Text.Window.canvas.bits]" but "mov edx,[name#.Window]" is replaced with "mov edx,[Win]". what gives? |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.