mirror of
https://github.com/cfenollosa/os-tutorial.git
synced 2024-10-27 20:34:19 +00:00
fixed errors in stack section
This commit is contained in:
parent
7aff64740e
commit
862271f2eb
@ -9,10 +9,16 @@ push 'C'
|
|||||||
|
|
||||||
; to show how the stack grows downwards
|
; to show how the stack grows downwards
|
||||||
mov al, [0x7ffe] ; 0x8000 - 2
|
mov al, [0x7ffe] ; 0x8000 - 2
|
||||||
int 0x10
|
int 0x10 ; prints A
|
||||||
|
|
||||||
|
mov al, [0x7ffc] ; 0x8000 - 4
|
||||||
|
int 0x10 ; prints B
|
||||||
|
|
||||||
|
mov al, [0x7ffa] ; 0x8000 - 6
|
||||||
|
int 0x10 ; prints C
|
||||||
|
|
||||||
; however, don't try to access [0x8000] now, because it won't work
|
; however, don't try to access [0x8000] now, because it won't work
|
||||||
; you can only access the stack top so, at this point, only 0x7ffe (look above)
|
; 0x8000 is just the base address and doesn't contain anything
|
||||||
mov al, [0x8000]
|
mov al, [0x8000]
|
||||||
int 0x10
|
int 0x10
|
||||||
|
|
||||||
@ -32,10 +38,6 @@ pop bx
|
|||||||
mov al, bl
|
mov al, bl
|
||||||
int 0x10 ; prints A
|
int 0x10 ; prints A
|
||||||
|
|
||||||
; data that has been pop'd from the stack is garbage now
|
|
||||||
mov al, [0x8000]
|
|
||||||
int 0x10
|
|
||||||
|
|
||||||
|
|
||||||
jmp $
|
jmp $
|
||||||
times 510-($-$$) db 0
|
times 510-($-$$) db 0
|
||||||
|
Loading…
Reference in New Issue
Block a user