[C decompilation] [th01] VSync interrupt handler

Time to get back into this.
This commit is contained in:
nmlgc 2015-09-05 22:06:46 +02:00
parent 75b8765e44
commit 14e69ceb6d
12 changed files with 209 additions and 830 deletions

View File

@ -28,17 +28,17 @@ th05:: $(TH05:\=bin\th05\)
bin\th01\zunsoft.com: th01\zunsoft.c bin\th01\zunsoft.com: th01\zunsoft.c
$(CC) $(CFLAGS) -mt -lt -nbin\th01\ $** masters.lib $(CC) $(CFLAGS) -mt -lt -nbin\th01\ $** masters.lib
bin\th01\op.exe: bin\th01\op.obj th01\op_04.c th01\op_10.c th01\op_11.c th01\op_12.cpp bin\th01\op.exe: bin\th01\op.obj th01\op_03.c th01\op_04.c th01\op_10.c th01\op_11.c th01\op_12.cpp
$(CC) $(CFLAGS) -ml -3 -nbin\th01\ -eOP.EXE @&&| $(CC) $(CFLAGS) -ml -3 -nbin\th01\ -eOP.EXE @&&|
$** $**
| |
bin\th01\reiiden.exe: bin\th01\reiiden.obj th01\main_04.c th01\main_12.c th01\main_13.c th01\main_14.c th01\main_16.c bin\th01\reiiden.exe: bin\th01\reiiden.obj th01\main_03.c th01\main_04.c th01\main_12.c th01\main_13.c th01\main_14.c th01\main_16.c
$(CC) $(CFLAGS) -ml -3 -nbin\th01\ -eREIIDEN.EXE @&&| $(CC) $(CFLAGS) -ml -3 -nbin\th01\ -eREIIDEN.EXE @&&|
$** $**
| |
bin\th01\fuuin.exe: bin\th01\fuuin.obj th01\fuuin_06.c th01\fuuin_11.c th01\fuuin_12.c th01\fuuin_13.c bin\th01\fuuin.exe: bin\th01\fuuin.obj th01\fuuin_05.c th01\fuuin_06.c th01\fuuin_11.c th01\fuuin_12.c th01\fuuin_13.c
$(CC) $(CFLAGS) -ml -3 -nbin\th01\ -eFUUIN.EXE @&&| $(CC) $(CFLAGS) -ml -3 -nbin\th01\ -eFUUIN.EXE @&&|
$** $**
| |

7
th01/fuuin_05.c Normal file
View File

@ -0,0 +1,7 @@
/* ReC98
* -----
* Code segment #5 of TH01's FUUIN.EXE
*/
#include "th01/hardware/vsync.c"
#include "th01/hardware/vsyncclr.c"

80
th01/hardware/vsync.c Normal file
View File

@ -0,0 +1,80 @@
/* ReC98
* -----
* VSync interrupt handler
*/
#include "th01/th01.h"
#pragma option -2
#pragma warn -aus
extern char vsync_initialized;
extern int vsync_callback_is_set;
extern int RES_X_HALF;
extern int RES_Y_HALF;
extern int vsync_frame;
extern int vsync_unused;
extern void interrupt (*vsync_callback_old)(void);
extern void (*vsync_callback)(void);
static void interrupt vsync_intfunc(void)
{
int res_x_half = RES_X_HALF;
int res_y_half = RES_Y_HALF;
vsync_frame++;
vsync_unused++;
if(vsync_callback_is_set) {
vsync_callback();
}
OUTB(0x00, 0x20); // End of Interrupt
OUTB(0x64, 0); // VSync interrupt trigger
}
void vsync_init(void)
{
if(vsync_initialized == 0) {
vsync_initialized = 1;
disable();
vsync_callback_old = getvect(0x0A);
setvect(0x0A, vsync_intfunc);
// Disable all interrupts from 0x08 to 0x0F except for 0x0A
OUTB(0x02, INPB(0x02) & 0xFB);
OUTB(0x64, 0); // VSync interrupt trigger
enable();
}
}
void vsync_exit(void)
{
if(vsync_initialized == 1) {
vsync_initialized = 0;
disable();
// Reenable all interrupts from 0x08 to 0x0F except for 0x0A
OUTB(0x02, INPB(0x02) | 0x04);
setvect(0x0a, vsync_callback_old);
enable();
}
}
void z_vsync_wait(void)
{
do {
_AL = INPB(0x60);
} while((_AL & 0x20) != 0);
do {
_AL = INPB(0x60);
} while((_AL & 0x20) == 0);
}
void vsync_callback_set(void (*vsync_callback_new)())
{
vsync_callback_is_set = 0;
vsync_callback = vsync_callback_new;
vsync_callback_is_set = 1;
}

View File

@ -0,0 +1,5 @@
public _vsync_frame, _vsync_unused, _vsync_callback_old, _vsync_callback
_vsync_frame dw ?
_vsync_unused dw ?
_vsync_callback_old dd ?
_vsync_callback dd ?

View File

@ -0,0 +1,46 @@
public _vsync_initialized, _vsync_callback_is_set, _RES_X_HALF, _RES_Y_HALF
_vsync_initialized db 0
_vsync_callback_is_set dw 0
dd 7
dd 0
_RES_X_HALF dw 320
_RES_Y_HALF dw 200
; Unused?
dw 0
dw 0
dw 639
dw 399
dw 0C000h
dw 0E000h
dw 0F000h
dw 0F800h
dw 0FC00h
dw 0FE00h
dw 0FF00h
dw 0FF80h
dw 0FFC0h
dw 0FFE0h
dw 0FE00h
dw 0EF00h
dw 0CF00h
dw 780h
dw 780h
dw 300h
dw 0
dw 4000h
dw 6000h
dw 7000h
dw 7800h
dw 7C00h
dw 7E00h
dw 7F00h
dw 7F80h
dw 7C00h
dw 6C00h
dw 4600h
dw 600h
dw 300h
dw 300h
dw 0
db 0

12
th01/hardware/vsyncclr.c Normal file
View File

@ -0,0 +1,12 @@
/* ReC98
* -----
* VSync interrupt callback clear function. In REIIDEN.EXE, this function needs
* to be put into a segment separate from vsync.c.
*/
extern int vsync_callback_is_set;
void vsync_callback_clear(void)
{
vsync_callback_is_set = 0;
}

6
th01/main_03.c Normal file
View File

@ -0,0 +1,6 @@
/* ReC98
* -----
* Code segment #3 of TH01's REIIDEN.EXE
*/
#include "th01/hardware/vsync.c"

View File

@ -3,4 +3,5 @@
* Code segment #4 of TH01's REIIDEN.EXE * Code segment #4 of TH01's REIIDEN.EXE
*/ */
#include "th01/hardware/vsyncclr.c"
#include "th01/ztext.c" #include "th01/ztext.c"

7
th01/op_03.c Normal file
View File

@ -0,0 +1,7 @@
/* ReC98
* -----
* Code segment #3 of TH01's OP.EXE
*/
#include "th01/hardware/vsync.c"
#include "th01/hardware/vsyncclr.c"

View File

@ -5363,10 +5363,10 @@ arg_0 = word ptr 6
push bp push bp
mov bp, sp mov bp, sp
mov word_14044, 0 mov _vsync_frame, 0
loc_C836: loc_C836:
mov ax, word_14044 mov ax, _vsync_frame
cmp ax, [bp+arg_0] cmp ax, [bp+arg_0]
jnb short loc_C840 jnb short loc_C840
jmp short loc_C836 jmp short loc_C836
@ -5748,192 +5748,9 @@ fuuin_04_TEXT ends
; Segment type: Pure code ; Segment type: Pure code
fuuin_05_TEXT segment byte public 'CODE' use16 fuuin_05_TEXT segment byte public 'CODE' use16
assume cs:fuuin_05_TEXT extern _vsync_init:proc
assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing extern _vsync_exit:proc
extern _z_vsync_wait:proc
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
; void __interrupt isr()
isr proc far
var_4 = word ptr -4
var_2 = word ptr -2
push ax
push bx
push cx
push dx
push es
push ds
push si
push di
push bp
mov bp, seg _DATA
mov ds, bp
mov bp, sp
sub sp, 4
mov ax, word_1344D
mov [bp+var_2], ax
mov ax, word_1344F
mov [bp+var_4], ax
inc word_14044
inc word_14046
cmp word_13443, 0
jz short loc_CA72
call farfp_1404C
loc_CA72:
xor dx, dx
mov al, 20h ; ' '
out dx, al
mov dx, 64h ; 'd'
mov al, 0
out dx, al ; AT Keyboard controller 8042.
leave
pop di
pop si
pop ds
pop es
pop dx
pop cx
pop bx
pop ax
iret
isr endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_CA87 proc far
push bp
mov bp, sp
cmp byte_13442, 0
jnz short loc_CAC7
mov byte_13442, 1
cli
push 0Ah ; interruptno
call _getvect
pop cx
mov word_1404A, dx
mov off_14048, ax
push seg fuuin_05_TEXT
push offset isr ; isr
push 0Ah ; interruptno
call _setvect
add sp, 6
mov dx, 2
in al, dx ; DMA controller, 8237A-5.
; channel 1 current address
and al, 0FBh
mov dx, 2
out dx, al ; DMA controller, 8237A-5.
; channel 1 base address
; (also sets current address)
mov dx, 64h ; 'd'
mov al, 0
out dx, al ; AT Keyboard controller 8042.
sti
loc_CAC7:
pop bp
retf
sub_CA87 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_CAC9 proc far
push bp
mov bp, sp
cmp byte_13442, 1
jnz short loc_CAF6
mov byte_13442, 0
cli
mov dx, 2
in al, dx ; DMA controller, 8237A-5.
; channel 1 current address
or al, 4
mov dx, 2
out dx, al ; DMA controller, 8237A-5.
; channel 1 base address
; (also sets current address)
push word_1404A
push off_14048 ; isr
push 0Ah ; interruptno
call _setvect
add sp, 6
sti
loc_CAF6:
pop bp
retf
sub_CAC9 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_CAF8 proc far
push bp
mov bp, sp
loc_CAFB:
mov dx, 60h
in al, dx ; AT Keyboard controller 8042.
test al, 20h
jnz short loc_CAFB
loc_CB03:
mov dx, 60h
in al, dx ; AT Keyboard controller 8042.
test al, 20h
jz short loc_CB03
pop bp
retf
sub_CAF8 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_CB0D proc far
arg_0 = word ptr 6
arg_2 = word ptr 8
push bp
mov bp, sp
mov word_13443, 0
mov dx, [bp+arg_2]
mov ax, [bp+arg_0]
mov word ptr farfp_1404C+2, dx
mov word ptr farfp_1404C, ax
mov word_13443, 1
pop bp
retf
sub_CB0D endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_CB2B proc far
push bp
mov bp, sp
mov word_13443, 0
pop bp
retf
sub_CB2B endp
fuuin_05_TEXT ends fuuin_05_TEXT ends
; =========================================================================== ; ===========================================================================
@ -6006,7 +5823,7 @@ sub_CEAD proc far
push 6 ; interruptno push 6 ; interruptno
call _setvect call _setvect
add sp, 6 add sp, 6
call sub_CA87 call _vsync_init
call _z_text_init call _z_text_init
call egc_start call egc_start
call graph_start call graph_start
@ -6075,7 +5892,7 @@ sub_CF48 proc far
push offset sub_CE87 ; isr push offset sub_CE87 ; isr
push 6 ; interruptno push 6 ; interruptno
call _setvect call _setvect
call sub_CAC9 call _vsync_exit
call _z_text_clear call _z_text_clear
call sub_D4FE call sub_D4FE
call sub_D094 call sub_D094
@ -6945,7 +6762,7 @@ var_2 = word ptr -2
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_D470: loc_D470:
call sub_CAF8 call _z_vsync_wait
xor si, si xor si, si
jmp short loc_D4E2 jmp short loc_D4E2
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -7050,7 +6867,7 @@ var_2 = word ptr -2
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_D51E: loc_D51E:
call sub_CAF8 call _z_vsync_wait
xor si, si xor si, si
jmp short loc_D585 jmp short loc_D585
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -7178,7 +6995,7 @@ var_2 = word ptr -2
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_D5E1: loc_D5E1:
call sub_CAF8 call _z_vsync_wait
xor si, si xor si, si
jmp short loc_D653 jmp short loc_D653
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -7283,7 +7100,7 @@ var_2 = word ptr -2
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_D68F: loc_D68F:
call sub_CAF8 call _z_vsync_wait
xor si, si xor si, si
jmp short loc_D6F6 jmp short loc_D6F6
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -9454,7 +9271,7 @@ loc_E7C1:
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_E7CD: loc_E7CD:
call sub_CAF8 call _z_vsync_wait
mov [bp+var_2], 0 mov [bp+var_2], 0
jmp loc_E88C jmp loc_E88C
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -10552,85 +10369,7 @@ aKo_0 db '
aC db '%c',0 aC db '%c',0
; char aCC_5[] ; char aCC_5[]
aCC_5 db '%c%c',0 aCC_5 db '%c%c',0
byte_13442 db 0 include th01/hardware/vsync[data].asm
word_13443 dw 0
db 7
dd 0
db 0
db 0
db 0
word_1344D dw 140h
word_1344F dw 0C8h
dd 0
db 7Fh
db 2
db 8Fh
db 1
db 0
db 0C0h ; À
db 0
db 0E0h
db 0
db 0F0h
db 0
db 0F8h
db 0
db 0FCh
db 0
db 0FEh
db 0
db 0FFh
db 80h
db 0FFh
db 0C0h ; À
db 0FFh
db 0E0h
db 0FFh
db 0
db 0FEh
db 0
db 0EFh
db 0
db 0CFh ; Ï
db 80h
db 7
db 80h
db 7
db 0
db 3
db 0
db 0
db 0
db 40h
db 0
db 60h
db 0
db 70h ; p
db 0
db 78h ; x
db 0
db 7Ch ; |
db 0
db 7Eh ; ~
db 0
db 7Fh
db 80h
db 7Fh
db 0
db 7Ch ; |
db 0
db 6Ch ; l
db 0
db 46h ; F
db 0
db 6
db 0
db 3
db 0
db 3
db 0
db 0
db 0
include th01/ztext[data].asm include th01/ztext[data].asm
byte_134B8 db 0 byte_134B8 db 0
db 0 db 0
@ -10827,12 +10566,7 @@ byte_14040 db ?
byte_14041 db ? byte_14041 db ?
byte_14042 db ? byte_14042 db ?
db ? db ?
word_14044 dw ? include th01/hardware/vsync[bss].asm
word_14046 dw ?
; void (__interrupt far *off_14048)()
off_14048 dw ?
word_1404A dw ?
farfp_1404C dd ?
dd ? dd ?
dd ? dd ?
dd ? dd ?

View File

@ -2113,10 +2113,10 @@ arg_0 = word ptr 6
mov bp, sp mov bp, sp
loc_B26C: loc_B26C:
mov ax, word_1355C mov ax, _vsync_frame
cmp ax, [bp+arg_0] cmp ax, [bp+arg_0]
jb short loc_B26C jb short loc_B26C
mov word_1355C, 0 mov _vsync_frame, 0
pop bp pop bp
retf retf
sub_B269 endp sub_B269 endp
@ -2127,175 +2127,9 @@ op_02_TEXT ends
; Segment type: Pure code ; Segment type: Pure code
op_03_TEXT segment byte public 'CODE' use16 op_03_TEXT segment byte public 'CODE' use16
assume cs:op_03_TEXT extern _vsync_init:proc
;org 0Ch extern _vsync_exit:proc
assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing extern _z_vsync_wait:proc
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
; void __interrupt isr()
isr proc far
var_4 = word ptr -4
var_2 = word ptr -2
push ax
push bx
push cx
push dx
push es
push ds
push si
push di
push bp
mov bp, seg _DATA
mov ds, bp
mov bp, sp
sub sp, 4
mov ax, word_1290D
mov [bp+var_2], ax
mov ax, word_1290F
mov [bp+var_4], ax
inc word_1355C
inc word_1355E
cmp word_12903, 0
jz short loc_B2AE
call farfp_13564
loc_B2AE:
xor dx, dx
mov al, 20h ; ' '
out dx, al
mov dx, 64h ; 'd'
mov al, 0
out dx, al ; AT Keyboard controller 8042.
leave
pop di
pop si
pop ds
pop es
pop dx
pop cx
pop bx
pop ax
iret
isr endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B2C3 proc far
push bp
mov bp, sp
cmp byte_12902, 0
jnz short loc_B303
mov byte_12902, 1
cli
push 0Ah ; interruptno
call _getvect
pop cx
mov word_13562, dx
mov off_13560, ax
push seg op_03_TEXT
push offset isr ; isr
push 0Ah ; interruptno
call _setvect
add sp, 6
mov dx, 2
in al, dx ; DMA controller, 8237A-5.
; channel 1 current address
and al, 0FBh
mov dx, 2
out dx, al ; DMA controller, 8237A-5.
; channel 1 base address
; (also sets current address)
mov dx, 64h ; 'd'
mov al, 0
out dx, al ; AT Keyboard controller 8042.
sti
loc_B303:
pop bp
retf
sub_B2C3 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B305 proc far
push bp
mov bp, sp
cmp byte_12902, 1
jnz short loc_B332
mov byte_12902, 0
cli
mov dx, 2
in al, dx ; DMA controller, 8237A-5.
; channel 1 current address
or al, 4
mov dx, 2
out dx, al ; DMA controller, 8237A-5.
; channel 1 base address
; (also sets current address)
push word_13562
push off_13560 ; isr
push 0Ah ; interruptno
call _setvect
add sp, 6
sti
loc_B332:
pop bp
retf
sub_B305 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B334 proc far
push bp
mov bp, sp
loc_B337:
mov dx, 60h
in al, dx ; AT Keyboard controller 8042.
test al, 20h
jnz short loc_B337
loc_B33F:
mov dx, 60h
in al, dx ; AT Keyboard controller 8042.
test al, 20h
jz short loc_B33F
pop bp
retf
sub_B334 endp
; ---------------------------------------------------------------------------
push bp
mov bp, sp
mov word_12903, 0
mov dx, [bp+8]
mov ax, [bp+6]
mov word ptr farfp_13564+2, dx
mov word ptr farfp_13564, ax
mov word_12903, 1
pop bp
retf
; ---------------------------------------------------------------------------
push bp
mov bp, sp
mov word_12903, 0
pop bp
retf
op_03_TEXT ends op_03_TEXT ends
; =========================================================================== ; ===========================================================================
@ -2368,7 +2202,7 @@ sub_B6E9 proc far
push 6 ; interruptno push 6 ; interruptno
call _setvect call _setvect
add sp, 6 add sp, 6
call sub_B2C3 call _vsync_init
call _z_text_init call _z_text_init
call egc_start call egc_start
call graph_start call graph_start
@ -2437,7 +2271,7 @@ sub_B784 proc far
push offset sub_B6C3 ; isr push offset sub_B6C3 ; isr
push 6 ; interruptno push 6 ; interruptno
call _setvect call _setvect
call sub_B305 call _vsync_exit
call _z_text_clear call _z_text_clear
call sub_BD3A call sub_BD3A
call sub_B8D0 call sub_B8D0
@ -3261,7 +3095,7 @@ var_2 = word ptr -2
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_BCAC: loc_BCAC:
call sub_B334 call _z_vsync_wait
xor si, si xor si, si
jmp short loc_BD1E jmp short loc_BD1E
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -3366,7 +3200,7 @@ var_2 = word ptr -2
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_BD5A: loc_BD5A:
call sub_B334 call _z_vsync_wait
xor si, si xor si, si
jmp short loc_BDC1 jmp short loc_BDC1
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -3476,7 +3310,7 @@ loc_BDF4:
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_BE1D: loc_BE1D:
call sub_B334 call _z_vsync_wait
xor si, si xor si, si
jmp short loc_BE8F jmp short loc_BE8F
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -3568,7 +3402,7 @@ loc_BE9F:
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_BECB: loc_BECB:
call sub_B334 call _z_vsync_wait
xor si, si xor si, si
jmp short loc_BF32 jmp short loc_BF32
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -5592,7 +5426,7 @@ loc_CFFD:
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_D009: loc_D009:
call sub_B334 call _z_vsync_wait
mov word ptr [bp-2], 0 mov word ptr [bp-2], 0
jmp loc_D0C8 jmp loc_D0C8
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -8205,85 +8039,7 @@ aGogbgGtg@gcglv db '
aCon db 'CON',0 aCon db 'CON',0
; char format[] ; char format[]
format db 'おつかれさまでした!!',0Ah,0 format db 'おつかれさまでした!!',0Ah,0
byte_12902 db 0 include th01/hardware/vsync[data].asm
word_12903 dw 0
db 7
dd 0
db 0
db 0
db 0
word_1290D dw 140h
word_1290F dw 0C8h
dd 0
db 7Fh
db 2
db 8Fh
db 1
db 0
db 0C0h
db 0
db 0E0h
db 0
db 0F0h
db 0
db 0F8h
db 0
db 0FCh
db 0
db 0FEh
db 0
db 0FFh
db 80h
db 0FFh
db 0C0h
db 0FFh
db 0E0h
db 0FFh
db 0
db 0FEh
db 0
db 0EFh
db 0
db 0CFh
db 80h
db 7
db 80h
db 7
db 0
db 3
db 0
db 0
db 0
db 40h
db 0
db 60h
db 0
db 70h ; p
db 0
db 78h ; x
db 0
db 7Ch ; |
db 0
db 7Eh ; ~
db 0
db 7Fh
db 80h
db 7Fh
db 0
db 7Ch ; |
db 0
db 6Ch ; l
db 0
db 46h ; F
db 0
db 6
db 0
db 3
db 0
db 3
db 0
db 0
db 0
include th01/ztext[data].asm include th01/ztext[data].asm
byte_12978 db 0 byte_12978 db 0
db 0 db 0
@ -8450,12 +8206,7 @@ dword_13418 dd ?
dd ? dd ?
dd ? dd ?
dd ? dd ?
word_1355C dw ? include th01/hardware/vsync[bss].asm
word_1355E dw ?
; void (__interrupt far *off_13560)()
off_13560 dw ?
word_13562 dw ?
farfp_13564 dd ?
dd ? dd ?
dd ? dd ?
dd ? dd ?

View File

@ -5370,12 +5370,12 @@ arg_0 = word ptr 6
mov bp, sp mov bp, sp
loc_E367: loc_E367:
mov ax, word_38812 mov ax, _vsync_frame
cmp ax, [bp+arg_0] cmp ax, [bp+arg_0]
jb short loc_E367 jb short loc_E367
loc_E36F: loc_E36F:
mov word_38812, 0 mov _vsync_frame, 0
pop bp pop bp
retf retf
sub_E364 endp sub_E364 endp
@ -5386,202 +5386,15 @@ main_02_TEXT ends
; Segment type: Pure code ; Segment type: Pure code
main_03_TEXT segment byte public 'CODE' use16 main_03_TEXT segment byte public 'CODE' use16
assume cs:main_03_TEXT extern _vsync_init:proc
;org 7 extern _vsync_exit:proc
assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing extern _z_vsync_wait:proc
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
; void __interrupt isr()
isr proc far
var_4 = word ptr -4
var_2 = word ptr -2
push ax
push bx
push cx
push dx
push es
push ds
push si
push di
push bp
mov bp, seg _DATA
mov ds, bp
mov bp, sp
sub sp, 4
mov ax, word_35023
mov [bp+var_2], ax
mov ax, word_35025
mov [bp+var_4], ax
inc word_38812
inc word_38814
cmp word_35019, 0
jz short loc_E3A9
call farfp_3881A
loc_E3A9:
xor dx, dx
mov al, 20h ; ' '
out dx, al
mov dx, 64h ; 'd'
mov al, 0
out dx, al ; AT Keyboard controller 8042.
leave
pop di
pop si
pop ds
pop es
pop dx
pop cx
pop bx
pop ax
iret
isr endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_E3BE proc far
push bp
mov bp, sp
cmp byte_35018, 0
jnz short loc_E3FE
mov byte_35018, 1
cli
push 0Ah ; interruptno
call _getvect
pop cx
mov word_38818, dx
mov off_38816, ax
push seg main_03_TEXT
push offset isr ; isr
push 0Ah ; interruptno
call _setvect
add sp, 6
mov dx, 2
in al, dx ; DMA controller, 8237A-5.
; channel 1 current address
and al, 0FBh
mov dx, 2
out dx, al ; DMA controller, 8237A-5.
; channel 1 base address
; (also sets current address)
mov dx, 64h ; 'd'
mov al, 0
out dx, al ; AT Keyboard controller 8042.
sti
loc_E3FE:
pop bp
retf
sub_E3BE endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_E400 proc far
push bp
mov bp, sp
cmp byte_35018, 1
jnz short loc_E42D
mov byte_35018, 0
cli
mov dx, 2
in al, dx ; DMA controller, 8237A-5.
; channel 1 current address
or al, 4
mov dx, 2
out dx, al ; DMA controller, 8237A-5.
; channel 1 base address
; (also sets current address)
push word_38818
push off_38816 ; isr
push 0Ah ; interruptno
call _setvect
add sp, 6
sti
loc_E42D:
pop bp
retf
sub_E400 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_E42F proc far
push bp
mov bp, sp
loc_E432:
mov dx, 60h
in al, dx ; AT Keyboard controller 8042.
test al, 20h
jnz short loc_E432
loc_E43A:
mov dx, 60h
in al, dx ; AT Keyboard controller 8042.
test al, 20h
jz short loc_E43A
pop bp
retf
sub_E42F endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_E444 proc far
arg_0 = word ptr 6
arg_2 = word ptr 8
push bp
mov bp, sp
mov word_35019, 0
mov dx, [bp+arg_2]
mov ax, [bp+arg_0]
mov word ptr farfp_3881A+2, dx
mov word ptr farfp_3881A, ax
mov word_35019, 1
pop bp
retf
sub_E444 endp
main_03_TEXT ends main_03_TEXT ends
; =========================================================================== ; ===========================================================================
; Segment type: Pure code ; Segment type: Pure code
main_04_TEXT segment byte public 'CODE' use16 main_04_TEXT segment byte public 'CODE' use16
assume cs:main_04_TEXT
;org 2
assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_E462 proc far
push bp
mov bp, sp
mov word_35019, 0
pop bp
retf
sub_E462 endp
extern _z_text_init:proc extern _z_text_init:proc
extern _z_text_25line:proc extern _z_text_25line:proc
extern _z_text_setcursor:proc extern _z_text_setcursor:proc
@ -5649,7 +5462,7 @@ sub_E7E4 proc far
push 6 ; interruptno push 6 ; interruptno
call _setvect call _setvect
add sp, 6 add sp, 6
call sub_E3BE call _vsync_init
call _z_text_init call _z_text_init
call egc_start call egc_start
call graph_start call graph_start
@ -5718,7 +5531,7 @@ sub_E87F proc far
push offset sub_E7BE ; isr push offset sub_E7BE ; isr
push 6 ; interruptno push 6 ; interruptno
call _setvect call _setvect
call sub_E400 call _vsync_exit
call _z_text_clear call _z_text_clear
call sub_EE35 call sub_EE35
call sub_E9CB call sub_E9CB
@ -6598,7 +6411,7 @@ var_2 = word ptr -2
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_EDA7: loc_EDA7:
call sub_E42F call _z_vsync_wait
xor si, si xor si, si
jmp short loc_EE19 jmp short loc_EE19
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -6703,7 +6516,7 @@ var_2 = word ptr -2
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_EE55: loc_EE55:
call sub_E42F call _z_vsync_wait
xor si, si xor si, si
jmp short loc_EEBC jmp short loc_EEBC
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -6831,7 +6644,7 @@ var_2 = word ptr -2
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_EF18: loc_EF18:
call sub_E42F call _z_vsync_wait
xor si, si xor si, si
jmp short loc_EF8A jmp short loc_EF8A
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -6936,7 +6749,7 @@ var_2 = word ptr -2
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_EFC6: loc_EFC6:
call sub_E42F call _z_vsync_wait
xor si, si xor si, si
jmp short loc_F02D jmp short loc_F02D
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -9107,7 +8920,7 @@ loc_100F8:
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_10104: loc_10104:
call sub_E42F call _z_vsync_wait
mov [bp+var_2], 0 mov [bp+var_2], 0
jmp loc_101C3 jmp loc_101C3
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@ -29824,85 +29637,7 @@ aTn db '
; char aOp[3] ; char aOp[3]
aOp db 'op',0 aOp db 'op',0
db 0 db 0
byte_35018 db 0 include th01/hardware/vsync[data].asm
word_35019 dw 0
db 7
dd 0
db 0
db 0
db 0
word_35023 dw 140h
word_35025 dw 0C8h
dd 0
db 7Fh
db 2
db 8Fh
db 1
db 0
db 0C0h ; À
db 0
db 0E0h
db 0
db 0F0h
db 0
db 0F8h
db 0
db 0FCh
db 0
db 0FEh
db 0
db 0FFh
db 80h
db 0FFh
db 0C0h ; À
db 0FFh
db 0E0h
db 0FFh
db 0
db 0FEh
db 0
db 0EFh
db 0
db 0CFh ; Ï
db 80h
db 7
db 80h
db 7
db 0
db 3
db 0
db 0
db 0
db 40h
db 0
db 60h
db 0
db 70h ; p
db 0
db 78h ; x
db 0
db 7Ch ; |
db 0
db 7Eh ; ~
db 0
db 7Fh
db 80h
db 7Fh
db 0
db 7Ch ; |
db 0
db 6Ch ; l
db 0
db 46h ; F
db 0
db 6
db 0
db 3
db 0
db 3
db 0
db 0
db 0
include th01/ztext[data].asm include th01/ztext[data].asm
byte_3508E db 0 byte_3508E db 0
db 0 db 0
@ -33111,12 +32846,7 @@ word_387DA dw ?
dword_3880A dd ? dword_3880A dd ?
word_3880E dw ? word_3880E dw ?
word_38810 dw ? word_38810 dw ?
word_38812 dw ? include th01/hardware/vsync[bss].asm
word_38814 dw ?
; void (__interrupt far *off_38816)()
off_38816 dw ?
word_38818 dw ?
farfp_3881A dd ?
dd ? dd ?
dd ? dd ?
dd ? dd ?