flat assembler
Message board for the users of flat assembler.
Index
> DOS > [CALL vs JMP] ret not working |
Author |
|
freecrac 23 Jan 2015, 07:09
Hello.
theguy wrote:
This is because DOS place the instruction of an "int 20h" at the top of the PSP and it push a zero word to the stack just before it let the COM-program execute. if we do not corrupt the stack and the code segment and if we execute at last the "ret" instruction, then the cpu return to the address of zero and continue executing the instruction of the "int 20h" inside of the PSP for terminating our programm. And for calling a subroutine we can use the call instruction. The call instruction push its return address to the stack and if we execute a ret intstruction, then the cpu pop the return address from the stack and return to the caller for executing the next instruction. Code: org 100h mov al, 'x' call label_test mov al, 'y' call label_test Looop: jmp Looop ;------------- ; Subroutines ;------------- label_test: mov ah, 0x0e int 0x10 ret |
|||
23 Jan 2015, 07:09 |
|
theguy 23 Jan 2015, 07:16
That works! , thanks ill have to look into this more closely to fully understand it, is there any good sources out there that could teach me by example, using only dos not windows forms.
|
|||
23 Jan 2015, 07:16 |
|
baldr 23 Jan 2015, 09:49
theguy,
There are tons of open-source assembly language DOS programs available, Google is your friend (though most of them are MASM/TASM/nasm). You may as well contrive simple problem and try to make solution, community here will help if you show some efforts. Just ask relevant questions. |
|||
23 Jan 2015, 09:49 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.