flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
pelaillo
Could you clarify a little? I didn't manage to follow you.
If you decompile a program and there is no debug information nor sources, you cannot figure out what the labels were called. Labels just dissapeared when you assemble a program. |
|||
![]() |
|
gumletis
Yes, thats the problem, labels are just illusion, i wanna do a CALL or a jmp command without need to use a label. Like
jmp 0x4 ; JUMP TO mov ah,0x0 | int 0x16 \/ mov dx,cx ; here without need to do like this jmp mylabel mov ah,0x0 int 0x16 mylabel: mov dx,cx .... please help me, and say if you doesn't understand what im saying, so its my bad english and please ask me again _________________ LOOOL |
|||
![]() |
|
beppe85
You need to know ahead the size of each encoded instruction. That makes hard mantaining of program.
Better if you use anonymous labels, like: Code: jmp @f mov ah,0x0 int 0x16 @@: mov dx,cx @f means the label just after the instruction. @b means the label just before the instruction. |
|||
![]() |
|
gumletis
i know, but doesn't wanna use any labels, becuase the compiler change of the labels so there isn't any labels, so i wanna use the only thing that the program do when its assembled, and its just to jump or call a line.
_________________ LOOOL |
|||
![]() |
|
beppe85
gumletis wrote: i know, but doesn't wanna use any labels, becuase the compiler change of the labels so there isn't any labels, so i wanna use the only thing that the program do when its assembled, and its just to jump or call a line. Sorry, but this is BASIC. Assembly handles bytes. _________________ "I assemble, therefore I am" If you got some spare time, visit my blog: http://www.beppe.theblog.com.br/ and sign my guestmap |
|||
![]() |
|
gumletis
what you mean that this is the basic? are there away to do it?, if not so i would ask for made so you can do it, fx if the compiler get this "jmp [[0x4]]" so its jump to line 4, or "call [[0x4]]" PLEASE! becuase i've seen that in the source code there is just "jmp 0x4" if you have a label in line 4
_________________ LOOOL |
|||
![]() |
|
vid
it's like this:
Code: jmp here db 100h here: "jmp" is followed by value which is RELATIVE distance of jump (eg. how far forward / backward you want to jump). So compiler just calculates fifference between target of jump (label here) and "jmp" instruction and this is used as argument for jump |
|||
![]() |
|
gumletis
Yes, but the problem is that i wanna do it without the distance, i wanna do it my self. So instead of this
Code: jmp here db 100h here: i wanna do it some like this Code: jmp 0x3 ; donno if its 0x3 or 0x4(becuase of the start point of the file or such thing :-s db 100h xor ah,ah Are there a way to do it that way? _________________ LOOOL |
|||
![]() |
|
asmdemon
I think i understand what your looking for. The problem is that you need some form of reference to JMP to.
Code: org 0x100 jmp 0x0104 ;static value i entered to jump to xor ah,ah dw 0x0000 xor ah, ah compiles the same as: Code: org 0x100 jmp dojump ;label to the unknown location of xor ah, ah dw 0x0000 dojump: xor ah, ah To figure out the actuall jump location, you would have to calculate the number of bytes that you are jumping to and insert that as a value after the JMP command. FASM does this automatically because it knows the bytes that each specific command takes, but if you want to do it by hand you would have to manually count the bytes required for the jump, then add that number( 0x04) to your ORG (0x0100). The only downside is what if you want to do this: Code: org 0x0100 jmp 0x0104 dw 0x0000 db 0x00 ;you needed more data space, for example. xor ah, ah now your code jumps to a data db instead of the xor instruction. This could become a pain in debugging your code because just a small change will change all of your data and jmp locations. I hope i answered your question. ![]() |
|||
![]() |
|
gumletis
nice asm-demon, that was what i was looking for, THANKS! i know if i change a single thing it would change all the jmp locations, but K.I.S.S, and i don't want the compiler to do so much for me,
![]() |
|||
![]() |
|
Mota
gumletis, the jmp doesnt jump to a line, it jumps to a certain address, in bytes. jmp 0x104 is just a coincidence that it is , in fact, line 4.
to do what you want (line jmps), you'd need to code a macro to place as a prefix each line, and a new macro for jmps and calls. Or you could make your own version of fasm, where you can use the word line to change the number after it to the actual address. |
|||
![]() |
|
gumletis
lol, my own version of fasm, fasm is almost perfect, only a few things there should be changed in it(if you ask me) and lol, i am not so good to asm that i can do that, and also i just use the "certain" address, becuase i wanna do that the compiled program do, like i don't wanna write
int 21h i wanna write int 0x21 just some small things i don't do, for have my compiler not change anything for me |
|||
![]() |
|
gunblade
int 0x21 is fine, and is taken to be exactly the same as int 21h by fasm.
![]() i see what you mean, something like jmp +4 would jump 4 bytes ahead, it could be fun, but i really dont see the need for that, very unmaintainable, having labels is much nicer. |
|||
![]() |
|
gumletis
lol, my friend call me unhuman becuase i didn't like labels, and want to jump/call to lines instead of using the labels...
![]() |
|||
![]() |
|
bubach
so use:
Code: jmp line1 dw 0x0000 line1: mov cx, ax ![]() |
|||
![]() |
|
Tomasz Grysztar
gunblade wrote: i see what you mean, something like jmp +4 would jump 4 bytes ahead, You can do just: Code: jmp $+4 to jump 4 bytes ahead. |
|||
![]() |
|
THEWizardGenius
Just do a JMP FAR!
Code: jmp far cs:[0FFFFh] I think this will assemble, don't know exactly if it would do what you want, but it does what I want... ![]() Of course, you can use this code: Code: jmp far [hi] ;... hi dd 00000000h ;Address you want to jump to here... I didn't know that that was legal usage of JMP, but I saw something similar used in the sourcecode for some old BIOS, so I guess it probably works... Good luck ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.