I am following a os dev tutorial and learning the basics of assembly programming. https://github.com/cfenollosa/os-tutorial/blob/master/04-bootsector-stack/boot_sect_stack.asm
Atm I am trying to understand how the stack works, my assumptions:
- It grows down from high memory to low memory i.e. 0xFFFFFF --> 0x000000
Here is my code.
mov bp, 0x8000 ; this is an address far away from 0x7c00 so that we don't get overwritten
mov sp, bp ; if the stack is empty then sp points to bp
push 'A'
push 'B'
push 'C'
; to show how the stack grows downwards
mov al, [0x7ffe] ; 0x8000 - 2 ; why is this minus 2 if it's directly below
int 0x10
The output is:
A
My question is why is the address of A 0x7ffe when it is directly below 0x8000 (minus 2), surely this is 1 below?