Skip to content

Commit

Permalink
[Reduction] #370: key_sense
Browse files Browse the repository at this point in the history
  • Loading branch information
nmlgc committed Aug 30, 2014
1 parent 12c1e85 commit 614caf6
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 121 deletions.
50 changes: 50 additions & 0 deletions libs/master.lib/key_sense.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
; Master Library - Key Sense
;
; Description:
; 現在のキーコードグループ中のキーの押下状態を調べる。
;
; Function/Procedures:
; int key_sense( int keygroup ) ;
;
; Parameters:
; char keygroup キーコードグループ
;
; Returns:
; キーの押下状態
;
; Binding Target:
; TASM
;
; Running Target:
; NEC PC-9801 Normal mode
;
; Requiring Resources:
; CPU: 8086
;
; Compiler/Assembler:
; TASM 2.51
;
; Note:
; キーバッファとは関係なく動作する。
; キーリピートによってとりこぼす恐れがあるので二度実行し
; 結果のorをとること
; んーっと、一般人仕様(tab 8のMASM Mode)なので安心してください。
;
; Author:
; SuCa
;
; Rivision History:
; 93/06/16 initial
; 93/ 6/17 Initial: keysense.asm/master.lib 0.19

func KEY_SENSE
@@keygroup = RETSIZE*2

mov bx,sp
mov ax,ss:[bx+@@keygroup]
mov ah,04h
int 18h
mov al,ah
mov ah,0
ret 2
endfunc
33 changes: 9 additions & 24 deletions th01_fuuin.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2143,22 +2143,7 @@ include libs/master.lib/file_read.asm
include libs/master.lib/file_close.asm
include libs/master.lib/file_ropen.asm
include libs/master.lib/file_seek.asm

; =============== S U B R O U T I N E =======================================


sub_11DE proc far
mov bx, sp
mov ax, ss:[bx+4]
mov ah, 4
int 18h ; TRANSFER TO ROM BASIC
; causes transfer to ROM-based BASIC (IBM-PC)
; often reboots a compatible; often has no effect at all
mov al, ah
mov ah, 0
retf 2
sub_11DE endp

include libs/master.lib/key_sense.asm
include libs/master.lib/dos_ropen.asm
include libs/master.lib/egc.asm

Expand Down Expand Up @@ -10868,16 +10853,16 @@ arg_0 = word ptr 6

loc_A2A5:
push 7
call sub_11DE
call key_sense
mov [bp+var_2], ax
push 5
call sub_11DE
call key_sense
mov [bp+var_4], ax
push 7
call sub_11DE
call key_sense
or [bp+var_2], ax
push 5
call sub_11DE
call key_sense
or [bp+var_4], ax
mov al, byte_14039
mov ah, 0
Expand Down Expand Up @@ -10994,16 +10979,16 @@ loc_A3BB:
and al, 4
mov byte_1403E, al
push 0
call sub_11DE
call key_sense
mov [bp+var_2], ax
push 3
call sub_11DE
call key_sense
mov [bp+var_4], ax
push 0
call sub_11DE
call key_sense
or [bp+var_2], ax
push 3
call sub_11DE
call key_sense
or [bp+var_4], ax
mov al, byte_1403F
mov ah, 0
Expand Down
47 changes: 15 additions & 32 deletions th01_reiiden.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2343,24 +2343,7 @@ locret_140C:
retf
sub_13EE endp

; ---------------------------------------------------------------------------
nop

; =============== S U B R O U T I N E =======================================


sub_140E proc far
mov bx, sp
mov ax, ss:[bx+4]
mov ah, 4
int 18h ; TRANSFER TO ROM BASIC
; causes transfer to ROM-based BASIC (IBM-PC)
; often reboots a compatible; often has no effect at all
mov al, ah
mov ah, 0
retf 2
sub_140E endp

include libs/master.lib/key_sense.asm
include libs/master.lib/dos_ropen.asm
include libs/master.lib/grcg_setcolor.asm
include libs/master.lib/grcg_pset.asm
Expand Down Expand Up @@ -13738,28 +13721,28 @@ arg_0 = word ptr 6

loc_B559:
push 7
call sub_140E
call key_sense
mov [bp+var_2], ax
push 5
call sub_140E
call key_sense
mov [bp+var_4], ax
push 8
call sub_140E
call key_sense
mov [bp+var_6], ax
push 9
call sub_140E
call key_sense
mov [bp+var_8], ax
push 7
call sub_140E
call key_sense
or [bp+var_2], ax
push 5
call sub_140E
call key_sense
or [bp+var_4], ax
push 8
call sub_140E
call key_sense
or [bp+var_6], ax
push 9
call sub_140E
call key_sense
or [bp+var_8], ax
mov al, byte_386FC
mov ah, 0
Expand Down Expand Up @@ -13956,16 +13939,16 @@ loc_B745:
and al, 4
mov byte_38701, al
push 0
call sub_140E
call key_sense
mov [bp+var_2], ax
push 3
call sub_140E
call key_sense
mov [bp+var_4], ax
push 0
call sub_140E
call key_sense
or [bp+var_2], ax
push 3
call sub_140E
call key_sense
or [bp+var_4], ax
mov al, byte_38702
mov ah, 0
Expand Down Expand Up @@ -14029,10 +14012,10 @@ loc_B802:
cmp word_34A6C, 1
jnz short locret_B87A
push 6
call sub_140E
call key_sense
mov [bp+var_2], ax
push 6
call sub_140E
call key_sense
or [bp+var_2], ax
mov al, byte_3870A
mov ah, 0
Expand Down
19 changes: 2 additions & 17 deletions th01_zunsoft.asm
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ loc_822:

loc_85D:
push si
call sub_ACE
call key_sense
or di, ax
inc si

Expand Down Expand Up @@ -726,22 +726,7 @@ include libs/master.lib/graph_start.asm
include libs/master.lib/palette_show.asm
include libs/master.lib/palette_init.asm
include libs/master.lib/keybeep.asm

; =============== S U B R O U T I N E =======================================


sub_ACE proc near
mov bx, sp
mov ax, ss:[bx+2]
mov ah, 4
int 18h ; TRANSFER TO ROM BASIC
; causes transfer to ROM-based BASIC (IBM-PC)
; often reboots a compatible; often has no effect at all
mov al, ah
mov ah, 0
retn 2
sub_ACE endp

include libs/master.lib/key_sense.asm
include libs/master.lib/bfnt_header_read.asm
include libs/master.lib/bfnt_entry_pat.asm
include libs/master.lib/bfnt_header_analysis.asm
Expand Down
31 changes: 7 additions & 24 deletions th02_main.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1596,24 +1596,7 @@ loc_1EDF:
retf 4
sub_1E78 endp

; ---------------------------------------------------------------------------
nop

; =============== S U B R O U T I N E =======================================


sub_1EE4 proc far
mov bx, sp
mov ax, ss:[bx+4]
mov ah, 4
int 18h ; TRANSFER TO ROM BASIC
; causes transfer to ROM-based BASIC (IBM-PC)
; often reboots a compatible; often has no effect at all
mov al, ah
mov ah, 0
retf 2
sub_1EE4 endp

include libs/master.lib/key_sense.asm
include libs/master.lib/palette_show.asm
include libs/master.lib/pfclose.asm

Expand Down Expand Up @@ -16434,17 +16417,17 @@ sub_F464 proc far
mov al, byte_1E300
cbw
push ax
call sub_1EE4
call key_sense
mov si, ax
mov al, byte_1E301
cbw
push ax
call sub_1EE4
call key_sense
or si, ax
mov al, byte_1E302
cbw
push ax
call sub_1EE4
call key_sense
or si, ax
push 2
nop
Expand All @@ -16453,17 +16436,17 @@ sub_F464 proc far
mov al, byte_1E300
cbw
push ax
call sub_1EE4
call key_sense
or si, ax
mov al, byte_1E301
cbw
push ax
call sub_1EE4
call key_sense
or si, ax
mov al, byte_1E302
cbw
push ax
call sub_1EE4
call key_sense
or si, ax
mov ax, si
pop si
Expand Down
31 changes: 7 additions & 24 deletions th02_maine.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1083,24 +1083,7 @@ loc_1AF8:
retf 0Ah
sub_1AA6 endp


; =============== S U B R O U T I N E =======================================


sub_1B74 proc far
mov bx, sp
mov ax, ss:[bx+4]
mov ah, 4
int 18h ; TRANSFER TO ROM BASIC
; causes transfer to ROM-based BASIC (IBM-PC)
; often reboots a compatible; often has no effect at all
mov al, ah
mov ah, 0
retf 2
sub_1B74 endp

; ---------------------------------------------------------------------------
nop
include libs/master.lib/key_sense.asm

; =============== S U B R O U T I N E =======================================

Expand Down Expand Up @@ -8406,17 +8389,17 @@ sub_B45F proc far
mov al, byte_D70A
cbw
push ax
call sub_1B74
call key_sense
mov si, ax
mov al, byte_D70B
cbw
push ax
call sub_1B74
call key_sense
or si, ax
mov al, byte_D70C
cbw
push ax
call sub_1B74
call key_sense
or si, ax
push 2
nop
Expand All @@ -8425,17 +8408,17 @@ sub_B45F proc far
mov al, byte_D70A
cbw
push ax
call sub_1B74
call key_sense
or si, ax
mov al, byte_D70B
cbw
push ax
call sub_1B74
call key_sense
or si, ax
mov al, byte_D70C
cbw
push ax
call sub_1B74
call key_sense
or si, ax
mov ax, si
pop si
Expand Down

0 comments on commit 614caf6

Please sign in to comment.