Message board for the users of flat assembler.
> MenuetOS > macro problem
DC740 14 Aug 2005, 17:47
i was trying to do some macros that made my life easier, and everything worked great until i tryied this...
the next macro works great if you use a short "string"
for example : Caption db 'thing',0 but doesn't work if you use:Caption db 'muuuuuuuchbigeeeeerrrrrrstrrriinggggggg',0
the program that uses it closes itself... this happens when i use push and pop... look:
; LABEL - Put text to frame
; (SYNTAX) LABEL Xstart,Ystart,Color,text
; (SAMPLE) LABEL 10,12,cl_Green+font_Big,labelcaption
macro label arg1,arg2,arg4,arg3
xor esi,esi ;set esi to 0
mov edx,arg3 ;copy caption to ebx
push edx ;######## here is the push
cmp byte [edx],0 ;compare if current char is 0
je @f ;if equal then goto forward
inc esi ;not equal so inc esi and ebx
jmp @b ;keep with the loop until 0 is found
cmp byte [esi],0 ;if textlenght=0 then goto next #######
je @f ;###this is not necesary... and it's not working anyway
pop edx ;######and here is the pop
anyway i changed this and used mov edx,caption to do exactly the same, and now is working, but anyway i want to know way i can't use push and pop to do that
|14 Aug 2005, 17:47||
DC740 14 Aug 2005, 22:40
fixed, i don't remember right now, but i realised the solution when i was watching tv hehe so there is no need to reply to that one... but i always have problems...
i can get this to work... maybe be cause i'm really tired, but i can't find why it s not working
macro drawlist x,y,ys,Color,data,ind
xor edi,edi ;set edi to 0
add edx,ind*40 ;this way we draw only from the index
mov ebx,x*65536+y ; draw info text with function 4
mov esi,40 ;the number of bytes to put on the screen
mov eax,4 ;the api number
inc edi ;this is a counter to know how many line have we drawn
int 0x40 ;draw the line
add ebx,10 ;go down a few pixels (another line)
add edx,40 ;the next line in the data block
cmp byte [edi],ys/10 ;this doesn't work, if i have drawn all the lines i can in the specified y size (ys) it should finish drawing new lines, but it keeps drawing the rest of the data block lines until it finds 0
cmp byte [edx],0
|14 Aug 2005, 22:40||
DC740 15 Aug 2005, 16:25
again i found the solution by myself, sorry to every one to make oyu lose your time, good bye and happy coding
|15 Aug 2005, 16:25||
< Last Thread | Next Thread >
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.