2019-11-26 11:51:08 +00:00
|
|
|
public GRAPH_PUTSA_FX
|
|
|
|
graph_putsa_fx proc far
|
|
|
|
|
|
|
|
@@str = dword ptr 6
|
|
|
|
@@color = word ptr 0Ah
|
|
|
|
@@y = word ptr 0Ch
|
|
|
|
@@x = word ptr 0Eh
|
|
|
|
|
2022-11-19 09:28:00 +00:00
|
|
|
@@line equ <ch>
|
|
|
|
|
2019-11-26 11:51:08 +00:00
|
|
|
push bp
|
|
|
|
mov bp, sp
|
|
|
|
push si
|
|
|
|
push di
|
|
|
|
push ds
|
|
|
|
mov dx, [bp+@@color]
|
|
|
|
GRCG_NOINT_SETMODE_VIA_MOV al, GC_RMW
|
2020-04-26 14:26:40 +00:00
|
|
|
GRCG_SETCOLOR_DIRECT dx
|
2019-11-26 11:51:08 +00:00
|
|
|
mov ax, GRAM_400
|
|
|
|
mov es, ax
|
|
|
|
assume es:nothing
|
|
|
|
mov dx, [bp+@@y]
|
|
|
|
shl dx, 6
|
|
|
|
mov di, dx
|
|
|
|
shr dx, 2
|
|
|
|
add di, dx
|
|
|
|
mov cx, [bp+@@x]
|
|
|
|
mov al, 0Bh
|
|
|
|
out 68h, al
|
|
|
|
mov bx, _graph_putsa_fx_func
|
|
|
|
add bx, bx
|
2020-10-26 13:30:35 +00:00
|
|
|
cmp bx, (FX_MASK * word)
|
2019-11-26 11:51:08 +00:00
|
|
|
jb short @@not_masking
|
2020-10-26 13:30:35 +00:00
|
|
|
cmp bx, (FX_MASK_END * word)
|
2019-11-26 11:51:08 +00:00
|
|
|
jnb short @@not_masking
|
|
|
|
|
2020-10-26 13:30:35 +00:00
|
|
|
mov ax, (GLYPH_MASK_TABLE - (FX_MASK * word))[bx]
|
2019-11-26 11:51:08 +00:00
|
|
|
mov word ptr cs:grppsafx_glyph_mask, ax
|
2020-12-01 20:58:19 +00:00
|
|
|
mov bx, (FX_MASK * word) ; offset of the [glyph_bold_and_mask] offset
|
2019-11-26 11:51:08 +00:00
|
|
|
|
|
|
|
@@not_masking:
|
|
|
|
mov ax, GLYPH_WEIGHT_FUNC_TABLE_1[bx]
|
|
|
|
mov word ptr cs:grppsafx_glyph_func_1, ax
|
|
|
|
|
|
|
|
mov ax, GLYPH_WEIGHT_FUNC_TABLE_2[bx]
|
|
|
|
mov word ptr cs:grppsafx_glyph_func_2, ax
|
|
|
|
|
|
|
|
mov ax, _graph_putsa_fx_spacing
|
|
|
|
mov word ptr cs:grppsafx_glyph_spacing_1, ax
|
|
|
|
mov word ptr cs:grppsafx_glyph_spacing_2, ax
|
|
|
|
push ds
|
|
|
|
pop fs
|
|
|
|
assume fs:_DATA
|
|
|
|
lds si, [bp+@@str]
|
|
|
|
lodsb
|
|
|
|
or al, al
|
|
|
|
jz short @@EXITLOOP
|
|
|
|
|
|
|
|
@@SLOOP:
|
|
|
|
mov dx, cx
|
|
|
|
shr dx, 3
|
|
|
|
add di, dx
|
|
|
|
and cx, 7
|
|
|
|
mov ah, 9
|
|
|
|
test al, 0E0h
|
|
|
|
jns short @@ANK_OR_RIGHT
|
|
|
|
jp short @@NOT_ANK_BUT_RIGHT
|
|
|
|
|
|
|
|
@@KANJI: mov ah, al
|
|
|
|
lodsb
|
|
|
|
shl ah, 1
|
|
|
|
cmp al, 9Fh
|
|
|
|
jnb short @@SKIP
|
|
|
|
cmp al, 80h
|
|
|
|
adc ax, 0FEDFh
|
|
|
|
@@SKIP: sbb al, 0FEh
|
|
|
|
|
|
|
|
and ax, 7F7Fh
|
|
|
|
out 0A1h, al
|
|
|
|
mov al, ah
|
|
|
|
out 0A3h, al
|
|
|
|
nop
|
|
|
|
|
2022-11-19 09:28:00 +00:00
|
|
|
@@graph_double_loop_kanji:
|
|
|
|
mov al, @@line
|
2019-11-26 11:51:08 +00:00
|
|
|
or al, 20h
|
|
|
|
out 0A5h, al
|
|
|
|
in al, 0A9h
|
|
|
|
mov ah, al
|
2022-11-19 09:28:00 +00:00
|
|
|
mov al, @@line
|
2019-11-26 11:51:08 +00:00
|
|
|
out 0A5h, al
|
|
|
|
in al, 0A9h
|
|
|
|
|
|
|
|
grppsafx_glyph_func_1 equ $+1
|
2020-10-26 13:30:35 +00:00
|
|
|
call glyph_weight_bold
|
2019-11-26 11:51:08 +00:00
|
|
|
mov bh, al
|
|
|
|
mov bl, 0
|
|
|
|
shr ax, cl
|
|
|
|
shr bx, cl
|
|
|
|
xchg ah, al
|
|
|
|
stosw
|
|
|
|
mov es:[di], bl
|
|
|
|
add di, ROW_SIZE - 2
|
2022-11-19 09:28:00 +00:00
|
|
|
inc @@line
|
|
|
|
cmp @@line, GLYPH_H
|
|
|
|
jb short @@graph_double_loop_kanji
|
2020-01-13 21:52:19 +00:00
|
|
|
sub di, ROW_SIZE * GLYPH_H
|
2019-11-26 11:51:08 +00:00
|
|
|
|
|
|
|
grppsafx_glyph_spacing_1 equ $+1
|
|
|
|
mov dx, 1234h
|
|
|
|
|
|
|
|
@@next_char:
|
2022-11-19 09:28:00 +00:00
|
|
|
xor @@line, @@line
|
2019-11-26 11:51:08 +00:00
|
|
|
add cx, dx
|
|
|
|
lodsb
|
|
|
|
or al, al
|
|
|
|
jnz short @@SLOOP
|
|
|
|
|
|
|
|
@@EXITLOOP:
|
|
|
|
mov al, 0Ah
|
|
|
|
out 68h, al
|
|
|
|
GRCG_OFF_VIA_XOR al
|
|
|
|
pop ds
|
|
|
|
pop di
|
|
|
|
pop si
|
|
|
|
pop bp
|
|
|
|
retf 0Ah
|
|
|
|
; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
@@NOT_ANK_BUT_RIGHT:
|
|
|
|
add ax, 80h
|
|
|
|
|
|
|
|
@@ANK_OR_RIGHT:
|
|
|
|
cmp al, ' '
|
|
|
|
jz short @@dont_print_space
|
|
|
|
|
|
|
|
out 0A1h, al
|
|
|
|
mov al, ah
|
|
|
|
out 0A3h, al
|
|
|
|
nop
|
|
|
|
|
2022-11-19 09:28:00 +00:00
|
|
|
@@graph_double_loop_ank:
|
|
|
|
mov al, @@line
|
2019-11-26 11:51:08 +00:00
|
|
|
or al, 20h
|
|
|
|
out 0A5h, al
|
2022-11-19 09:28:00 +00:00
|
|
|
|
|
|
|
; ZUN bug: In contrast to the C++ version, this one stores halfwidth glyphs
|
|
|
|
; in the low byte of a 16-dot variable rather than the high one. While this
|
|
|
|
; seems better because it preserves additional dots generated by the weight
|
|
|
|
; functions (and especially FX_WEIGHT_BLACK) in the high byte, it only works
|
|
|
|
; for non-aligned [x] positions where these dots are ROR'd back into place.
|
|
|
|
; For byte-aligned [x] positions, they remain in their original position
|
|
|
|
; within the high byte, and appear on screen as glitches, 15 pixels to the
|
|
|
|
; right of the glyph they belong to.
|
2019-11-26 11:51:08 +00:00
|
|
|
in al, 0A9h
|
|
|
|
xor ah, ah
|
|
|
|
|
|
|
|
grppsafx_glyph_func_2 equ $+1
|
2020-10-26 13:30:35 +00:00
|
|
|
call glyph_weight_bold
|
2019-11-26 11:51:08 +00:00
|
|
|
ror ax, cl
|
|
|
|
stosw
|
|
|
|
add di, ROW_SIZE - 2
|
2022-11-19 09:28:00 +00:00
|
|
|
inc @@line
|
|
|
|
cmp @@line, GLYPH_H
|
|
|
|
jb short @@graph_double_loop_ank
|
2020-01-13 21:52:19 +00:00
|
|
|
sub di, ROW_SIZE * GLYPH_H
|
2019-11-26 11:51:08 +00:00
|
|
|
|
|
|
|
@@dont_print_space:
|
|
|
|
grppsafx_glyph_spacing_2 equ $+1
|
|
|
|
mov dx, 1234h
|
|
|
|
shr dx, 1
|
|
|
|
jmp short @@next_char
|
|
|
|
graph_putsa_fx endp
|
|
|
|
even
|
|
|
|
|
2022-11-19 09:28:00 +00:00
|
|
|
; Weight functions
|
|
|
|
; ----------------
|
|
|
|
; Directly applied to the 16-dot glyph [row].
|
|
|
|
|
|
|
|
row equ <ax>
|
|
|
|
tmp equ <dx>
|
2019-11-26 11:51:08 +00:00
|
|
|
|
2020-10-26 13:30:35 +00:00
|
|
|
glyph_weight_heavy label near
|
2022-11-19 09:28:00 +00:00
|
|
|
mov tmp, row
|
|
|
|
add tmp, tmp
|
|
|
|
or row, tmp
|
2020-10-26 13:30:35 +00:00
|
|
|
glyph_weight_normal label near
|
2019-11-25 08:44:38 +00:00
|
|
|
retn
|
|
|
|
|
2020-10-26 13:30:35 +00:00
|
|
|
glyph_weight_black label near
|
2022-11-19 09:28:00 +00:00
|
|
|
mov tmp, row
|
|
|
|
shl tmp, 1
|
|
|
|
or row, tmp
|
2020-10-26 13:30:35 +00:00
|
|
|
glyph_weight_bold label near
|
2022-11-19 09:28:00 +00:00
|
|
|
mov tmp, row
|
|
|
|
mov bp, row
|
2019-11-25 08:44:38 +00:00
|
|
|
add bp, bp
|
2022-11-19 09:28:00 +00:00
|
|
|
or row, bp
|
|
|
|
xor tmp, row
|
|
|
|
add tmp, tmp
|
|
|
|
not tmp
|
|
|
|
and row, tmp
|
2019-11-25 08:44:38 +00:00
|
|
|
retn
|
|
|
|
|
2020-12-01 20:58:19 +00:00
|
|
|
glyph_bold_and_mask proc near
|
2020-10-26 13:30:35 +00:00
|
|
|
call glyph_weight_bold
|
2019-11-25 08:44:38 +00:00
|
|
|
mov bl, ch
|
|
|
|
and bx, 3
|
|
|
|
add bx, bx
|
|
|
|
|
|
|
|
grppsafx_glyph_mask equ $+3
|
2022-11-19 09:28:00 +00:00
|
|
|
and row, fs:[bx+1234h]
|
2019-11-25 08:44:38 +00:00
|
|
|
retn
|
2020-12-01 20:58:19 +00:00
|
|
|
glyph_bold_and_mask endp
|
2022-11-19 09:28:00 +00:00
|
|
|
; ----------------
|