logs archiveIRC Archive / Undernet / #asm / 2006 / May / 19 / 1
CMind
hi
is that a channel about assembly?
vml
Yes.
(No, I won't make a joke)
CMind
I'm looking for hard drive instruction set
not the AT command but the language used to write the firmware
any idea?
MalibuVI
hello
any1 here
Terminus
hello. just curious, why does string data have to be terminated by a $ like in MSG DB "Foo", 0Dh, 0Ah, "$"? i've been googling and reading books but so far none of them seems to explain it in detail.
MalibuVI
hi terminus
Terminus
hello MalibuVI. can you shed light on my question? :)
MalibuVI
do u know anything about making a malloc.c in assembler where u set aside 2048 bytes for memory allocation
no sorry;(
Terminus
MalibuVI: i'm sorry. i'm really ignorant about assembly. i'm just trying to recall some of the stuff i sort of learned 8 years ago. :|
         

MalibuVI
hehe
in 1998
Terminus
MalibuVI: yeah... i stopped at writing a hello world program for dos. haha
MalibuVI: i did come across something interesting in this really old book i'm reading. apparently, you can leave a gap in the middle of the program, like for example 10 bytes with ORG $+10 don't know how useful that is to you though. :|
MalibuVI
ok:)
heh
im actually looking for a full code for it
it didnt say me anything but thnx forthe help can u do some further investigation
?
Terminus
MalibuVI: well, that's the only thing i can think of, create a gap somewhere and reference that memory address. if you always need 2048 bytes, a FOO DB 2048 DUP(?) might work but that's not the way malloc works, right?
MalibuVI
ya but how do i wrote the actual code
in asembly language
Terminus
MalibuVI: by the way, if you want to know what the $ is for, i learned it from a guy in freenode. it's for terminating strings that are used in bios calls. :)
MalibuVI
cool;)
sounds good if i was to use it once
Terminus
MalibuVI: well, i'm sorry but i don't have any code for that. like i said earlier, i'm 8 years out of date and don't know much. :|
MalibuVI
now back to the complete coding;)
damn
im stuck here,)
;)
EwIck
Terminus: the "gap" thing is used to displace the program at a particular address
it's used for boot sector programs, for example
Terminus
EwIck: oh... boundary alignment and stuff?
EwIck
no, not really
like, the BIOS loads the boot sector at a particular address, which is not 0
so you need that for your assembler to correctly assign jump addresses and stuff
Terminus
oh... the gap at the beginning of the code then, like ORG 100
MalibuVI
ya
Terminus
and i assume the preceding 100 bytes are header stuff?
MalibuVI
Ewick: can you help with this assembler version of malloc.c?
EwIck
not quite, I'm leaving for work soon
MalibuVI
shoot
Terminus
EwIck: anyway, i know i really have to learn a lot more stuff about assembly so i'm just gonna have to read up on it again. thanks for the info. :)
MalibuVI
ok
ewick can i email you about it?
         

Terminus
i get the whole boot sector is not at 0 part but i just can't get why it's needed by the assembler to correctly assign jump addresses. heh
EwIck
because sometimes the assembler will use an absolute address in the instruction
so start of program + offset is not good if your assembler thinks your program starts at 0 and that's not the case with a boot sector program
MalibuVI
ewixk: what is the assembly code for setting aside the 2048 bytes to allocate memory
ewick
Terminus
oh, do'h! >.<
MalibuVI
?
Terminus
EwIck: thanks for clearing that up. :)
EwIck
MalibuVI: for dynamic memory you need to rely on whatever your operating system's API has
if you want malloc, you'll have to link with some C library
malloc is easy to use though
push size;
call malloc;
mov pointer, eax;
Terminus
EwIck: ds stays the same with that one, right?
MalibuVI
thnx
its malloc.c for the gnu linux
EwIck
a good malloc implementation will restore segments before returning
MalibuVI
so i just write push size; 2048
call malloc;
mov pointer, eax;
or is it more do write?
EwIck
maybe a pop after the call to, I've never actually done it in assembly
too*
Terminus
EwIck: just wondering how you'd get the segment address if it's a far pointer. :)
MalibuVI
call pop malloc;
u mean?
EwIck
there's no such thing as a far pointer nowadays.
huh
?? aoa
no bots, great.
search "Art of Assembly", and read
MalibuVI
thnx
Terminus
EwIck: oh, so memory addresses are always referenced as segment:address then? or is that because the processor expects you to stay in the same segment the entire time?
MalibuVI
im really stuck
EwIck
Terminus: nobody works in real mode anymore
Terminus
EwIck: oh, right. the protected mode stuff with the processor then. thanks! you're being really informative. :)
EwIck
yeah
Terminus
maybe now i can start putting knuth to good use. hehe
whoa! no starch press! i want this book!
EwIck
and with most operating systems, you have one code segment, and one data segment, both of which point at the same place
and it's virtual memory, too
going to work now
later
Terminus
EwIck: take care! =)
MalibuVI
ok
ewick can i email you about it?
;)
u there terminus
?
Terminus
MalibuVI: yeah, i'm here. just writing stuff.
MalibuVI
ok
Terminus
hmmm... on second thought, i don't think i'm gonna get art of assembly. reviews say it's only good for HLA and i definitely want to go beyond that.
MalibuVI
ya
so i hope u got time to travel with me on the hounrey to find out how to set aside 2048 bytes for memory allocation in assembly
;)
---------------------------------------------->journey
its a heap based malloc so to speak
hello?
are uthere
Malibu05
hey
treminus?
terminus?
hello
psvll
hi
any amd64 coders?
i wonder how sign extension to 64bit works. movsx rdi, edx is giving an error message
edcba
i thought there was an autmoatic sign extension
you should read the manual :)
psvll
i'm searchin
figured if someone knows i could save time :)
gcc uses movslq
vml
movsxd :_P
psvll
what's it called in yasm?
movsxd? honest?
vml
Nah.
psvll
gas is so totally out of touch with reality that i'd prefer to avoid uit
vml
Read this: http://cdrom.amd.com/21860/updates/Backup_Optimization_guide/wwhelp/wwhimpl/common/html/wwhelp.htm?context=OptguideHelp&file=OptguideHelp-17-3.html
psvll
i have received enough brain damage from it on x86
vml
MOVSXD reg64, mreg32

63h

DirectPath

1

Ugh, sorry.
I thought it would be just a line.
psvll
working great, thanks man
now just have to figure out why movsxb doesn't exist :P
i'm assuming that is covered on that page you posted, so i'll go right there :P
:P
"This page uses frames, but your browser doesn't support them" :(
vml
I don't think it would be very useful for you now, anyway.
psvll
ok so it doesn't cover other data types?
i need to know the whole range - byte, word, dword to qword
i suppose i can always movsx smaller types to 32bit, then use movsxd.. but as i said, gcc uses movsbq ;)
thinking perhapss this is just unimplemented in yasm, it's not terribly mature yet
immense: movsx rdi, edx doesn't work .... but movsx rdi, dx does!!! problem solved :b
« prev 1 2 next »