10
10
11
11
.errnz __JWASM__ lt 218 , <JWasm v2. 18 + required>
12
12
13
- HANDLE_IN_388H_DIRECTLY equ 1 ; must match #define in ptrap.c
14
- RMPICTRAPDYN equ 0 ; must match #define in ptrap.c
13
+ HANDLE_IN_388H_DIRECTLY equ 1 ; std=1, must match #define in ptrap.c
14
+ RMPICTRAPDYN equ 0 ; std=0, must match #define in ptrap.c
15
+
16
+ ;--- if RMPICTRAPDYN is 0, the PIC port 0020h is permanently trapped.
17
+ ;--- if RMPICTRAPDYN is 1, the PIC port 0020h is trapped only while an IRQ 5/7
18
+ ;--- is emulated. This is quite some overhead, currently unsure if it works stable.
15
19
16
20
.code
17
21
18
22
assume ds :nothing , ss :nothing
19
23
24
+ ;--- 12 bytes data - if this is changed, PTRAP.C must be adjusted!
20
25
_0000 dd 0 ; rmcb to vsbhda port trap handler
21
- _0004 db 0
26
+ _0004 db 0 ; last 388h value written
22
27
_0005 db 0
23
- dw 0
24
- _0008 dd 0 ; entry Jemm/Qemm "untrapped io"
28
+ dw 0 ; not used
29
+ _0008 dd 0 ; QPI entry Jemm/Qemm, for "untrapped io"
25
30
26
- ;--- port trap proc, called by Jemm/Qemm
31
+ ;--- port trap proc, called by QPIEmu/Qemm;
32
+ ;--- this code runs in real-mode.
27
33
28
34
PTRAP_RM_Wrapper proc c public
29
35
@@ -42,7 +48,7 @@ normal:
42
48
is388:
43
49
test cl , 4 ; OUT instr?
44
50
jnz is388out
45
- mov al , [ _0005 ] ; IN 388h
51
+ mov al , [ _0005 ] ; last timer value written to 389h
46
52
test al , 1
47
53
jz @F
48
54
mov al , 0C0h
@@ -68,19 +74,22 @@ is389:
68
74
endif
69
75
70
76
ife RMPICTRAPDYN
77
+
78
+ ;--- this code runs when NO IRQ 5/7 is emulated.
79
+ ;--- since port 0020h is permanently trapped, QPI must be called
80
+ ;--- to execute the IN/OUT instruction.
81
+ ;--- 02/2024: fixed: register AH/AX preserved for IN/OUT
82
+
71
83
is20:
72
84
push bx
85
+ xchg ax , bx
73
86
test cl , 4 ; OUT instr?
74
- jnz is20out
75
- mov ax , 1a00h
76
- call [ _0008 ]
77
- mov al , bl
78
- pop bx
79
- retf
80
- is20out:
81
- mov bl , al
82
- mov ax , 1a01h
83
- call [ _0008 ]
87
+ . 386
88
+ setnz al ; ax=1a00h is "sim IN", 1a01h = "sim OUT"
89
+ . 286
90
+ mov ah , 1ah
91
+ call [ _0008 ] ; call QPIEmu/Qemm
92
+ xchg ax , bx
84
93
pop bx
85
94
retf
86
95
endif
0 commit comments