flat assembler
Message board for the users of flat assembler.

Index > MenuetOS > macro problem

Author
Thread Post new topic Reply to topic
DC740



Joined: 01 Oct 2004
Posts: 74
Location: Argentina
DC740
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
{
words2reg ebx,arg1,arg2

dword2reg ecx,arg4

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
inc edx
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 Razz
pop edx ;######and here is the pop
mov eax,4
int 0x40
@@:
}

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
Post 14 Aug 2005, 17:47
View user's profile Send private message Reply with quote
DC740



Joined: 01 Oct 2004
Posts: 74
Location: Argentina
DC740
fixed, i don't remember right now, but i realised the solution when i was watching tv hehe Very Happy 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
mov edx,data
add edx,ind*40 ;this way we draw only from the index

mov ebx,x*65536+y ; draw info text with function 4
mov ecx,Color

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
je @f
cmp byte [edx],0
jne @b
@@:
}


please help Embarassed
good bye
Post 14 Aug 2005, 22:40
View user's profile Send private message Reply with quote
DC740



Joined: 01 Oct 2004
Posts: 74
Location: Argentina
DC740
again i found the solution by myself, sorry to every one to make oyu lose your time, good bye and happy coding
Post 15 Aug 2005, 16:25
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.