home *** CD-ROM | disk | FTP | other *** search
/ FreeWare Collection 2 / FreeSoftwareCollection2pd199x-jp.img / oricon / src / bios.asm next >
Assembly Source File  |  1990-06-14  |  13KB  |  833 lines

  1.     .286p
  2. _TEXT    SEGMENT  BYTE PUBLIC 'CODE'
  3. _TEXT    ENDS
  4. _DATA    SEGMENT  WORD PUBLIC 'DATA'
  5. _DATA    ENDS
  6. CONST    SEGMENT  WORD PUBLIC 'CONST'
  7. CONST    ENDS
  8. _BSS    SEGMENT  WORD PUBLIC 'BSS'
  9. _BSS    ENDS
  10. DGROUP    GROUP    CONST,    _BSS,    _DATA
  11.  
  12.     ASSUME  CS: _TEXT, DS: DGROUP, SS: DGROUP, ES: DGROUP
  13.  
  14. _TEXT    SEGMENT
  15.  
  16. ;*******************************************
  17. ;*    ORICON40用にアセブルするなら
  18. ;*    LINE40を定義すること
  19. ;*    ゲェ失敗じゃ
  20. ;*    仮想VRAMがC800:1000以上に無い!
  21. ;*******************************************
  22. ;LINE40    equ    1
  23. ;*******************************************
  24.  
  25. extrn    _BIOS_91:NEAR
  26. extrn    _CUR_X:WORD
  27. extrn    _CUR_Y:WORD
  28. extrn    _CUR_OFF2:WORD
  29. extrn    _CUR_SIZE2:WORD
  30. extrn    _CUR_DSP_FLG:BYTE
  31. extrn    _Act_Dsp:BYTE
  32. extrn   oak_set:near
  33. extrn   oak_reset:near
  34.  
  35. ;*******************************************
  36. GVRAM    equ    0C000h
  37. CVRAM    equ    0C800h
  38. KVRAM    equ    0CA00h
  39.  
  40.   ifdef    LINE40
  41. ANKCG    equ    0CA00h
  42.   else
  43. ANKCG    equ    0CB00h
  44.   endif
  45.  
  46. MAX_X    equ    80
  47.  
  48.   ifdef    LINE40
  49. MAX_Y    equ    39
  50. MAX_Y2    equ    40
  51. CHRSIZ    equ    8
  52. LINSIZ    equ    10
  53.   else
  54. MAX_Y    equ    24
  55. MAX_Y2    equ    25
  56. CHRSIZ    equ    16
  57. LINSIZ    equ    16
  58.   endif
  59. ;*****************************
  60. ;*    Work Vram Eria
  61. ;****************************
  62. dmy_ram    dw    (MAX_X*MAX_Y2) dup(0)
  63. ;*****************************
  64. ;*    割り込みワ-ク
  65. ;*****************************
  66. ds_bak    dw    ?
  67. es_bak    dw    ?
  68. vct_off    dw    ?
  69. vct_seg    dw    ?
  70. old_x    dw    0
  71. ;*********************
  72. ;*    VSYNC
  73. ;*********************
  74. IRQ_CODE equ    0Bh
  75. VS_TIME    equ    4        ; 画面更新間隔の設定
  76.  
  77. vs_para    db    0,0
  78. vs_off    dw    ?
  79. vs_seg    dw    ?
  80. old_off    dw    ?
  81. old_seg    dw    ?
  82. irq_map    db    0,0,0,0
  83. vs_cnt    db    0
  84.  
  85. int_ent proc far
  86.     mov    dx,05CAh
  87.     out    dx,al
  88.     sti
  89.  
  90.     inc    cs:[vs_cnt]
  91.     cmp    cs:[vs_cnt],VS_TIME
  92.     jb    int_rt
  93.     mov    cs:[vs_cnt],0
  94.  
  95.     mov    ds,cs:[ds_bak]
  96.     mov    es,cs:[es_bak]
  97.     cmp    byte ptr [_Act_Dsp],0    ;割り込み禁止フラグ
  98.     jne    int_rt
  99.  
  100.     mov    dx,05C8h
  101.     in    al,dx
  102.     test    al,80h
  103.     jnz    int_go
  104.  
  105.     mov    ah,byte ptr [_CUR_X]
  106.     mov    al,byte ptr [_CUR_Y]
  107.     cmp    ax,cs:[old_x]
  108.     jz    int_rt
  109.  
  110. int_go:    mov    byte ptr [_Act_Dsp],1    ;多重割り込み防止
  111.     call    _cflush
  112.     mov    byte ptr [_Act_Dsp],0
  113.     mov    ah,byte ptr [_CUR_X]
  114.     mov    al,byte ptr [_CUR_Y]
  115.     mov    cs:[old_x],ax
  116.  
  117. int_rt:    ret
  118. int_ent endp
  119.  
  120. vs_set    proc    near
  121.     push    ds
  122.  
  123.     mov    ah,01h
  124.     mov    dl,IRQ_CODE
  125.     int    0AEh
  126.     mov    cs:[old_off],di
  127.     mov    cs:[old_seg],ds
  128.  
  129.     push    cs
  130.     pop    ds
  131.     mov    di,offset int_ent
  132.     mov    cs:[vs_off],di
  133.     mov    cs:[vs_seg],ds
  134.     mov    di,offset vs_para
  135.     mov    ah,00h
  136.     mov    dl,IRQ_CODE
  137.     int    0AEh
  138.  
  139.     mov    ah,03h
  140.     mov    di,offset irq_map
  141.     int    0AEh
  142.     or    byte ptr cs:[di+2],08h
  143.     mov    ah,02h
  144.     int    0AEh
  145.  
  146.     pop    ds
  147.     ret
  148. vs_set    endp
  149.  
  150. vs_reset proc    near
  151.     push    ds
  152.  
  153.     push    cs
  154.     pop    ds
  155.     mov    ah,03h
  156.     mov    di,offset irq_map
  157.     int    0AEh
  158.     and    byte ptr cs:[di+2],0F7h
  159.     mov    ah,02h
  160.     int    0AEh
  161.  
  162.     mov    di,cs:[old_off]
  163.     mov    ds,cs:[old_seg]
  164.     mov    ah,00h
  165.     mov    dl,IRQ_CODE
  166.     int    0AEh
  167.  
  168.     pop    ds
  169.     ret
  170. vs_reset endp
  171. ;******************************
  172. ;*    コンソ-ルBIOS(int 91h)
  173. ;******************************
  174. bios_ent proc far
  175.     pusha
  176.     push    ds    ;+2
  177.     push    es    ;+0
  178.     sti
  179.     cld
  180.     mov    bp,sp
  181.     mov    ds,cs:[ds_bak]
  182.     mov    es,cs:[es_bak]
  183.     push    ss
  184.     push    bp
  185.     call    _BIOS_91
  186.     add    sp,4
  187.     pop    es
  188.     pop    ds
  189.     popa
  190.     iret
  191. bios_ent endp
  192. ;*********************************************
  193. ;*    コンソ-ルBIOSベクタ(int 91h) &
  194. ;*    タイマ割り込みの設定
  195. ;*********************************************
  196.     PUBLIC    _setbios
  197. _setbios PROC NEAR
  198.     pusha
  199.     push    ds
  200.     push    es
  201.  
  202.     mov    ax,ds
  203.     mov    cs:[ds_bak],ax
  204.     mov    ax,es
  205.     mov    cs:[es_bak],ax
  206.  
  207.     mov    ax,3591h        ; int 91h
  208.     int    21h
  209.     mov    ax,es
  210.     mov    [vct_seg],ax
  211.     mov    [vct_off],bx
  212.  
  213.     mov    dx,offset bios_ent
  214.     push    cs
  215.     pop    ds
  216.     mov    ax,2591h        ; int 91h
  217.     int    21h
  218.  
  219.     call    oak_set
  220.     call    vs_set
  221.  
  222.     pop    es
  223.     pop    ds
  224.     popa
  225.     ret    
  226. _setbios ENDP
  227. ;***************************************
  228. ;*    ベクタ及び割り込みの解除 & 終了
  229. ;***************************************
  230.     PUBLIC    _resetbios
  231. _resetbios PROC NEAR
  232.     pusha
  233.     push    ds
  234.     push    es
  235.  
  236.     call    vs_reset
  237.     call    oak_reset
  238.  
  239.     mov    ax,cs:[vct_seg]
  240.     mov    ds,ax
  241.     mov    dx,cs:[vct_off]
  242.     mov    ax,2591h
  243.     int    21h
  244.  
  245.     pop    es
  246.     pop    ds
  247.     popa
  248.     ret    
  249. _resetbios ENDP
  250. ;**********************************************
  251. ;*    colset(char *vram,int color,int byte);
  252. ;**********************************************
  253.     PUBLIC    _colset
  254. _colset    proc    near
  255.     push    bp
  256.     mov    bp,sp
  257.     push    es
  258.     push    di
  259.  
  260.     cld
  261.     mov    ax,CVRAM
  262.     mov    es,ax
  263.     mov    di,[bp+4]
  264.     sub    al,al
  265.     mov    ah,[bp+6]
  266.     mov    cx,[bp+8]
  267.     shr    cx,1
  268.     jcxz    colst1
  269.     rep    stosw
  270.  
  271. colst1:    pop    di
  272.     pop    es
  273.     pop    bp
  274.     ret
  275. _colset    endp
  276. ;*****************************************************
  277. ;*    vramcpy(char *src,char *des,int byte);
  278. ;*****************************************************
  279.     PUBLIC    _vramcpy
  280. _vramcpy proc    near
  281.     push    bp
  282.     mov    bp,sp
  283.     push    ds
  284.     push    es
  285.     push    di
  286.     push    si
  287.  
  288.     cld
  289.     mov    ax,CVRAM
  290.     mov    ds,ax
  291.     mov    es,ax
  292.     mov    di,[bp+4]
  293.     mov    si,[bp+6]
  294.     mov    cx,[bp+8]
  295.     shr    cx,1
  296.     jcxz    vfcp1
  297. ;    mov    byte ptr [_Act_Dsp],1    ;スクロ-ル時 漢字表示が乱れるなら
  298.     rep    movsw
  299.  
  300.     mov    ax,KVRAM
  301.     mov    ds,ax
  302.     mov    es,ax
  303.     mov    di,[bp+4]
  304.     mov    si,[bp+6]
  305.     mov    cx,[bp+8]
  306.     shr    cx,1
  307.     rep    movsw
  308. ;    mov    byte ptr [_Act_Dsp],0    ; このフラグを操作してちょ
  309.  
  310. vfcp1:    pop    si
  311.     pop    di
  312.     pop    es
  313.     pop    ds
  314.     pop    bp
  315.     ret
  316. _vramcpy endp
  317. ;*****************************************************
  318. ;*    vramcpy(char *src,char *des,int byte);
  319. ;*****************************************************
  320.     PUBLIC    _vramrcpy
  321. _vramrcpy proc    near
  322.     push    bp
  323.     mov    bp,sp
  324.     push    ds
  325.     push    es
  326.     push    di
  327.     push    si
  328.  
  329.     std
  330.     mov    ax,CVRAM
  331.     mov    ds,ax
  332.     mov    es,ax
  333.     mov    di,[bp+4]
  334.     mov    si,[bp+6]
  335.     mov    cx,[bp+8]
  336.     shr    cx,1
  337.     jcxz    vrcp1
  338.     rep    movsw
  339.  
  340.     mov    ax,KVRAM
  341.     mov    ds,ax
  342.     mov    es,ax
  343.     mov    di,[bp+4]
  344.     mov    si,[bp+6]
  345.     mov    cx,[bp+8]
  346.     shr    cx,1
  347.     rep    movsw
  348.  
  349. vrcp1:    pop    si
  350.     pop    di
  351.     pop    es
  352.     pop    ds
  353.     pop    bp
  354.     ret
  355. _vramrcpy endp
  356. ;*********************************
  357. ;*    int sjisto(int code);
  358. ;*********************************
  359.     PUBLIC    _sjisto
  360. _sjisto proc    near
  361.     push    bp
  362.     mov    bp,sp
  363.     mov    ax,[bp+4]
  364.     cmp    ah,9fh
  365.     jbe    sjto1
  366.     sub    ah,0B1h-071h
  367. sjto1:  sub    ah,071h
  368.     shl    ah,1
  369.     inc    ah
  370.     cmp    al,7fh
  371.     jbe    sjto2
  372.     dec    al
  373. sjto2:    cmp    al,9eh
  374.     jb    sjto3
  375.     sub    al,7dh
  376.     inc    ah
  377.     jmp    sjto4
  378. sjto3:    sub    al,1fh
  379. sjto4:    pop    bp
  380.     ret
  381. _sjisto    ENDP
  382. ;*************************
  383. ;*    Beep();
  384. ;*************************
  385.     PUBLIC    _Beep
  386. _Beep    proc    near
  387.     push    dx
  388.     push    cx
  389.     mov    dx,0FF98h
  390.     in    al,dx
  391.     mov    cx,5000        ; x 10us
  392.     int    0FDh
  393.     out    dx,al
  394.     pop    cx
  395.     pop    dx
  396.     ret
  397. _Beep    ENDP
  398. ;**********************************************
  399. ;*
  400. ;*    fork(char *cmd,char *pram)
  401. ;*
  402. ;**********************************************
  403. para    dw    0
  404.     dw    ?    ; param offset
  405.     dw    ?    ;       seg
  406.     dw    ?    ; FCB1 offset
  407.     dw    ?    ;      seg
  408.     dw    ?    ; FCB2 offset
  409.     dw    ?       ;      seg
  410. fcb1    db    16 dup (0)
  411. fcb2    db    16 dup (0)
  412.  
  413.     public    _fork
  414. _fork    proc    near
  415.     push    bp
  416.     mov    bp,sp
  417.     push    ds
  418.     push    es
  419.     push    di
  420.     push    si
  421.     push    dx
  422.     push    bx
  423.  
  424.     mov    di,offset para
  425.     mov    ax,[bp+6]        ; parameter offset
  426.     mov    cs:[di+2],ax
  427.     mov    ax,ds
  428.     mov    cs:[di+4],ax
  429.     mov    ax,cs
  430.     mov    bx,offset fcb1
  431.     mov    cs:[di+6],bx
  432.     mov    cs:[di+8],ax
  433.     mov    bx,offset fcb2
  434.     mov    cs:[di+10],bx
  435.     mov    cs:[di+12],ax
  436.  
  437.     mov    es,ax
  438.     mov    si,[bp+6]
  439.     mov    di,offset fcb1
  440.     mov    ax,2901h
  441.     int    21h
  442.     mov    di,offset fcb2
  443.     mov    ax,2901h
  444.     int    21h
  445.  
  446.     mov    ax,cs
  447.     mov    es,ax
  448.     mov    dx,[bp+4]
  449.     mov    bx,offset para
  450.     mov    ax,4B00h
  451.     int    21h
  452.  
  453.     pop    bx
  454.     pop    dx
  455.     pop    si
  456.     pop    di
  457.     pop    es
  458.     pop    ds
  459.     pop    bp
  460.     ret
  461. _fork    endp
  462. ;********************************************
  463. ;*
  464. ;*    AsinKey(int ch,int byte,char *str)
  465. ;*
  466. ;********************************************
  467.     public    _AsinKey
  468. _AsinKey proc    near
  469.     push    bp
  470.     mov    bp,sp
  471.     push    di
  472.  
  473.     mov    ax,0E00h    ; Assin String
  474.     mov    dx,[bp+4]    ; Key Code
  475.     mov    cx,[bp+6]    ; Str Count
  476.     mov    di,[bp+8]    ; Str Addr
  477.     int    90h        ; Key BIOS
  478.  
  479.     pop    di
  480.     pop    bp
  481.     ret
  482. _AsinKey endp
  483. ;****************************************
  484. ; Wrt_Ank
  485. ;   al:char ah:attr
  486. ;   cx:x    bx:y
  487. ;****************************************
  488.     PUBLIC    _Wrt_Ank
  489. _Wrt_Ank proc    near
  490.     push    ds
  491.     push    si
  492.     push    es
  493.     push    di
  494.     push    cx
  495.     push    bx
  496.  
  497.     push    ax
  498.     sub    ah,ah        ; char=>ANKCG address [si]
  499.  
  500.   ifdef    LINE40
  501.     shl    ax,3        ; * 8
  502.   else
  503.     shl    ax,4        ; * 16
  504.   endif
  505.  
  506.     mov    si,ax
  507.     mov    ax,80*LINSIZ    ; x + y * 80*16(GVRAM address) [di]
  508.     mul    bx
  509.     add    ax,cx
  510.     mov    di,ax
  511.     pop    ax
  512.  
  513.     mov    bl,ah
  514.     mov    cl,bl        ;cl
  515.     and    bx,7
  516.  
  517.     test    cl,20h        ;cl
  518.     je    $I147
  519.     or    bl,8            ;at
  520.  
  521. $I147:
  522.     test    cl,18h        ;cl
  523.     je    $I148
  524.     mov    bh,0FFh            ;bk
  525. $I148:
  526.     mov    ax,ANKCG
  527.     mov    ds,ax
  528.     mov    ax,GVRAM
  529.     mov    es,ax
  530.     mov    dx,0FF99h
  531.     mov    al,01h
  532.     out    dx,al
  533.  
  534.     mov    al,0Fh
  535.     mov    dx,0FF81h
  536.     out    dx,al
  537.  
  538.     mov    cx,LINSIZ
  539.     push    di
  540.     sub    al,al
  541. $F151:    mov    es:[di],al
  542.     add    di,80
  543.     loop    $F151
  544.     pop    di
  545.  
  546.     mov    al,bl
  547.     out    dx,al
  548.     mov    cx,CHRSIZ
  549. $F155:    lodsb
  550.     xor    al,bh
  551.     mov    es:[di],al
  552.     add    di,80
  553.     loop    $F155
  554.  
  555.     mov    dx,0FF99h
  556.     xor    al,al
  557.     out    dx,al
  558.  
  559.     pop    bx
  560.     pop    cx
  561.     pop    di
  562.     pop    es
  563.     pop    si
  564.     pop    ds
  565.     ret    
  566. _Wrt_Ank    ENDP
  567. ;************************************
  568. ; Wrt_Kan
  569. ;   dx:漢字(反転注意)    ah:attr
  570. ;   cx:x              bx:y
  571. ;************************************
  572.     PUBLIC    _Wrt_Kan
  573. _Wrt_Kan PROC NEAR
  574.     push    es
  575.     push    di
  576.     push    cx
  577.     push    bx
  578.  
  579.     push    ax
  580.     push    dx
  581.     mov    ax,80*LINSIZ    ; x + y * 80*16(GVRAM address) [di]
  582.     mul    bx
  583.     add    ax,cx
  584.     mov    di,ax
  585.     pop    dx
  586.     pop    ax
  587.     mov    cl,ah
  588.  
  589.     push    cx
  590.     mov    cx,dx
  591.     xchg    ch,cl
  592. ;****** Bug Fix Start *******
  593.     cmp    ch,70h
  594.     jb    Not_Cnv
  595.     cmp    ch,74h
  596.     ja    Not_Cnv
  597.     cmp    cl,60h
  598.     jb    Not_Cnv
  599.     cmp    cl,7Eh
  600.     ja    Not_Cnv
  601.     add    cx,07C0h
  602.     jmp    Cnv_End
  603.  
  604. Not_Cnv:cmp    ch,75h
  605.     je    Ext_Cnv
  606.     cmp    ch,76h
  607.     jne    Cnv_End
  608. Ext_Cnv:sub    ch,75h
  609.     sub    cl,21h
  610.     mov    al,94
  611.     mul    ch
  612.     xor    ch,ch
  613.     add    ax,cx
  614.     mov    dx,ax
  615.     mov    cl,5
  616.     shr    dx,cl     ; dx / 32
  617.     and    ax,1Fh    ; ax % 32
  618.     mov    ch,dl    ; dx * 256
  619.     mov    cl,al
  620.     add    cx,0900h
  621. Cnv_End:
  622. ;******* Bug Fix End ********
  623.     xchg    ch,cl
  624.     mov    ax,cx
  625.     pop    cx
  626.     mov    dx,0FF94h
  627.     out    dx,al
  628.     inc    dx
  629.     mov    al,ah
  630.     out    dx,al
  631.  
  632.     mov    bl,cl    ;cl
  633.     and    bx,7
  634.  
  635.     test    cl,20h    ;cl
  636.     je    $I247
  637.     or    bl,8            ;at
  638. $I247:
  639.     test    cl,18h    ;cl
  640.     je    $I248
  641.     mov    bh,0FFh            ;bk
  642. $I248:
  643.     mov    al,0Fh
  644.     mov    dx,0FF81h
  645.     out    dx,al
  646.  
  647.     mov    ax,GVRAM
  648.     mov    es,ax
  649.     mov    cx,LINSIZ
  650.     push    di
  651.     sub    ax,ax
  652. $F251:    mov    es:[di],ax
  653.     add    di,80
  654.     loop    $F251
  655.     pop    di
  656.  
  657.     mov    al,bl
  658.     out    dx,al
  659.     mov    cx,CHRSIZ
  660.  
  661.   ifdef    LINE40
  662. $F277:    push    cx
  663.     mov    dx,0FF96h
  664.     in    al,dx
  665.     mov    ah,al
  666.     inc    dx
  667.     in    al,dx
  668.     mov    cx,ax
  669.     dec    dx
  670.     in    al,dx
  671.     mov    ah,al
  672.     inc    dx
  673.     in    al,dx
  674.     or    ax,cx
  675.     xor    al,bh
  676.     xor    ah,bh
  677.     xchg    ah,al
  678.     mov    es:[di],ax
  679.     add    di,80
  680.     pop    cx
  681.     loop    $F277
  682.   else
  683. $F277:    mov    dx,0FF96h
  684.     in    al,dx
  685.     xor    al,bh
  686.     mov    es:[di],al
  687.     inc    dx
  688.     in    al,dx
  689.     xor    al,bh
  690.     mov    es:[di+1],al
  691.     add    di,80
  692.     loop    $F277
  693.   endif
  694.  
  695.     pop    bx
  696.     pop    cx
  697.     pop    di
  698.     pop    es
  699.     ret    
  700. _Wrt_Kan ENDP
  701. ;*****************************
  702. ; locate
  703. ;*****************************
  704.     PUBLIC    _locate
  705. _locate    proc    near
  706.     push    es
  707.     mov    cx,[_CUR_X]
  708.     mov    bx,[_CUR_Y]
  709.     mov    ax,MAX_X
  710.     mul    bx
  711.     add    ax,cx
  712.     shl    ax,1
  713.     add    ax,offset dmy_ram
  714.     mov    di,ax
  715.     xor    byte ptr cs:[di+1],0FFh
  716.  
  717.   ifdef    LINE40
  718.     mov    ax,LINSIZ
  719.     mul    bx
  720.     mov    bx,[_CUR_OFF2]
  721.     shr    bx,1
  722.     add    ax,bx
  723.     mov    bx,80
  724.   else
  725.     shl    bx,4        ; y *= 16
  726.     add    bx,[_CUR_OFF2]
  727.     mov    ax,80
  728.   endif
  729.     mul    bx        ; y *= 80
  730.     add    ax,cx        ; y + x
  731.     mov    di,ax
  732.  
  733.     mov    ax,GVRAM
  734.     mov    es,ax
  735.     mov    dx,0FF81h
  736.     mov    al,00000001b
  737.     call    loca_sub
  738.     mov    al,01000010b
  739.     call    loca_sub
  740.     mov    al,10000100b
  741.     mov    al,10000100b
  742.     call    loca_sub
  743.     mov    al,11001000b
  744.     call    loca_sub
  745.     pop    es
  746.     ret    
  747.  
  748. loca_sub:
  749.     out    dx,al
  750.     push    di
  751.     mov    cx,[_CUR_SIZE2]
  752.   ifdef    LINE40
  753.     shr    cx,1
  754.   endif
  755. loca1:    not    byte ptr es:[di]
  756.     add    di,80
  757.     loop    loca1
  758.     pop    di
  759.     ret
  760. _locate    ENDP
  761. ;***********************************************
  762. ;仮想VRAM部(DMYCON Ver2.03)
  763. ;                             by (山)
  764. ;***********************************************
  765.         public    _cflush2
  766. _cflush2    proc    near
  767.         pusha
  768.         push    ds
  769.         push    es
  770.         call    _cflush
  771.         pop    es
  772.         pop    ds
  773.         popa
  774.         ret
  775. _cflush2    endp
  776.  
  777. _cflush        proc near
  778.         push    es
  779.         push    ds
  780.         cld
  781.         mov    ax,CVRAM    ; cp
  782.         mov    ds,ax
  783.         xor    si,si
  784.  
  785.         mov    ax,cs        ; dp
  786.         mov    es,ax
  787.         mov    di,offset dmy_ram
  788.  
  789.         xor    cx,cx        ; x:cx
  790.         xor    bx,bx        ; y:bx
  791.  
  792. cf_lp1:        mov    ax,[si]
  793.         test    ah,40h
  794.         je    short cf_ank
  795.  
  796.         mov    dx,[si+2000h]
  797.         cmp    dx,es:[di+2]
  798.         jne    short cf_knj
  799.         cmp    ah,es:[di+1]
  800.         je    short cf_ked
  801. cf_knj:        mov    es:[di],ax
  802.         mov    es:[di+2],dx
  803.         call    _Wrt_kan
  804. cf_ked:        add    si,4
  805.         add    di,4
  806.         add    cx,2
  807.         jmp    short cf_end
  808.  
  809. cf_ank:        cmp    ax,es:[di]
  810.         mov    es:[di],ax
  811.         je    short cf_aed
  812.         call    _Wrt_ank
  813. cf_aed:        add    si,2
  814.         add    di,2
  815.         inc    cx
  816. cf_end:        cmp    cx,MAX_X
  817.         jb    short cf_lp1
  818.         sub    cx,MAX_X
  819.         inc    bx
  820.         cmp    bx,MAX_Y2
  821.         jb    short cf_lp1
  822.  
  823.         pop    ds
  824.         pop    es
  825.         cmp    byte ptr [_CUR_DSP_FLG],0
  826.         jne    short cf_end2
  827.         call    _locate
  828. cf_end2:    ret
  829. _cflush        endp
  830.  
  831. _TEXT        ENDS
  832. END
  833.