home *** CD-ROM | disk | FTP | other *** search
/ FreeWare Collection 2 / FreeSoftwareCollection2pd199x-jp.img / yaru / tbiosuty.asm next >
Assembly Source File  |  1990-06-14  |  10KB  |  442 lines

  1. ;------------------------------------------------------------------------------
  2. ;
  3. ;    題名    TBIOSUTY.COM  Version 0.1    date 1990.06.03
  4. ;
  5. ;    作者    ヤルヤル (NAC01135)
  6. ;
  7. ;    内容    TBIOS改造+αユーティリティ
  8. ;
  9. ;    内訳    TBIOSを改造してあこぎにスピードUPする!!
  10. ;        TBIOSを改造して某ソフトのデータの品質を若干良くする!!
  11. ;        TBIOSを改造してMSXパッドを使えるようにする!!
  12. ;        電子ボリュームを初期化する!!
  13. ;        RS232Cと内蔵モデムの切り換えをする!!
  14. ;
  15. ;    以前に作った「VSYNC.COM」の発展型です. ただ機能が豊富な分だけ
  16. ;    使い方が複雑になっています.
  17. ;
  18. ;------------------------------------------------------------------------------
  19.         .286c
  20.         assume cs:YARU_code
  21. YARU_code    segment
  22. ;------------------------------------------------------------------------------
  23. DEBUG            equ    0
  24. ;------------------------------------------------------------------------------
  25. MOGUMOGU        equ    03b90h
  26. MODEM_SEL_REG        equ    0a0ah
  27. FMPCM_MUTE        equ    04d5h
  28. ELEVOL_CTRLREG        equ    04ech
  29. ELEVOL_CTRL        equ    0ech
  30. ELEVOL_HIGHADR        equ    0e3h
  31. SOUND_OFF        equ    00111111b
  32. SOUND_ON        equ    01111111b
  33.  
  34. SELECT_RS232C        equ    080h
  35. SELECT_MODEM        equ    0c0h
  36.  
  37. repairfm_data        equ    003h
  38. repairvsync_data    equ    0ech
  39. maskfm_data        equ    001h
  40. killvsync_data        equ    0c3h
  41. msxjoysap_data        equ    00fh
  42.  
  43. joypad_length        equ    08
  44. fm_length        equ    09
  45. vsync_length        equ    10
  46. ;------------------------------------------------------------------------------
  47. TBIOSUTY    proc    near
  48.         push    bx
  49.         push    cx
  50.         push    dx
  51.         push    si
  52.         push    di
  53.         push    bp
  54.         push    ds
  55.         push    es
  56.         cld
  57. msxpad:
  58.         mov    si,offset joypad_code+100h    ; MSXパッドが使える
  59.         mov    cx,joypad_length
  60.         mov    ah,msxjoysap_data
  61.         call    patch_main
  62.         mov    si,offset joypad_code+100h
  63.         mov    cx,joypad_length
  64.         mov    ah,msxjoysap_data
  65.         call    patch_main
  66. get_string:
  67.         mov    ah,62h                ; PSPセグメントアドレスを得る
  68.         int    21h
  69.         mov    es,bx
  70.         mov    di,80h
  71.         cmp    byte ptr es:[di],0        ; 入力文字列が無い?
  72.         je    short messege
  73. fmpcm_mask:
  74.         mov    dx,FMPCM_MUTE            ; 内蔵音源音出力停止
  75.         xor    al,al
  76.         out    dx,al
  77. read_length:
  78.         mov    cl,es:[di]            ; cx = 文字列長
  79.         xor    ch,ch
  80.         inc    di
  81. check_paramater:
  82.         push    cx
  83.         mov    al,'+'
  84.         repnz    scasb                ; +オプション有り?
  85.         test    cx,cx
  86.         pop    cx
  87.         jz    short minus_check
  88.         push    cx
  89.         call    patch_plus
  90.         pop    cx
  91. minus_check:
  92.         mov    di,81h
  93.         push    cx
  94.         mov    al,'-'
  95.         repnz    scasb                ; -オプション有り?
  96.         test    cx,cx
  97.         pop    cx
  98.         jz    short exit
  99.         call    patch_minus
  100. exit:
  101.         pop    es
  102.         pop    ds
  103.         pop    bp
  104.         pop    di
  105.         pop    si
  106.         pop    dx
  107.         pop    cx
  108.         pop    bx
  109.         mov    ax,4c00h            ; 終了する
  110.         int    21h
  111. messege:
  112.         push    cs
  113.         pop    ds
  114.         mov    dx,offset USE_MESSEGE+100h    ; 使用方法の表示
  115.         mov    ah,9
  116.         int    21h
  117.         jmp    short exit
  118. TBIOSUTY    endp
  119. ;------------------------------------------------------------------------------
  120. ;    +オプション処理
  121. ;------------------------------------------------------------------------------
  122. patch_plus    proc    near
  123.         xor    dl,dl
  124.         mov    si,di
  125. read_pluscmd:
  126.         lods    byte ptr es:[si]
  127.         cmp    al,'a'
  128.         jb    short check_pluscmd
  129.         cmp    al,'z'
  130.         ja    short check_pluscmd
  131.         sub    al,20h                ; 小文字 → 大文字変換
  132. check_pluscmd:
  133.         cmp    al,'S'
  134.         jne    short check_plus2nd
  135.         or    dl,10000000b
  136.         jmp    short read_pluscmd
  137. check_plus2nd:
  138.         cmp    al,'V'
  139.         jne    short check_plus3rd
  140.         or    dl,01000000b
  141.         jmp    short read_pluscmd
  142. check_plus3rd:
  143.         cmp    al,'I'
  144.         jne    short repair_fm
  145.         or    dl,00100000b
  146.         jmp    short read_pluscmd
  147. repair_fm:
  148.         add    dl,dl
  149.         jnc    short repair_vsync
  150.         mov    si,offset repfm_code+100h
  151.         mov    cx,fm_length
  152.         mov    ah,repairfm_data
  153.         call    patch_main
  154. repair_vsync:
  155.         add    dl,dl
  156.         jnc    short init_elevol
  157.         mov    si,offset repvsync_code+100h
  158.         mov    cx,vsync_length
  159.         mov    ah,repairvsync_data
  160.         call    patch_main
  161. init_elevol:
  162.         add    dl,dl
  163.         jnc    short plus_exit
  164.         mov    dx,ELEVOL_CTRLREG
  165.         mov    al,SOUND_OFF
  166.         out    dx,al
  167.         mov    ah,4                ; 電子ボリューム初期化
  168. volinit_loop:
  169.         dec    ah
  170.         mov    dl,ELEVOL_HIGHADR
  171.         mov    al,ah
  172.         out    dx,al
  173.         dec    dx
  174.         xor    al,al
  175.         out    dx,al
  176.         dec    dx
  177.         mov    al,ah
  178.         out    dx,al
  179.         dec    dx
  180.         xor    al,al
  181.         out    dx,al
  182.         test    ah,ah
  183.         jnz    short volinit_loop
  184.         mov    dl,ELEVOL_CTRL            ; LED初期化
  185.         mov    al,SOUND_ON
  186.         out    dx,al
  187. plus_exit:
  188.         ret
  189. patch_plus    endp
  190. ;------------------------------------------------------------------------------
  191. ;    -オプション処理
  192. ;------------------------------------------------------------------------------
  193. patch_minus    proc    near
  194.         xor    dl,dl
  195.         mov    si,di
  196. read_minuscmd:
  197.         lods    byte ptr es:[si]
  198.         cmp    al,'a'
  199.         jb    short check_minuscmd
  200.         cmp    al,'z'
  201.         ja    short check_minuscmd
  202.         sub    al,20h            ; 小文字 → 大文字変換
  203. check_minuscmd:
  204.         cmp    al,'S'
  205.         jne    short check_minus2nd
  206.         or    dl,10000000b
  207.         jmp    short read_minuscmd
  208. check_minus2nd:
  209.         cmp    al,'V'
  210.         jne    short check_minus3rd
  211.         or    dl,01000000b
  212.         jmp    short read_minuscmd
  213. check_minus3rd:
  214.         cmp    al,'I'
  215.         jne    short check_minus4th
  216.         or    dl,00100000b
  217.         jmp    short read_minuscmd
  218. check_minus4th:
  219.         cmp    al,'R'
  220.         jne    short check_minus5th
  221.         or    dl,00010000b
  222.         jmp    short read_minuscmd
  223. check_minus5th:
  224.         cmp    al,'M'
  225.         jne    short mask_fm
  226.         or    dl,00001000b
  227.         jmp    short read_minuscmd
  228. mask_fm:
  229.         add    dl,dl
  230.         jnc    short kill_vsync
  231.         mov    si,offset maskfm_code+100h
  232.         mov    cx,fm_length
  233.         mov    ah,maskfm_data
  234.         call    patch_main
  235. kill_vsync:
  236.         add    dl,dl
  237.         jnc    short set_elevol
  238.         mov    si,offset killvsync_code+100h
  239.         mov    cx,vsync_length
  240.         mov    ah,killvsync_data
  241.         call    patch_main
  242. set_elevol:
  243.         add    dl,dl
  244. set_rs232c:
  245.         xor    al,al
  246.         add    dl,dl
  247.         jnc    short set_modem
  248.         mov    al,SELECT_RS232C
  249. set_modem:
  250.         add    dl,dl
  251.         jnc    short select_main
  252.         mov    al,SELECT_MODEM
  253. select_main:
  254.         test    al,al
  255.         jz    short minus_exit
  256.         mov    dx,MODEM_SEL_REG
  257.         out    dx,al
  258. minus_exit:
  259.         ret
  260. patch_minus    endp
  261. ;------------------------------------------------------------------------------
  262. ;    パッチ当てメイン
  263. ;------------------------------------------------------------------------------
  264. patch_main    proc    near
  265. if DEBUG;---------------
  266.         push    ax
  267.         push    dx
  268.         mov    dx,offset kenbegin_msg+100h
  269.         mov    ah,9
  270.         int    21h
  271.         pop    dx
  272.         pop    ax
  273. endif    ;---------------
  274.         push    dx
  275.         push    es
  276.         mov    bp,cx            ; bp = compare length
  277.         mov    dx,MOGUMOGU        ; Read I/O Port
  278.         in    al,dx
  279.         mov    bl,al
  280.         add    dx,2
  281.         in    al,dx
  282.         mov    bh,al
  283.         add    dx,2
  284.         in    al,dx
  285. set_segment:
  286.         mov    dx,bx            ; Calc Segment & Offset
  287.         mov    cl,4
  288.         shr    dx,cl
  289.         shl    al,cl
  290.         or    dh,al
  291.         push    dx            ; segment
  292.         pop    es
  293.         push    cs            ; ds = cs
  294.         pop    ds
  295.         and    bx,000fh        ; offset
  296.         mov    di,bx
  297.         mov    dx,si
  298. set_length:
  299.         xor    cx,cx
  300.         sub    cx,bx
  301. check_before64k:
  302.         mov    si,dx
  303.         lodsb
  304.         repnz    scasb
  305.         jne    short checkend_64k
  306.         call    code_check
  307. checkend_64k:
  308.         test    cx,cx
  309.         jnz    short check_before64k
  310. set_lastlength:
  311.         push    es
  312.         pop    cx
  313.         add    cx,1000h
  314.         push    cx
  315.         pop    es
  316.         xor    di,di
  317.         mov    cx,16384
  318.         add    cx,bx
  319. check_last16k:
  320.         mov    si,dx
  321.         lodsb
  322.         repnz    scasb
  323.         jne    short checkend_16k
  324.         call    code_check
  325. checkend_16k:
  326.         test    cx,cx
  327.         jnz    short check_last16k
  328. if DEBUG;---------------
  329.         push    ax
  330.         push    dx
  331.         mov    dx,offset kenend_msg+100h
  332.         mov    ah,9
  333.         int    21h
  334.         pop    dx
  335.         pop    ax
  336. endif    ;---------------
  337.         pop    es
  338.         pop    dx
  339.         ret
  340. code_check:
  341.         push    di
  342.         push    cx
  343.         push    es
  344.         mov    cl,4
  345.         push    di
  346.         shr    di,cl
  347.         push    es            ; cx = es
  348.         pop    cx
  349.         add    cx,di
  350.         pop    di
  351.         and    di,0000fh
  352.         push    cx
  353.         pop    es
  354.         mov    cx,bp
  355.         rep    cmpsb
  356.         test    cx,cx
  357.         pop    es
  358.         pop    cx
  359.         pop    di
  360.         jnz    short patch_exit
  361. if DEBUG;---------------
  362.         push    ax
  363.         push    dx
  364.         mov    dx,offset patchstart_msg+100h
  365.         mov    ah,9
  366.         int    21h
  367.         mov    ah,8
  368.         int    21h
  369.         pop    dx
  370.         pop    ax
  371. endif    ;---------------
  372.         mov    es:[di-1],ah
  373. patch_exit:
  374.         ret
  375. patch_main    endp
  376. ;------------------------------------------------------------------------------
  377. USE_MESSEGE    label    byte
  378. db    "TBIOS EXPAND? UTILITY Version0.1    update 1990.06.03",13,10
  379. db    13,10
  380. db    "[OPTION] -s → FM音源音出力禁止",13,10
  381. db    "         +s → FM音源音出力許可",13,10
  382. db    "         -v → VSYNC描画チェック解除",13,10
  383. db    "         +v → VSYNC描画チェック復帰",13,10
  384. db    "         +i → 電子ボリューム初期化",13,10
  385. db    "         -r → RS232Cが有効",13,10
  386. db    "         -m → 内蔵モデムが有効",13,10
  387. db    13,10
  388. db    "[SAMPLE] TBIOSUTY -sm +vi",13,10
  389. db    "         TBIOSUTY -svr",13,10,"$"
  390.  
  391. repfm_code    label    byte
  392.         db    001h            ; (and    al),01h  ここを書き換え
  393.         db    066h,0bah,0d5h,004h    ; mov    dx,04d5h
  394.         db    0eeh            ; out    dx,al
  395.         db    08ah,0e3h        ; mov    ah,bl
  396.         db    0b2h,0e3h        ; mov    dl,0e3h
  397.  
  398. repvsync_code    label    byte
  399.                         ;1ST_CHECK:
  400.         db    0c3h            ; ret  ここを書き換え
  401.         db    0a8h,001h        ; test    al,01h
  402.         db    075h,0fbh        ; jne    1ST_CHECK
  403.                         ;2ND_CHECK:
  404.         db    0ech            ; in    al,dx
  405.         db    0a8h,001h        ; test    al,01h
  406.         db    074h,0fbh        ; je    2ND_CHECK
  407.         db    0c3h            ; ret
  408.  
  409. killvsync_code    label    byte
  410.                         ;1ST_CHECK:
  411.         db    0ech            ; in    al,dx  ここを書き換え
  412.         db    0a8h,001h        ; test    al,01h
  413.         db    075h,0fbh        ; jne    1ST_CHECK
  414.                         ;2ND_CHECK:
  415.         db    0ech            ; in    al,dx
  416.         db    0a8h,001h        ; test    al,01h
  417.         db    074h,0fbh        ; je    2ND_CHECK
  418.         db    0c3h            ; ret
  419.  
  420. maskfm_code    label    byte
  421.         db    003h            ;(and    al),03h  ここを書き換え
  422.         db    066h,0bah,0d5h,004h    ; mov    dx,04d5h
  423.         db    0eeh            ; out    dx,al
  424.         db    08ah,0e3h        ; mov    ah,bl
  425.         db    0b2h,0e3h        ; mov    dl,0e3h
  426.  
  427. joypad_code    label    byte
  428.         db    03fh,0d0h        ;(mov    ax),d03fh
  429.         db    084h,0F6h        ; test    dh,dh
  430.         db    074h,003h        ; je    skip
  431.         db    080h,0c4h,002h        ; add    ah,02h
  432.  
  433. if DEBUG;---------------
  434. kenbegin_msg    db    "検索開始!!",13,10,"$"
  435. patchstart_msg    db    "パッチを当てます!!",13,10,"$"
  436. kenend_msg    db    "検索終了!!",13,10,"$"
  437. endif    ;---------------
  438. ;------------------------------------------------------------------------------
  439. YARU_code    ends
  440. ;------------------------------------------------------------------------------
  441.         end
  442.