mirror of https://github.com/nmlgc/ReC98.git
[Maintenance] Add address constants for the PC-98 BIOS key press bitmap
Part of P0133, funded by [Anonymous].
This commit is contained in:
parent
ec8be31cd3
commit
7b409a086a
19
pc98kbd.h
19
pc98kbd.h
|
@ -2,6 +2,25 @@
|
|||
// -----
|
||||
// PC-98 keyboard constants
|
||||
|
||||
// BIOS key press bitmap addresses
|
||||
typedef enum {
|
||||
KEYGROUP_0 = 0x52A,
|
||||
KEYGROUP_1,
|
||||
KEYGROUP_2,
|
||||
KEYGROUP_3,
|
||||
KEYGROUP_4,
|
||||
KEYGROUP_5,
|
||||
KEYGROUP_6,
|
||||
KEYGROUP_7,
|
||||
KEYGROUP_8,
|
||||
KEYGROUP_9,
|
||||
KEYGROUP_10,
|
||||
KEYGROUP_11,
|
||||
KEYGROUP_12,
|
||||
KEYGROUP_13,
|
||||
KEYGROUP_14,
|
||||
} bios_keygroups;
|
||||
|
||||
typedef enum {
|
||||
K0_ESC = 0x01,
|
||||
K0_1 = 0x02,
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
; BIOS key press bitmap addresses
|
||||
KEYGROUP_0 = 52Ah
|
||||
KEYGROUP_1 = 52Bh
|
||||
KEYGROUP_2 = 52Ch
|
||||
KEYGROUP_3 = 52Dh
|
||||
KEYGROUP_4 = 52Eh
|
||||
KEYGROUP_5 = 52Fh
|
||||
KEYGROUP_6 = 530h
|
||||
KEYGROUP_7 = 531h
|
||||
KEYGROUP_8 = 532h
|
||||
KEYGROUP_9 = 533h
|
||||
KEYGROUP_10 = 534h
|
||||
KEYGROUP_11 = 535h
|
||||
KEYGROUP_12 = 536h
|
||||
KEYGROUP_13 = 537h
|
||||
KEYGROUP_14 = 538h
|
|
@ -1,3 +1,5 @@
|
|||
include pc98kbd.inc
|
||||
|
||||
; The key state is checked twice, 614.4 µs apart, to ignore the momentary "key
|
||||
; released" events sent by PC-98 keyboards at the typematic rate if a key is
|
||||
; held down. This ensures that the game consistently sees that specific input
|
||||
|
@ -17,7 +19,7 @@ _input_reset_sense_key_held proc far
|
|||
mov es, ax
|
||||
|
||||
@@up?:
|
||||
mov ah, byte ptr es:[531h]
|
||||
mov ah, byte ptr es:[KEYGROUP_7]
|
||||
test ah, 4
|
||||
jz short @@down?
|
||||
or _input_sp, INPUT_UP
|
||||
|
@ -40,7 +42,7 @@ _input_reset_sense_key_held proc far
|
|||
or _input_sp, INPUT_RIGHT
|
||||
|
||||
@@num6?:
|
||||
mov ah, byte ptr es:[533h]
|
||||
mov ah, byte ptr es:[KEYGROUP_9]
|
||||
test ah, 1
|
||||
jz short @@num1?
|
||||
or _input_mp_p2, INPUT_RIGHT
|
||||
|
@ -65,7 +67,7 @@ _input_reset_sense_key_held proc far
|
|||
or _input_sp, INPUT_DOWN_RIGHT
|
||||
|
||||
@@num4?:
|
||||
mov ah, byte ptr es:[532h]
|
||||
mov ah, byte ptr es:[KEYGROUP_8]
|
||||
test ah, 40h
|
||||
jz short @@num7?
|
||||
or _input_mp_p2, INPUT_LEFT
|
||||
|
@ -90,7 +92,7 @@ _input_reset_sense_key_held proc far
|
|||
or _input_sp, INPUT_UP_RIGHT
|
||||
|
||||
@@z?:
|
||||
mov ah, byte ptr es:[52Fh]
|
||||
mov ah, byte ptr es:[KEYGROUP_5]
|
||||
test ah, 2
|
||||
jz short @@x?
|
||||
or _input_mp_p1, INPUT_SHOT
|
||||
|
@ -118,7 +120,7 @@ _input_reset_sense_key_held proc far
|
|||
or _input_mp_p1, INPUT_DOWN_RIGHT
|
||||
|
||||
@@f?:
|
||||
mov ah, byte ptr es:[52Eh]
|
||||
mov ah, byte ptr es:[KEYGROUP_4]
|
||||
test ah, 1
|
||||
jz short @@h?
|
||||
or _input_mp_p1, INPUT_LEFT
|
||||
|
@ -129,7 +131,7 @@ _input_reset_sense_key_held proc far
|
|||
or _input_mp_p1, INPUT_RIGHT
|
||||
|
||||
@@r?:
|
||||
mov ah, byte ptr es:[52Ch]
|
||||
mov ah, byte ptr es:[KEYGROUP_2]
|
||||
test ah, 8
|
||||
jz short @@t?
|
||||
or _input_mp_p1, INPUT_UP_LEFT
|
||||
|
@ -150,19 +152,19 @@ _input_reset_sense_key_held proc far
|
|||
or _input_sp, INPUT_Q
|
||||
|
||||
@@esc?:
|
||||
mov ah, byte ptr es:[52Ah]
|
||||
mov ah, byte ptr es:[KEYGROUP_0]
|
||||
test ah, 1
|
||||
jz short @@return?
|
||||
or _input_sp, INPUT_CANCEL
|
||||
|
||||
@@return?:
|
||||
mov ah, byte ptr es:[52Dh]
|
||||
mov ah, byte ptr es:[KEYGROUP_3]
|
||||
test ah, 10h
|
||||
jz short @@space?
|
||||
or _input_sp, INPUT_OK
|
||||
|
||||
@@space?:
|
||||
mov ah, byte ptr es:[530h]
|
||||
mov ah, byte ptr es:[KEYGROUP_6]
|
||||
test ah, 10h
|
||||
jz short @@wait?
|
||||
or _input_sp, INPUT_SHOT
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
include pc98kbd.inc
|
||||
|
||||
; TH05 insists on only updating the affected byte, so...
|
||||
if GAME eq 4
|
||||
OR_INPUT_LOW macro value
|
||||
|
@ -25,7 +27,7 @@ public _input_sense
|
|||
_input_sense proc far
|
||||
xor ax, ax
|
||||
mov es, ax
|
||||
mov ah, byte ptr es:[531h]
|
||||
mov ah, byte ptr es:[KEYGROUP_7]
|
||||
test ah, 4
|
||||
jz short @@down?
|
||||
OR_INPUT_LOW INPUT_UP
|
||||
|
@ -46,7 +48,7 @@ _input_sense proc far
|
|||
OR_INPUT_LOW INPUT_RIGHT
|
||||
|
||||
@@num6?:
|
||||
mov ah, byte ptr es:[533h]
|
||||
mov ah, byte ptr es:[KEYGROUP_9]
|
||||
test ah, 1
|
||||
jz short @@num1?
|
||||
OR_INPUT_LOW INPUT_RIGHT
|
||||
|
@ -67,7 +69,7 @@ _input_sense proc far
|
|||
OR_INPUT_HIGH INPUT_DOWN_RIGHT
|
||||
|
||||
@@num4?:
|
||||
mov ah, byte ptr es:[532h]
|
||||
mov ah, byte ptr es:[KEYGROUP_8]
|
||||
test ah, 40h
|
||||
jz short @@num7?
|
||||
OR_INPUT_LOW INPUT_LEFT
|
||||
|
@ -88,7 +90,7 @@ _input_sense proc far
|
|||
OR_INPUT_HIGH INPUT_UP_RIGHT
|
||||
|
||||
@@z?:
|
||||
mov ah, byte ptr es:[52Fh]
|
||||
mov ah, byte ptr es:[KEYGROUP_5]
|
||||
test ah, 2
|
||||
jz short @@x?
|
||||
OR_INPUT_LOW INPUT_SHOT
|
||||
|
@ -99,25 +101,25 @@ _input_sense proc far
|
|||
OR_INPUT_LOW INPUT_BOMB
|
||||
|
||||
@@q?:
|
||||
mov ah, byte ptr es:[52Ch]
|
||||
mov ah, byte ptr es:[KEYGROUP_2]
|
||||
test ah, 1
|
||||
jz short @@esc?
|
||||
OR_INPUT_HIGH INPUT_Q
|
||||
|
||||
@@esc?:
|
||||
mov ah, byte ptr es:[52Ah]
|
||||
mov ah, byte ptr es:[KEYGROUP_0]
|
||||
test ah, 1
|
||||
jz short @@return?
|
||||
OR_INPUT_HIGH INPUT_CANCEL
|
||||
|
||||
@@return?:
|
||||
mov ah, byte ptr es:[52Dh]
|
||||
mov ah, byte ptr es:[KEYGROUP_3]
|
||||
test ah, 10h
|
||||
jz short @@space?
|
||||
OR_INPUT_HIGH INPUT_OK
|
||||
|
||||
@@space?:
|
||||
mov ah, byte ptr es:[530h]
|
||||
mov ah, byte ptr es:[KEYGROUP_6]
|
||||
test ah, 10h
|
||||
jz short @@shift?
|
||||
OR_INPUT_LOW INPUT_SHOT
|
||||
|
|
Loading…
Reference in New Issue