home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FreeWare Collection 2
/
FreeSoftwareCollection2pd199x-jp.img
/
yaru
/
tbiosuty.asm
next >
Wrap
Assembly Source File
|
1990-06-14
|
10KB
|
442 lines
;------------------------------------------------------------------------------
;
; 題名 TBIOSUTY.COM Version 0.1 date 1990.06.03
;
; 作者 ヤルヤル (NAC01135)
;
; 内容 TBIOS改造+αユーティリティ
;
; 内訳 TBIOSを改造してあこぎにスピードUPする!!
; TBIOSを改造して某ソフトのデータの品質を若干良くする!!
; TBIOSを改造してMSXパッドを使えるようにする!!
; 電子ボリュームを初期化する!!
; RS232Cと内蔵モデムの切り換えをする!!
;
; 以前に作った「VSYNC.COM」の発展型です. ただ機能が豊富な分だけ
; 使い方が複雑になっています.
;
;------------------------------------------------------------------------------
.286c
assume cs:YARU_code
YARU_code segment
;------------------------------------------------------------------------------
DEBUG equ 0
;------------------------------------------------------------------------------
MOGUMOGU equ 03b90h
MODEM_SEL_REG equ 0a0ah
FMPCM_MUTE equ 04d5h
ELEVOL_CTRLREG equ 04ech
ELEVOL_CTRL equ 0ech
ELEVOL_HIGHADR equ 0e3h
SOUND_OFF equ 00111111b
SOUND_ON equ 01111111b
SELECT_RS232C equ 080h
SELECT_MODEM equ 0c0h
repairfm_data equ 003h
repairvsync_data equ 0ech
maskfm_data equ 001h
killvsync_data equ 0c3h
msxjoysap_data equ 00fh
joypad_length equ 08
fm_length equ 09
vsync_length equ 10
;------------------------------------------------------------------------------
TBIOSUTY proc near
push bx
push cx
push dx
push si
push di
push bp
push ds
push es
cld
msxpad:
mov si,offset joypad_code+100h ; MSXパッドが使える
mov cx,joypad_length
mov ah,msxjoysap_data
call patch_main
mov si,offset joypad_code+100h
mov cx,joypad_length
mov ah,msxjoysap_data
call patch_main
get_string:
mov ah,62h ; PSPセグメントアドレスを得る
int 21h
mov es,bx
mov di,80h
cmp byte ptr es:[di],0 ; 入力文字列が無い?
je short messege
fmpcm_mask:
mov dx,FMPCM_MUTE ; 内蔵音源音出力停止
xor al,al
out dx,al
read_length:
mov cl,es:[di] ; cx = 文字列長
xor ch,ch
inc di
check_paramater:
push cx
mov al,'+'
repnz scasb ; +オプション有り?
test cx,cx
pop cx
jz short minus_check
push cx
call patch_plus
pop cx
minus_check:
mov di,81h
push cx
mov al,'-'
repnz scasb ; -オプション有り?
test cx,cx
pop cx
jz short exit
call patch_minus
exit:
pop es
pop ds
pop bp
pop di
pop si
pop dx
pop cx
pop bx
mov ax,4c00h ; 終了する
int 21h
messege:
push cs
pop ds
mov dx,offset USE_MESSEGE+100h ; 使用方法の表示
mov ah,9
int 21h
jmp short exit
TBIOSUTY endp
;------------------------------------------------------------------------------
; +オプション処理
;------------------------------------------------------------------------------
patch_plus proc near
xor dl,dl
mov si,di
read_pluscmd:
lods byte ptr es:[si]
cmp al,'a'
jb short check_pluscmd
cmp al,'z'
ja short check_pluscmd
sub al,20h ; 小文字 → 大文字変換
check_pluscmd:
cmp al,'S'
jne short check_plus2nd
or dl,10000000b
jmp short read_pluscmd
check_plus2nd:
cmp al,'V'
jne short check_plus3rd
or dl,01000000b
jmp short read_pluscmd
check_plus3rd:
cmp al,'I'
jne short repair_fm
or dl,00100000b
jmp short read_pluscmd
repair_fm:
add dl,dl
jnc short repair_vsync
mov si,offset repfm_code+100h
mov cx,fm_length
mov ah,repairfm_data
call patch_main
repair_vsync:
add dl,dl
jnc short init_elevol
mov si,offset repvsync_code+100h
mov cx,vsync_length
mov ah,repairvsync_data
call patch_main
init_elevol:
add dl,dl
jnc short plus_exit
mov dx,ELEVOL_CTRLREG
mov al,SOUND_OFF
out dx,al
mov ah,4 ; 電子ボリューム初期化
volinit_loop:
dec ah
mov dl,ELEVOL_HIGHADR
mov al,ah
out dx,al
dec dx
xor al,al
out dx,al
dec dx
mov al,ah
out dx,al
dec dx
xor al,al
out dx,al
test ah,ah
jnz short volinit_loop
mov dl,ELEVOL_CTRL ; LED初期化
mov al,SOUND_ON
out dx,al
plus_exit:
ret
patch_plus endp
;------------------------------------------------------------------------------
; -オプション処理
;------------------------------------------------------------------------------
patch_minus proc near
xor dl,dl
mov si,di
read_minuscmd:
lods byte ptr es:[si]
cmp al,'a'
jb short check_minuscmd
cmp al,'z'
ja short check_minuscmd
sub al,20h ; 小文字 → 大文字変換
check_minuscmd:
cmp al,'S'
jne short check_minus2nd
or dl,10000000b
jmp short read_minuscmd
check_minus2nd:
cmp al,'V'
jne short check_minus3rd
or dl,01000000b
jmp short read_minuscmd
check_minus3rd:
cmp al,'I'
jne short check_minus4th
or dl,00100000b
jmp short read_minuscmd
check_minus4th:
cmp al,'R'
jne short check_minus5th
or dl,00010000b
jmp short read_minuscmd
check_minus5th:
cmp al,'M'
jne short mask_fm
or dl,00001000b
jmp short read_minuscmd
mask_fm:
add dl,dl
jnc short kill_vsync
mov si,offset maskfm_code+100h
mov cx,fm_length
mov ah,maskfm_data
call patch_main
kill_vsync:
add dl,dl
jnc short set_elevol
mov si,offset killvsync_code+100h
mov cx,vsync_length
mov ah,killvsync_data
call patch_main
set_elevol:
add dl,dl
set_rs232c:
xor al,al
add dl,dl
jnc short set_modem
mov al,SELECT_RS232C
set_modem:
add dl,dl
jnc short select_main
mov al,SELECT_MODEM
select_main:
test al,al
jz short minus_exit
mov dx,MODEM_SEL_REG
out dx,al
minus_exit:
ret
patch_minus endp
;------------------------------------------------------------------------------
; パッチ当てメイン
;------------------------------------------------------------------------------
patch_main proc near
if DEBUG;---------------
push ax
push dx
mov dx,offset kenbegin_msg+100h
mov ah,9
int 21h
pop dx
pop ax
endif ;---------------
push dx
push es
mov bp,cx ; bp = compare length
mov dx,MOGUMOGU ; Read I/O Port
in al,dx
mov bl,al
add dx,2
in al,dx
mov bh,al
add dx,2
in al,dx
set_segment:
mov dx,bx ; Calc Segment & Offset
mov cl,4
shr dx,cl
shl al,cl
or dh,al
push dx ; segment
pop es
push cs ; ds = cs
pop ds
and bx,000fh ; offset
mov di,bx
mov dx,si
set_length:
xor cx,cx
sub cx,bx
check_before64k:
mov si,dx
lodsb
repnz scasb
jne short checkend_64k
call code_check
checkend_64k:
test cx,cx
jnz short check_before64k
set_lastlength:
push es
pop cx
add cx,1000h
push cx
pop es
xor di,di
mov cx,16384
add cx,bx
check_last16k:
mov si,dx
lodsb
repnz scasb
jne short checkend_16k
call code_check
checkend_16k:
test cx,cx
jnz short check_last16k
if DEBUG;---------------
push ax
push dx
mov dx,offset kenend_msg+100h
mov ah,9
int 21h
pop dx
pop ax
endif ;---------------
pop es
pop dx
ret
code_check:
push di
push cx
push es
mov cl,4
push di
shr di,cl
push es ; cx = es
pop cx
add cx,di
pop di
and di,0000fh
push cx
pop es
mov cx,bp
rep cmpsb
test cx,cx
pop es
pop cx
pop di
jnz short patch_exit
if DEBUG;---------------
push ax
push dx
mov dx,offset patchstart_msg+100h
mov ah,9
int 21h
mov ah,8
int 21h
pop dx
pop ax
endif ;---------------
mov es:[di-1],ah
patch_exit:
ret
patch_main endp
;------------------------------------------------------------------------------
USE_MESSEGE label byte
db "TBIOS EXPAND? UTILITY Version0.1 update 1990.06.03",13,10
db 13,10
db "[OPTION] -s → FM音源音出力禁止",13,10
db " +s → FM音源音出力許可",13,10
db " -v → VSYNC描画チェック解除",13,10
db " +v → VSYNC描画チェック復帰",13,10
db " +i → 電子ボリューム初期化",13,10
db " -r → RS232Cが有効",13,10
db " -m → 内蔵モデムが有効",13,10
db 13,10
db "[SAMPLE] TBIOSUTY -sm +vi",13,10
db " TBIOSUTY -svr",13,10,"$"
repfm_code label byte
db 001h ; (and al),01h ここを書き換え
db 066h,0bah,0d5h,004h ; mov dx,04d5h
db 0eeh ; out dx,al
db 08ah,0e3h ; mov ah,bl
db 0b2h,0e3h ; mov dl,0e3h
repvsync_code label byte
;1ST_CHECK:
db 0c3h ; ret ここを書き換え
db 0a8h,001h ; test al,01h
db 075h,0fbh ; jne 1ST_CHECK
;2ND_CHECK:
db 0ech ; in al,dx
db 0a8h,001h ; test al,01h
db 074h,0fbh ; je 2ND_CHECK
db 0c3h ; ret
killvsync_code label byte
;1ST_CHECK:
db 0ech ; in al,dx ここを書き換え
db 0a8h,001h ; test al,01h
db 075h,0fbh ; jne 1ST_CHECK
;2ND_CHECK:
db 0ech ; in al,dx
db 0a8h,001h ; test al,01h
db 074h,0fbh ; je 2ND_CHECK
db 0c3h ; ret
maskfm_code label byte
db 003h ;(and al),03h ここを書き換え
db 066h,0bah,0d5h,004h ; mov dx,04d5h
db 0eeh ; out dx,al
db 08ah,0e3h ; mov ah,bl
db 0b2h,0e3h ; mov dl,0e3h
joypad_code label byte
db 03fh,0d0h ;(mov ax),d03fh
db 084h,0F6h ; test dh,dh
db 074h,003h ; je skip
db 080h,0c4h,002h ; add ah,02h
if DEBUG;---------------
kenbegin_msg db "検索開始!!",13,10,"$"
patchstart_msg db "パッチを当てます!!",13,10,"$"
kenend_msg db "検索終了!!",13,10,"$"
endif ;---------------
;------------------------------------------------------------------------------
YARU_code ends
;------------------------------------------------------------------------------
end