home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FreeWare Collection 2
/
FreeSoftwareCollection2pd199x-jp.img
/
cdplay
/
src
/
vram.asm
< prev
Wrap
Assembly Source File
|
1990-06-14
|
10KB
|
501 lines
;*****************************************************************
;
;void wrtstr(char *str,x,y,font,ccol,bcol)
;
;struct {
; int v_x, v_y; /* Displry X ,Y */
; int v_font; /* Font Size 16 or 8 */
; int v_ccol, v_bcol; /* color */
;} PARA;
;
; font = if font != 0 then duble font)
;
;*****************************************************************
v_para struc
v_x dd ?
v_y dd ?
v_font dd ?
v_ccol dd ?
v_bcol dd ?
v_para ends
extrn MOS_disp:near
;*************************************
; VRAM Direct Access Program
;*************************************
bitptn segment 'DATA'
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
bitptn ends
VRAM segment 'CODE'
assume cs:VRAM
;*************************************
; 漢字フォントの取り出し
;*************************************
; in eax = Kanji Code
; out esi = Kanji Font Address
;*************************************
kanfon proc near
movzx ecx,ax
bt ecx,15
jnc kanfn0
cmp ch,9fh
jbe sjto1
sub ch,0B1h-071h
sjto1: sub ch,071h
shl ch,1
inc ch
cmp cl,7fh
jbe sjto2
dec cl
sjto2: cmp cl,9eh
jb sjto3
sub cl,7dh
inc ch
jmp kanfn0
sjto3: sub cl,1fh
kanfn0: cmp ch,30h
jnb kanfn1
mov ebx,ecx
and ebx,0700h
shl ebx,2
jmp kanfn2
kanfn1: mov ebx,ecx
and ebx,0f00h
shl ebx,2
add ebx,8000h
mov eax,ecx
and eax,0f000h
sub eax,03000h
shl eax,2 ; eax*4
lea eax,[eax+eax*2] ; eax = eax + eax * 2
add ebx,eax ; ebx += eax * 12
kanfn2: mov eax,ecx
and eax,001fh;
shl eax,5
add ebx,eax
mov eax,ecx
and eax,0060h
sub eax,0020h
shl eax,9
add ebx,eax
mov al,ch
and al,0f0h
cmp al,20h
jne kanfn3
cmp cl,60h
jb kanfn3
sub ebx,6000h
kanfn3: cmp al,70h
jne kanfn4
cmp cl,60h
jb kanfn4
sub ebx,8000h
kanfn4: mov esi,ebx
ret
kanfon endp
;**************************************
; Write Kanji Code (JIS or SJIS)
;**************************************
; in eax = kanji Code
; edi = VRAM Address
; out edi = next VRAM Address
;**************************************
wrtkan proc near
push edi
push esi
call kanfon
mov ecx,[ebp].v_font
mov ch,16
wrtkn1: mov dx,es:[esi]
lea esi,[esi+2]
or cl,cl
jz wrtkn3
xchg dh,dl
mov ax,dx
sar dx,1
or dx,ax
xchg dh,dl
wrtkn3: movzx eax,dl
mov eax,ds:[eax*4+offset fntptn]
mov ebx,eax
not ebx
and eax,[ebp].v_ccol
and ebx,[ebp].v_bcol
or eax,ebx
mov fs:[edi],eax
movzx eax,dh
mov eax,ds:[eax*4+offset fntptn]
mov ebx,eax
not ebx
and eax,[ebp].v_ccol
and ebx,[ebp].v_bcol
or eax,ebx
mov fs:[edi+4],eax
add edi,512
dec ch
jnz wrtkn1
pop esi
pop edi
add edi,8
ret
wrtkan endp
;***********************************
; Write ANK code
;***********************************
; in eax = ANK Code
; edi = VRAM Address
; out edi = next VRAM Address
;***********************************
wrtank proc near
push edi
push esi
movzx esi,al
mov ecx,[ebp].v_font
mov ch,8
shl esi,3
add esi,3D000h
wrtak2: movzx eax,byte ptr es:[esi]
inc esi
or cl,cl
jz wrtak3
mov dx,ax
sar ax,1
or ax,dx
wrtak3: mov eax,ds:[eax*4+offset fntptn]
mov ebx,eax
not ebx
and eax,[ebp].v_ccol
and ebx,[ebp].v_bcol
or eax,ebx
mov fs:[edi],eax
add edi,512
dec ch
jnz wrtak2
pop esi
pop edi
add edi,4
ret
wrtank endp
;***********************************
; Color Pattan Seting
;***********************************
; int EAX Color No
; out EAX Color Pattn
;***********************************
colptn proc near
push ebx
mov ebx,eax
shl eax,4
or eax,ebx
mov ebx,eax
shl eax,8
or eax,ebx
mov ebx,eax
shl eax,16
or eax,ebx
pop ebx
ret
colptn endp
;***********************************
; Write String
;***********************************
public wrtstr
wrtstr proc near
; push 0
; call MOS_disp
; add esp,4
push ebp
mov ebp,esp
push esi
push edi
push ebx
push es
push fs
mov esi,8[ebp]
lea ebp,12[ebp]
mov edi,[ebp].v_y
shl edi,9
mov eax,[ebp].v_x
sar eax,1
add edi,eax
mov eax,[ebp].v_ccol
call colptn
mov [ebp].v_ccol,eax
mov eax,[ebp].v_bcol
call colptn
mov [ebp].v_bcol,eax
mov ax,138h
mov es,ax
mov eax,104h
mov fs,ax
wrtst1: mov al,[esi]
inc esi
or al,al
jz wrtst6
cmp al,81h
jb wrtst4
cmp al,9fh
jbe wrtst3
cmp al,0e0h
jb wrtst4
cmp al,0fch
jnbe wrtst4
wrtst3: mov ah,al
mov al,[esi]
inc esi
cmp al,40h
jb wrtst5
cmp al,7fh
jz wrtst5
cmp al,0fch
jnbe wrtst5
call wrtkan
jmp wrtst1
wrtst5: mov al,ah
dec esi
wrtst4: call wrtank
jmp wrtst1
wrtst6: pop fs
pop es
pop ebx
pop edi
pop esi
pop ebp
; push 1
; call MOS_disp
; add esp,4
ret
wrtstr endp
;***************************************
; write Bit Ptan
;*****************************************************
;void wrtptn(char *ptn, x, y, sx, sy, col, bak)
; 8 12 16 20 24 28 32
;*****************************************************
public wrtptn
wrtptn proc
push 0
call MOS_disp
add esp,4
push ebp
mov ebp,esp
push esi
push edi
push ebx
push es
mov esi,8[ebp]
mov edi,16[ebp]
shl edi,9
mov eax,12[ebp]
sar eax,1
add edi,eax
mov eax,28[ebp]
call colptn
mov 28[ebp],eax
mov eax,32[ebp]
call colptn
mov 32[ebp],eax
sar dword ptr 20[ebp],3
mov ax,104h
mov es,ax
wrtpt1: mov ecx,20[ebp]
push edi
wrtpt2: movzx eax,byte ptr[esi]
inc esi
mov eax,ds:[eax*4+offset fntptn]
mov ebx,eax
not ebx
and eax,28[ebp]
and ebx,32[ebp]
or eax,ebx
mov es:[edi],eax
lea edi,[edi+4]
loop wrtpt2
pop edi
add edi,512
dec dword ptr 24[ebp]
jnz wrtpt1
pop es
pop ebx
pop edi
pop esi
leave
push 1
call MOS_disp
add esp,4
ret
wrtptn endp
;*****************************
; Text Scroll
;**************************************************************
;void VRAM_roll(int x,int y,int sx,int sy,int mov,int bakcol)
;**************************************************************
public VRAM_roll
VRAM_roll proc near
push 0
call MOS_disp
add esp,4
push ebp
mov ebp,esp
push esi
push edi
push ebx
push ds
push es
mov edi,8[ebp]
sar edi,1
mov eax,12[ebp]
shl eax,9
add edi,eax
mov esi,24[ebp]
shl esi,9
add esi,edi
mov eax,16[ebp]
mov ebx,512
sar eax,1
sub ebx,eax
sar eax,2
mov 16[ebp],eax
mov ax,104h
mov ds,ax
mov es,ax
cld
mov edx,20[ebp]
L0001: mov ecx,16[ebp]
rep movsd
add edi,ebx
add esi,ebx
dec edx
jnz L0001
mov eax,28[ebp]
mov edx,eax
shl edx,4
or eax,edx
mov edx,eax
shl edx,8
or eax,edx
mov edx,eax
shl edx,16
or eax,edx
mov edx,24[ebp]
L0002: mov ecx,16[ebp]
rep stosd
add edi,ebx
dec edx
jnz L0002
pop es
pop ds
pop ebx
pop edi
pop esi
leave
push 1
call MOS_disp
add esp,4
ret
VRAM_roll endp
VRAM ends
end