I have been attempting to use a stack for variable transportation to a function. The code is compiled using NASM, which probably seems rather obvious to most. I have a stack set up like this:
Code: Select all
cli
mov ax, 0x0000
mov ss, ax
mov sp, 0xffff
sti
Code: Select all
push 0 ; Head
push 0 ; Track
push 2 ; Sector
Here is what I am trying to achieve, but loading them from the stack rather than just hard coding in the values:
Code: Select all
mov cl, 2 ; Sector
mov ch, 0 ; Track
mov dh, 0 ; Head
Any information you can give explaining the various aspects of using the stack for arguments would be wonderful. When I began trying to get using the stack for arguments to work, I thought it was as simple as popping off the argument into any of the registers. How come for example you cannot pop into the CL, CH and DH registers? Also, what is the proper way to do this?
Thank you!
Best regards,
Red