shadeos/learning/old_src/16bit/segmentation.asm

26 lines
397 B
NASM
Raw Permalink Normal View History

mov ah, 0x0e
mov al, [the_secret]
int 0x10 ; shouldnt work
mov bx, 0x7c0 ; segment is automatically << 4
mov ds, bx ; set data segment offset to 0x7c0
; all memory references will be offset by ds implicitly
mov al, [the_secret]
int 0x10
mov al, [es:the_secret]
int 0x10
mov bx, 0x7c0
mov es, bx
mov al, [es:the_secret]
int 0x10
jmp $
the_secret:
db "X"
times 510 - ($-$$) db 0
dw 0xaa55