1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
.MODEL TINY
.CODE
.386
ORG 100h
start:
PUSH CS
POP DS
MOV AX,0B800h
MOV ES,AX
MOV WORD PTR ES:[2 * 80 * 24],0141h ; AFFICHE 'A'
; disable IRQ's
CLI
; disable NMI's
IN AL,70h
OR AL,80h
OUT 70h,AL
XOR EAX,EAX
MOV AX,CS
SHL EAX,4
ADD DWORD PTR [GDT + 2], EAX
.386p
MOV eax,cr0 ; read cr0
OR al ,1 ; set CR0.PM bit to 1
MOV cr0,eax ; switch to PM mode !
mov bx,GDT
;lgdt [bx] <-- plante
MOV AX,10h
;MOV ES,AX <--- plante
MOV WORD PTR ES:[0B8000h + 2 * 80 * 24 + 2],0242h ; AFFICHE 'B'
mov eax,cr0 ; read cr0
and al,254 ; set CR0.PM bit to 0
mov cr0,eax ; switch to real mode !
.386p
PUSH CS
POP DS
MOV AX,0B800h
MOV ES,AX
MOV WORD PTR ES:[2 * 80 * 24 + 2],0343h ; AFFICHE 'C'
RET
; NULL
GDT_00 DW 0 ; len
DW 0 ; base low
DB 0 ; base high
DB 0 ; access
DB 0 ; attribs
DB 0 ; base ext
; CODE32
GDT_08 DW 0ffffh ; len
DW 0h ; base low
DB 0 ; base high
DB 10011011b ; access
DB 11011111b ; attribs
DB 0 ; base ext
; DATA32
GDT_10 DW 0ffffh ; len
DW 0h ; base low
DB 0 ; base high
DB 10010011b ; access
DB 11011111b ; attribs
DB 0 ; base ext
GDT DW $ - GDT_00
DW GDT_00
DW 0
END start |
Partager