home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 3
/
FREEWARE.BIN
/
towns_os
/
whisper
/
source
/
vram.asm
< prev
next >
Wrap
Assembly Source File
|
1980-01-02
|
20KB
|
936 lines
;*************************************
; VRAM Direct Access Program
;*************************************
extrn page_ofs:dword
extrn errno:word
bitptn segment 'DATA'
;*************************************
; 16色VRAMビットパタ-ン
;*************************************
slp_tim dw 0FFFFh ; anime sleep time
ankfnt dd 16*256 dup(?)
fntcol dd 256 dup(?)
fntptn dd 000000000h,0F0000000h,00F000000h,0FF000000h
dd 000F00000h,0F0F00000h,00FF00000h,0FFF00000h
dd 0000F0000h,0F00F0000h,00F0F0000h,0FF0F0000h
dd 000FF0000h,0F0FF0000h,00FFF0000h,0FFFF0000h
dd 00000F000h,0F000F000h,00F00F000h,0FF00F000h
dd 000F0F000h,0F0F0F000h,00FF0F000h,0FFF0F000h
dd 0000FF000h,0F00FF000h,00F0FF000h,0FF0FF000h
dd 000FFF000h,0F0FFF000h,00FFFF000h,0FFFFF000h
dd 000000F00h,0F0000F00h,00F000F00h,0FF000F00h
dd 000F00F00h,0F0F00F00h,00FF00F00h,0FFF00F00h
dd 0000F0F00h,0F00F0F00h,00F0F0F00h,0FF0F0F00h
dd 000FF0F00h,0F0FF0F00h,00FFF0F00h,0FFFF0F00h
dd 00000FF00h,0F000FF00h,00F00FF00h,0FF00FF00h
dd 000F0FF00h,0F0F0FF00h,00FF0FF00h,0FFF0FF00h
dd 0000FFF00h,0F00FFF00h,00F0FFF00h,0FF0FFF00h
dd 000FFFF00h,0F0FFFF00h,00FFFFF00h,0FFFFFF00h
dd 0000000F0h,0F00000F0h,00F0000F0h,0FF0000F0h
dd 000F000F0h,0F0F000F0h,00FF000F0h,0FFF000F0h
dd 0000F00F0h,0F00F00F0h,00F0F00F0h,0FF0F00F0h
dd 000FF00F0h,0F0FF00F0h,00FFF00F0h,0FFFF00F0h
dd 00000F0F0h,0F000F0F0h,00F00F0F0h,0FF00F0F0h
dd 000F0F0F0h,0F0F0F0F0h,00FF0F0F0h,0FFF0F0F0h
dd 0000FF0F0h,0F00FF0F0h,00F0FF0F0h,0FF0FF0F0h
dd 000FFF0F0h,0F0FFF0F0h,00FFFF0F0h,0FFFFF0F0h
dd 000000FF0h,0F0000FF0h,00F000FF0h,0FF000FF0h
dd 000F00FF0h,0F0F00FF0h,00FF00FF0h,0FFF00FF0h
dd 0000F0FF0h,0F00F0FF0h,00F0F0FF0h,0FF0F0FF0h
dd 000FF0FF0h,0F0FF0FF0h,00FFF0FF0h,0FFFF0FF0h
dd 00000FFF0h,0F000FFF0h,00F00FFF0h,0FF00FFF0h
dd 000F0FFF0h,0F0F0FFF0h,00FF0FFF0h,0FFF0FFF0h
dd 0000FFFF0h,0F00FFFF0h,00F0FFFF0h,0FF0FFFF0h
dd 000FFFFF0h,0F0FFFFF0h,00FFFFFF0h,0FFFFFFF0h
dd 00000000Fh,0F000000Fh,00F00000Fh,0FF00000Fh
dd 000F0000Fh,0F0F0000Fh,00FF0000Fh,0FFF0000Fh
dd 0000F000Fh,0F00F000Fh,00F0F000Fh,0FF0F000Fh
dd 000FF000Fh,0F0FF000Fh,00FFF000Fh,0FFFF000Fh
dd 00000F00Fh,0F000F00Fh,00F00F00Fh,0FF00F00Fh
dd 000F0F00Fh,0F0F0F00Fh,00FF0F00Fh,0FFF0F00Fh
dd 0000FF00Fh,0F00FF00Fh,00F0FF00Fh,0FF0FF00Fh
dd 000FFF00Fh,0F0FFF00Fh,00FFFF00Fh,0FFFFF00Fh
dd 000000F0Fh,0F0000F0Fh,00F000F0Fh,0FF000F0Fh
dd 000F00F0Fh,0F0F00F0Fh,00FF00F0Fh,0FFF00F0Fh
dd 0000F0F0Fh,0F00F0F0Fh,00F0F0F0Fh,0FF0F0F0Fh
dd 000FF0F0Fh,0F0FF0F0Fh,00FFF0F0Fh,0FFFF0F0Fh
dd 00000FF0Fh,0F000FF0Fh,00F00FF0Fh,0FF00FF0Fh
dd 000F0FF0Fh,0F0F0FF0Fh,00FF0FF0Fh,0FFF0FF0Fh
dd 0000FFF0Fh,0F00FFF0Fh,00F0FFF0Fh,0FF0FFF0Fh
dd 000FFFF0Fh,0F0FFFF0Fh,00FFFFF0Fh,0FFFFFF0Fh
dd 0000000FFh,0F00000FFh,00F0000FFh,0FF0000FFh
dd 000F000FFh,0F0F000FFh,00FF000FFh,0FFF000FFh
dd 0000F00FFh,0F00F00FFh,00F0F00FFh,0FF0F00FFh
dd 000FF00FFh,0F0FF00FFh,00FFF00FFh,0FFFF00FFh
dd 00000F0FFh,0F000F0FFh,00F00F0FFh,0FF00F0FFh
dd 000F0F0FFh,0F0F0F0FFh,00FF0F0FFh,0FFF0F0FFh
dd 0000FF0FFh,0F00FF0FFh,00F0FF0FFh,0FF0FF0FFh
dd 000FFF0FFh,0F0FFF0FFh,00FFFF0FFh,0FFFFF0FFh
dd 000000FFFh,0F0000FFFh,00F000FFFh,0FF000FFFh
dd 000F00FFFh,0F0F00FFFh,00FF00FFFh,0FFF00FFFh
dd 0000F0FFFh,0F00F0FFFh,00F0F0FFFh,0FF0F0FFFh
dd 000FF0FFFh,0F0FF0FFFh,00FFF0FFFh,0FFFF0FFFh
dd 00000FFFFh,0F000FFFFh,00F00FFFFh,0FF00FFFFh
dd 000F0FFFFh,0F0F0FFFFh,00FF0FFFFh,0FFF0FFFFh
dd 0000FFFFFh,0F00FFFFFh,00F0FFFFFh,0FF0FFFFFh
dd 000FFFFFFh,0F0FFFFFFh,00FFFFFFFh,0FFFFFFFFh
;**********************************************
; 漢字コ-ドチェックテ-ブル
;**********************************************
ISKAN1 equ 1
ISKAN2 equ 2
; 0 1 2 3 4 5 6 7 8 9 A B C D E F
kantbl db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;1
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;2
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;3
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 ;4
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 ;5
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 ;6
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,0 ;7
db 2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 ;8
db 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 ;9
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 ;A
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 ;B
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 ;C
db 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 ;D
db 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 ;E
db 3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0 ;F
bitptn ends
VRAM segment 'CODE'
assume cs:VRAM,ds:bitptn
;**************************************
; String to VRAM Display
;**************************************
; putstr(char *vram, char *str)
; +8 +12
;**************************************
align 4 ; align set
public putstr
putstr proc near
push ebp
mov ebp,esp
xor eax,eax
push eax ; work push
push gs
push fs
push es
push esi
push edi
push edx
push ecx
push ebx
cld
mov ax,104h ; VRAM Selecter
mov es,ax ; es = VRAM Selecter
mov ax,0110h ; TBIOS Selecter
mov fs,ax ; fs = TBIOS
mov ax,ds
mov gs,ax ; gs = ds
align 4 ; align set
putlop: ; Put Loop
mov esi,[ebp+12] ; char *str
putlp2:
lodsb ; Get String ※
or al,al
je Left_clear ; End of String ?
cmp al,0Ah ; \n skip
je putlp2
movzx eax,al
mov bl,[eax+offset kantbl]
and bl,ISKAN1
jz putank ; Not iskanji1 ?
movzx ebx,byte ptr [esi]
mov bh,[ebx+offset kantbl]
and bh,ISKAN2
jz putank ; Not iskanji2 ?
mov bh,al
inc esi ; doubel_word ????? ※
mov [ebp+12],esi ; Save *str
shl bh,1 ; Shift Jis to Jis
cmp bl,080h
adc bx,1f61h
add bl,7fh
jc short knf1
add bl,0a2h
knf1: and bh,7fh ; StoJ end
mov ax,0100h
mov dx,1010h
call pword ptr fs:[00a0h] ; Get Kanji Font
mov edi,ss:[ebp+8] ; *vram
add edi,ss:[ebp-4] ; work add
or edi,gs:[page_ofs] ; or Page Offset
mov ebx,offset fntcol
xor edx,edx ; edx=0
xor ecx,ecx ; ecx=0
REPT 16
lodsw ; Get Kanji Font Pattern
mov cl,al ; Left Font Pattern
mov dl,ah ; Right Font Pattern
mov eax,gs:[ebx+ecx*4] ; Get Vram Bit Patan
stosd ; Write Left Font
mov eax,gs:[ebx+edx*4] ; Get Vram Bit Patan
stosd ; Write Right Font
add edi,512-4*2 ; 1 Line 512 Byte
endm
mov ax,gs
mov ds,ax
add dword ptr [ebp-4],8 ; Next vram Address
jmp putlop ; Next Put String Loop
align 4 ; align set
putank: ; Write Ank Font
mov [ebp+12],esi ; Save *str
movzx esi,al
shl esi,6 ; 4x16=64
add esi,offset ankfnt ; ANK Font Table Offset
mov edi,[ebp+8] ; *vram
add edi,[ebp-4] ; work add
or edi,[page_ofs] ; or Page Offset
mov ebx,512-4
REPT 15
movsd ; Trans Font
add edi,ebx ; Line add
endm
movsd ; Trans Font
add dword ptr [ebp-4],4 ; Next vram Address
jmp putlop ; Next Put String Loop
align 4
Left_clear:
; VRAM Clear
mov ebx,320
sub ebx,[ebp-4] ; nokori dword
je nonclr
mov edi,[ebp+8] ; *vram
add edi,[ebp-4] ; work add
or edi,[page_ofs] ; or Page Offset
shr ebx,2 ; / 4
mov ebp,[ebp-4]
add ebp,512-320
mov eax,[fntcol]
mov edx,03FFFFh
mov esi,[page_ofs]
REPT 16
mov ecx,ebx ; nokori dword
rep stosd
add edi,ebp
and edi,edx
or edi,esi
endm
nonclr:
; end of VRAM Clear
pop ebx
pop ecx
pop edx
pop edi
pop esi
pop es
pop fs
pop gs
pop eax ; work pop
pop ebp
ret ; end of putstr
putstr endp
;***************************************************
; void ctblset(int Chr_Col,int Bak_Col);
;***************************************************
public ctblset
ctblset proc near
push ebp
mov ebp,esp
push esi
push edi
push fs
mov ecx,256
mov esi,offset fntptn
mov edi,offset fntcol
ctblp: lodsd
mov edx,eax
not edx
and eax,[ebp+8]
and edx,[ebp+12]
or eax,edx
stosd
loop ctblp
mov ax,138h ; ANK Font Selecter
mov fs,ax
mov esi,3D800h
mov edi,offset ankfnt
mov ecx,16*256
aktb1: movzx eax,byte ptr fs:[esi]
inc esi
mov eax,[eax*4+fntcol]
stosd
loop aktb1
pop fs
pop edi
pop esi
pop ebp
ret
ctblset endp
public inport
;****************************************************************************
; wrtstr(char *str, int page, char *vram, int forcol, int bakcol, int font)
; +8 +12 +16 +20 +24 +28
;****************************************************************************
align 4 ; align set
public wrtstr
wrtstr proc near
push ebp
mov ebp,esp
push gs
push fs
push es
push esi
push edi
push ebx
mov ax,104h ; VRAM Selecter
mov gs,ax ; gs = VRAM Selecter
mov ax,110h ; TBIOS Selecter
mov fs,ax ; fs = TBIOS
align 4 ; align set
wrtlop: ; Put Loop
mov esi,[ebp+8] ; char *str
movzx eax,byte ptr [esi]
inc si
or al,al
jnz short wrtnxt ; End of String ?
pop ebx
pop edi
pop esi
pop es
pop fs
pop gs
pop ebp
ret ; end of putstr
align 4 ; align set
wrtnxt:
mov bl,[eax+offset kantbl]
and bl,ISKAN1
jz wrtank ; Not iskanji1 ?
movzx ebx,byte ptr [esi]
mov bh,[ebx+offset kantbl]
and bh,ISKAN2
jz wrtank ; Not iskanji2 ?
mov bh,al
inc si
mov [ebp+8],esi ; Save *str
shl bh,1 ; Shift Jis to Jis
cmp bl,080h
adc bx,1f61h
add bl,7fh
jc short wrtst1
add bl,0a2h
wrtst1: and bh,7fh ; StoJ end
mov ax,0100h
mov dx,1010h
push ds
call pword ptr fs:[00a0h] ; Get Kanji Font
push ds ; ds:esi = Kanji Font
pop es ; cheng ds<->es
pop ds
mov edi,[ebp+16] ; *vram
or edi,[ebp+12] ; page
mov ecx,[ebp+28] ; Y = 16 Dot Font
align 4 ; align set
wtkn1: mov bx,es:[esi]
add esi,2
cmp byte ptr [ebp+28],16
je short wtkn2
or bx,es:[esi]
add esi,2
wtkn2:
movzx eax,bl ; Get Kanji Left Font Pattan
mov eax,[eax*4+fntptn] ; Get Vram Bit Patan
mov edx,eax
not edx
and eax,[ebp+20]
and edx,[ebp+24]
or eax,edx
mov gs:[edi],eax ; Write Kanji Left Font
movzx eax,bh ; Get Kanji Right Font Pattan
mov eax,[eax*4+fntptn] ; Get Vram Bit Patan
mov edx,eax
not edx
and eax,[ebp+20]
and edx,[ebp+24]
or eax,edx
mov gs:[edi+4],eax ; Write Kanji Right Font
add edi,512 ; 1 Line 512 Byte
and edi,03FFFFh
or edi,[ebp+12] ; Page
loop wtkn1
add dword ptr [ebp+16],8
jmp wrtlop ; Next Put String Loop
align 4 ; align set
wrtank: ; Write Ank Font
cmp al,1Bh ; Esc Code
jne short wtak0
movzx eax,byte ptr [esi]
inc esi
wtak0: mov [ebp+8],esi ; Save *str
mov esi,eax
cmp byte ptr [ebp+28],16
jne short wrtft1
shl esi,4 ; x16
add esi,3D800h ; 8x16 ANK Font Offset
jmp short wrtft2
wrtft1: shl esi,3 ; x8
add esi,3D000h ; 8x8 ANK Font Offset
wrtft2: mov ax,138h ; ANK Font Selecter
mov es,ax
mov edi,[ebp+16] ; *vram
or edi,[ebp+12] ; Page
mov ecx,[ebp+28] ; Y = 16 Dot Font
align 4 ; align set
wtak1: movzx eax,byte ptr es:[esi] ; Get Font Pattan
inc esi
mov eax,[eax*4+fntptn] ; Get Vram Bit Patan
mov edx,eax
not edx
and eax,[ebp+20]
and edx,[ebp+24]
or eax,edx
mov gs:[edi],eax ; Write Ank Font
add edi,512 ; 1 Line 512 Byte
and edi,03FFFFh
or edi,[ebp+12] ; Page
loop wtak1
add dword ptr [ebp+16],4
jmp wrtlop ; Next Put String Loop
wrtstr endp
;**************************************
; int inport(int portaddr)
;**************************************
inport proc near
push ebp
mov ebp,esp
push edx
mov edx,[ebp+8]
xor eax,eax
in al,dx
pop edx
pop ebp
ret
inport endp
;**************************************
; VRAM Disp Start Addr Set
;**************************************
public dsp_adr_set
dsp_adr_set proc near
push ebp
mov ebp,esp
push edx
mov dx,0440h
mov al,17 ; CRTC FA0
out dx,al
mov dx,0442h
mov eax,[ebp+8]
out dx,ax
pop edx
pop ebp
ret
dsp_adr_set endp
;***********************************
; Soft Timer
; Soft_time(int us) 1 = 10us
;***********************************
public Soft_time
Soft_time proc near
mov cx,[esp+4]
int 0FDh
ret
Soft_time endp
;***********************************
; int iskan(char *str);
;***********************************
public iskan
iskan proc near
push esi
mov esi,[esp+8]
movzx eax,byte ptr [esi]
mov al,[eax+offset kantbl]
and al,ISKAN1
jz nokan
movzx eax,byte ptr [esi+1]
mov al,[eax+offset kantbl]
and al,ISKAN2
jz nokan
mov eax,1
pop esi
ret
nokan: xor eax,eax
pop esi
ret
iskan endp
;****************************************************
; cputstr(char *vram, char *str, int col, int bak)
; +8 +12 +16 +20
;****************************************************
align 4 ; align set
public cputstr
cputstr proc near
push ebp
mov ebp,esp
xor eax,eax
push eax ; work push
push gs
push fs
push es
push esi
push edi
push edx
push ecx
push ebx
cld
mov ax,104h ; VRAM Selecter
mov es,ax ; es = VRAM Selecter
mov ax,0110h ; TBIOS Selecter
mov fs,ax ; fs = TBIOS
mov ax,ds
mov gs,ax ; gs = ds
align 4 ; align set
cputlop: ; Put Loop
mov esi,[ebp+12] ; char *str
cputlp2:
lodsb ; Get String ※
or al,al
je cLeft_clear ; End of String ?
cmp al,0Ah ; \n skip
je cputlp2
movzx eax,al
mov bl,[eax+offset kantbl]
and bl,ISKAN1
jz cputank ; Not iskanji1 ?
movzx ebx,byte ptr [esi]
mov bh,[ebx+offset kantbl]
and bh,ISKAN2
jz cputank ; Not iskanji2 ?
mov bh,al
inc esi ; doubel_word ????? ※
mov [ebp+12],esi ; Save *str
shl bh,1 ; Shift Jis to Jis
cmp bl,080h
adc bx,1f61h
add bl,7fh
jc short cknf1
add bl,0a2h
cknf1: and bh,7fh ; StoJ end
mov ax,0100h
mov dx,1010h
call pword ptr fs:[00a0h] ; Get Kanji Font
mov edi,ss:[ebp+8] ; *vram
add edi,ss:[ebp-4] ; work add
or edi,gs:[page_ofs] ; or Page Offset
mov ebx,offset fntptn
xor ecx,ecx ; ecx=0
REPT 16
lodsb ; Get Kanji Font Pattern
mov cl,al ; Left Font Pattern
mov eax,gs:[ebx+ecx*4] ; Get Vram Bit Patan
mov edx,eax
not eax
and eax,ss:[ebp+20]
and edx,ss:[ebp+16]
or eax,edx
stosd ; Write Left Font
lodsb ; Get Kanji Font Pattern
mov cl,al
mov eax,gs:[ebx+ecx*4] ; Get Vram Bit Patan
mov edx,eax
not eax
and eax,ss:[ebp+20]
and edx,ss:[ebp+16]
or eax,edx
stosd ; Write Right Font
add edi,512-4*2 ; 1 Line 512 Byte
endm
mov ax,gs
mov ds,ax
add dword ptr [ebp-4],8 ; Next vram Address
jmp cputlop ; Next Put String Loop
align 4 ; align set
cputank: ; Write Ank Font
mov [ebp+12],esi ; Save *str
movzx esi,al
shl esi,4 ; 4x16=64
add esi,3D800h
mov edi,[ebp+8] ; *vram
add edi,[ebp-4] ; work add
or edi,[page_ofs] ; or Page Offset
mov ax,138h ; ANK Font Selecter
mov ds,ax
xor ecx,ecx
mov ebx,offset fntptn
REPT 16
lodsb
mov cl,al ; Left Font Pattern
mov eax,gs:[ebx+ecx*4] ; Get Vram Bit Patan
mov edx,eax
not eax
and eax,ss:[ebp+20]
and edx,ss:[ebp+16]
or eax,edx
stosd ; Write Left Font
add edi,512-4 ; Line add
endm
mov ax,gs
mov ds,ax
add dword ptr [ebp-4],4 ; Next vram Address
jmp cputlop ; Next Put String Loop
align 4
cLeft_clear:
; VRAM Clear
mov ebx,320
sub ebx,[ebp-4] ; nokori dword
je cnonclr
mov edi,[ebp+8] ; *vram
add edi,[ebp-4] ; work add
or edi,[page_ofs] ; or Page Offset
shr ebx,2 ; / 4
mov eax,[ebp+20]
mov ebp,[ebp-4]
add ebp,512-320
mov edx,03FFFFh
mov esi,[page_ofs]
REPT 16
mov ecx,ebx ; nokori dword
rep stosd
add edi,ebp
and edi,edx
or edi,esi
endm
cnonclr:
; end of VRAM Clear
pop ebx
pop ecx
pop edx
pop edi
pop esi
pop es
pop fs
pop gs
pop eax ; work pop
pop ebp
ret ; end of putstr
cputstr endp
;
; void decode(char *vram,char *buf)
; +8 +12
SLEEP equ 0FFFFh
public ANI_decode
ANI_decode proc near
push ebp
mov ebp,esp
push edi
push esi
push edx
push ecx
push ebx
push es
mov slp_tim,SLEEP ; init sleep time
mov ax,104h ; VRAM selecter
mov es,ax
mov edi,[ebp+8]
mov esi,[ebp+12]
declop: lodsw
test ax,8000h
jnz short decskip
and eax,7FFFh
add edi,eax
jmp short declop
decskip:cmp ax,0FFFFh
je short decend
cmp ax,0FFFEh
je short decnew
cmp ax,0FFFDh
je short chgslp
test ax,4000h
jnz short decrep
and ax,3FFFh
movzx ecx,ax
and ecx,3
jz short dec1
rep movsb
dec1: movzx ecx,ax
shr ecx,2
jecxz short declop
rep movsd
jmp short declop
chgslp: lodsw
mov slp_tim,ax
jmp short declop
decnew: mov edi,[ebp+8]
mov cx,slp_tim
int 0FDh
jmp short declop
decrep: and ax,3FFFh
movzx ecx,ax
lodsd
rep stosd
jmp short declop
decend: pop es
pop ebx
pop ecx
pop edx
pop esi
pop edi
pop ebp
ret
ANI_decode endp
public vram_scrool
vram_scrool proc near
push ebp
mov ebp,esp
push edi
push esi
push ecx
push edx
push es
push ds
mov ax,104h ; VRAM selecter
mov es,ax
mov ds,ax
mov edi,[ebp+8]
mov esi,edi
add esi,512*16 ; next char Line
mov edx,[ebp+12]
vr_lp: mov ecx,320/4
rep movsd
add esi,192
add edi,192
dec edx
jne short vr_lp
xor eax,eax
mov edx,16
vr_cr: mov ecx,320/4
rep stosd
add edi,192
dec edx
jne short vr_cr
pop ds
pop es
pop edx
pop ecx
pop esi
pop edi
pop ebp
ret
vram_scrool endp
;************************************
;void wrt_ank(int ch,int adr);
; +8 +12
;************************************
public wrt_ank
wrt_ank proc near
push ebp
mov ebp,esp
push es
push esi
push edi
mov ax,104h ; VRAM Selecter
mov es,ax ; es = VRAM Selecter
movzx esi,byte ptr [ebp+8]
shl esi,6 ; 4x16=64
add esi,offset ankfnt ; ANK Font Table Offset
mov edi,[ebp+12] ; *vram
or edi,[page_ofs] ; or Page Offset
mov ecx,512-4
REPT 15
movsd ; Trans Font
add edi,ecx ; Line add
endm
movsd ; Trans Font
pop edi
pop esi
pop es
pop ebp
ret
wrt_ank endp
;************************************
;void wrt_kan(int ch,int adr);
; +8 +12
;************************************
public wrt_kan
wrt_kan proc near
push ebp
mov ebp,esp
push fs
push gs
push es
push ds
push esi
push edi
push edx
push ebx
mov ax,104h ; VRAM Selecter
mov es,ax ; es = VRAM Selecter
mov ax,0110h ; TBIOS Selecter
mov fs,ax ; fs = TBIOS
mov ax,ds
mov gs,ax ; gs = ds
movzx ebx,word ptr [ebp+8]
shl bh,1 ; Shift Jis to Jis
cmp bl,080h
adc bx,1f61h
add bl,7fh
jc short wt_kn1
add bl,0a2h
wt_kn1: and bh,7fh ; StoJ end
mov ax,0100h
mov dx,1010h
call pword ptr fs:[00a0h] ; Get Kanji Font
mov edi,ss:[ebp+12] ; *vram
or edi,gs:[page_ofs] ; or Page Offset
mov ebx,offset fntcol
xor edx,edx ; edx=0
xor ecx,ecx ; ecx=0
REPT 16
lodsw ; Get Kanji Font Pattern
mov cl,al ; Left Font Pattern
mov dl,ah ; Right Font Pattern
mov eax,gs:[ebx+ecx*4] ; Get Vram Bit Patan
stosd ; Write Left Font
mov eax,gs:[ebx+edx*4] ; Get Vram Bit Patan
stosd ; Write Right Font
add edi,512-4*2 ; 1 Line 512 Byte
endm
pop ebx
pop edx
pop edi
pop esi
pop ds
pop es
pop gs
pop fs
pop ebp
ret
wrt_kan endp
;************************************
;void wrt_cur(int adr);
; +8
;************************************
public wrt_cur
wrt_cur proc near
mov eax,[esp+4]
push fs
mov cx,104h ; VRAM Selecter
mov fs,cx
not dword ptr fs:[eax]
not dword ptr fs:[eax+512]
pop fs
ret
wrt_cur endp
VRAM ends
end