38 lines
585 B
NASM
38 lines
585 B
NASM
mov ah, 0x0e ; tty mode
|
|
|
|
mov bp, 0x8000 ; far away from 0x7c00, want to avoid overwriting ourself
|
|
mov sp, bp ; if stack empty, sp points to bp
|
|
|
|
push 'A'
|
|
push 'B'
|
|
push 'C'
|
|
|
|
; stack grows downwards
|
|
mov al, [0x7ffe] ; 0x8000 - 2
|
|
int 0x10
|
|
|
|
; you can only access stack top now
|
|
mov al, [0x8000]
|
|
int 0x10
|
|
|
|
; recover chars with pop
|
|
; you can onoly pop words, so you need an aux register to manipulate the lower byte
|
|
pop bx
|
|
mov al, bl
|
|
int 0x10
|
|
|
|
pop bx
|
|
mov al, bl
|
|
int 0x10
|
|
|
|
pop bx
|
|
mov al, bl
|
|
int 0x10
|
|
|
|
; pop'd stack is garbage now
|
|
mov al, [0x8000]
|
|
int 0x10
|
|
|
|
jmp $
|
|
times 510-($-$$) db 0
|
|
dw 0xaa55 |