I'm writing some practice programs for 16 bit NASM and begin
my housekeeping as follows:
...
mov ax,initdata ;move segment address of initalized
mov ds,ax ;data through ax to ds.
mov ax,stackseg ;move segment address of stack through
mov ss,ax ;ax to ss.
mov sp,stackptr ;put the offset of the byte after the
;reserved bytes into sp.
...
This real mode, segmented model program assembles, links and
runs.
When I load my program into DEBUG and immediately look at
the status of the regesters I find that the stack segment
and the stack pointer have already been correctly loaded,
i.e., before a single instruction has been executed. I've
varied the number of bytes reserved for the stack and it's
always correct, right there in sp.
AND, when I trace through the program my instruction
mov sp,stackptr
is not there.
What's going on here?
my housekeeping as follows:
...
mov ax,initdata ;move segment address of initalized
mov ds,ax ;data through ax to ds.
mov ax,stackseg ;move segment address of stack through
mov ss,ax ;ax to ss.
mov sp,stackptr ;put the offset of the byte after the
;reserved bytes into sp.
...
This real mode, segmented model program assembles, links and
runs.
When I load my program into DEBUG and immediately look at
the status of the regesters I find that the stack segment
and the stack pointer have already been correctly loaded,
i.e., before a single instruction has been executed. I've
varied the number of bytes reserved for the stack and it's
always correct, right there in sp.
AND, when I trace through the program my instruction
mov sp,stackptr
is not there.
What's going on here?