www.pudn.com > kpe42s.zip > PMDRV.ASM
code segment
assume cs:code,ds:code
.386p
start proc near
jmp next
;-------------------------------------------------------------------------
number db '0123456789ABCDEF',00h
prterr db 'ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ· ',0dh,0ah
db '³ A Generation Protection Error #?? º ',0dh,0ah
db '³ CS:EIP= : º ',0dh,0ah
db 'ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ ',0dh,0ah
db 'Program Terminated .... ',0dh,0ah
db '$'
;-------------------------------------------------------------------------
mark1 db 'ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ[Freeway]ÄÄÄ·',0dh,0ah
db '³ Protection Mode Driver Version 4.20 º',0dh,0ah
db '³ (C) Copyright Werong Ho 1998-07-29 º',0dh,0ah
db 'ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ',0dh,0ah
db '$'
msg_100 db 'XMS Driver not found !',0dh,0ah,'$'
msg_101 db 'XMS not enough than 128K !',0dh,0ah,'$'
msg_102 db 'CPU in Virtual 8086 !',0dh,0ah,'$'
msg_103 db 'Install OK !',0dh,0ah,'$'
xmssi dw 0010h dup (0) ;XMS DS:SI °Ñ¼Æ°Ï
mem_a dw 0003h dup (0) ;XMS 64K (µ{¦¡½X)
mem_b dw 0003h dup (0) ;XMS 32K/32K (°Ñ¼Æ/°ïÅ|)
mem_c dw 0003h dup (0) ;XMS 260K (¤À¶ªí¥Î)
xmsdrv dw 0000h,0000h
old_idt dw 03ffh,0000h,0000h,0000h
;*************************************************************************
newcr3 dd 00000000h ;CR3 ªº¼ÆÈ
cr3gdt db 1400h dup (0) ;CR3 ªº GDT Â\¦b¦¹
;*************************************************************************
;* 00000000 =(4) Ū¨ú S-ICE ¦¸ 00000054 =(2) ¸T¤îŪ¨ú CRn
;* 00000004 =(4) CD01 00000056 =(2) ¸T¤î¼g¤J CRn
;* 00000008 =(4) 'T' 00000058 =(2) ¸T¤îŪ¨ú DRn
;* 0000000C =(4) CD09 0000005A =(2) ¸T¤î¼g¤J DRn
;* 00000010 =(4) F1 ²£¥Í INT_1 ¦¸¼Æ 0000005C =(4) IDT ¬dªí¦ì§}
;* 00000014 =(4) Ū CR0 ¦¸¼Æ 00000060 =(2) ¤¤Â_Åã¥Ü¾¹ºX¼Ð
;* 00000018 =(4) ¼g CR0 ¦¸¼Æ 00000062 =(2) «O¯d
;* 0000001C =(4) Ū CR3 ¦¸¼Æ 00000064 =(4) ¤£©úªº INT_6 ¦¸¼Æ
;* 00000020 =(4) ¼g CR3 ¦¸¼Æ 00000068 =(4) µwÅ餤Â_¦¸¼Æ
;* 00000024 =(4) Ū DR0 ¦¸¼Æ 0000006C =(4) ¤¤Â_Åã¥Ü¾¹ VRAM
;* 00000028 =(4) ¼g DR0 ¦¸¼Æ 00000070 =(4) CD03 ¦¸
;* 0000002C =(4) Ū DR1 ¦¸¼Æ 00000074 =(4) CC ¦¸
;* 00000030 =(4) ¼g DR1 ¦¸¼Æ 00000078 =(2) I/O ²£¥Íªº¤¤Â_¥N½X
;* 00000034 =(4) Ū DR2 ¦¸¼Æ
;* 00000038 =(4) ¼g DR2 ¦¸¼Æ
;* 0000003C =(4) Ū DR3 ¦¸¼Æ
;* 00000040 =(4) ¼g DR3 ¦¸¼Æ
;* 00000044 =(4) Ū DR6 ¦¸¼Æ
;* 00000048 =(4) ¼g DR6 ¦¸¼Æ
;* 0000004C =(4) Ū DR7 ¦¸¼Æ
;* 00000050 =(4) ¼g DR7 ¦¸¼Æ
;*************************************************************************
intfftab dw offset func_0,0000h,0000h,0000h
dw offset func_1,0000h,0000h,0000h
dw offset func_2,0000h,0000h,0000h
dw offset func_3,0000h,0000h,0000h
dw offset func_4,0000h,0000h,0000h
dw offset func_5,0000h,0000h,0000h
dw offset func_6,0000h,0000h,0000h
dw offset func_7,0000h,0000h,0000h
dw offset func_8,0000h,0000h,0000h
dw offset func_9,0000h,0000h,0000h
dw offset func_a,0000h,0000h,0000h
dw offset func_b,0000h,0000h,0000h
dw offset func_c,0000h,0000h,0000h
dw offset func_d,0000h,0000h,0000h
dw offset func_e,0000h,0000h,0000h
dw offset func_f,0000h,0000h,0000h
dw offset func_10,0000h,0000h,0000h
dw offset func_11,0000h,0000h,0000h
dw offset func_12,0000h,0000h,0000h
dw offset func_13,0000h,0000h,0000h
dw offset func_14,0000h,0000h,0000h
dw offset func_15,0000h,0000h,0000h
dw offset func_16,0000h,0000h,0000h
dw offset func_17,0000h,0000h,0000h
dw offset func_18,0000h,0000h,0000h
tssltr dd 00000000h
dd 0000ff00h ;ESP
dw 0028h,0000h ;SS.0
dd 0,0,0,0,0
dw offset enter_v86,0000h ;EIP
dd 00000200h ;EFlag
dd 0,0,0,0
dd 0000ff00h ;ESP
dd 0,0,0
dw 0010h,0000h ;ES.0
dw 0008h,0000h ;CS.0
dw 0028h,0000h ;SS.0
dw 0010h,0000h ;DS,0
dw 0010h,0000h ;FS.0
dw 0010h,0000h ;GS.0
dw 0000h,0000h ;LDT.0
dw 0000h,0068h ;0.IOMAP
db 1000h dup (0)
dw 0ffffh
tssjmp dd 00000000h
dd 0000ff00h ;ESP
dw 0028h,0000h ;SS.0
dd 0,0,0,0,0
dw offset enter_v86,0000h ;EIP
dd 00000000h ;EFlag
dd 0,0,0,0
dd 0000ff00h ;ESP
dd 0,0,0
dw 0010h,0000h ;ES.0
dw 0008h,0000h ;CS.0
dw 0028h,0000h ;SS.0
dw 0010h,0000h ;DS,0
dw 0010h,0000h ;FS.0
dw 0010h,0000h ;GS.0
dw 0000h,0000h ;LDT.0
dw 0000h,0068h ;0.IOMAP
iomap db 1000h dup (0)
dw 0ffffh
gdtadds db 47h,00h,00h,00h,00h,00h
gdttab db 000h,000h,000h,000h,000h,000h,000h,000h ;00 Null
db 0ffh,0ffh,000h,000h,000h,09bh,000h,000h ;08 PRG Seg
db 0ffh,0ffh,000h,000h,000h,093h,08fh,000h ;10 Dos=Page
db 0ffh,0ffh,000h,000h,000h,089h,000h,000h ;18 TSSltr
db 0ffh,0ffh,000h,000h,000h,089h,000h,000h ;20 TSSjmp
db 0ffh,0ffh,000h,000h,000h,093h,000h,000h ;28 Data / Stack
db 0ffh,007h,000h,000h,000h,093h,000h,000h ;30 Int
db 0ffh,0ffh,000h,080h,00bh,093h,000h,000h ;38 Video
db 0ffh,0ffh,000h,000h,000h,093h,000h,000h ;40 PRG Seg
idtadds db 0ffh,07h,00h,00h,00h,00h
idttab dw offset new_00,0008h,0ee00h,0000h,offset new_01,0008h,0ee00h,0000h
dw offset new_02,0008h,0ee00h,0000h,offset new_03,0008h,0ee00h,0000h
dw offset new_04,0008h,0ee00h,0000h,offset new_05,0008h,0ee00h,0000h
dw offset new_06,0008h,0ee00h,0000h,offset new_07,0008h,0ee00h,0000h
dw offset new_08,0008h,0ee00h,0000h,offset new_09,0008h,0ee00h,0000h
dw offset new_0a,0008h,0ee00h,0000h,offset new_0b,0008h,0ee00h,0000h
dw offset new_0c,0008h,0ee00h,0000h,offset new_0d,0008h,0ee00h,0000h
dw offset new_0e,0008h,0ee00h,0000h,offset new_0f,0008h,0ee00h,0000h
dw offset new_10,0008h,0ee00h,0000h,offset new_11,0008h,0ee00h,0000h
dw offset new_12,0008h,0ee00h,0000h,offset new_13,0008h,0ee00h,0000h
dw offset new_14,0008h,0ee00h,0000h,offset new_15,0008h,0ee00h,0000h
dw offset new_16,0008h,0ee00h,0000h,offset new_17,0008h,0ee00h,0000h
dw offset new_18,0008h,0ee00h,0000h,offset new_19,0008h,0ee00h,0000h
dw offset new_1a,0008h,0ee00h,0000h,offset new_1b,0008h,0ee00h,0000h
dw offset new_1c,0008h,0ee00h,0000h,offset new_1d,0008h,0ee00h,0000h
dw offset new_1e,0008h,0ee00h,0000h,offset new_1f,0008h,0ee00h,0000h
dw offset new_20,0008h,0ee00h,0000h,offset new_21,0008h,0ee00h,0000h
dw offset new_22,0008h,0ee00h,0000h,offset new_23,0008h,0ee00h,0000h
dw offset new_24,0008h,0ee00h,0000h,offset new_25,0008h,0ee00h,0000h
dw offset new_26,0008h,0ee00h,0000h,offset new_27,0008h,0ee00h,0000h
dw offset new_28,0008h,0ee00h,0000h,offset new_29,0008h,0ee00h,0000h
dw offset new_2a,0008h,0ee00h,0000h,offset new_2b,0008h,0ee00h,0000h
dw offset new_2c,0008h,0ee00h,0000h,offset new_2d,0008h,0ee00h,0000h
dw offset new_2e,0008h,0ee00h,0000h,offset new_2f,0008h,0ee00h,0000h
dw offset new_30,0008h,0ee00h,0000h,offset new_31,0008h,0ee00h,0000h
dw offset new_32,0008h,0ee00h,0000h,offset new_33,0008h,0ee00h,0000h
dw offset new_34,0008h,0ee00h,0000h,offset new_35,0008h,0ee00h,0000h
dw offset new_36,0008h,0ee00h,0000h,offset new_37,0008h,0ee00h,0000h
dw offset new_38,0008h,0ee00h,0000h,offset new_39,0008h,0ee00h,0000h
dw offset new_3a,0008h,0ee00h,0000h,offset new_3b,0008h,0ee00h,0000h
dw offset new_3c,0008h,0ee00h,0000h,offset new_3d,0008h,0ee00h,0000h
dw offset new_3e,0008h,0ee00h,0000h,offset new_3f,0008h,0ee00h,0000h
dw offset new_40,0008h,0ee00h,0000h,offset new_41,0008h,0ee00h,0000h
dw offset new_42,0008h,0ee00h,0000h,offset new_43,0008h,0ee00h,0000h
dw offset new_44,0008h,0ee00h,0000h,offset new_45,0008h,0ee00h,0000h
dw offset new_46,0008h,0ee00h,0000h,offset new_47,0008h,0ee00h,0000h
dw offset new_48,0008h,0ee00h,0000h,offset new_49,0008h,0ee00h,0000h
dw offset new_4a,0008h,0ee00h,0000h,offset new_4b,0008h,0ee00h,0000h
dw offset new_4c,0008h,0ee00h,0000h,offset new_4d,0008h,0ee00h,0000h
dw offset new_4e,0008h,0ee00h,0000h,offset new_4f,0008h,0ee00h,0000h
dw offset new_50,0008h,0ee00h,0000h,offset new_51,0008h,0ee00h,0000h
dw offset new_52,0008h,0ee00h,0000h,offset new_53,0008h,0ee00h,0000h
dw offset new_54,0008h,0ee00h,0000h,offset new_55,0008h,0ee00h,0000h
dw offset new_56,0008h,0ee00h,0000h,offset new_57,0008h,0ee00h,0000h
dw offset new_58,0008h,0ee00h,0000h,offset new_59,0008h,0ee00h,0000h
dw offset new_5a,0008h,0ee00h,0000h,offset new_5b,0008h,0ee00h,0000h
dw offset new_5c,0008h,0ee00h,0000h,offset new_5d,0008h,0ee00h,0000h
dw offset new_5e,0008h,0ee00h,0000h,offset new_5f,0008h,0ee00h,0000h
dw offset new_60,0008h,0ee00h,0000h,offset new_61,0008h,0ee00h,0000h
dw offset new_62,0008h,0ee00h,0000h,offset new_63,0008h,0ee00h,0000h
dw offset new_64,0008h,0ee00h,0000h,offset new_65,0008h,0ee00h,0000h
dw offset new_66,0008h,0ee00h,0000h,offset new_67,0008h,0ee00h,0000h
dw offset new_68,0008h,0ee00h,0000h,offset new_69,0008h,0ee00h,0000h
dw offset new_6a,0008h,0ee00h,0000h,offset new_6b,0008h,0ee00h,0000h
dw offset new_6c,0008h,0ee00h,0000h,offset new_6d,0008h,0ee00h,0000h
dw offset new_6e,0008h,0ee00h,0000h,offset new_6f,0008h,0ee00h,0000h
dw offset new_70,0008h,0ee00h,0000h,offset new_71,0008h,0ee00h,0000h
dw offset new_72,0008h,0ee00h,0000h,offset new_73,0008h,0ee00h,0000h
dw offset new_74,0008h,0ee00h,0000h,offset new_75,0008h,0ee00h,0000h
dw offset new_76,0008h,0ee00h,0000h,offset new_77,0008h,0ee00h,0000h
dw offset new_78,0008h,0ee00h,0000h,offset new_79,0008h,0ee00h,0000h
dw offset new_7a,0008h,0ee00h,0000h,offset new_7b,0008h,0ee00h,0000h
dw offset new_7c,0008h,0ee00h,0000h,offset new_7d,0008h,0ee00h,0000h
dw offset new_7e,0008h,0ee00h,0000h,offset new_7f,0008h,0ee00h,0000h
dw offset new_80,0008h,0ee00h,0000h,offset new_81,0008h,0ee00h,0000h
dw offset new_82,0008h,0ee00h,0000h,offset new_83,0008h,0ee00h,0000h
dw offset new_84,0008h,0ee00h,0000h,offset new_85,0008h,0ee00h,0000h
dw offset new_86,0008h,0ee00h,0000h,offset new_87,0008h,0ee00h,0000h
dw offset new_88,0008h,0ee00h,0000h,offset new_89,0008h,0ee00h,0000h
dw offset new_8a,0008h,0ee00h,0000h,offset new_8b,0008h,0ee00h,0000h
dw offset new_8c,0008h,0ee00h,0000h,offset new_8d,0008h,0ee00h,0000h
dw offset new_8e,0008h,0ee00h,0000h,offset new_8f,0008h,0ee00h,0000h
dw offset new_90,0008h,0ee00h,0000h,offset new_91,0008h,0ee00h,0000h
dw offset new_92,0008h,0ee00h,0000h,offset new_93,0008h,0ee00h,0000h
dw offset new_94,0008h,0ee00h,0000h,offset new_95,0008h,0ee00h,0000h
dw offset new_96,0008h,0ee00h,0000h,offset new_97,0008h,0ee00h,0000h
dw offset new_98,0008h,0ee00h,0000h,offset new_99,0008h,0ee00h,0000h
dw offset new_9a,0008h,0ee00h,0000h,offset new_9b,0008h,0ee00h,0000h
dw offset new_9c,0008h,0ee00h,0000h,offset new_9d,0008h,0ee00h,0000h
dw offset new_9e,0008h,0ee00h,0000h,offset new_9f,0008h,0ee00h,0000h
dw offset new_a0,0008h,0ee00h,0000h,offset new_a1,0008h,0ee00h,0000h
dw offset new_a2,0008h,0ee00h,0000h,offset new_a3,0008h,0ee00h,0000h
dw offset new_a4,0008h,0ee00h,0000h,offset new_a5,0008h,0ee00h,0000h
dw offset new_a6,0008h,0ee00h,0000h,offset new_a7,0008h,0ee00h,0000h
dw offset new_a8,0008h,0ee00h,0000h,offset new_a9,0008h,0ee00h,0000h
dw offset new_aa,0008h,0ee00h,0000h,offset new_ab,0008h,0ee00h,0000h
dw offset new_ac,0008h,0ee00h,0000h,offset new_ad,0008h,0ee00h,0000h
dw offset new_ae,0008h,0ee00h,0000h,offset new_af,0008h,0ee00h,0000h
dw offset new_b0,0008h,0ee00h,0000h,offset new_b1,0008h,0ee00h,0000h
dw offset new_b2,0008h,0ee00h,0000h,offset new_b3,0008h,0ee00h,0000h
dw offset new_b4,0008h,0ee00h,0000h,offset new_b5,0008h,0ee00h,0000h
dw offset new_b6,0008h,0ee00h,0000h,offset new_b7,0008h,0ee00h,0000h
dw offset new_b8,0008h,0ee00h,0000h,offset new_b9,0008h,0ee00h,0000h
dw offset new_ba,0008h,0ee00h,0000h,offset new_bb,0008h,0ee00h,0000h
dw offset new_bc,0008h,0ee00h,0000h,offset new_bd,0008h,0ee00h,0000h
dw offset new_be,0008h,0ee00h,0000h,offset new_bf,0008h,0ee00h,0000h
dw offset new_c0,0008h,0ee00h,0000h,offset new_c1,0008h,0ee00h,0000h
dw offset new_c2,0008h,0ee00h,0000h,offset new_c3,0008h,0ee00h,0000h
dw offset new_c4,0008h,0ee00h,0000h,offset new_c5,0008h,0ee00h,0000h
dw offset new_c6,0008h,0ee00h,0000h,offset new_c7,0008h,0ee00h,0000h
dw offset new_c8,0008h,0ee00h,0000h,offset new_c9,0008h,0ee00h,0000h
dw offset new_ca,0008h,0ee00h,0000h,offset new_cb,0008h,0ee00h,0000h
dw offset new_cc,0008h,0ee00h,0000h,offset new_cd,0008h,0ee00h,0000h
dw offset new_ce,0008h,0ee00h,0000h,offset new_cf,0008h,0ee00h,0000h
dw offset new_d0,0008h,0ee00h,0000h,offset new_d1,0008h,0ee00h,0000h
dw offset new_d2,0008h,0ee00h,0000h,offset new_d3,0008h,0ee00h,0000h
dw offset new_d4,0008h,0ee00h,0000h,offset new_d5,0008h,0ee00h,0000h
dw offset new_d6,0008h,0ee00h,0000h,offset new_d7,0008h,0ee00h,0000h
dw offset new_d8,0008h,0ee00h,0000h,offset new_d9,0008h,0ee00h,0000h
dw offset new_da,0008h,0ee00h,0000h,offset new_db,0008h,0ee00h,0000h
dw offset new_dc,0008h,0ee00h,0000h,offset new_dd,0008h,0ee00h,0000h
dw offset new_de,0008h,0ee00h,0000h,offset new_df,0008h,0ee00h,0000h
dw offset new_e0,0008h,0ee00h,0000h,offset new_e1,0008h,0ee00h,0000h
dw offset new_e2,0008h,0ee00h,0000h,offset new_e3,0008h,0ee00h,0000h
dw offset new_e4,0008h,0ee00h,0000h,offset new_e5,0008h,0ee00h,0000h
dw offset new_e6,0008h,0ee00h,0000h,offset new_e7,0008h,0ee00h,0000h
dw offset new_e8,0008h,0ee00h,0000h,offset new_e9,0008h,0ee00h,0000h
dw offset new_ea,0008h,0ee00h,0000h,offset new_eb,0008h,0ee00h,0000h
dw offset new_ec,0008h,0ee00h,0000h,offset new_ed,0008h,0ee00h,0000h
dw offset new_ee,0008h,0ee00h,0000h,offset new_ef,0008h,0ee00h,0000h
dw offset new_f0,0008h,0ee00h,0000h,offset new_f1,0008h,0ee00h,0000h
dw offset new_f2,0008h,0ee00h,0000h,offset new_f3,0008h,0ee00h,0000h
dw offset new_f4,0008h,0ee00h,0000h,offset new_f5,0008h,0ee00h,0000h
dw offset new_f6,0008h,0ee00h,0000h,offset new_f7,0008h,0ee00h,0000h
dw offset new_f8,0008h,0ee00h,0000h,offset new_f9,0008h,0ee00h,0000h
dw offset new_fa,0008h,0ee00h,0000h,offset new_fb,0008h,0ee00h,0000h
dw offset new_fc,0008h,0ee00h,0000h,offset new_fd,0008h,0ee00h,0000h
dw offset new_fe,0008h,0ee00h,0000h,offset new_ff,0008h,0ee00h,0000h
new_00 :
push 0000h
jmp int_emu
new_01 :
push 0001h
push bp
mov bp,sp
add bp,04h
push eax
push ebx
mov ax,0010h
mov ds,ax
mov ax,0028h
mov es,ax
mov eax,dr6
or es:[007ah],eax
mov eax,ss:[bp+00h]
mov ebx,ss:[bp+04h]
shl ebx,04h
add ebx,eax
cmp word ptr ds:[ebx-02h],01cdh
jnz L8
inc dword ptr es:[00000004h]
or dword ptr es:[00000004h],80000000h
jmp L10
L8 :
test dword ptr ss:[bp+08h],00000100h
jz L9
inc dword ptr es:[00000008h]
or dword ptr es:[00000008h],80000000h
jmp L10
L9 :
cmp byte ptr ds:[ebx-01h],0f1h
jnz L1
inc dword ptr es:[00000010h]
or dword ptr es:[00000010h],80000000h
jmp L10
L1 :
inc dword ptr es:[00000068h]
or dword ptr es:[00000068h],80000000h
jmp L10
L10 :
pop ebx
pop eax
pop bp
jmp int_emu
new_02 :
push 0002h
jmp int_emu
new_03 :
push 0003h
push bp
mov bp,sp
add bp,04h
push eax
push ebx
mov ax,0010h
mov ds,ax
mov ax,0028h
mov es,ax
mov eax,ss:[bp+00h]
mov ebx,ss:[bp+04h]
shl ebx,04h
add ebx,eax
cmp word ptr ds:[ebx-02h],03cdh
jnz L11
inc dword ptr es:[0070h]
or dword ptr es:[0070h],80000000h
jmp L12
L11 :
inc dword ptr es:[0074h]
or dword ptr es:[0074h],80000000h
jmp L12
L12 :
cmp si,4647h
jnz L13
cmp di,4a4dh
jnz L13
inc dword ptr es:[0000h]
or dword ptr es:[0000h],80000000h
L13 :
pop ebx
pop eax
pop bp
jmp int_emu
new_04 :
push 0004h
jmp int_emu
new_05 :
push 0005h
jmp int_emu
new_06 :
push 0006h
push bp
mov bp,sp
add bp,04h
push eax
push ebx
mov ax,0010h
mov ds,ax
mov ax,0028h
mov es,ax
mov eax,ss:[bp+00h]
mov ebx,ss:[bp+04h]
shl ebx,04h
add ebx,eax
cmp word ptr ds:[ebx-02h],06cdh
jz L2
inc dword ptr es:[0064h]
or dword ptr es:[0064h],80000000h
L2 :
pop ebx
pop eax
pop bp
jmp int_emu
new_07 :
push 0007h
jmp int_emu
new_08 :
push 0008h
jmp int_emu
new_09 :
push 0009h
push bp
mov bp,sp
add bp,04h
push eax
push ebx
mov ax,0010h
mov ds,ax
mov ax,0028h
mov es,ax
mov eax,ss:[bp+00h]
mov ebx,ss:[bp+04h]
shl ebx,04h
add ebx,eax
cmp word ptr ds:[ebx-02h],09cdh
jnz L14
inc dword ptr es:[000ch]
or dword ptr es:[000ch],80000000h
jmp L14
L14 :
pop ebx
pop eax
pop bp
jmp int_emu
new_0a :
push 000ah
jmp int_emu
new_0b :
push 000bh
jmp int_emu
new_0c :
push 000ch
jmp int_emu
new_0d :
push 000dh
push bp ;
mov bp,sp ;¤ñ¹ï¬O§_µo¥Í General Protection Error
add bp,04h ;¦pªG¬O«h¸õ¨ì CHK_ERR_CMD °µÂ½Ä¶°Ê§@
cmp bp,0fedch ;
jz no_prot_err ;
pop bp ;
jmp chk_err_cmd ;
no_prot_err : ;
pop bp
jmp int_emu
new_0e :
push 000eh
jmp int_emu
new_0f :
push 000fh
jmp int_emu
new_10 :
push 0010h
jmp int_emu
new_11 :
push 0011h
jmp int_emu
new_12 :
push 0012h
jmp int_emu
new_13 :
push 0013h
jmp int_emu
new_14 :
push 0014h
jmp int_emu
new_15 :
cmp ah,87h
jnz L18
push bp
mov bp,sp
add bp,02h
push eax
push ebx
push ecx
push edx
push edi
push esi
mov ebx,ss:[bp+14h]
shl ebx,04h
and esi,0000ffffh
add ebx,esi
mov ax,0010h
mov ds,ax
mov es,ax
mov esi,ds:[ebx+12h]
mov edi,ds:[ebx+1ah]
and esi,00ffffffh
and edi,00ffffffh
mov al,ds:[ebx+17h]
shl eax,18h
and eax,0ff000000h
or esi,eax
mov al,ds:[ebx+1fh]
shl eax,18h
and eax,0ff000000h
or edi,eax
or cx,cx
jz L17
L16 :
mov ax,ds:[esi]
mov es:[edi],ax
add esi,02h
add edi,02h
loop L16
L17 :
mov eax,cr3
mov cr3,eax ;restore Pageunit CPU internal cache
pop esi
pop edi
pop edx
pop ecx
pop ebx
pop eax
pop bp
iretd
L18 :
push 0015h
jmp int_emu
new_16 :
push 0016h
jmp int_emu
new_17 :
push 0017h
jmp int_emu
new_18 :
push 0018h
jmp int_emu
new_19 :
push 0019h
jmp int_emu
new_1a :
push 001ah
jmp int_emu
new_1b :
push 001bh
jmp int_emu
new_1c :
push 001ch
jmp int_emu
new_1d :
push 001dh
jmp int_emu
new_1e :
push 001eh
jmp int_emu
new_1f :
push 001fh
jmp int_emu
new_20 :
push 0020h
jmp int_emu
new_21 :
push 0021h
jmp int_emu
new_22 :
push 0022h
jmp int_emu
new_23 :
push 0023h
jmp int_emu
new_24 :
push 0024h
jmp int_emu
new_25 :
push 0025h
jmp int_emu
new_26 :
push 0026h
jmp int_emu
new_27 :
push 0027h
jmp int_emu
new_28 :
push 0028h
jmp int_emu
new_29 :
push 0029h
jmp int_emu
new_2a :
push 002ah
jmp int_emu
new_2b :
push 002bh
jmp int_emu
new_2c :
push 002ch
jmp int_emu
new_2d :
push 002dh
jmp int_emu
new_2e :
push 002eh
jmp int_emu
new_2f :
push 002fh
jmp int_emu
new_30 :
push 0030h
jmp int_emu
new_31 :
push 0031h
jmp int_emu
new_32 :
push 0032h
jmp int_emu
new_33 :
push 0033h
jmp int_emu
new_34 :
push 0034h
jmp int_emu
new_35 :
push 0035h
jmp int_emu
new_36 :
push 0036h
jmp int_emu
new_37 :
push 0037h
jmp int_emu
new_38 :
push 0038h
jmp int_emu
new_39 :
push 0039h
jmp int_emu
new_3a :
push 003ah
jmp int_emu
new_3b :
push 003bh
jmp int_emu
new_3c :
push 003ch
jmp int_emu
new_3d :
push 003dh
jmp int_emu
new_3e :
push 003eh
jmp int_emu
new_3f :
push 003fh
jmp int_emu
new_40 :
push 0040h
jmp int_emu
new_41 :
push 0041h
jmp int_emu
new_42 :
push 0042h
jmp int_emu
new_43 :
push 0043h
jmp int_emu
new_44 :
push 0044h
jmp int_emu
new_45 :
push 0045h
jmp int_emu
new_46 :
push 0046h
jmp int_emu
new_47 :
push 0047h
jmp int_emu
new_48 :
push 0048h
jmp int_emu
new_49 :
push 0049h
jmp int_emu
new_4a :
push 004ah
jmp int_emu
new_4b :
push 004bh
jmp int_emu
new_4c :
push 004ch
jmp int_emu
new_4d :
push 004dh
jmp int_emu
new_4e :
push 004eh
jmp int_emu
new_4f :
push 004fh
jmp int_emu
new_50 :
push 0050h
jmp int_emu
new_51 :
push 0051h
jmp int_emu
new_52 :
push 0052h
jmp int_emu
new_53 :
push 0053h
jmp int_emu
new_54 :
push 0054h
jmp int_emu
new_55 :
push 0055h
jmp int_emu
new_56 :
push 0056h
jmp int_emu
new_57 :
push 0057h
jmp int_emu
new_58 :
push 0058h
jmp int_emu
new_59 :
push 0059h
jmp int_emu
new_5a :
push 005ah
jmp int_emu
new_5b :
push 005bh
jmp int_emu
new_5c :
push 005ch
jmp int_emu
new_5d :
push 005dh
jmp int_emu
new_5e :
push 005eh
jmp int_emu
new_5f :
push 005fh
jmp int_emu
new_60 :
push 0060h
jmp int_emu
new_61 :
push 0061h
jmp int_emu
new_62 :
push 0062h
jmp int_emu
new_63 :
push 0063h
jmp int_emu
new_64 :
push 0064h
jmp int_emu
new_65 :
push 0065h
jmp int_emu
new_66 :
push 0066h
jmp int_emu
new_67 :
push 0067h
jmp int_emu
new_68 :
push 0068h
jmp int_emu
new_69 :
push 0069h
jmp int_emu
new_6a :
push 006ah
jmp int_emu
new_6b :
push 006bh
jmp int_emu
new_6c :
push 006ch
jmp int_emu
new_6d :
push 006dh
jmp int_emu
new_6e :
push 006eh
jmp int_emu
new_6f :
push 006fh
jmp int_emu
new_70 :
push 0070h
jmp int_emu
new_71 :
push 0071h
jmp int_emu
new_72 :
push 0072h
jmp int_emu
new_73 :
push 0073h
jmp int_emu
new_74 :
push 0074h
jmp int_emu
new_75 :
push 0075h
jmp int_emu
new_76 :
push 0076h
jmp int_emu
new_77 :
push 0077h
jmp int_emu
new_78 :
push 0078h
jmp int_emu
new_79 :
push 0079h
jmp int_emu
new_7a :
push 007ah
jmp int_emu
new_7b :
push 007bh
jmp int_emu
new_7c :
push 007ch
jmp int_emu
new_7d :
push 007dh
jmp int_emu
new_7e :
push 007eh
jmp int_emu
new_7f :
push 007fh
jmp int_emu
new_80 :
push 0080h
jmp int_emu
new_81 :
push 0081h
jmp int_emu
new_82 :
push 0082h
jmp int_emu
new_83 :
push 0083h
jmp int_emu
new_84 :
push 0084h
jmp int_emu
new_85 :
push 0085h
jmp int_emu
new_86 :
push 0086h
jmp int_emu
new_87 :
push 0087h
jmp int_emu
new_88 :
push 0088h
jmp int_emu
new_89 :
push 0089h
jmp int_emu
new_8a :
push 008ah
jmp int_emu
new_8b :
push 008bh
jmp int_emu
new_8c :
push 008ch
jmp int_emu
new_8d :
push 008dh
jmp int_emu
new_8e :
push 008eh
jmp int_emu
new_8f :
push 008fh
jmp int_emu
new_90 :
push 0090h
jmp int_emu
new_91 :
push 0091h
jmp int_emu
new_92 :
push 0092h
jmp int_emu
new_93 :
push 0093h
jmp int_emu
new_94 :
push 0094h
jmp int_emu
new_95 :
push 0095h
jmp int_emu
new_96 :
push 0096h
jmp int_emu
new_97 :
push 0097h
jmp int_emu
new_98 :
push 0098h
jmp int_emu
new_99 :
push 0099h
jmp int_emu
new_9a :
push 009ah
jmp int_emu
new_9b :
push 009bh
jmp int_emu
new_9c :
push 009ch
jmp int_emu
new_9d :
push 009dh
jmp int_emu
new_9e :
push 009eh
jmp int_emu
new_9f :
push 009fh
jmp int_emu
new_a0 :
push 00a0h
jmp int_emu
new_a1 :
push 00a1h
jmp int_emu
new_a2 :
push 00a2h
jmp int_emu
new_a3 :
push 00a3h
jmp int_emu
new_a4 :
push 00a4h
jmp int_emu
new_a5 :
push 00a5h
jmp int_emu
new_a6 :
push 00a6h
jmp int_emu
new_a7 :
push 00a7h
jmp int_emu
new_a8 :
push 00a8h
jmp int_emu
new_a9 :
push 00a9h
jmp int_emu
new_aa :
push 00aah
jmp int_emu
new_ab :
push 00abh
jmp int_emu
new_ac :
push 00ach
jmp int_emu
new_ad :
push 00adh
jmp int_emu
new_ae :
push 00aeh
jmp int_emu
new_af :
push 00afh
jmp int_emu
new_b0 :
push 00b0h
jmp int_emu
new_b1 :
push 00b1h
jmp int_emu
new_b2 :
push 00b2h
jmp int_emu
new_b3 :
push 00b3h
jmp int_emu
new_b4 :
push 00b4h
jmp int_emu
new_b5 :
push 00b5h
jmp int_emu
new_b6 :
push 00b6h
jmp int_emu
new_b7 :
push 00b7h
jmp int_emu
new_b8 :
push 00b8h
jmp int_emu
new_b9 :
push 00b9h
jmp int_emu
new_ba :
push 00bah
jmp int_emu
new_bb :
push 00bbh
jmp int_emu
new_bc :
push 00bch
jmp int_emu
new_bd :
push 00bdh
jmp int_emu
new_be :
push 00beh
jmp int_emu
new_bf :
push 00bfh
jmp int_emu
new_c0 :
push 00c0h
jmp int_emu
new_c1 :
push 00c1h
jmp int_emu
new_c2 :
push 00c2h
jmp int_emu
new_c3 :
push 00c3h
jmp int_emu
new_c4 :
push 00c4h
jmp int_emu
new_c5 :
push 00c5h
jmp int_emu
new_c6 :
push 00c6h
jmp int_emu
new_c7 :
push 00c7h
jmp int_emu
new_c8 :
push 00c8h
jmp int_emu
new_c9 :
push 00c9h
jmp int_emu
new_ca :
push 00cah
jmp int_emu
new_cb :
push 00cbh
jmp int_emu
new_cc :
push 00cch
jmp int_emu
new_cd :
push 00cdh
jmp int_emu
new_ce :
push 00ceh
jmp int_emu
new_cf :
push 00cfh
jmp int_emu
new_d0 :
push 00d0h
jmp int_emu
new_d1 :
push 00d1h
jmp int_emu
new_d2 :
push 00d2h
jmp int_emu
new_d3 :
push 00d3h
jmp int_emu
new_d4 :
push 00d4h
jmp int_emu
new_d5 :
push 00d5h
jmp int_emu
new_d6 :
push 00d6h
jmp int_emu
new_d7 :
push 00d7h
jmp int_emu
new_d8 :
push 00d8h
jmp int_emu
new_d9 :
push 00d9h
jmp int_emu
new_da :
push 00dah
jmp int_emu
new_db :
push 00dbh
jmp int_emu
new_dc :
push 00dch
jmp int_emu
new_dd :
push 00ddh
jmp int_emu
new_de :
push 00deh
jmp int_emu
new_df :
push 00dfh
jmp int_emu
new_e0 :
push 00e0h
jmp int_emu
new_e1 :
push 00e1h
jmp int_emu
new_e2 :
push 00e2h
jmp int_emu
new_e3 :
push 00e3h
jmp int_emu
new_e4 :
push 00e4h
jmp int_emu
new_e5 :
push 00e5h
jmp int_emu
new_e6 :
push 00e6h
jmp int_emu
new_e7 :
push 00e7h
jmp int_emu
new_e8 :
push 00e8h
jmp int_emu
new_e9 :
push 00e9h
jmp int_emu
new_ea :
push 00eah
jmp int_emu
new_eb :
push 00ebh
jmp int_emu
new_ec :
push 00ech
jmp int_emu
new_ed :
push 00edh
jmp int_emu
new_ee :
push 00eeh
jmp int_emu
new_ef :
push 00efh
jmp int_emu
new_f0 :
push 00f0h
jmp int_emu
new_f1 :
push 00f1h
jmp int_emu
new_f2 :
push 00f2h
jmp int_emu
new_f3 :
push 00f3h
jmp int_emu
new_f4 :
push 00f4h
jmp int_emu
new_f5 :
push 00f5h
jmp int_emu
new_f6 :
push 00f6h
jmp int_emu
new_f7 :
push 00f7h
jmp int_emu
new_f8 :
push 00f8h
jmp int_emu
new_f9 :
push 00f9h
jmp int_emu
new_fa :
push 00fah
jmp int_emu
new_fb :
push 00fbh
jmp int_emu
new_fc :
push 00fch
jmp int_emu
new_fd :
push 00fdh
jmp int_emu
new_fe :
push 00feh
jmp int_emu
new_ff :
cmp di,'IR'
jnz L6
cmp si,'PP'
jnz L6
jmp L7
L6 :
push 00ffh
jmp int_emu
L7 :
cmp ax,0019h
jnb L6
push bp
push eax
mov bp,sp
push ebx
mov bx,0040h
mov ds,bx
mov bx,0028h
mov es,bx
mov bx,ax
shl bx,03h
jmp ds:[bx+offset intfftab]
;-------------------------------------------------------------------------
; µêÀÀÀô¹Ò¤ä´©ªº©R¥O¤@Äýªí
;-------------------------------------------------------------------------
func_0 :
push cx
push di
mov di,0000h
mov cx,8000h
mov al,00h
cld
repz stosb
mov ax,0040h
mov es,ax
mov di,offset iomap
mov al,00h
mov cx,1000h
cld
repz stosb
mov bx,offset iomap
or byte ptr es:[bx+0ch],01h ;³]©wÄdI/O 60h
pop di
pop cx
mov eax,00000000h
mov dr6,eax
mov eax,00000400h
mov dr7,eax
jmp end_func
func_1 :
mov dword ptr ss:[bp-04h],0000030ah
jmp end_func
func_2 :
mov ecx,es:[0000h]
jmp end_func
func_3 :
mov ecx,es:[0068h]
mov ss:[bp],ecx
mov ecx,es:[0004h]
mov edx,es:[0008h]
jmp end_func
func_4 :
mov ecx,es:[0070h]
mov edx,es:[0074h]
jmp end_func
func_5 :
mov ecx,es:[000ch]
jmp end_func
func_6 :
mov ecx,es:[0010h]
jmp end_func
func_7 :
mov ecx,es:[0014h]
mov edx,es:[0018h]
jmp end_func
func_8 :
mov ecx,es:[001ch]
mov edx,es:[0020h]
jmp end_func
func_9 :
mov ecx,es:[0024h]
mov edx,es:[0028h]
jmp end_func
func_a :
mov ecx,es:[002ch]
mov edx,es:[0030h]
jmp end_func
func_b :
mov ecx,es:[0034h]
mov edx,es:[0038h]
jmp end_func
func_c :
mov ecx,es:[003ch]
mov edx,es:[0040h]
jmp end_func
func_d :
mov ecx,es:[0044h]
mov edx,es:[0048h]
jmp end_func
func_e :
mov ecx,es:[004ch]
mov edx,es:[0050h]
jmp end_func
func_f :
mov word ptr es:[0056h],0001h
jmp end_func
func_10 :
mov word ptr es:[0054h],0001h
jmp end_func
func_11 :
push cx
push dx
mov es:[0078h],cx
mov bx,dx
shr bx,03h
and dx,07h
mov cl,dl
mov al,01h
rol al,cl
or ds:[bx+offset iomap],al
pop dx
pop cx
jmp end_func
func_12 :
pop ebx
mov es:[005ch],ebx
push ebx
jmp end_func
func_13 :
mov eax,dr6
mov ss:[bp],eax
jmp end_func
func_14 :
mov eax,ss:[bp]
mov dr6,eax
jmp end_func
func_15 :
pop ebx
mov word ptr es:[0060h],0001h
mov es:[006ch],ebx
push ebx
jmp end_func
func_16 :
mov edx,es:[007ah]
jmp end_func
func_17 :
mov ecx,es:[0064h]
jmp end_func
func_18 :
jmp end_func
end_func :
pop ebx
pop eax
pop bp
iretd
int_emu :
push bp
mov bp,sp
add bp,04h
push eax
push ebx
mov ax,ss:[bp-02h] ;AX=INT?
cmp bp,0fedch ;BP=FEDC=OK BP=FED8=ERR
jnz protection_err
mov ax,0010h ;
mov ds,ax ;
mov ax,ss:[bp+0ch] ;
sub ax,06h ;
mov ss:[bp+0ch],ax ;
xor eax,eax ;
xor ebx,ebx ;
mov ax,ss:[bp+10h] ;V86 ¤U IRET nªð¦^ªº¦ì§}
shl eax,04h ;
mov bx,ss:[bp+0ch] ;
add ebx,eax ;
mov ax,ss:[bp+00h] ;
mov ds:[ebx],ax ;
mov ax,ss:[bp+04h] ;
mov ds:[ebx+02h],ax ;
mov ax,ss:[bp+08h] ;
mov ds:[ebx+04h],ax ;
nop
xor ebx,ebx ;
mov bx,ss:[bp-02h] ;
shl ebx,02h ;
mov eax,ss:[005ch] ;GET IDT Emulation
add ebx,eax ;
mov ax,ds:[ebx] ;IRETD«á¸õ¨ì¦ó³B°õ¦æ
mov ss:[bp+00h],ax ;(¬d 0000:0000 ªº¤¤Â_ªí)
mov ax,ds:[ebx+02h] ;
mov ss:[bp+04h],ax ;
mov eax,ss:[bp+08h]
or eax,00032000h
and eax,0fffffeffh
mov ss:[bp+08h],eax
cmp word ptr ss:[0060h],0001h
jnz L15
mov ax,ss:[bp-02h]
call al_to_di
L15 :
pop ebx
pop eax
pop bp
add sp,02h
iretd
;-------------------------------------------------------------------------
set_32bit :
mov cs:[di+02h],ax
shr eax,10h
mov cs:[di+04h],al
mov cs:[di+07h],ah
ret
cut_space :
cmp byte ptr ds:[si],20h
jnz cut_ok
inc si
jmp cut_space
cut_ok :
ret
end_prog :
mov ax,cs
mov ds,ax
mov ah,09h
int 21h
mov ax,4cffh
int 21h
next : ;¡i µ{¦¡¶}©l ¡j
or byte ptr cs:iomap+0ch,01h ;³]©wÄdI/O 60h
mov ah,4ah
mov bx,0800h
int 21h
mov sp,07e00h
mov ax,cs
mov ds,ax
mov ah,09h
mov dx,offset mark1
int 21h
smsw ax
test al,01h
jz in_real_mode
mov ah,09h
mov dx,offset msg_102
int 21h
mov ax,4cffh
int 21h
in_real_mode :
NOP
;-------------------------------------------------------------------------
; ·j´M¨Ã°t¸m©µ¦ù°O¾ÐÅé 64K x 2 ¶ô
;-------------------------------------------------------------------------
mov ax,4300h
int 2fh
cmp al,80h
jz found_xms
mov dx,offset msg_100
jmp end_prog
found_xms :
mov ax,4310h
int 2fh
add bx,05h
mov cs:xmsdrv,bx
mov cs:xmsdrv+02h,es
mov ah,09h
mov dx,0040h
call dword ptr cs:xmsdrv
cmp ax,0001h
jz alloc_mem_a
mov dx,offset msg_101
jmp end_prog
alloc_mem_a :
mov cs:mem_a,dx
mov ah,09h
mov dx,0040h
call dword ptr cs:xmsdrv
cmp ax,0001h
jz alloc_mem_b
mov ah,0ah
mov dx,cs:mem_a
call dword ptr cs:xmsdrv
mov dx,offset msg_101
jmp end_prog
alloc_mem_b :
mov cs:mem_b,dx
mov ah,09h
mov dx,0104h ;260K
call dword ptr cs:xmsdrv
cmp ax,0001h
jz alloc_mem_c
mov ah,0ah
mov dx,cs:mem_a
call dword ptr cs:xmsdrv
mov ah,0ah
mov dx,cs:mem_b
call dword ptr cs:xmsdrv
mov dx,offset msg_101
jmp end_prog
alloc_mem_c :
mov cs:mem_c,dx
NOP
mov ah,0ch
mov dx,cs:mem_a
call dword ptr cs:xmsdrv
mov cs:mem_a+02h,bx
mov cs:mem_a+04h,dx
mov ah,0ch
mov dx,cs:mem_b
call dword ptr cs:xmsdrv
mov cs:mem_b+02h,bx
mov cs:mem_b+04h,dx
mov ah,0ch
mov dx,cs:mem_c
call dword ptr cs:xmsdrv
mov cs:mem_c+02h,bx
mov cs:mem_c+04h,dx
; mov ah,0dh
; mov dx,cs:mem_a
; call dword ptr cs:xmsdrv
; mov ah,0dh
; mov dx,cs:mem_b
; call dword ptr cs:xmsdrv
;-------------------------------------------------------------------------
; ¶}±Ò A20 ÅÞ¿è¹h
;-------------------------------------------------------------------------
mov ah,03h ;¾ãÅéP¯à A20
call dword ptr cs:xmsdrv
mov ah,05h ;¤ù±P¯à A20
call dword ptr cs:xmsdrv
;-------------------------------------------------------------------------
; ®Ú¾Ú©Ò°t¸m¨ìªº©µ¦ù°O¾ÐÅé¥h³]©w GDT.IDT ªí
;-------------------------------------------------------------------------
mov bx,offset mem_a
mov eax,cs:[bx+02h]
mov di,offset gdttab+08h
call set_32bit
mov bx,offset mem_a
mov eax,cs:[bx+02h]
xor ebx,ebx
mov bx,offset tssltr
add eax,ebx
mov di,offset gdttab+18h
call set_32bit
mov bx,offset mem_a
mov eax,cs:[bx+02h]
xor ebx,ebx
mov bx,offset tssjmp
add eax,ebx
mov di,offset gdttab+20h
call set_32bit
mov bx,offset mem_b
mov eax,cs:[bx+02h]
mov di,offset gdttab+28h
call set_32bit
mov bx,offset mem_a
mov eax,cs:[bx+02h]
xor ebx,ebx
mov bx,offset idttab
add eax,ebx
mov di,offset gdttab+30h
call set_32bit
mov bx,offset mem_a
mov eax,cs:[bx+02h]
mov di,offset gdttab+40h
call set_32bit
mov bx,offset mem_a
mov eax,cs:[bx+02h]
xor ebx,ebx
mov bx,offset gdttab
add eax,ebx
mov bx,offset gdtadds
mov cs:[bx+02h],eax
mov bx,offset mem_a
mov eax,cs:[bx+02h]
xor ebx,ebx
mov bx,offset idttab
add eax,ebx
mov bx,offset idtadds
mov cs:[bx+02h],eax
;-------------------------------------------------------------------------
; ±N¥Dµ{¦¡·h¨ì XMS ¤W±¥h ,¥Î¥H¤£¦û¥D°O¾ÐÅé ,¥þ³¡³£¦b«OÅ@¼Ò¦¡¤U°õ¦æ.
;-------------------------------------------------------------------------
mov ax,cs
mov ds,ax
mov es,ax
mov si,offset xmssi
mov word ptr ds:[si],0fffeh
mov word ptr ds:[si+02h],0000h
mov word ptr ds:[si+04h],0000h
mov word ptr ds:[si+06h],0000h
mov ds:[si+08h],cs
mov ax,cs:mem_a
mov ds:[si+0ah],ax
mov word ptr ds:[si+0ch],0000h
mov word ptr ds:[si+0eh],0000h
mov ah,0bh
call dword ptr cs:xmsdrv
;-------------------------------------------------------------------------
; ¶i¤J«OÅ@¼Ò¦¡
;-------------------------------------------------------------------------
cli
lgdt fword ptr cs:gdtadds
lidt fword ptr cs:idtadds
mov eax,cr0
or al,01h
mov cr0,eax
mov bx,0018h
ltr bx
db 0eah,00h,00h,20h,00h ;®Ú¾ÚTSSªí¥iª¾¸õ¨ìenter_v86
;-------------------------------------------------------------------------
; ½sͤÀ¶ªí
;-------------------------------------------------------------------------
enter_v86 :
mov ax,0010h
mov ds,ax
mov ax,0040h
mov es,ax
mov bx,offset mem_a
mov eax,es:[bx+02h]
mov bx,offset cr3gdt
and ebx,0fffff000h
add ebx,1000h
add eax,ebx
mov bx,offset newcr3
mov es:[bx],eax ;CR3 È
mov cr3,eax
mov esi,eax
mov bx,offset mem_c
mov eax,es:[bx+02h]
and eax,0fffff000h
add eax,00001000h
mov ebx,eax
or eax,00000027h
mov ds:[esi],eax ;¤À¶ªí¦ì§}
add eax,00001000h
mov ds:[esi+04h],eax
add eax,00001000h
mov ds:[esi+08h],eax
add eax,00001000h
mov ds:[esi+0ch],eax
add eax,00001000h
mov ds:[esi+10h],eax
mov eax,00000067h
mov cx,0ffffh
L3 :
mov ds:[ebx],eax
add eax,00001000h
add ebx,04h
loop L3
;-------------------------------------------------------------------------
; ªð¦^ DOS
;-------------------------------------------------------------------------
mov ax,0028h
mov es,ax
mov di,0000h
xor ax,ax
mov cx,8000h
cld
repz stosw
xor eax,eax
mov ax,code
push eax ;GS
push eax ;FS
push eax ;DS
push eax ;ES
push eax ;SS
mov ax,0f000h
push eax ;ESP
mov eax,00023000h ;³]©wVM=1 µ¥¯Å=3
push eax ;Eflag
xor eax,eax
mov ax,code
push eax ;CS
mov ax,offset return_dos
push eax ;EIP
mov eax,cr0
or eax,80000000h
mov cr0,eax
clts ;±N 387 ¤Á´«¦¨ 32 ¦ì¤¸¼Ò¦¡
iretd ;¦^¨ì V86 (¦@¼u¥X24h BYTE)
;-------------------------------------------------------------------------
; ¤U±ªºµ{¦¡«K¬O¦^¨ì V86 Ä~Äò°õ¦æªºµ{¦¡
;-------------------------------------------------------------------------
return_dos :
sti
mov ax,cs
mov ds,ax
mov ah,09h
mov dx,offset msg_103
int 21h
mov ax,4cffh
int 21h
;-------------------------------------------------------------------------
; «O¯d : ¥Î¥H²M°£°t¸m XMS ªº°O¾ÐÅé (¥»°O¾ÐÅé¤wÂ\¤J°õ¦æªºµ{¦¡.¼È¤£¥iÄÀ©ñ)
;-------------------------------------------------------------------------
mov ah,0ah
mov dx,cs:mem_b
call dword ptr cs:xmsdrv
mov ah,0ah
mov dx,cs:mem_a
call dword ptr cs:xmsdrv
mov ax,4cffh
int 21h
;-------------------------------------------------------------------------
; ¥Î¥H½Ķ V86 ¹Á¸ÕŪ¡B¼g CRx DRx HLT ®Éªº¿ù»~.
;-------------------------------------------------------------------------
chk_err_cmd :
push ebp
mov bp,sp
add bp,0ah
push eax
push ebx
mov ax,0010h
mov ds,ax
mov ax,0028h
mov es,ax
xor eax,eax
xor ebx,ebx
mov eax,ss:[bp]
mov ebx,ss:[bp+04h]
shl ebx,04h
add ebx,eax
cmp byte ptr ds:[ebx],0fh ;CRx ©Î DRx Ū¨ú©Î¼g¤J
jz reg_err
cmp byte ptr ds:[ebx],0f4h ;HLT
jz cmd_hlt
cmp byte ptr ds:[ebx],0eeh
jz out_dx_al
cmp byte ptr ds:[ebx],0e6h
jz out_20_al
cmp byte ptr ds:[ebx],0e7h
jz out_20_ax
cmp byte ptr ds:[ebx],0efh
jz out_dx_ax
cmp byte ptr ds:[ebx],0ech
jz in_al_dx
cmp byte ptr ds:[ebx],0e4h
jz in_al_20
cmp byte ptr ds:[ebx],0e5h
jz in_ax_20
cmp byte ptr ds:[ebx],0edh
jz in_ax_dx
mov ax,000dh ;int error_code
protection_err :
mov ebp,0fedch
nop
mov cx,0040h
mov ds,cx
mov bx,ax ;AX=ErrCode
ror bx,04h
and bx,000fh
mov dl,ds:[bx+offset number]
mov ds:prterr+4eh,dl
mov bx,ax
and bx,000fh
mov dl,ds:[bx+offset number]
mov ds:prterr+4fh,dl
nop
push di
mov di,offset prterr+61h
mov ax,ss:[bp+04h] ;AX=CS
mov cx,0004h
L24 :
rol ax,04h
mov bx,ax
and bx,000fh
mov dl,ds:[bx+offset number]
mov ds:[di],dl
inc di
loop L24
pop di
push di
mov di,offset prterr+66h
mov eax,ss:[bp] ;EAX=EIP
mov cx,0008h
L25 :
rol eax,04h
mov bx,ax
and bx,000fh
mov dl,ds:[bx+offset number]
mov ds:[di],dl
inc di
loop L25
pop di
mov ax,0040h
mov ds,ax
mov ax,0038h
mov es,ax
push si
push di
mov si,offset prterr
mov di,0000h
mov bx,0000h
L26 :
mov al,ds:[si]
inc si
cmp al,0dh
jz L27
cmp al,0ah
jz L28
cmp al,'$'
jz L29
mov es:[di],al
mov byte ptr es:[di+01h],07h
add di,02h
jmp L26
L27 :
mov di,bx
jmp L26
L28 :
add bx,00a0h
mov di,bx
jmp L26
L29 :
pop di
pop si
mov ax,0010h
mov ds,ax
mov word ptr ds:[0450h],0400h
mov cx,ds:[0084h]
mov ss:[bp],ecx
mov cx,ds:[0086h]
mov ss:[bp+04h],ecx
and dword ptr ss:[bp+08h],0fffffeffh ;Disable 'T'
or dword ptr ss:[bp+08h],00032000h ;DPL=3
mov esp,0fedch
mov ax,4cffh
iretd
reg_err :
mov ax,ds:[ebx+01h]
mov bx,ax
mov eax,ss:[bp-0eh]
cmp bx,0c020h ;EAX,CR0
jz reg_eax_cr0
cmp bx,0c120h
jz reg_ecx_cr0
cmp bx,0c220h
jz reg_edx_cr0
cmp bx,0c320h
jz reg_ebx_cr0
cmp bx,0c420h
jz reg_esp_cr0
cmp bx,0c520h
jz reg_ebp_cr0
cmp bx,0c620h
jz reg_esi_cr0
cmp bx,0c720h
jz reg_edi_cr0
cmp bx,0d020h ;EAX,CR2
jz reg_eax_cr2
cmp bx,0d120h
jz reg_ecx_cr2
cmp bx,0d220h
jz reg_edx_cr2
cmp bx,0d320h
jz reg_ebx_cr2
cmp bx,0d420h
jz reg_esp_cr2
cmp bx,0d520h
jz reg_ebp_cr2
cmp bx,0d620h
jz reg_esi_cr2
cmp bx,0d720h
jz reg_edi_cr2
cmp bx,0d820h ;EAX,CR3
jz reg_eax_cr3
cmp bx,0d920h
jz reg_ecx_cr3
cmp bx,0da20h
jz reg_edx_cr3
cmp bx,0db20h
jz reg_ebx_cr3
cmp bx,0dc20h
jz reg_esp_cr3
cmp bx,0dd20h
jz reg_ebp_cr3
cmp bx,0de20h
jz reg_esi_cr3
cmp bx,0df20h
jz reg_edi_cr3
cmp bx,0c022h ;CR0,EAX
jz reg_cr0_eax
cmp bx,0c122h
jz reg_cr0_ecx
cmp bx,0c222h
jz reg_cr0_edx
cmp bx,0c322h
jz reg_cr0_ebx
cmp bx,0c422h
jz reg_cr0_esp
cmp bx,0c522h
jz reg_cr0_ebp
cmp bx,0c622h
jz reg_cr0_esi
cmp bx,0c722h
jz reg_cr0_edi
cmp bx,0d022h ;CR2,EAX
jz reg_cr2_eax
cmp bx,0d122h
jz reg_cr2_ecx
cmp bx,0d222h
jz reg_cr2_edx
cmp bx,0d322h
jz reg_cr2_ebx
cmp bx,0d422h
jz reg_cr2_esp
cmp bx,0d522h
jz reg_cr2_ebp
cmp bx,0d622h
jz reg_cr2_esi
cmp bx,0d722h
jz reg_cr2_edi
cmp bx,0d822h ;CR3,EAX
jz reg_cr3_eax
cmp bx,0d922h
jz reg_cr3_ecx
cmp bx,0da22h
jz reg_cr3_edx
cmp bx,0db22h
jz reg_cr3_ebx
cmp bx,0dc22h
jz reg_cr3_esp
cmp bx,0dd22h
jz reg_cr3_ebp
cmp bx,0de22h
jz reg_cr3_esi
cmp bx,0df22h
jz reg_cr3_edi
cmp bx,0c021h ;EAX,DR0
jz reg_eax_dr0
cmp bx,0c121h
jz reg_ecx_dr0
cmp bx,0c221h
jz reg_edx_dr0
cmp bx,0c321h
jz reg_ebx_dr0
cmp bx,0c421h
jz reg_esp_dr0
cmp bx,0c521h
jz reg_ebp_dr0
cmp bx,0c621h
jz reg_esi_dr0
cmp bx,0c721h
jz reg_edi_dr0
cmp bx,0c821h ;EAX,DR1
jz reg_eax_dr1
cmp bx,0c921h
jz reg_ecx_dr1
cmp bx,0ca21h
jz reg_edx_dr1
cmp bx,0cb21h
jz reg_ebx_dr1
cmp bx,0cc21h
jz reg_esp_dr1
cmp bx,0cd21h
jz reg_ebp_dr1
cmp bx,0ce21h
jz reg_esi_dr1
cmp bx,0cf21h
jz reg_edi_dr1
cmp bx,0d021h ;EAX,DR2
jz reg_eax_dr2
cmp bx,0d121h
jz reg_ecx_dr2
cmp bx,0d221h
jz reg_edx_dr2
cmp bx,0d321h
jz reg_ebx_dr2
cmp bx,0d421h
jz reg_esp_dr2
cmp bx,0d521h
jz reg_ebp_dr2
cmp bx,0d621h
jz reg_esi_dr2
cmp bx,0d721h
jz reg_edi_dr2
cmp bx,0d821h ;EAX,DR3
jz reg_eax_dr3
cmp bx,0d921h
jz reg_ecx_dr3
cmp bx,0da21h
jz reg_edx_dr3
cmp bx,0db21h
jz reg_ebx_dr3
cmp bx,0dc21h
jz reg_esp_dr3
cmp bx,0dd21h
jz reg_ebp_dr3
cmp bx,0de21h
jz reg_esi_dr3
cmp bx,0df21h
jz reg_edi_dr3
cmp bx,0f021h ;EAX,DR6
jz reg_eax_dr6
cmp bx,0f121h
jz reg_ecx_dr6
cmp bx,0f221h
jz reg_edx_dr6
cmp bx,0f321h
jz reg_ebx_dr6
cmp bx,0f421h
jz reg_esp_dr6
cmp bx,0f521h
jz reg_ebp_dr6
cmp bx,0f621h
jz reg_esi_dr6
cmp bx,0f721h
jz reg_edi_dr6
cmp bx,0f821h ;EAX,DR7
jz reg_eax_dr7
cmp bx,0f921h
jz reg_ecx_dr7
cmp bx,0fa21h
jz reg_edx_dr7
cmp bx,0fb21h
jz reg_ebx_dr7
cmp bx,0fc21h
jz reg_esp_dr7
cmp bx,0fd21h
jz reg_ebp_dr7
cmp bx,0fe21h
jz reg_esi_dr7
cmp bx,0ff21h
jz reg_edi_dr7
cmp bx,0c023h ;DR0,EAX
jz reg_dr0_eax
cmp bx,0c123h
jz reg_dr0_ecx
cmp bx,0c223h
jz reg_dr0_edx
cmp bx,0c323h
jz reg_dr0_ebx
cmp bx,0c423h
jz reg_dr0_esp
cmp bx,0c523h
jz reg_dr0_ebp
cmp bx,0c623h
jz reg_dr0_esi
cmp bx,0c723h
jz reg_dr0_edi
cmp bx,0c823h ;DR1,EAX
jz reg_dr1_eax
cmp bx,0c923h
jz reg_dr1_ecx
cmp bx,0ca23h
jz reg_dr1_edx
cmp bx,0cb23h
jz reg_dr1_ebx
cmp bx,0cc23h
jz reg_dr1_esp
cmp bx,0cd23h
jz reg_dr1_ebp
cmp bx,0ce23h
jz reg_dr1_esi
cmp bx,0cf23h
jz reg_dr1_edi
cmp bx,0d023h ;DR2,EAX
jz reg_dr2_eax
cmp bx,0d123h
jz reg_dr2_ecx
cmp bx,0d223h
jz reg_dr2_edx
cmp bx,0d323h
jz reg_dr2_ebx
cmp bx,0d423h
jz reg_dr2_esp
cmp bx,0d523h
jz reg_dr2_ebp
cmp bx,0d623h
jz reg_dr2_esi
cmp bx,0d723h
jz reg_dr2_edi
cmp bx,0d823h ;DR3,EAX
jz reg_dr3_eax
cmp bx,0d923h
jz reg_dr3_ecx
cmp bx,0da23h
jz reg_dr3_edx
cmp bx,0db23h
jz reg_dr3_ebx
cmp bx,0dc23h
jz reg_dr3_esp
cmp bx,0dd23h
jz reg_dr3_ebp
cmp bx,0de23h
jz reg_dr3_esi
cmp bx,0df23h
jz reg_dr3_edi
cmp bx,0f023h ;DR6,EAX
jz reg_dr6_eax
cmp bx,0f123h
jz reg_dr6_ecx
cmp bx,0f223h
jz reg_dr6_edx
cmp bx,0f323h
jz reg_dr6_ebx
cmp bx,0f423h
jz reg_dr6_esp
cmp bx,0f523h
jz reg_dr6_ebp
cmp bx,0f623h
jz reg_dr6_esi
cmp bx,0f723h
jz reg_dr6_edi
cmp bx,0f823h ;DR7,EAX
jz reg_dr7_eax
cmp bx,0f923h
jz reg_dr7_ecx
cmp bx,0fa23h
jz reg_dr7_edx
cmp bx,0fb23h
jz reg_dr7_ebx
cmp bx,0fc23h
jz reg_dr7_esp
cmp bx,0fd23h
jz reg_dr7_ebp
cmp bx,0fe23h
jz reg_dr7_esi
cmp bx,0ff23h
jz reg_dr7_edi
mov ax,000dh ;int error_code
jmp protection_err
;-------------------------------------------------------------------------
reg_eax_cr0 :
mov eax,cr0
mov ss:[bp-0eh],eax
jmp return_r_cr0
reg_ecx_cr0 :
mov ecx,cr0
jmp return_r_cr0
reg_edx_cr0 :
mov edx,cr0
jmp return_r_cr0
reg_ebx_cr0 :
mov eax,cr0
mov ss:[bp-12h],eax
jmp return_r_cr0
reg_esp_cr0 :
mov eax,cr0
mov ss:[bp+0ch],eax
jmp return_r_cr0
reg_ebp_cr0 :
mov eax,cr0
mov ss:[bp-0ah],ax
jmp return_r_cr0
reg_esi_cr0 :
mov esi,cr0
jmp return_r_cr0
reg_edi_cr0 :
mov esi,cr0
jmp return_r_cr0
reg_eax_cr2 :
mov eax,cr2
mov ss:[bp-0eh],eax
jmp return_3
reg_ecx_cr2 :
mov ecx,cr2
jmp return_3
reg_edx_cr2 :
mov edx,cr2
jmp return_3
reg_ebx_cr2 :
mov eax,cr2
mov ss:[bp-12h],eax
jmp return_3
reg_esp_cr2 :
mov eax,cr2
mov ss:[bp+0ch],eax
jmp return_3
reg_ebp_cr2 :
mov eax,cr2
mov ss:[bp-0ah],ax
jmp return_3
reg_esi_cr2 :
mov esi,cr2
jmp return_3
reg_edi_cr2 :
mov esi,cr2
jmp return_3
reg_eax_cr3 :
mov eax,cr3
mov ss:[bp-0eh],eax
jmp return_r_cr3
reg_ecx_cr3 :
mov ecx,cr3
jmp return_r_cr3
reg_edx_cr3 :
mov edx,cr3
jmp return_r_cr3
reg_ebx_cr3 :
mov eax,cr3
mov ss:[bp-12h],eax
jmp return_r_cr3
reg_esp_cr3 :
mov eax,cr3
mov ss:[bp+0ch],eax
jmp return_r_cr3
reg_ebp_cr3 :
mov eax,cr3
mov ss:[bp-0ah],ax
jmp return_r_cr3
reg_esi_cr3 :
mov esi,cr3
jmp return_r_cr3
reg_edi_cr3 :
mov esi,cr3
jmp return_r_cr3
reg_cr0_eax :
mov eax,ss:[bp-0eh]
jmp reboot_system
reg_cr0_ecx :
mov eax,ecx
jmp reboot_system
reg_cr0_edx :
mov eax,edx
jmp reboot_system
reg_cr0_ebx :
mov eax,ss:[bp-12h]
jmp reboot_system
reg_cr0_esp :
mov eax,ss:[bp+0ch]
jmp reboot_system
reg_cr0_ebp :
mov eax,ss:[bp-0ah]
jmp reboot_system
reg_cr0_esi :
mov eax,esi
jmp reboot_system
reg_cr0_edi :
mov eax,edi
jmp reboot_system
reboot_system :
mov ebx,0ffffffffh
mov cr3,ebx
or eax,80000001h
mov cr0,eax
hold :
cli
jmp hold
reg_cr2_eax :
mov eax,ss:[bp-0eh]
mov cr2,eax
jmp return_3
reg_cr2_ecx :
mov cr2,ecx
jmp return_3
reg_cr2_edx :
mov cr2,edx
jmp return_3
reg_cr2_ebx :
mov eax,ss:[bp-12h]
mov cr2,eax
jmp return_3
reg_cr2_esp :
mov eax,ss:[bp+0ch]
mov cr2,eax
jmp return_3
reg_cr2_ebp :
mov eax,ss:[bp-0ah]
mov cr2,eax
jmp return_3
reg_cr2_esi :
mov cr2,esi
jmp return_3
reg_cr2_edi :
mov cr2,edi
jmp return_3
reg_cr3_eax :
mov eax,ss:[bp-0eh]
mov cr3,eax
jmp return_w_cr3
reg_cr3_ecx :
mov cr3,ecx
jmp return_w_cr3
reg_cr3_edx :
mov cr3,edx
jmp return_w_cr3
reg_cr3_ebx :
mov eax,ss:[bp-12h]
mov cr3,eax
jmp return_w_cr3
reg_cr3_esp :
mov eax,ss:[bp+0ch]
mov cr3,eax
jmp return_w_cr3
reg_cr3_ebp :
mov eax,ss:[bp-0ah]
mov cr3,eax
jmp return_w_cr3
reg_cr3_esi :
mov cr3,esi
jmp return_w_cr3
reg_cr3_edi :
mov cr3,edi
jmp return_w_cr3
reg_eax_dr0 :
mov eax,dr0
mov ss:[bp-0eh],eax
jmp return_r_dr0
reg_ecx_dr0 :
mov ecx,dr0
jmp return_r_dr0
reg_edx_dr0 :
mov edx,dr0
jmp return_r_dr0
reg_ebx_dr0 :
mov eax,dr0
mov ss:[bp-12h],eax
jmp return_r_dr0
reg_esp_dr0 :
mov eax,dr0
mov ss:[bp+0ch],eax
jmp return_r_dr0
reg_ebp_dr0 :
mov eax,dr0
mov ss:[bp-0ah],eax
jmp return_r_dr0
reg_esi_dr0 :
mov esi,dr0
jmp return_r_dr0
reg_edi_dr0 :
mov edi,dr0
jmp return_r_dr0
reg_eax_dr1 :
mov eax,dr1
mov ss:[bp-0eh],eax
jmp return_r_dr1
reg_ecx_dr1 :
mov ecx,dr1
jmp return_r_dr1
reg_edx_dr1 :
mov edx,dr1
jmp return_r_dr1
reg_ebx_dr1 :
mov eax,dr1
mov ss:[bp-12h],eax
jmp return_r_dr1
reg_esp_dr1 :
mov eax,dr1
mov ss:[bp+0ch],eax
jmp return_r_dr1
reg_ebp_dr1 :
mov eax,dr1
mov ss:[bp-0ah],eax
jmp return_r_dr1
reg_esi_dr1 :
mov esi,dr1
jmp return_r_dr1
reg_edi_dr1 :
mov edi,dr1
jmp return_r_dr1
reg_eax_dr2 :
mov eax,dr2
mov ss:[bp-0eh],eax
jmp return_r_dr2
reg_ecx_dr2 :
mov ecx,dr2
jmp return_r_dr2
reg_edx_dr2 :
mov edx,dr2
jmp return_r_dr2
reg_ebx_dr2 :
mov eax,dr2
mov ss:[bp-12h],eax
jmp return_r_dr2
reg_esp_dr2 :
mov eax,dr2
mov ss:[bp+0ch],eax
jmp return_r_dr2
reg_ebp_dr2 :
mov eax,dr2
mov ss:[bp-0ah],eax
jmp return_r_dr2
reg_esi_dr2 :
mov esi,dr2
jmp return_r_dr2
reg_edi_dr2 :
mov edi,dr2
jmp return_r_dr2
reg_eax_dr3 :
mov eax,dr3
mov ss:[bp-0eh],eax
jmp return_r_dr3
reg_ecx_dr3 :
mov ecx,dr3
jmp return_r_dr3
reg_edx_dr3 :
mov edx,dr3
jmp return_r_dr3
reg_ebx_dr3 :
mov eax,dr3
mov ss:[bp-12h],eax
jmp return_r_dr3
reg_esp_dr3 :
mov eax,dr3
mov ss:[bp+0ch],eax
jmp return_r_dr3
reg_ebp_dr3 :
mov eax,dr3
mov ss:[bp-0ah],eax
jmp return_r_dr3
reg_esi_dr3 :
mov esi,dr3
jmp return_r_dr3
reg_edi_dr3 :
mov edi,dr3
jmp return_r_dr3
reg_eax_dr6 :
mov eax,dr6
mov ss:[bp-0eh],eax
jmp return_r_dr6
reg_ecx_dr6 :
mov ecx,dr6
jmp return_r_dr6
reg_edx_dr6 :
mov edx,dr6
jmp return_r_dr6
reg_ebx_dr6 :
mov eax,dr6
mov ss:[bp-12h],eax
jmp return_r_dr6
reg_esp_dr6 :
mov eax,dr6
mov ss:[bp+0ch],eax
jmp return_r_dr6
reg_ebp_dr6 :
mov eax,dr6
mov ss:[bp-0ah],eax
jmp return_r_dr6
reg_esi_dr6 :
mov esi,dr6
jmp return_r_dr6
reg_edi_dr6 :
mov edi,dr6
jmp return_r_dr6
reg_eax_dr7 :
mov eax,dr7
mov ss:[bp-0eh],eax
jmp return_r_dr7
reg_ecx_dr7 :
mov ecx,dr7
jmp return_r_dr7
reg_edx_dr7 :
mov edx,dr7
jmp return_r_dr7
reg_ebx_dr7 :
mov eax,dr7
mov ss:[bp-12h],eax
jmp return_r_dr7
reg_esp_dr7 :
mov eax,dr7
mov ss:[bp+0ch],eax
jmp return_r_dr7
reg_ebp_dr7 :
mov eax,dr7
mov ss:[bp-0ah],eax
jmp return_r_dr7
reg_esi_dr7 :
mov esi,dr7
jmp return_r_dr7
reg_edi_dr7 :
mov edi,dr7
jmp return_r_dr7
reg_dr0_eax :
mov eax,ss:[bp-0eh]
mov dr0,eax
jmp return_w_dr0
reg_dr0_ecx :
mov dr0,ecx
jmp return_w_dr0
reg_dr0_edx :
mov dr0,edx
jmp return_w_dr0
reg_dr0_ebx :
mov eax,ss:[bp-12h]
mov dr0,eax
jmp return_w_dr0
reg_dr0_esp :
mov eax,ss:[bp+0ch]
mov dr0,eax
jmp return_w_dr0
reg_dr0_ebp :
mov eax,ss:[bp-0ah]
mov dr0,eax
jmp return_w_dr0
reg_dr0_esi :
mov dr0,esi
jmp return_w_dr0
reg_dr0_edi :
mov dr0,edi
jmp return_w_dr0
reg_dr1_eax :
mov eax,ss:[bp-0eh]
mov dr1,eax
jmp return_w_dr1
reg_dr1_ecx :
mov dr1,ecx
jmp return_w_dr1
reg_dr1_edx :
mov dr1,edx
jmp return_w_dr1
reg_dr1_ebx :
mov eax,ss:[bp-12h]
mov dr1,eax
jmp return_w_dr1
reg_dr1_esp :
mov eax,ss:[bp+0ch]
mov dr1,eax
jmp return_w_dr1
reg_dr1_ebp :
mov eax,ss:[bp-0ah]
mov dr1,eax
jmp return_w_dr1
reg_dr1_esi :
mov dr1,esi
jmp return_w_dr1
reg_dr1_edi :
mov dr1,edi
jmp return_w_dr1
reg_dr2_eax :
mov eax,ss:[bp-0eh]
mov dr2,eax
jmp return_w_dr2
reg_dr2_ecx :
mov dr2,ecx
jmp return_w_dr2
reg_dr2_edx :
mov dr2,edx
jmp return_w_dr2
reg_dr2_ebx :
mov eax,ss:[bp-12h]
mov dr2,eax
jmp return_w_dr2
reg_dr2_esp :
mov eax,ss:[bp+0ch]
mov dr2,eax
jmp return_w_dr2
reg_dr2_ebp :
mov eax,ss:[bp-0ah]
mov dr2,eax
jmp return_w_dr2
reg_dr2_esi :
mov dr2,esi
jmp return_w_dr2
reg_dr2_edi :
mov dr2,edi
jmp return_w_dr2
reg_dr3_eax :
mov eax,ss:[bp-0eh]
mov dr3,eax
jmp return_w_dr3
reg_dr3_ecx :
mov dr3,ecx
jmp return_w_dr3
reg_dr3_edx :
mov dr3,edx
jmp return_w_dr3
reg_dr3_ebx :
mov eax,ss:[bp-12h]
mov dr3,eax
jmp return_w_dr3
reg_dr3_esp :
mov eax,ss:[bp+0ch]
mov dr3,eax
jmp return_w_dr3
reg_dr3_ebp :
mov eax,ss:[bp-0ah]
mov dr3,eax
jmp return_w_dr3
reg_dr3_esi :
mov dr3,esi
jmp return_w_dr3
reg_dr3_edi :
mov dr3,edi
jmp return_w_dr3
reg_dr6_eax :
mov eax,ss:[bp-0eh]
mov dr6,eax
jmp return_w_dr6
reg_dr6_ecx :
mov dr6,ecx
jmp return_w_dr6
reg_dr6_edx :
mov dr6,edx
jmp return_w_dr6
reg_dr6_ebx :
mov eax,ss:[bp-12h]
mov dr6,eax
jmp return_w_dr6
reg_dr6_esp :
mov eax,ss:[bp+0ch]
mov dr6,eax
jmp return_w_dr6
reg_dr6_ebp :
mov eax,ss:[bp-0ah]
mov dr6,eax
jmp return_w_dr6
reg_dr6_esi :
mov dr6,esi
jmp return_w_dr6
reg_dr6_edi :
mov dr6,edi
jmp return_w_dr6
reg_dr7_eax :
mov eax,ss:[bp-0eh]
mov dr7,eax
jmp return_w_dr7
reg_dr7_ecx :
mov dr7,ecx
jmp return_w_dr7
reg_dr7_edx :
mov dr7,edx
jmp return_w_dr7
reg_dr7_ebx :
mov eax,ss:[bp-12h]
mov dr7,eax
jmp return_w_dr7
reg_dr7_esp :
mov eax,ss:[bp+0ch]
mov dr7,eax
jmp return_w_dr7
reg_dr7_ebp :
mov eax,ss:[bp-0ah]
mov dr7,eax
jmp return_w_dr7
reg_dr7_esi :
mov dr7,esi
jmp return_w_dr7
reg_dr7_edi :
mov dr7,edi
jmp return_w_dr7
;-------------------------------------------------------------------------
return_r_cr0 :
inc dword ptr es:[0014h]
or dword ptr es:[0014h],80000000h
jmp return_3
return_r_cr3 :
inc dword ptr es:[001ch]
or dword ptr es:[001ch],80000000h
jmp return_3
return_w_cr3 :
inc dword ptr es:[0020h]
or dword ptr es:[0020h],80000000h
jmp return_3
return_r_dr0 :
inc dword ptr es:[0024h]
or dword ptr es:[0024h],80000000h
jmp return_3
return_r_dr1 :
inc dword ptr es:[002ch]
or dword ptr es:[002ch],80000000h
jmp return_3
return_r_dr2 :
inc dword ptr es:[0034h]
or dword ptr es:[0034h],80000000h
jmp return_3
return_r_dr3 :
inc dword ptr es:[003ch]
or dword ptr es:[003ch],80000000h
jmp return_3
return_r_dr6 :
inc dword ptr es:[0044h]
or dword ptr es:[0044h],80000000h
jmp return_3
return_r_dr7 :
inc dword ptr es:[004ch]
or dword ptr es:[004ch],80000000h
jmp return_3
return_w_dr0 :
inc dword ptr es:[0028h]
or dword ptr es:[0028h],80000000h
jmp return_3
return_w_dr1 :
inc dword ptr es:[0030h]
or dword ptr es:[0030h],80000000h
jmp return_3
return_w_dr2 :
inc dword ptr es:[0038h]
or dword ptr es:[0038h],80000000h
jmp return_3
return_w_dr3 :
inc dword ptr es:[0040h]
or dword ptr es:[0040h],80000000h
jmp return_3
return_w_dr6 :
inc dword ptr es:[0048h]
or dword ptr es:[0048h],80000000h
jmp return_3
return_w_dr7 :
inc dword ptr es:[0050h]
or dword ptr es:[0050h],80000000h
jmp return_3
;-------------------------------------------------------------------------
out_dx_al :
mov al,ss:[bp-0eh] ;¨ú¥XALÈ
cmp dx,0060h
jz L4
out dx,al
jmp iobreak_1byte
L4 :
cmp al,0ddh
jnz L5
mov al,0dfh
L5 :
out dx,al
jmp return_1
out_20_al :
mov al,ss:[bp-0eh] ;¨ú¥XALÈ
push dx
mov dh,00h
mov dl,ds:[ebx+01h]
cmp dx,0060h
jz L19
out dx,al
pop dx
jmp iobreak_2byte
L19 :
cmp al,0ddh
jnz L20
mov al,0dfh
L20 :
out dx,al
pop dx
jmp return_2
out_20_ax :
mov ax,ss:[bp-0eh] ;¨ú¥XAXÈ
push dx
mov dh,00h
mov dl,ds:[ebx+01h]
out dx,ax
pop dx
jmp iobreak_2byte
out_dx_ax :
mov ax,ss:[bp-0eh] ;¨ú¥XAXÈ
out dx,ax
jmp iobreak_1byte
in_al_dx :
in al,dx
mov ss:[bp-0eh],al ;¦^¦sALÈ
cmp dx,0060h
jz return_1
jmp iobreak_1byte
in_al_20 :
push dx
mov dh,00h
mov dl,ds:[ebx+01h]
in al,dx
mov ss:[bp-0eh],al ;¦^¦sALÈ
cmp dx,0060h
pop dx
jz return_2
jmp iobreak_2byte
in_ax_20 :
push dx
mov dh,00h
mov dl,ds:[ebx+01h]
in ax,dx
mov ss:[bp-0eh],ax ;¦^¦sAXÈ
pop dx
jmp iobreak_2byte
in_ax_dx :
in ax,dx
mov ss:[bp-0eh],ax ;¦^¦sAXÈ
jmp iobreak_1byte
iobreak_1byte :
add dword ptr ss:[bp],00000001h ;EIP ¥[1
mov ax,ss:[0078h]
mov ss:[bp-02h],ax
pop ebx
pop eax
pop ebp
add sp,04h
jmp int_emu
iobreak_2byte :
add dword ptr ss:[bp],00000002h ;EIP ¥[2
mov ax,ss:[0078h]
mov ss:[bp-02h],ax
pop ebx
pop eax
pop ebp
add sp,04h
jmp int_emu
return_1 :
add dword ptr ss:[bp],00000001h ;EIP ¥[1
pop ebx
pop eax
test word ptr ss:[bp+08h],0100h ;'T' ºX¼Ð ON ?
jnz re_call_int_1
pop ebp
add sp,06h
iretd
return_2 :
add dword ptr ss:[bp],00000002h ;EIP ¥[2
pop ebx
pop eax
test word ptr ss:[bp+08h],0100h ;'T' ºX¼Ð ON ?
jnz re_call_int_1
pop ebp
add sp,06h
iretd
return_3 :
add dword ptr ss:[bp],00000003h ;EIP ¥[3
pop ebx
pop eax
test word ptr ss:[bp+08h],0100h ;'T' ºX¼Ð ON ?
jnz re_call_int_1
pop ebp
add sp,06h
iretd
re_call_int_1 :
pop ebp
add sp,06h
jmp new_01
cmd_hlt :
add dword ptr ss:[bp],00000001h ;EIP ¥[ 1
pop ebx
pop eax
test word ptr ss:[bp+08h],0100h
jnz re_call_int_1
pop ebp
add sp,06h
iretd
;-------------------------------------------------------------------------
al_to_di :
push eax
push ebx
push ecx
push edx
push edi
push ds
push es
mov edi,ss:[006ch]
mov bx,0040h
mov ds,bx
mov bx,0010h
mov es,bx
mov cx,0002h
mov dh,70h
L22 :
rol al,04h
mov bx,ax
and bx,000fh
mov dl,ds:[bx+offset number]
mov es:[edi],dx
add di,02h
loop L22
pop es
pop ds
pop edi
pop edx
pop ecx
pop ebx
pop eax
ret
start endp
code ends
end start