flat assembler
Message board for the users of flat assembler.

Index > MenuetOS > need some help understanding this code

Author
Thread Post new topic Reply to topic
DC740



Joined: 01 Oct 2004
Posts: 74
Location: Argentina
DC740
i was trying to understand how the strings work and i was looking at tinypad code, when it calls fasm with parameters... in the
start_fasm:

mov esi,filename
mov edi,fasm_parameters

cmp byte [esi],'/'
je .yes_systree

mov ecx,[filename_len]
rep movsb
mov al,',' ;this adds the comma after the filename in the fasm_parameters(example (filename=test.asm):fasm_parameter='test.asm,'... maybe i'm wrong ? :S
stosb

mov ecx,[filename_len];it starts all again, but why?
add ecx,-4 ;and what is this code doing?
mov esi,filename
rep movsb;this copies the filename again to fasm_parameters?
;then fasm_parameters=¿¿¿???

mov al,',';it adds the comma again
stosb
;i don't understand the next code
mov [edi],dword '/RD/'
add edi,4
mov [edi],word '1/'
inc edi
inc edi

mov al,0; and this adds the 0 at the end of the string
stosb


ok, as you can see, i'm very newbie, but i hope you can help me, i really want to understand this code (i'm also playing a little with this program in particular)
Post 23 Jul 2005, 01:39
View user's profile Send private message Reply with quote
DC740



Joined: 01 Oct 2004
Posts: 74
Location: Argentina
DC740
i understood almost everything, thanx!, anyway the last part is not too clear to me, i thought that if you did this:mov [edi],dword '/RD/'
you would be deleting the old data in edi, but i guess that i was wrong Embarassed
and why this adds the '1/' whitout worring about the variable size (i have a lot of confusing things in my mind)...
ok, to tell the truth i need an explanation of the last things... after the
" ;i don't understand the next code "
mov [edi],word '1/'
inc edi
inc edi
Post 23 Jul 2005, 03:00
View user's profile Send private message Reply with quote
Night Rider



Joined: 28 Jul 2005
Posts: 72
Night Rider
Quote:
" ;i don't understand the next code "
mov [edi],word '1/'
inc edi
inc edi

OK.
Sorry my english
it puts string '1/' to the some place in memory, by address stored in edi.
Quote:
and why this adds the '1/' whitout worring about the variable size

Very Happy Very Happy Very Happy
There is no variables in Assembler. There are Sirs Registers and Mrs memory.
you see word 'word' next to '1/'? It orders precisely to store 2 bytes in RAM.

_________________
My best regards
Post 28 Jul 2005, 00:08
View user's profile Send private message ICQ Number 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.