[Reverse-engineering] [th04/th05] Inlined GRCG color setting calls

Funded by -Tom-.
This commit is contained in:
nmlgc 2018-12-06 17:00:31 +01:00
parent 83e089cba9
commit 70d1e1c230
7 changed files with 38 additions and 197 deletions

View File

@ -80,3 +80,25 @@ GRCG_OFF_VIA_XOR macro value_reg:req
out 7Ch, value_reg
endm
; ------------------------
; GRCG color setting macros
; -------------------------
; In contrast to master.lib's own grcg_setcolor(), these keep the current
; GRCG mode.
GRCG_SETCOLOR_DIRECT_CLOBBERING macro port_reg:req, col_reg:req
mov port_reg, 7Eh
rept 4
shr ah, 1
sbb al, al
out dx, al
endm
endm
GRCG_SETCOLOR_DIRECT macro col_reg:req
rept 4
shr col_reg, 1
sbb al, al
out 7Eh, al
endm
endm
; -------------------------

View File

@ -2961,19 +2961,7 @@ sub_C15C endp
sub_C162 proc near
cli
mov dx, 7Eh ; '~'
shr ah, 1
sbb al, al
out dx, al
shr ah, 1
sbb al, al
out dx, al
shr ah, 1
sbb al, al
out dx, al
shr ah, 1
sbb al, al
out dx, al
GRCG_SETCOLOR_DIRECT_CLOBBERING dx, ah
sti
retn
sub_C162 endp
@ -3519,18 +3507,7 @@ sub_C42C endp
sub_C4C0 proc near
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
GRCG_SETCOLOR_DIRECT ah
retn
sub_C4C0 endp
@ -3643,18 +3620,7 @@ sub_C546 proc near
nop
loc_C57A:
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
GRCG_SETCOLOR_DIRECT ah
mov ch, 10h
mov di, bx
cmp di, 7850h
@ -3704,18 +3670,7 @@ loc_C5DC:
; ---------------------------------------------------------------------------
loc_C5E2:
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
GRCG_SETCOLOR_DIRECT ah
mov ch, 10h
mov di, bx
cmp di, 7850h
@ -18767,19 +18722,7 @@ sub_13E8C endp
sub_13EF6 proc near
cli
mov dx, 7Eh ; '~'
shr ah, 1
sbb al, al
out dx, al
shr ah, 1
sbb al, al
out dx, al
shr ah, 1
sbb al, al
out dx, al
shr ah, 1
sbb al, al
out dx, al
GRCG_SETCOLOR_DIRECT_CLOBBERING dx, ah
sti
retn
sub_13EF6 endp

View File

@ -5326,18 +5326,7 @@ loc_D1FC:
push ds
mov dx, [bp+0Ah]
GRCG_NOINT_SETMODE_VIA_MOV al, GC_RMW
shr dx, 1
sbb al, al
out 7Eh, al
shr dx, 1
sbb al, al
out 7Eh, al
shr dx, 1
sbb al, al
out 7Eh, al
shr dx, 1
sbb al, al
out 7Eh, al
GRCG_SETCOLOR_DIRECT dx
mov ax, 0A800h
mov es, ax
assume es:nothing

View File

@ -5549,18 +5549,7 @@ arg_8 = word ptr 0Eh
push ds
mov dx, [bp+arg_4]
GRCG_NOINT_SETMODE_VIA_MOV al, GC_RMW
shr dx, 1
sbb al, al
out 7Eh, al
shr dx, 1
sbb al, al
out 7Eh, al
shr dx, 1
sbb al, al
out 7Eh, al
shr dx, 1
sbb al, al
out 7Eh, al
GRCG_SETCOLOR_DIRECT dx
mov ax, 0A800h
mov es, ax
assume es:nothing

View File

@ -6944,18 +6944,7 @@ sub_E02E endp
sub_E0C2 proc near
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
GRCG_SETCOLOR_DIRECT ah
retn
sub_E0C2 endp
@ -7068,18 +7057,7 @@ sub_E148 proc near
nop
loc_E17C:
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
GRCG_SETCOLOR_DIRECT ah
mov ch, 10h
mov di, bx
cmp di, 7850h
@ -7129,18 +7107,7 @@ loc_E1DE:
; ---------------------------------------------------------------------------
loc_E1E4:
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
GRCG_SETCOLOR_DIRECT ah
mov ch, 10h
mov di, bx
cmp di, 7850h
@ -7901,19 +7868,7 @@ sub_E6E8 endp
sub_E6EE proc near
cli
mov dx, 7Eh ; '~'
shr ah, 1
sbb al, al
out dx, al
shr ah, 1
sbb al, al
out dx, al
shr ah, 1
sbb al, al
out dx, al
shr ah, 1
sbb al, al
out dx, al
GRCG_SETCOLOR_DIRECT_CLOBBERING dx, ah
sti
retn
sub_E6EE endp
@ -21975,19 +21930,7 @@ sub_159E6 endp
sub_15A04 proc near
cli
mov dx, 7Eh ; '~'
shr ah, 1
sbb al, al
out dx, al
shr ah, 1
sbb al, al
out dx, al
shr ah, 1
sbb al, al
out dx, al
shr ah, 1
sbb al, al
out dx, al
GRCG_SETCOLOR_DIRECT_CLOBBERING dx, ah
sti
retn
sub_15A04 endp

View File

@ -168,18 +168,7 @@ arg_4 = word ptr 0Ah
nop
loc_2E02:
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
shr ah, 1
sbb al, al
out 7Eh, al
GRCG_SETCOLOR_DIRECT ah
mov ch, dl
loc_2E1C:
@ -8275,18 +8264,7 @@ arg_8 = word ptr 0Eh
push ds
mov dx, [bp+arg_4]
GRCG_NOINT_SETMODE_VIA_MOV al, GC_RMW
shr dx, 1
sbb al, al
out 7Eh, al
shr dx, 1
sbb al, al
out 7Eh, al
shr dx, 1
sbb al, al
out 7Eh, al
shr dx, 1
sbb al, al
out 7Eh, al
GRCG_SETCOLOR_DIRECT dx
mov ax, 0A800h
mov es, ax
assume es:nothing

View File

@ -5139,18 +5139,7 @@ arg_8 = word ptr 0Eh
push ds
mov dx, [bp+arg_4]
GRCG_NOINT_SETMODE_VIA_MOV al, GC_RMW
shr dx, 1
sbb al, al
out 7Eh, al
shr dx, 1
sbb al, al
out 7Eh, al
shr dx, 1
sbb al, al
out 7Eh, al
shr dx, 1
sbb al, al
out 7Eh, al
GRCG_SETCOLOR_DIRECT dx
mov ax, 0A800h
mov es, ax
assume es:nothing
@ -5843,19 +5832,7 @@ sub_DB0D endp
sub_DB21 proc near
cli
mov dx, 7Eh ; '~'
shr ah, 1
sbb al, al
out dx, al
shr ah, 1
sbb al, al
out dx, al
shr ah, 1
sbb al, al
out dx, al
shr ah, 1
sbb al, al
out dx, al
GRCG_SETCOLOR_DIRECT_CLOBBERING dx, ah
sti
retn
sub_DB21 endp