This commit is contained in:
Qitian Zeng 2023-09-21 11:42:05 -07:00 committed by GitHub
commit 6b6339e0d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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