21,500
社区成员
发帖
与我相关
我的任务
分享.model small
.586p
DSEG SEGMENT USE16
DESC STRUC
LimitL DW 0 ;段界限(BIT0-15)
BaseL DW 0 ;段基地址(BIT0-15)
BaseM DB 0 ;段基地址(BIT16-23)
Attributes DB 0 ;段屬性
LimitH DB 0 ;段界限(BIT16-19)
BaseH DB 0 ;段基地址(BIT24-31)
DESC ENDS
PDesc STRUC
Limit DW 0 ;16位界限
Base DD 0 ;32位基地址
PDesc ENDS
GDT_def Label Fword
Null_Desc DESC < 0h, 0h, 00h, 00h, 000h, 0>
Data_Desc DESC < 0FFFFh, 0h, 00h, 92h, 08Fh, 0>
GDT_Addr PDesc <$-GDT_def-1>;
DSEG ENDS
CSEG SEGMENT USE16
ASSUME CS:CSEG,DS:DSEG
.Startup
call Set4gb
;
;
mov esi, 0E0000040h
mov dword ptr eax,fs:[esi];問題處
bswap eax
mov cx,4
@@:
push cx
push eax
mov ah,al
mov cl,4
shr ah,cl
mov cl,al
.if ah >= 10
add ah,'A'-10
.else
add ah,'0'
.endif
mov dl,ah
mov ah,2
int 21h
and cl,00001111b
.if cl >= 10
add cl,'A'-10
.else
add cl,'0'
.endif
mov dl,cl
mov ah,2
int 21h
pop eax
mov cl,8
ror eax,cl
pop cx
loop @b
; write your code in here.
;
.exit
Set4gb PROC NEAR
mov eax, ds
shl eax, 4
xor ebx, ebx
mov bx, offset GDT_def
add eax, ebx
mov dword ptr GDT_Addr+2, eax
lgdt fword ptr GDT_Addr
cli
; mov word ptr GDT_Addr, (2*8-1);
in al, 92h
or al, 002
out 092h, al
out 0edh, al
mov bx, 8
mov eax, cr0
or al, 1
mov cr0, eax
jmp pMod
pMod:
mov fs, bx
mov gs, bx
and al, 0FEh
mov cr0, eax
jmp rMod
rMod:
mov ax, 0
mov fs, ax
mov gs, ax
sti
ret
Set4gb ENDP
CSEG ENDS
end