mirror of
https://github.com/cfenollosa/os-tutorial.git
synced 2025-12-17 12:24:37 +03:00
lesson 6, segmentation
This commit is contained in:
27
06-bootsector-segmentation/boot_sect_segmentation.asm
Normal file
27
06-bootsector-segmentation/boot_sect_segmentation.asm
Normal file
@@ -0,0 +1,27 @@
|
||||
mov ah, 0x0e ; tty
|
||||
|
||||
mov al, [the_secret]
|
||||
int 0x10 ; we already saw this doesn't work, right?
|
||||
|
||||
mov bx, 0x7c0 ; remember, the segment is automatically <<4 for you
|
||||
mov ds, bx
|
||||
; WARNING: from now on all memory references will be offset by 'ds' implicitly
|
||||
mov al, [the_secret]
|
||||
int 0x10
|
||||
|
||||
mov al, [es:the_secret]
|
||||
int 0x10 ; doesn't look right... isn't 'es' currently 0x000?
|
||||
|
||||
mov bx, 0x7c0
|
||||
mov es, bx
|
||||
mov al, [es:the_secret]
|
||||
int 0x10
|
||||
|
||||
|
||||
jmp $
|
||||
|
||||
the_secret:
|
||||
db "X"
|
||||
|
||||
times 510 - ($-$$) db 0
|
||||
dw 0xaa55
|
||||
Reference in New Issue
Block a user