home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v2.zip / DDKX86 / DBCSDD / SRC_DBCS / VDHV / ATLS_PVB.ASM < prev    next >
Assembly Source File  |  1995-04-14  |  105KB  |  2,395 lines

  1. ;*DDK*************************************************************************/
  2. ;
  3. ; COPYRIGHT (C) Microsoft Corporation, 1989
  4. ; COPYRIGHT    Copyright (C) 1995 IBM Corporation
  5. ;
  6. ;    The following IBM OS/2 WARP source code is provided to you solely for
  7. ;    the purpose of assisting you in your development of OS/2 WARP device
  8. ;    drivers. You may use this code in accordance with the IBM License
  9. ;    Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  10. ;    Copyright statement may not be removed.;
  11. ;*****************************************************************************/
  12.         PAGE    60,132
  13.         TITLE   ATLS_PVB.ASM -- PVB Write Routines for ATLAS U.S. Format
  14.  
  15. ;/*****************************************************************************
  16. ;*
  17. ;* SOURCE FILE NAME = ATLS_PVB.ASM
  18. ;*
  19. ;* DESCRIPTIVE NAME = Regen Buffer Update Routine
  20. ;*
  21. ;*
  22. ;* VERSION      V2.0
  23. ;*
  24. ;* DATE
  25. ;*
  26. ;* DESCRIPTION
  27. ;*
  28. ;* FUNCTIONS
  29. ;*
  30. ;* NOTES        NONE
  31. ;*
  32. ;* STRUCTURES   NONE
  33. ;*
  34. ;* EXTERNAL REFERENCES  NONE
  35. ;*
  36. ;* EXTERNAL FUNCTIONS
  37. ;*
  38. ;*              NONE
  39. ;*
  40. ;* CHANGE ACTIVIY =
  41. ;*   DATE      FLAG       APAR    CHANGE DESCRIPTION
  42. ;*   --------  ---------- -----   --------------------------------------
  43. ;*   mm/dd/yy  @Vr.mpppxx xxxxx   xxxxxxx
  44. ;*   09/01/89  J-KK0901           KKJ, Performance Up and Support Mono Mode
  45. ;*   10/04/89  J-KK1004           KKJ, P0081 Mono Mode Attribute Incorrect.
  46. ;*   10/05/89  J-KK1005           KKJ, [bp].Sub_AttrState -> .Sub_Option
  47. ;*   10/17/89  J-KK1017           KKJ, Add Set_StartEndRow for Xvio Redraw.
  48. ;*   10/31/89  J-KK1031           KKJ,     - All DBCS Chars have 9Dh as 3rd attr.
  49. ;*                                     Delete FONTCALL.
  50. ;*             j-ys1023,1026,          111 for MS-Xvio support.
  51. ;*   11/13/89  J-KK1113           KKJ,     - Not Redrawn in Mono Mode.
  52. ;*   11/15/89  j-ys1115           MS-XVIO,     in WrtNattr (P0149 SCT$12CC) fix.
  53. ;*   11/16/89  j-ys1116           MS-XVIO, avoid Trap-D in the edge.
  54. ;*   11/17/89  J-KK1117           KKJ, P0158 SCT$12CC - NAttr     in Mono mode
  55. ;*   12/15/89  J-KK1215           KKJ, Performance Up and Fix Trap-D
  56. ;*   01/10/90  J-KK0110           KKJ, Add Real Mode Handling
  57. ;*   02/05/90  J-KK0205           KKJ, Fix     - End offset must be adjusted.
  58. ;*   02/21/90  J-KKB12            KKJ, Fix     - Fill Cell with MSB On.
  59. ;*             J-TS100391         TSO, Fix     - JS01739
  60. ;*             J-TS102291         TSO, PTR JS01738 During VioPopUp, Screen group ID is forced
  61. ;*                                     to No.3 with no notification.
  62. ;*             J-TS011492         TSO, Fix     - JS02411
  63. ;****************************************************************************/
  64.  
  65.         .286c                           ; 286 protect mode instructions
  66.  
  67.         .xlist
  68.         INCLUDE struc.inc               ; Structure macro
  69.         INCLUDE vdhequ.inc              ; Buffer update equates
  70.         INCLUDE vdhstruc.inc            ; Buffer update data structures
  71.         include vdh.inc                 ; Definitions
  72. INCL_DOSINFOSEG     equ     1           ;                               ;J-TS102291
  73.         include os2.inc                 ; InfoSeg definition            ;J-TS102291
  74.         include vgaemu.inc              ; VGA text emulation video buffer
  75.         .list
  76.  
  77. _DATA   SEGMENT WORD PUBLIC 'DATA'
  78. ;************************************************************************
  79. ;*  Global data                                                         *
  80. ;************************************************************************
  81.         extrn   VideoBuffSel : word
  82.         extrn   XGAExist     : word
  83.         extrn   HardwareScroll  : word
  84.         extrn   PrevLineComp    : word
  85.         extrn   MaxLineComp     : word
  86.  
  87. _DATA   ENDS
  88.  
  89.         extrn   DOSGETINFOSEG      : far    ; Dos call
  90.         extrn   DOSFREESEG         : far    ; Dos call
  91.         extrn   FNTGETIMAGEADDR    : far    ; get DBCS font image
  92.         extrn   FNTGETACTIVEBUFFER : far    ; get SBCS font buffer
  93.         extrn   SetupAPAWrite      : far    ; setup APA write mode
  94.         extrn   SetupAPAMove       : far    ; setup APA move mode
  95.         extrn   SetAPAColor        : far    ; set APA write color
  96.         extrn   SetClsColor        : far    ; set APA clear color
  97.         extrn   SetGridColor       : far    ; set grid color
  98.         extrn   ShowCursor         : near   ; show cursor
  99.         extrn   HideCursor         : near   ; hide cursor
  100.         extrn   SetAPAStart        : far    ; set APA display start address
  101.         extrn   _InitPointer       : near   ; inform font data to mouse pointer
  102.  
  103. R2CSEG  SEGMENT WORD    PUBLIC 'CODE'
  104.         ASSUME  CS:R2CSEG,DS:NOTHING,ES:NOTHING
  105.  
  106. ;********************** START OF SPECIFICATIONS *************************
  107. ;*                                                                      *
  108. ;* SUBROUTINE NAME:     UpdateRegenB                                    *
  109. ;*                                                                      *
  110. ;* DESCRIPTIVE NAME:    Call a Update Regen (PVB) routine               *
  111. ;*                      For DBCS VGA mode.                              *
  112. ;*                                                                      *
  113. ;* INPUT:                                                               *
  114. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)      *
  115. ;* ES:DI  --->  LVB Address                     (see XGAWRITE.ASM)      *
  116. ;*                                                                      *
  117. ;* INTERNAL REFERENCES: UpdateRegenOneLineB, Set_StartEndRow            *
  118. ;*                                                                      *
  119. ;* EXTERNAL REFERENCES: ShowCursor, HideCursor, SetupAPAWrite           *
  120. ;*                                                                      *
  121. ;********************** END OF SPECIFICATIONS ***************************
  122. UpdateRegenB    proc near
  123.         public  UpdateRegenB
  124.  
  125.         .if     <[bp].PVB_Sel ne 0> and ; PVB Update ?
  126.         .if     <[bp].Sub_length gt 0>  ; one or more character update?
  127.  
  128.             call    HideCursor          ; hide cursor
  129.  
  130.             call    SetupAPAWrite       ; setup APA write mode
  131.             mov     [bp].APAPrevColor, -1   ; reset preset color
  132.  
  133.             mov     ds, [bp].LVB_Sel    ; setup LVB/Shadow PVB pointer
  134.             mov     si, [bp].Sub_offset ; ds:si = LVB top
  135.             mov     ax, _DATA           ; es:di = Shadow PVB top
  136.             mov     es, ax              ; 
  137.             mov     es, es:VideoBuffSel ; 
  138.             mov     di, [bp].PVBOff     ; PVB buffer is 2 bytes/cell
  139.             shl     di, 1               ; Shadow buffer is 4 bytes/cell
  140.  
  141.             shl     [bp].Sub_PVBend, 1  ; adjust PVB buffer end
  142.             .if     <[bp].Sub_index eq WCELL> and ; this call is from WriteCellStr ;J-TS100391
  143.             .if     <bit [bp].Sub_Option nand CA_Request>               ;J-TS100391
  144.                 shr     [bp].FirstRow, 1  ; convet from byte to cell (word)
  145.                 shr     [bp].RowLength, 1 ; 
  146.             .endif
  147.  
  148.             mov     dx, [bp].Sub_length ; setup total cell count
  149.  
  150.             .if     <dx g [bp].FirstRow> ; Update region is included in a line?
  151.                 mov     cx, [bp].FirstRow ; No, set first row length
  152.             .else
  153.                 mov     cx, dx          ; Yes, set total length
  154.             .endif
  155.  
  156. UpdateRegenLoopB:
  157.                 push    cx                  ; save current line counter
  158.                 push    dx                  ; & total counter
  159.  
  160.                 call    UpdateRegenOneLineB ; call one line update function
  161.  
  162.                 pop     dx                  ; restore current line counter
  163.                 pop     cx                  ; & total counter
  164.  
  165.                 sub     dx, cx          ; dec total length
  166.                 jz      UpdateRegenLoopExitB    ; end ? then exit the loop
  167.  
  168.                 .if     <dx gt [bp].RowLength>  ; set next line length
  169.                     mov     cx, [bp].RowLength  ; full line
  170.                 .else
  171.                     mov     cx, dx              ; last line
  172.                 .endif
  173.                 add     di, [BP].PVBSkip        ; skip PVB pointer to next line
  174.                 add     di, [BP].PVBSkip        ; 2 times PVBSkip is 2 byte/cell
  175.                 jmp     UpdateRegenLoopB        ; goto next line
  176.  
  177. UpdateRegenLoopExitB:
  178.             mov     al, 1               ; 2 bytes Cell
  179.             shr     di, 1               ; adjust ptr
  180.             call    Set_StartEndRow     ; 
  181.  
  182.             call    ShowCursor          ; show cursor
  183.  
  184.         .endif
  185.         ret
  186. UpdateRegenB endp
  187.  
  188. ;********************** START OF SPECIFICATIONS *************************
  189. ;*                                                                      *
  190. ;* SUBROUTINE NAME:     UpdateRegenOneLineB                             *
  191. ;*                                                                      *
  192. ;* DESCRIPTIVE NAME:    Update shadow buffer & call APA update routine  *
  193. ;*                      For DBCS VGA mode.                              *
  194. ;*                                                                      *
  195. ;* INPUT:                                                               *
  196. ;* CX           Cell Count                                              *
  197. ;* DS:SI  --->  LVB Address                                             *
  198. ;* ES:DI  --->  Shadow Buffer Address                                   *
  199. ;*                                                                      *
  200. ;* INTERNAL REFERENCES: ShadowToAPA, MonoToColor                        *
  201. ;*                                                                      *
  202. ;* EXTERNAL REFERENCES: None                                            *
  203. ;*                                                                      *
  204. ;********************** END OF SPECIFICATIONS ***************************
  205. UpdateRegenOneLineB proc    near
  206.         public  UpdateRegenOneLineB
  207.  
  208.         mov     [bp].APA_from, di       ; save shadow top pointer & char cnt
  209.         mov     [bp].APA_cnt, cx        ; for latter use (update APA image)
  210.  
  211.         .if     <di ge 4> and           ; First character check
  212.         mov     bl, es:shadow[di+3]     ; Target header is DBCS 2nd ?
  213.         and     bl, dbcsA1+dbcsA2       ; 
  214.         .if     <bl eq dbcsA1+dbcsA2>   ; Overwrite DBCS 1st
  215.             mov     byte ptr es:shadow[di-4], 20h                   ; set space
  216.             mov     word ptr es:shadow[di-2], EXTRA_ATTR+CHANGE_BIT ; reset flag
  217.             sub     [bp].APA_from, 4    ; adjust APA update area
  218.             inc     [bp].APA_cnt
  219.         .endif                          ; 
  220.  
  221.         mov     bl, [si+TOEXT+1]        ; Source header is DBCS 2nd ?
  222.         and     bl, dbcsA1+dbcsA2       ; 
  223.         .if     <bl eq dbcsA1+dbcsA2>   ; 
  224.             mov     al, 20h             ; Yes, then write SBCS space
  225.             mov     dx, EXTRA_ATTR      ; 
  226.         .else
  227.             mov     al, [si]            ; No, get character code from LVB
  228.             mov     dx, [si+TOEXT]      ; 
  229.         .endif
  230.         mov     ah, [si+1]              ; Get attribute
  231.  
  232. OneLineLoopB:
  233.  
  234.         .if     <cx eq 1>               ; Last character check
  235.  
  236.             .if     <di lt [bp].Sub_PVBend> and ; 
  237.             mov     bl, es:shadow[di+3] ; Target tail is DBCS 1st ?
  238.             and     bl, dbcsA1+dbcsA2   ; 
  239.             .if     <bl eq dbcsA1>      ; Overwrite DBCS 2nd
  240.                 mov     byte ptr es:shadow[di+4], 20h           ; set space
  241.                 mov     word ptr es:shadow[di+6], EXTRA_ATTR+CHANGE_BIT ; reset flag
  242.                 inc     [bp].APA_cnt    ; adjust APA update area
  243.             .endif                      ; 
  244.  
  245.             mov     bl, [si+TOEXT+1]    ; Source tail is DBCS 1st ?
  246.             and     bl, dbcsA1+dbcsA2   ; 
  247.             .if     <bl eq dbcsA1>      ; 
  248.                 mov     al, 20h         ; Yes, then write SBCS space
  249.                 mov     dx, EXTRA_ATTR  ; 
  250.             .endif
  251.  
  252.         .endif
  253.                                             ; check blink/hi-int bit
  254.         .if     <bit ah and ATLAS_BLINK> and ; MSB(Blink/H-Int) Bit On
  255.         .if     <bit <byte ptr [bp].Sub_Option> and BLINK_STATE> ;Blink State On
  256.             and     ah, not ATLAS_BLINK     ; Reset Blink in Attr0
  257.             mov     dl, ATLAS_BLINK         ; Set Blink in PVB
  258.         .endif
  259.  
  260.         .if     <[bp].Sub_colors eq 0>  ; Mono mode ?
  261.             call    MonoToColor         ; convert attribute
  262.             or      dx, bx
  263.         .endif
  264.  
  265.         .if     <ax ne <word ptr es:shadow[di  ]>> or ; displayed char
  266.         .if     <dx ne <word ptr es:shadow[di+2]>>    ; is changed ?
  267.             or      dx, CHANGE_BIT                    ; set change flag
  268.             mov     word ptr es:shadow[di], ax        ; Copy char/attr0
  269.             mov     word ptr es:shadow[di+2], dx      ; Store Extra Attr1/2
  270.         .endif
  271.  
  272.         add     si, 2                       ; set pointer to next source
  273.         add     di, 4                       ; set pointer to next target
  274.  
  275.         dec     cx                          ; check loop end
  276.         jz      OneLineLoopExitB
  277.  
  278.         mov     ax, [si]                    ; get next char/attr0
  279.         mov     dx, [si+TOEXT]              ; get next attr1/attr2
  280.         jmp     OneLineLoopB
  281.  
  282. OneLineLoopExitB:
  283.         push    si                  ; save source & target pointer
  284.         push    di
  285.         push    ds
  286.         push    es
  287.  
  288.         call    ShadowToAPA         ; Update APA based on shadow buf
  289.  
  290.         pop     es                  ; restore source & target pointer
  291.         pop     ds
  292.         pop     di
  293.         pop     si
  294.  
  295.         ret
  296.  
  297. UpdateRegenOneLineB endp
  298.  
  299. ;********************** START OF SPECIFICATIONS *************************
  300. ;*                                                                      *
  301. ;* SUBROUTINE NAME:     ShadowToAPA                                     *
  302. ;*                                                                      *
  303. ;* DESCRIPTIVE NAME:    Update APA according to shadow buffer.          *
  304. ;*                                                                      *
  305. ;* INPUT:                                                               *
  306. ;* [bp].APA_from --->  Shadow Buffer Address                            *
  307. ;* [bp].APA_cnt        Cell Count                                       *
  308. ;*                                                                      *
  309. ;* INTERNAL REFERENCES: FontGetSBCS, FontGetDBCS                        *
  310. ;*                                                                      *
  311. ;* EXTERNAL REFERENCES: SetAPAColor                                     *
  312. ;*                                                                      *
  313. ;********************** END OF SPECIFICATIONS ***************************
  314. ShadowToAPA proc    near
  315.         public  ShadowToAPA
  316.  
  317.         mov     ax, _DATA                   ; Get text emulation video buffer
  318.         mov     ds, ax                      ; Get PVB selector from stack
  319.         mov     ds, ds:VideoBuffSel
  320.                                             ; Get PVB selector from stack
  321.         mov     bx, [bp].APA_from           ; set source pointer ds:bx
  322.         mov     es, [bp].PVB_Sel            ; Get PVB selector from stack
  323.         mov     ax, bx                      ; set target pointer es:di
  324.         shr     ax, 2                       ; di = (si / 4) / LVB_WIDTH
  325.         mov     dh, byte ptr [bp].Sub_cols  ;        * FONT_HEIGHT * APA_WIDTH
  326.         div     dh                          ;    + (si / 4) % LVB_WIDTH
  327.         mov     di, ax                      ;    + APAStart
  328.         shr     di, 8
  329.         mov     dx, APA_WIDTH*FONT_HEIGHT
  330.         xor     ah, ah
  331.         mul     dx
  332.         add     di, ax
  333.         add     di, ds:VGA_APAStart
  334.         mov     dx, [bp].APA_cnt            ; set loop counter
  335.  
  336. ShadowLoop:
  337.  
  338.         .if     <bit <byte ptr ds:shadow[bx+3]> and dbcsA1> near ; DBCS ?
  339.  
  340.             .if     <bit <word ptr ds:shadow[bx+2]> and CHANGE_BIT> or
  341.             .if     <bit <word ptr ds:shadow[bx+6]> and CHANGE_BIT> near ; changed ?
  342.  
  343.                 and     word ptr ds:shadow[bx+2], not CHANGE_BIT ; clear change
  344.                 and     word ptr ds:shadow[bx+6], not CHANGE_BIT ; bit
  345.  
  346.                 mov     al, ds:shadow[bx+1] ; get APA write color (left  harf)
  347.                 xor     ah, ah
  348.                 mov     cl, ds:shadow[bx+5] ; get APA write color (right harf)
  349.                 xor     ch, ch
  350.  
  351.                 .if     <ax eq cx> near     ; left & right are same attribute ?
  352.                     .if     <ax ne [bp].APAPrevColor>   ; color is changed ?
  353.                         mov     [bp].APAPrevColor, ax   ; set APA write color (left harf)
  354.                         call    SetAPAColor
  355.                     .endif
  356.  
  357.                     push    ds                  ; push shadow buffer selector
  358.  
  359.                     mov     al, ds:shadow[bx+4] ; get DBCS font
  360.                     mov     ah, ds:shadow[bx]
  361.                     call    FontGetDBCS
  362.  
  363.                     xor     ax, ax          ; move font image from font buf to APA
  364.                     stosw                   ; clear first line
  365.                     add     di, APA_WIDTH-2
  366.                     movsw
  367.                     add     di, APA_WIDTH-2
  368.                     movsw
  369.                     add     di, APA_WIDTH-2
  370.                     movsw
  371.                     add     di, APA_WIDTH-2
  372.                     movsw
  373.                     add     di, APA_WIDTH-2
  374.                     movsw
  375.                     add     di, APA_WIDTH-2
  376.                     movsw
  377.                     add     di, APA_WIDTH-2
  378.                     movsw
  379.                     add     di, APA_WIDTH-2
  380.                     movsw
  381.                     add     di, APA_WIDTH-2
  382.                     movsw
  383.                     add     di, APA_WIDTH-2
  384.                     movsw
  385.                     add     di, APA_WIDTH-2
  386.                     movsw
  387.                     add     di, APA_WIDTH-2
  388.                     movsw
  389.                     add     di, APA_WIDTH-2
  390.                     movsw
  391.                     add     di, APA_WIDTH-2
  392.                     movsw
  393.                     add     di, APA_WIDTH-2
  394.                     movsw
  395.                     add     di, APA_WIDTH-2
  396.                     movsw
  397.                     add     di, APA_WIDTH-2
  398.                     stosw                   ; clear last line
  399.  
  400.                     sub     di, APA_WIDTH*(FONT_HEIGHT-1)   ; resotre & inc APA ptr
  401.                     pop     ds              ; pop shadow buffer selector
  402.                                             ; underline ?
  403.                     .if     <bit <byte ptr ds:shadow[bx+2]> and A_UNDERLINE_BIT>
  404.                         mov     byte ptr es:[di+APA_WIDTH*(FONT_HEIGHT-1)-2], 0ffh
  405.                     .endif
  406.                     .if     <bit <byte ptr ds:shadow[bx+6]> and A_UNDERLINE_BIT>
  407.                         mov     byte ptr es:[di+APA_WIDTH*(FONT_HEIGHT-1)-1], 0ffh
  408.                     .endif
  409.                                             ; Horz/Vert grid ?
  410.                     .if     <bit <byte ptr ds:shadow[bx+2]> and A_HORZ_BIT+A_VERT_BIT>
  411.                         push    di
  412.                         sub     di, 2
  413.                         mov     al, ds:shadow[bx+2]
  414.                         call    DrawGrid    ; draw horz & vert grid
  415.                         pop     di
  416.                     .endif
  417.                     .if     <bit <byte ptr ds:shadow[bx+6]> and A_HORZ_BIT+A_VERT_BIT>
  418.                         push    di
  419.                         dec     di
  420.                         mov     al, ds:shadow[bx+6]
  421.                         call    DrawGrid    ; draw horz & vert grid
  422.                         pop     di
  423.                     .endif
  424.  
  425.                 .else near
  426.                     .if     <ax ne [bp].APAPrevColor>   ; color is changed ?
  427.                         mov     [bp].APAPrevColor, ax   ; set APA write color (left harf)
  428.                         call    SetAPAColor
  429.                     .endif
  430.  
  431.                     push    ds                  ; push shadow buffer selector
  432.  
  433.                     push    word ptr ds:shadow[bx+2]    ; save attr1/2 word for latter use
  434.  
  435.                     mov     al, ds:shadow[bx+4] ; get DBCS font
  436.                     mov     ah, ds:shadow[bx]
  437.                     call    FontGetDBCS
  438.  
  439.                     xor     al, al          ; move font image from font buf to APA
  440.                     stosb                   ; clear first line (left harf)
  441.                     add     di, APA_WIDTH-1
  442.                     movsb
  443.                     inc     si
  444.                     add     di, APA_WIDTH-1
  445.                     movsb
  446.                     inc     si
  447.                     add     di, APA_WIDTH-1
  448.                     movsb
  449.                     inc     si
  450.                     add     di, APA_WIDTH-1
  451.                     movsb
  452.                     inc     si
  453.                     add     di, APA_WIDTH-1
  454.                     movsb
  455.                     inc     si
  456.                     add     di, APA_WIDTH-1
  457.                     movsb
  458.                     inc     si
  459.                     add     di, APA_WIDTH-1
  460.                     movsb
  461.                     inc     si
  462.                     add     di, APA_WIDTH-1
  463.                     movsb
  464.                     inc     si
  465.                     add     di, APA_WIDTH-1
  466.                     movsb
  467.                     inc     si
  468.                     add     di, APA_WIDTH-1
  469.                     movsb
  470.                     inc     si
  471.                     add     di, APA_WIDTH-1
  472.                     movsb
  473.                     inc     si
  474.                     add     di, APA_WIDTH-1
  475.                     movsb
  476.                     inc     si
  477.                     add     di, APA_WIDTH-1
  478.                     movsb
  479.                     inc     si
  480.                     add     di, APA_WIDTH-1
  481.                     movsb
  482.                     inc     si
  483.                     add     di, APA_WIDTH-1
  484.                     movsb
  485.                     inc     si
  486.                     add     di, APA_WIDTH-1
  487.                     movsb
  488.                     add     di, APA_WIDTH-1 ; clear last line
  489.                     stosb
  490.  
  491.                     sub     di, APA_WIDTH*(FONT_HEIGHT-1)   ; resotre & inc APA ptr
  492.                     sub     si, (FONT_HEIGHT-3)*2            ; restore font pointer
  493.  
  494.                     pop     ax              ; get attr1/2 word
  495.                                             ; underline ?
  496.                     .if     <bit al and A_UNDERLINE_BIT>
  497.                         mov     byte ptr es:[di+APA_WIDTH*(FONT_HEIGHT-1)-1], 0ffh
  498.                     .endif
  499.                                             ; Horz/Vert grid ?
  500.                     .if     <bit al and A_HORZ_BIT+A_VERT_BIT>
  501.                         push    di
  502.                         dec     di
  503.                         call    DrawGrid    ; draw horz & vert grid
  504.                         pop     di
  505.                     .endif
  506.  
  507.                     .if     <cx ne [bp].APAPrevColor>   ; color is changed ?
  508.                         mov     [bp].APAPrevColor, cx   ; set APA write color (right harf)
  509.                         mov     ax, cx
  510.                         call    SetAPAColor
  511.                     .endif
  512.  
  513.                     xor     al, al          ; move font image from font buf to APA
  514.                     stosb                   ; clear first line (right harf)
  515.                     add     di, APA_WIDTH-1
  516.                     movsb
  517.                     inc     si
  518.                     add     di, APA_WIDTH-1
  519.                     movsb
  520.                     inc     si
  521.                     add     di, APA_WIDTH-1
  522.                     movsb
  523.                     inc     si
  524.                     add     di, APA_WIDTH-1
  525.                     movsb
  526.                     inc     si
  527.                     add     di, APA_WIDTH-1
  528.                     movsb
  529.                     inc     si
  530.                     add     di, APA_WIDTH-1
  531.                     movsb
  532.                     inc     si
  533.                     add     di, APA_WIDTH-1
  534.                     movsb
  535.                     inc     si
  536.                     add     di, APA_WIDTH-1
  537.                     movsb
  538.                     inc     si
  539.                     add     di, APA_WIDTH-1
  540.                     movsb
  541.                     inc     si
  542.                     add     di, APA_WIDTH-1
  543.                     movsb
  544.                     inc     si
  545.                     add     di, APA_WIDTH-1
  546.                     movsb
  547.                     inc     si
  548.                     add     di, APA_WIDTH-1
  549.                     movsb
  550.                     inc     si
  551.                     add     di, APA_WIDTH-1
  552.                     movsb
  553.                     inc     si
  554.                     add     di, APA_WIDTH-1
  555.                     movsb
  556.                     inc     si
  557.                     add     di, APA_WIDTH-1
  558.                     movsb
  559.                     inc     si
  560.                     add     di, APA_WIDTH-1
  561.                     stosb                   ; clear last line
  562.                     add     di, APA_WIDTH-1
  563.                     stosb
  564.  
  565.                     sub     di, APA_WIDTH*(FONT_HEIGHT-1)   ; resotre & inc APA ptr
  566.                     pop     ds              ; pop shadow buffer selector
  567.                                             ; underline ?
  568.                     .if     <bit <byte ptr ds:shadow[bx+6]> and A_UNDERLINE_BIT>
  569.                         mov     byte ptr es:[di+APA_WIDTH*(FONT_HEIGHT-1)-1], 0ffh
  570.                     .endif
  571.                                             ; Horz/Vert grid ?
  572.                     .if     <bit <byte ptr ds:shadow[bx+6]> and A_HORZ_BIT+A_VERT_BIT>
  573.                         push    di
  574.                         dec     di
  575.                         mov     al, ds:shadow[bx+6]
  576.                         call    DrawGrid    ; draw horz & vert grid
  577.                         pop     di
  578.                     .endif
  579.  
  580.                 .endif
  581.  
  582.                 add     bx, 8               ; increase shadow buf ptr
  583.  
  584.             .else                           ; char is not changed
  585.  
  586.                 add     bx, 8               ; skip to next char
  587.                 add     di, 2
  588.  
  589.             .endif
  590.  
  591.             sub     dx, 2                   ; dec loop counter
  592.  
  593.         .else near                          ; SBCS
  594.  
  595.             .if     <bit <word ptr ds:shadow[bx+2]> and CHANGE_BIT> near ; changed ?
  596.  
  597.                 and     word ptr ds:shadow[bx+2], not CHANGE_BIT ; clear change
  598.  
  599.                 mov     al, ds:shadow[bx+1] ; set APA write color
  600.                 xor     ah, ah
  601.  
  602.                 .if     <ax ne [bp].APAPrevColor>   ; color is changed ?
  603.                     mov     [bp].APAPrevColor, ax
  604.                     call    SetAPAColor
  605.                 .endif
  606.  
  607.                 push    ds                  ; push shadow buffer selector
  608.  
  609.                 mov     al, ds:shadow[bx]   ; get SBCS font
  610.                 mov     ah, ds:shadow[bx+3]
  611.                 call    FontGetSBCS
  612.  
  613.                 movsb                       ; move font image from font buf to APA
  614.                 add     di, APA_WIDTH-1
  615.                 movsb
  616.                 add     di, APA_WIDTH-1
  617.                 movsb
  618.                 add     di, APA_WIDTH-1
  619.                 movsb
  620.                 add     di, APA_WIDTH-1
  621.                 movsb
  622.                 add     di, APA_WIDTH-1
  623.                 movsb
  624.                 add     di, APA_WIDTH-1
  625.                 movsb
  626.                 add     di, APA_WIDTH-1
  627.                 movsb
  628.                 add     di, APA_WIDTH-1
  629.                 movsb
  630.                 add     di, APA_WIDTH-1
  631.                 movsb
  632.                 add     di, APA_WIDTH-1
  633.                 movsb
  634.                 add     di, APA_WIDTH-1
  635.                 movsb
  636.                 add     di, APA_WIDTH-1
  637.                 movsb
  638.                 add     di, APA_WIDTH-1
  639.                 movsb
  640.                 add     di, APA_WIDTH-1
  641.                 movsb
  642.                 add     di, APA_WIDTH-1
  643.                 movsb
  644.                 add     di, APA_WIDTH-1
  645.                 movsb
  646.                 add     di, APA_WIDTH-1
  647.                 movsb
  648.  
  649.                 sub     di, APA_WIDTH*(FONT_HEIGHT-1)   ; resotre & inc APA ptr
  650.  
  651.                 pop     ds                  ; pop shadow buffer selector
  652.  
  653.                                             ; underline ?
  654.                 .if     <bit <byte ptr ds:shadow[bx+2]> and A_UNDERLINE_BIT>
  655.                     mov     byte ptr es:[di+APA_WIDTH*(FONT_HEIGHT-1)-1], 0ffh
  656.                 .endif
  657.                                             ; Horz/Vert grid ?
  658.                 .if     <bit <byte ptr ds:shadow[bx+2]> and A_HORZ_BIT+A_VERT_BIT>
  659.                     push    di
  660.                     dec     di
  661.                     mov     al, ds:shadow[bx+2]
  662.                     call    DrawGrid        ; draw horz & vert grid
  663.                     pop     di
  664.                 .endif
  665.  
  666.                 add     bx, 4               ; increase shadow buf ptr
  667.  
  668.             .else                           ; char is changed
  669.  
  670.                 add     bx, 4               ; skip to next char
  671.                 inc     di
  672.  
  673.             .endif
  674.  
  675.             dec     dx                      ; dec loop counter
  676.  
  677.         .endif
  678.  
  679.         jz      ShadowExit                  ; check loop end
  680.         jmp     ShadowLoop
  681.  
  682. ShadowExit:
  683.         ret
  684. ShadowToAPA endp
  685.  
  686. ;********************** START OF SPECIFICATIONS *************************
  687. ;*                                                                      *
  688. ;* SUBROUTINE NAME:     DrawGrid                                        *
  689. ;*                                                                      *
  690. ;* DESCRIPTIVE NAME:    Draw vertical & horizontal grid lines.          *
  691. ;*                                                                      *
  692. ;* INPUT:                                                               *
  693. ;* AL          Grid attribute                                           *
  694. ;* ES:DI --->  APA Address                                              *
  695. ;*                                                                      *
  696. ;* INTERNAL REFERENCES: None                                            *
  697. ;*                                                                      *
  698. ;* EXTERNAL REFERENCES: SetGridColor                                    *
  699. ;*                                                                      *
  700. ;********************** END OF SPECIFICATIONS ***************************
  701. DrawGrid    proc    near
  702.         public  DrawGrid
  703.  
  704.         push    ax                          ; save grid flag
  705.  
  706.         push    ds                          ; get grid color
  707.         mov     ax, _DATA
  708.         mov     ds, ax
  709.         mov     ds, ds:VideoBuffSel
  710.         mov     al, ds:VGA_GridColor
  711.         pop     ds
  712.  
  713.         call    SetGridColor                ; set grid color
  714.  
  715.         pop     ax                          ; restore grid flag
  716.  
  717.         .if     <bit al and A_HORZ_BIT>     ; horizontal grid ?
  718.             mov     byte ptr es:[di], 0ffh
  719.         .endif
  720.  
  721.         .if     <bit al and A_VERT_BIT> near ; vertical grid ?
  722.             mov     al, 80h
  723.             mov     ah, es:[di]
  724.             stosb
  725.             add     di, APA_WIDTH-1
  726.             mov     ah, es:[di]
  727.             stosb
  728.             add     di, APA_WIDTH-1
  729.             mov     ah, es:[di]
  730.             stosb
  731.             add     di, APA_WIDTH-1
  732.             mov     ah, es:[di]
  733.             stosb
  734.             add     di, APA_WIDTH-1
  735.             mov     ah, es:[di]
  736.             stosb
  737.             add     di, APA_WIDTH-1
  738.             mov     ah, es:[di]
  739.             stosb
  740.             add     di, APA_WIDTH-1
  741.             mov     ah, es:[di]
  742.             stosb
  743.             add     di, APA_WIDTH-1
  744.             mov     ah, es:[di]
  745.             stosb
  746.             add     di, APA_WIDTH-1
  747.             mov     ah, es:[di]
  748.             stosb
  749.             add     di, APA_WIDTH-1
  750.             mov     ah, es:[di]
  751.             stosb
  752.             add     di, APA_WIDTH-1
  753.             mov     ah, es:[di]
  754.             stosb
  755.             add     di, APA_WIDTH-1
  756.             mov     ah, es:[di]
  757.             stosb
  758.             add     di, APA_WIDTH-1
  759.             mov     ah, es:[di]
  760.             stosb
  761.             add     di, APA_WIDTH-1
  762.             mov     ah, es:[di]
  763.             stosb
  764.             add     di, APA_WIDTH-1
  765.             mov     ah, es:[di]
  766.             stosb
  767.             add     di, APA_WIDTH-1
  768.             mov     ah, es:[di]
  769.             stosb
  770.             add     di, APA_WIDTH-1
  771.             mov     ah, es:[di]
  772.             stosb
  773.             add     di, APA_WIDTH-1
  774.             mov     ah, es:[di]
  775.             stosb
  776.             add     di, APA_WIDTH-1
  777.         .endif
  778.         mov     [bp].APAPrevColor, -1       ; reset draw color
  779.         ret
  780. DrawGrid    endp
  781.  
  782. ;********************** START OF SPECIFICATIONS *************************
  783. ;*                                                                      *
  784. ;* SUBROUTINE NAME:     UpdateAttrB                                     *
  785. ;*                                                                      *
  786. ;* DESCRIPTIVE NAME:    Call a Update Regen (PVB) routine for Attribute *
  787. ;*                                                                      *
  788. ;* INPUT:                                                               *
  789. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)      *
  790. ;* ES:DI  --->  LVB Address                     (see XGAWRITE.ASM)      *
  791. ;*                                                                      *
  792. ;* INTERNAL REFERENCES: UpdateRegenB                                    *
  793. ;*                                                                      *
  794. ;* EXTERNAL REFERENCES: None                                            *
  795. ;*                                                                      *
  796. ;********************** END OF SPECIFICATIONS ***************************
  797. UpdateAttrB proc near
  798.         public  UpdateAttrB
  799.  
  800.         call    UpdateRegenB
  801.  
  802.         ret
  803. UpdateAttrB endp
  804.  
  805. ;********************** START OF SPECIFICATIONS *************************
  806. ;*                                                                      *
  807. ;* SUBROUTINE NAME:     ATLAS_UpLeftR                                   *
  808. ;*                                                                      *
  809. ;* DESCRIPTIVE NAME:    Video device handler Scroll Up/Left             *
  810. ;*                      Move a one line.                                *
  811. ;*                                                                      *
  812. ;* INPUT:                                                               *
  813. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)      *
  814. ;* DS:SI  --->  Source Buffer Address           (see XGASCROL.ASM)      *
  815. ;* ES:DI  --->  PVB Address                     (see XGASCROL.ASM)      *
  816. ;* CX     --->  Words (Cell) to be moved        (see XGASCROL.ASM)      *
  817. ;* Flag   --->  CLD                             (see XGASCROL.ASM)      *
  818. ;*                                                                      *
  819. ;********************** END OF SPECIFICATIONS ***************************
  820. ATLAS_UpLeftR   proc
  821.         public  ATLAS_UpLeftR
  822.  
  823.  
  824.         mov     ax, [bp].Sub_cols               ; calc max right end
  825.         dec     ax
  826.  
  827.         push    ds                              ; get hardware scroll flag
  828.         mov     bx, _DATA
  829.         mov     ds, bx
  830.         mov     bx, ds:HardwareScroll
  831.         pop     ds
  832.  
  833.         .if     <bx                ne PROTECT_HS_OFF > and
  834.         .if     <[bp].leftscroll   eq 0              > and
  835.         .if     <[bp].rightscroll  eq ax             > and
  836.         .if     <[bp].leftdest     eq 0              > and
  837.         .if     <[bp].rightdest    eq ax             > and
  838.         .if     <[bp].topdest      eq 0              > and
  839.         .if     <[bp].bottomscroll eq SCREEN_HEIGHT-2>
  840.             call    ATLAS_UpLeftRHard
  841.         .else
  842.             call    ATLAS_UpLeftRSoft
  843.         .endif
  844.         ret
  845.  
  846. ATLAS_UpLeftR   endp
  847.  
  848. ;********************** START OF SPECIFICATIONS *************************
  849. ;*                                                                      *
  850. ;* SUBROUTINE NAME:     ATLAS_UpLeftRHard                               *
  851. ;*                                                                      *
  852. ;* DESCRIPTIVE NAME:    Video device handler Scroll Up/Left             *
  853. ;*                      Move a one line by hardware.                    *
  854. ;*                                                                      *
  855. ;* INPUT:                                                               *
  856. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)      *
  857. ;* DS:SI  --->  Source Buffer Address           (see XGASCROL.ASM)      *
  858. ;* ES:DI  --->  PVB Address                     (see XGASCROL.ASM)      *
  859. ;* CX     --->  Words (Cell) to be moved        (see XGASCROL.ASM)      *
  860. ;* Flag   --->  CLD                             (see XGASCROL.ASM)      *
  861. ;*                                                                      *
  862. ;********************** END OF SPECIFICATIONS ***************************
  863. ATLAS_UpLeftRHard   proc
  864.         public  ATLAS_UpLeftRHard
  865.  
  866.         call    HideCursor                  ; hide cursor
  867.  
  868.         ; scroll shadow buffer
  869.  
  870.         mov     si, [bp].PVBMoveSrcOff      ; setup shadow buffer src/dst ptrs
  871.         mov     di, [bp].PVBMoveDestOff
  872.  
  873.         mov     ax,[bp].PVBMoveCount        ; get move bytes
  874.         shr     ax, 1
  875.         mul     [bp].RowsToMove             ; setup row loop counter
  876.         mov     cx, ax
  877.  
  878.         mov     ax, _DATA                   ; setup shadow buf selector
  879.         mov     ds, ax
  880.         mov     es, ds:VideoBuffSel
  881.         mov     ds, ds:VideoBuffSel
  882.  
  883.         add     si, shadow                  ; adjust src/dst ptrs
  884.         add     di, shadow
  885.         rep     movsw                       ; Move Cells
  886.  
  887.         ; scroll APA
  888.  
  889.         call    SetupAPAMove                ; setup APA move mode
  890.  
  891.         mov     ax, _DATA                   ; setup DATA selector
  892.         mov     ds, ax
  893.         mov     ds, ds:VideoBuffSel
  894.  
  895.         mov     bx, ds:VGA_APAStart         ; get APA start address
  896.  
  897.         mov     ax, [bp].topscroll          ; modify APA top address
  898.         sub     ax, [bp].topdest
  899.         mov     dx, APA_WIDTH*FONT_HEIGHT
  900.         mul     dx
  901.         add     ds:VGA_APAStart, ax
  902.                                             ; move system reserved line
  903.         mov     ds, [bp].PVB_SEL            ; setup APA selector
  904.         mov     es, [bp].PVB_SEL
  905.         mov     si, APA_WIDTH*FONT_HEIGHT*(SCREEN_HEIGHT-1) ; setup src/dst ptrs
  906.         add     si, bx
  907.         mov     di, si
  908.         add     di, ax
  909.         push    si                          ; save current reserved line addr
  910.  
  911.         mov     cx, APA_WIDTH*FONT_HEIGHT   ;set move count
  912.  
  913.         rep     movsb                       ; move system reserved line
  914.  
  915.         mov     ax, _DATA                   ; set hardware APA start address
  916.         mov     ds, ax
  917.         mov     ds, ds:VideoBuffSel
  918.         mov     ax, ds:VGA_APAStart
  919.         call    SetAPAStart
  920.                                             ; clear lines
  921.         call    SetupAPAWrite               ; setup APA write mode
  922.  
  923.         xor     al, al
  924.         call    SetClsColor                 ; set clear color
  925.  
  926.         pop     di                          ; setup target ptr
  927.         mov     cx, APA_WIDTH*FONT_HEIGHT/2 ; setup clear counter
  928.  
  929.         mov     ax, 0ffffh
  930.         rep     stosw                       ; clear status line
  931.  
  932.         call    ShowCursor                  ; show cursor
  933.  
  934.         ret
  935.  
  936. ATLAS_UpLeftRHard   endp
  937.  
  938. ;********************** START OF SPECIFICATIONS *************************
  939. ;*                                                                      *
  940. ;* SUBROUTINE NAME:     ATLAS_UpLeftRSoft                               *
  941. ;*                                                                      *
  942. ;* DESCRIPTIVE NAME:    Video device handler Scroll Up/Left             *
  943. ;*                      Move a one line by software.                    *
  944. ;*                                                                      *
  945. ;* INPUT:                                                               *
  946. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)      *
  947. ;* DS:SI  --->  Source Buffer Address           (see XGASCROL.ASM)      *
  948. ;* ES:DI  --->  PVB Address                     (see XGASCROL.ASM)      *
  949. ;* CX     --->  Words (Cell) to be moved        (see XGASCROL.ASM)      *
  950. ;* Flag   --->  CLD                             (see XGASCROL.ASM)      *
  951. ;*                                                                      *
  952. ;********************** END OF SPECIFICATIONS ***************************
  953. ATLAS_UpLeftRSoft   proc
  954.         public  ATLAS_UpLeftRSoft
  955.  
  956.         call    HideCursor                  ; hide cursor
  957.  
  958.         call    SetupAPAWrite               ; setup APA write mode
  959.  
  960.         shl     [bp].Sub_PVBend, 1          ; adjust PVB buffer end
  961.  
  962.         mov     ax, _DATA                   ; setup DATA segment
  963.         mov     ds, ax
  964.         mov     ds, ds:VideoBuffSel
  965.  
  966.         mov     ax, [bp].APAMoveSrcOff      ; setup exchange offset
  967.         add     ax, ds:VGA_APAStart
  968.         mov     [bp].MoveSrcOff, ax
  969.         mov     ax, [bp].APAMoveDestOff
  970.         add     ax, ds:VGA_APAStart
  971.         mov     [bp].MoveDestOff, ax
  972.  
  973.         mov     si, [bp].PVBMoveSrcOff      ; setup shadow buffer src/dst ptrs
  974.         mov     di, [bp].PVBMoveDestOff
  975.  
  976.         mov     dx, [bp].RowsToMove         ; setup row loop counter
  977.  
  978. UpLeftLoop:
  979.         mov     ax, _DATA                   ; setup shadow buf selector
  980.         mov     ds, ax
  981.         mov     es, ds:VideoBuffSel
  982.         mov     ds, ds:VideoBuffSel
  983.  
  984.         mov     [bp].MoveFlag, 0            ; clear dirty flag
  985.  
  986.         ; scroll shadow buffer first
  987.  
  988.         .if     <si ge 4> and               ; 
  989.         mov     al, ds:shadow[si+3]         ; Source head is DBCS 2nd ?
  990.         and     al, dbcsA1+dbcsA2           ; 
  991.         .if     <al eq dbcsA1+dbcsA2>       ; Overwrite DBCS
  992.             mov     byte ptr ds:shadow[si-4], 20h        ; Fill Blank to first
  993.             mov     byte ptr ds:shadow[si  ], 20h        ; Fill Blank to second
  994.             mov     word ptr ds:shadow[si-2], EXTRA_ATTR ; reset flag
  995.             mov     word ptr ds:shadow[si+2], EXTRA_ATTR ; reset flag
  996.  
  997.             mov     ah, byte ptr ds:shadow[si-3]         ; get back colors
  998.             mov     al, byte ptr ds:shadow[si+1]
  999.             and     ah, 0f0h                             ; mix two colors
  1000.             shr     al, 4
  1001.             or      al, ah
  1002.             mov     [bp].ColSrcHead, al                  ; save colors
  1003.             or      [bp].MoveFlag, SRC_HEAD              ; set dirty flag
  1004.         .endif                              ; 
  1005.  
  1006.         .if     <di ge 4> and               ; 
  1007.         mov     al, ds:shadow[di+3]         ; Target head is DBCS 2nd ?
  1008.         and     al, dbcsA1+dbcsA2           ; 
  1009.         .if     <al eq dbcsA1+dbcsA2>       ; Overwrite DBCS 1st
  1010.             mov     byte ptr ds:shadow[di-4], 20h        ; set space
  1011.             mov     word ptr ds:shadow[di-2], EXTRA_ATTR ; reset flag
  1012.  
  1013.             mov     al, byte ptr ds:shadow[di-3]         ; get back color
  1014.             shr     al, 4
  1015.             mov     [bp].ColDstHead, al                  ; save color
  1016.             or      [bp].MoveFlag, DST_HEAD              ; set dirty flag
  1017.         .endif                              ; 
  1018.  
  1019.         mov     cx,[bp].PVBMoveCount        ; get move bytes
  1020.         shr     cx,1                        ; convert bytes to words
  1021.         add     si, shadow                  ; adjust src/dst ptrs
  1022.         add     di, shadow
  1023.         rep     movsw                       ; Move Cells
  1024.         sub     si, shadow                  ; restore src/dst ptrs
  1025.         sub     di, shadow
  1026.  
  1027.         .if     <si lt [bp].Sub_PVBend> and
  1028.         mov     al, ds:shadow[si+3]         ; Source tail is DBCS 1st ?
  1029.         and     al, dbcsA1+dbcsA2           ; 
  1030.         .if     <al eq dbcsA1+dbcsA2>       ; Overwrite DBCS
  1031.             mov     byte ptr ds:shadow[si-4], 20h        ; Fill Blank to first
  1032.             mov     byte ptr ds:shadow[si  ], 20h        ; Fill Blank to second
  1033.             mov     word ptr ds:shadow[si-2], EXTRA_ATTR ; reset flag
  1034.             mov     word ptr ds:shadow[si+2], EXTRA_ATTR ; reset flag
  1035.             mov     byte ptr ds:shadow[di-4], 20h        ;Change Copied Byte to Space
  1036.             mov     word ptr ds:shadow[di-2], EXTRA_ATTR ;reset flag
  1037.  
  1038.             mov     ah, byte ptr ds:shadow[si-3]         ; get back colors
  1039.             mov     al, byte ptr ds:shadow[si+1]
  1040.             and     ah, 0f0h                             ; mix two colors
  1041.             shr     al, 4
  1042.             or      al, ah
  1043.             mov     [bp].ColSrcTail, al                  ; save colors
  1044.             mov     al, byte ptr ds:shadow[di-3]         ; get dest back color
  1045.             shr     al, 4
  1046.             mov     [bp].ColDstTail, al                  ; save dest color
  1047.             or      [bp].MoveFlag, SRC_TAIL              ; set dirty flag
  1048.         .endif                              ; 
  1049.  
  1050.         .if     <di lt [bp].Sub_PVBend> and
  1051.         mov     al, ds:shadow[di+3]         ; Target tail is DBCS 1st ?
  1052.         and     al, dbcsA1+dbcsA2           ; 
  1053.         .if     <al eq dbcsA1+dbcsA2>       ; Overwrite DBCS 2nd
  1054.             mov     byte ptr ds:shadow[di  ], 20h        ; set space
  1055.             mov     word ptr ds:shadow[di+2], EXTRA_ATTR ; reset flag
  1056.  
  1057.             mov     al, byte ptr ds:shadow[di+1]         ; get back color
  1058.             shr     al, 4
  1059.             mov     [bp].ColDstTail, al                  ; save color
  1060.             or      [bp].MoveFlag, DST_TAIL              ; set dirty flag
  1061.         .endif                              ; 
  1062.  
  1063.         add     si, [bp].PVBMoveSkip        ; skip PVB src/dst ptrs to next line
  1064.         add     di, [bp].PVBMoveSkip        ; 
  1065.  
  1066.         xchg    si, [bp].MoveSrcOff         ; exchange src/dst ptr
  1067.         xchg    di, [bp].MoveDestOff        ; from PVB to APA
  1068.  
  1069.         ; scroll APA next
  1070.  
  1071.         ; process DBCS edges for APA
  1072.  
  1073.         mov     ax, [bp].PVB_SEL            ; setup APA selector
  1074.         mov     ds, ax
  1075.         mov     es, ax
  1076.  
  1077.         mov     ah, 0ffh                    ; preset clear byte
  1078.  
  1079.         .if     <bit [bp].MoveFlag and SRC_HEAD> ; clear source head edge DBCS ?
  1080.  
  1081.             ; clear source head - 1 char
  1082.  
  1083.             mov     al, [bp].ColSrcHead     ; set clear color
  1084.             shr     al, 4
  1085.             call    SetClsColor
  1086.             mov     cx, FONT_HEIGHT         ; set loop counter
  1087.             dec     si
  1088. ULSrcHeadLoop1:
  1089.             mov     ds:[si], ah             ; clear char box
  1090.             add     si, APA_WIDTH
  1091.             loop    ULSrcHeadLoop1
  1092.             sub     si, FONT_HEIGHT*APA_WIDTH-1
  1093.  
  1094.             ; clear source head char
  1095.  
  1096.             mov     al, [bp].ColSrcHead     ; set clear color
  1097.             call    SetClsColor
  1098.             mov     cx, FONT_HEIGHT         ; set loop counter
  1099. ULSrcHeadLoop2:
  1100.             mov     ds:[si], ah             ; clear char box
  1101.             add     si, APA_WIDTH
  1102.             loop    ULSrcHeadLoop2
  1103.             sub     si, FONT_HEIGHT*APA_WIDTH
  1104.         .endif
  1105.  
  1106.         .if     <bit [bp].MoveFlag and DST_HEAD> ; clear dest   head edge DBCS ?
  1107.  
  1108.             ; clear destination head - 1 char
  1109.  
  1110.             mov     al, [bp].ColDstHead     ; set clear color
  1111.             call    SetClsColor
  1112.             mov     cx, FONT_HEIGHT         ; set loop counter
  1113.             dec     di
  1114. ULDstHeadLoop:
  1115.             mov     ds:[di], ah             ; clear char box
  1116.             add     di, APA_WIDTH
  1117.             loop    ULDstHeadLoop
  1118.             sub     di, FONT_HEIGHT*APA_WIDTH-1
  1119.         .endif
  1120.  
  1121.         ; move APA contents
  1122.  
  1123.         call    SetupAPAMove                ; setup APA move mode
  1124.  
  1125.         mov     bx, FONT_HEIGHT
  1126. UpLeftAPALoop:
  1127.         mov     cx, [bp].APAMoveCount       ; move one line
  1128.         rep     movsb
  1129.         add     si,[bp].APAMoveSkip         ; skip to next line
  1130.         add     di,[bp].APAMoveSkip
  1131.  
  1132.         dec     bx                          ; loop
  1133.         jnz     UpLeftAPALoop
  1134.  
  1135.         sub     si, FONT_HEIGHT*APA_WIDTH   ; restore src/dst ptrs
  1136.         sub     di, FONT_HEIGHT*APA_WIDTH
  1137.         add     si, [bp].APAMoveCount       ; skip APA src/dst ptrs to the end
  1138.         add     di, [bp].APAMoveCount       ; 
  1139.  
  1140.         call    SetupAPAWrite               ; setup APA write mode
  1141.  
  1142.         .if     <bit [bp].MoveFlag and SRC_TAIL> ; clear source tail edge DBCS ?
  1143.  
  1144.             ; clear source tail char
  1145.  
  1146.             mov     al, [bp].ColSrcTail     ; set clear color
  1147.             shr     al, 4
  1148.             call    SetClsColor
  1149.             mov     cx, FONT_HEIGHT         ; set loop counter
  1150.             dec     si
  1151. ULSrcTailLoop1:
  1152.             mov     ds:[si], ah             ; clear char box
  1153.             add     si, APA_WIDTH
  1154.             loop    ULSrcTailLoop1
  1155.             sub     si, FONT_HEIGHT*APA_WIDTH-1
  1156.  
  1157.             ; clear source tail + 1 char
  1158.  
  1159.             mov     al, [bp].ColSrcTail     ; set clear color
  1160.             call    SetClsColor
  1161.             mov     cx, FONT_HEIGHT         ; set loop counter
  1162. ULSrcTailLoop2:
  1163.             mov     ds:[si], ah             ; clear char box
  1164.             add     si, APA_WIDTH
  1165.             loop    ULSrcTailLoop2
  1166.             sub     si, FONT_HEIGHT*APA_WIDTH
  1167.  
  1168.             ; clear destination tail char
  1169.  
  1170.             mov     al, [bp].ColDstTail     ; set clear color
  1171.             call    SetClsColor
  1172.             mov     cx, FONT_HEIGHT         ; set loop counter
  1173.             dec     di
  1174. ULSrcTailLoop3:
  1175.             mov     ds:[di], ah             ; clear char box
  1176.             add     di, APA_WIDTH
  1177.             loop    ULSrcTailLoop3
  1178.             sub     di, FONT_HEIGHT*APA_WIDTH-1
  1179.         .endif
  1180.  
  1181.         .if     <bit [bp].MoveFlag and DST_TAIL> ; clear dest   tail edge DBCS ?
  1182.  
  1183.             ; clear destination tail + 1 char
  1184.  
  1185.             mov     al, [bp].ColDstTail     ; set clear color
  1186.             call    SetClsColor
  1187.             mov     cx, FONT_HEIGHT         ; set loop counter
  1188. ULDstTailLoop:
  1189.             mov     ds:[di], ah             ; clear char box
  1190.             add     di, APA_WIDTH
  1191.             loop    ULDstTailLoop
  1192.             sub     di, FONT_HEIGHT*APA_WIDTH
  1193.         .endif
  1194.  
  1195.         add     si, [bp].APAMoveSkip        ; skip APA src/dst ptrs to next row
  1196.         add     si, (FONT_HEIGHT-1)*APA_WIDTH
  1197.         add     di, [bp].APAMoveSkip
  1198.         add     di, (FONT_HEIGHT-1)*APA_WIDTH
  1199.  
  1200.         xchg    si, [bp].MoveSrcOff         ; exchange src/dst ptr
  1201.         xchg    di, [bp].MoveDestOff        ; from APA to PVB
  1202.  
  1203.         dec     dx                          ; dec loop counter
  1204.         jz      UpLeftExit
  1205.         jmp     UpLeftLoop                  ; continue to loop
  1206.  
  1207. UpLeftExit:
  1208.         call    ShowCursor                  ; show cursor
  1209.  
  1210.         ret
  1211.  
  1212. ATLAS_UpLeftRSoft   endp
  1213.  
  1214. ;********************** START OF SPECIFICATIONS *************************
  1215. ;*                                                                      *
  1216. ;* SUBROUTINE NAME:     ATLAS_DnRightR                                  *
  1217. ;*                                                                      *
  1218. ;* DESCRIPTIVE NAME:    Video device handler Scroll Down/Right          *
  1219. ;*                      Move a one line.                                *
  1220. ;*                                                                      *
  1221. ;* INPUT:                                                               *
  1222. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)      *
  1223. ;* DS:SI  --->  Source Buffer Address           (see XGASCROL.ASM)      *
  1224. ;* ES:DI  --->  LVB Address                     (see XGASCROL.ASM)      *
  1225. ;* CX     --->  Words (Cell) to be moved        (see XGASCROL.ASM)      *
  1226. ;* Flag   --->  STD                             (see XGASCROL.ASM)      *
  1227. ;*                                                                      *
  1228. ;********************** END OF SPECIFICATIONS ***************************
  1229. ATLAS_DnRightR  proc
  1230.         public  ATLAS_DnRightR
  1231.  
  1232.         mov     ax, [bp].Sub_cols               ; calc max right end
  1233.         dec     ax
  1234.  
  1235.         push    ds                              ; get hardware scroll flag
  1236.         mov     bx, _DATA
  1237.         mov     ds, bx
  1238.         mov     bx, ds:HardwareScroll
  1239.         pop     ds
  1240.  
  1241.         .if     <bx                ne PROTECT_HS_OFF > and
  1242.         .if     <[bp].leftscroll   eq 0              > and
  1243.         .if     <[bp].rightscroll  eq ax             > and
  1244.         .if     <[bp].leftdest     eq 0              > and
  1245.         .if     <[bp].rightdest    eq ax             > and
  1246.         .if     <[bp].bottomdest   eq SCREEN_HEIGHT-2> and
  1247.         .if     <[bp].topscroll    eq 0              >
  1248.             call    ATLAS_DnRightRHard
  1249.         .else
  1250.             call    ATLAS_DnRightRSoft
  1251.         .endif
  1252.         ret
  1253.  
  1254. ATLAS_DnRightR  endp
  1255.  
  1256. ;********************** START OF SPECIFICATIONS *************************
  1257. ;*                                                                      *
  1258. ;* SUBROUTINE NAME:     ATLAS_DnRightRHard                              *
  1259. ;*                                                                      *
  1260. ;* DESCRIPTIVE NAME:    Video device handler Scroll Down/Right          *
  1261. ;*                      Move a one line by hardware.                    *
  1262. ;*                                                                      *
  1263. ;* INPUT:                                                               *
  1264. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)      *
  1265. ;* DS:SI  --->  Source Buffer Address           (see XGASCROL.ASM)      *
  1266. ;* ES:DI  --->  PVB Address                     (see XGASCROL.ASM)      *
  1267. ;* CX     --->  Words (Cell) to be moved        (see XGASCROL.ASM)      *
  1268. ;* Flag   --->  CLD                             (see XGASCROL.ASM)      *
  1269. ;*                                                                      *
  1270. ;********************** END OF SPECIFICATIONS ***************************
  1271. ATLAS_DnRightRHard   proc
  1272.         public  ATLAS_DnRightRHard
  1273.  
  1274.         call    HideCursor                  ; hide cursor
  1275.  
  1276.         ; scroll shadow buffer
  1277.  
  1278.         mov     si, [bp].PVBMoveSrcOff      ; setup shadow buffer src/dst ptrs
  1279.         mov     di, [bp].PVBMoveDestOff
  1280.  
  1281.         mov     ax,[bp].PVBMoveCount        ; get move bytes
  1282.         shr     ax, 1
  1283.         mul     [bp].RowsToMove             ; setup row loop counter
  1284.         mov     cx, ax
  1285.  
  1286.         mov     ax, _DATA                   ; setup shadow buf selector
  1287.         mov     ds, ax
  1288.         mov     es, ds:VideoBuffSel
  1289.         mov     ds, ds:VideoBuffSel
  1290.  
  1291.         add     si, shadow+2                ; adjust src/dst ptrs
  1292.         add     di, shadow+2
  1293.         rep     movsw                       ; Move Cells
  1294.  
  1295.         ; scroll APA
  1296.  
  1297.         call    SetupAPAMove                ; setup APA move mode
  1298.  
  1299.         mov     ax, _DATA                   ; setup DATA selector
  1300.         mov     ds, ax
  1301.         mov     ds, ds:VideoBuffSel
  1302.  
  1303.         mov     bx, ds:VGA_APAStart         ; get APA start address
  1304.  
  1305.         mov     ax, [bp].topdest            ; modify APA top address
  1306.         sub     ax, [bp].topscroll
  1307.         mov     dx, APA_WIDTH*FONT_HEIGHT
  1308.         mul     dx
  1309.         sub     ds:VGA_APAStart, ax
  1310.  
  1311.         push    ax                          ; set hardware APA start address
  1312.         push    bx
  1313.         mov     ax, ds:VGA_APAStart
  1314.         call    SetAPAStart
  1315.         pop     bx
  1316.         pop     ax
  1317.                                             ; move system reserved line
  1318.         mov     ds, [bp].PVB_SEL            ; setup APA selector
  1319.         mov     es, [bp].PVB_SEL
  1320.         mov     si, APA_WIDTH*FONT_HEIGHT*SCREEN_HEIGHT-1   ; setup src/dst ptrs
  1321.         add     si, bx
  1322.         mov     di, si
  1323.         sub     di, ax
  1324.  
  1325.         mov     cx, APA_WIDTH*FONT_HEIGHT   ;set move count
  1326.  
  1327.         rep     movsb                       ; move system reserved line
  1328.  
  1329.         call    ShowCursor                  ; show cursor
  1330.  
  1331.         ret
  1332.  
  1333. ATLAS_DnRightRHard  endp
  1334.  
  1335. ;********************** START OF SPECIFICATIONS *************************
  1336. ;*                                                                      *
  1337. ;* SUBROUTINE NAME:     ATLAS_DnRightRSoft                              *
  1338. ;*                                                                      *
  1339. ;* DESCRIPTIVE NAME:    Video device handler Scroll Down/Right          *
  1340. ;*                      Move a one line by software.                    *
  1341. ;*                                                                      *
  1342. ;* INPUT:                                                               *
  1343. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)      *
  1344. ;* DS:SI  --->  Source Buffer Address           (see XGASCROL.ASM)      *
  1345. ;* ES:DI  --->  LVB Address                     (see XGASCROL.ASM)      *
  1346. ;* CX     --->  Words (Cell) to be moved        (see XGASCROL.ASM)      *
  1347. ;* Flag   --->  STD                             (see XGASCROL.ASM)      *
  1348. ;*                                                                      *
  1349. ;********************** END OF SPECIFICATIONS ***************************
  1350. ATLAS_DnRightRSoft  proc
  1351.         public  ATLAS_DnRightRSoft
  1352.  
  1353.         call    HideCursor                  ; hide cursor
  1354.  
  1355.         call    SetupAPAWrite               ; setup APA write mode
  1356.  
  1357.         shl     [bp].Sub_PVBend, 1          ; adjust PVB buffer end
  1358.  
  1359.         mov     ax, _DATA                   ; setup DATA segment
  1360.         mov     ds, ax
  1361.         mov     ds, ds:VideoBuffSel
  1362.  
  1363.         mov     ax, [bp].APAMoveSrcOff      ; setup exchange offset
  1364.         add     ax, ds:VGA_APAStart
  1365.         mov     [bp].MoveSrcOff, ax
  1366.         mov     ax, [bp].APAMoveDestOff
  1367.         add     ax, ds:VGA_APAStart
  1368.         mov     [bp].MoveDestOff, ax
  1369.  
  1370.         mov     si, [bp].PVBMoveSrcOff      ; setup shadow buffer src/dst ptrs
  1371.         mov     di, [bp].PVBMoveDestOff
  1372.  
  1373.         mov     dx, [bp].RowsToMove         ; setup row loop counter
  1374.  
  1375. DnRightLoop:
  1376.         mov     ax, _DATA                   ; setup shadow buf selector
  1377.         mov     ds, ax
  1378.         mov     es, ds:VideoBuffSel
  1379.         mov     ds, ds:VideoBuffSel
  1380.  
  1381.         mov     [bp].MoveFlag, 0            ; clear dirty flag
  1382.  
  1383.         ; scroll shadow buffer first
  1384.  
  1385.         .if     <si lt [bp].Sub_PVBend> and ; 
  1386.         mov     al, ds:shadow[si+3]         ; Source head is DBCS 1st ?
  1387.         and     al, dbcsA1+dbcsA2           ; 
  1388.         .if     <al eq dbcsA1>              ; Overwrite DBCS
  1389.             mov     byte ptr ds:shadow[si  ], 20h        ; Fill Blank to first
  1390.             mov     byte ptr ds:shadow[si+4], 20h        ; Fill Blank to second
  1391.             mov     word ptr ds:shadow[si+2], EXTRA_ATTR ; reset flag
  1392.             mov     word ptr ds:shadow[si+6], EXTRA_ATTR ; reset flag
  1393.  
  1394.             mov     ah, byte ptr ds:shadow[si+1]         ; get back colors
  1395.             mov     al, byte ptr ds:shadow[si+5]
  1396.             and     ah, 0f0h                             ; mix two colors
  1397.             shr     al, 4
  1398.             or      al, ah
  1399.             mov     [bp].ColSrcHead, al                  ; save colors
  1400.             or      [bp].MoveFlag, SRC_HEAD              ; set dirty flag
  1401.         .endif                              ; 
  1402.  
  1403.         .if     <di lt [bp].Sub_PVBend> and ; 
  1404.         mov     al, ds:shadow[di+3]         ; Target head is DBCS 1st ?
  1405.         and     al, dbcsA1+dbcsA2           ; 
  1406.         .if     <al eq dbcsA1>              ; Overwrite DBCS 2nd
  1407.             mov     byte ptr ds:shadow[di+4], 20h        ; set space
  1408.             mov     word ptr ds:shadow[di+6], EXTRA_ATTR ; reset flag
  1409.  
  1410.             mov     al, byte ptr ds:shadow[di+5]         ; get back color
  1411.             shr     al, 4
  1412.             mov     [bp].ColDstHead, al                  ; save color
  1413.             or      [bp].MoveFlag, DST_HEAD              ; set dirty flag
  1414.         .endif                              ; 
  1415.  
  1416.         mov     cx,[bp].PVBMoveCount        ; get move bytes
  1417.         shr     cx,1                        ; convert bytes to words
  1418.         add     si, shadow+2                ; adjust src/dst ptrs
  1419.         add     di, shadow+2
  1420.         rep     movsw                       ; Move Cells
  1421.         sub     si, shadow+2                ; restore src/dst ptrs
  1422.         sub     di, shadow+2
  1423.  
  1424.         .if     <si ge 0> and
  1425.         mov     al, ds:shadow[si+3]         ; Source tail is DBCS 2nd ?
  1426.         and     al, dbcsA1+dbcsA2           ; 
  1427.         .if     <al eq dbcsA1>              ; Overwrite DBCS
  1428.             mov     byte ptr ds:shadow[si  ], 20h        ; Fill Blank to first
  1429.             mov     byte ptr ds:shadow[si+4], 20h        ; Fill Blank to second
  1430.             mov     word ptr ds:shadow[si+2], EXTRA_ATTR ; reset flag
  1431.             mov     word ptr ds:shadow[si+6], EXTRA_ATTR ; reset flag
  1432.             mov     byte ptr ds:shadow[di+4], 20h        ;Change Copied Byte to Space
  1433.             mov     word ptr ds:shadow[di+6], EXTRA_ATTR ;reset flag
  1434.  
  1435.             mov     ah, byte ptr ds:shadow[si+1]         ; get back colors
  1436.             mov     al, byte ptr ds:shadow[si+5]
  1437.             and     ah, 0f0h                             ; mix two colors
  1438.             shr     al, 4
  1439.             or      al, ah
  1440.             mov     [bp].ColSrcTail, al                  ; save colors
  1441.             mov     al, byte ptr ds:shadow[di+1]         ; get dest back color
  1442.             shr     al, 4
  1443.             mov     [bp].ColDstTail, al                  ; save dest color
  1444.             or      [bp].MoveFlag, SRC_TAIL              ; set dirty flag
  1445.         .endif                              ; 
  1446.  
  1447.         .if     <di ge 0> and
  1448.         mov     al, ds:shadow[di+3]         ; Target tail is DBCS 2nd ?
  1449.         and     al, dbcsA1+dbcsA2           ; 
  1450.         .if     <al eq dbcsA1>              ; Overwrite DBCS 1st
  1451.             mov     byte ptr ds:shadow[di  ], 20h        ; set space
  1452.             mov     word ptr ds:shadow[di+2], EXTRA_ATTR ; reset flag
  1453.  
  1454.             mov     al, byte ptr ds:shadow[di+1]         ; get back color
  1455.             shr     al, 4
  1456.             mov     [bp].ColDstTail, al                  ; save color
  1457.             or      [bp].MoveFlag, DST_TAIL              ; set dirty flag
  1458.         .endif                              ; 
  1459.  
  1460.         sub     si, [bp].PVBMoveSkip        ; skip PVB src/dst ptrs to next line
  1461.         sub     di, [bp].PVBMoveSkip        ; 
  1462.  
  1463.         xchg    si, [bp].MoveSrcOff         ; exchange src/dst ptr
  1464.         xchg    di, [bp].MoveDestOff        ; from PVB to APA
  1465.  
  1466.         ; scroll APA next
  1467.  
  1468.         ; process DBCS edges for APA
  1469.  
  1470.         mov     bx, ds:VGA_APAStart         ; get APA start address
  1471.         mov     ax, [bp].PVB_SEL            ; setup APA selector
  1472.         mov     ds, ax
  1473.         mov     es, ax
  1474.  
  1475.         mov     ah, 0ffh                    ; preset clear byte
  1476.  
  1477.         .if     <bit [bp].MoveFlag and SRC_HEAD> ; clear source head edge DBCS ?
  1478.  
  1479.             ; clear source head char
  1480.  
  1481.             mov     al, [bp].ColSrcHead     ; set clear color
  1482.             shr     al, 4
  1483.             call    SetClsColor
  1484.             mov     cx, FONT_HEIGHT         ; set loop counter
  1485. DRSrcHeadLoop1:
  1486.             mov     ds:[si], ah             ; clear char box
  1487.             sub     si, APA_WIDTH
  1488.             loop    DRSrcHeadLoop1
  1489.             add     si, FONT_HEIGHT*APA_WIDTH+1
  1490.  
  1491.             ; clear source head + 1 char
  1492.  
  1493.             mov     al, [bp].ColSrcHead     ; set clear color
  1494.             call    SetClsColor
  1495.             mov     cx, FONT_HEIGHT         ; set loop counter
  1496. DRSrcHeadLoop2:
  1497.             mov     ds:[si], ah             ; clear char box
  1498.             sub     si, APA_WIDTH
  1499.             loop    DRSrcHeadLoop2
  1500.             add     si, FONT_HEIGHT*APA_WIDTH-1
  1501.         .endif
  1502.  
  1503.         .if     <bit [bp].MoveFlag and DST_HEAD> ; clear dest   head edge DBCS ?
  1504.  
  1505.             ; clear destination head + 1 char
  1506.  
  1507.             mov     al, [bp].ColDstHead     ; set clear color
  1508.             call    SetClsColor
  1509.             mov     cx, FONT_HEIGHT         ; set loop counter
  1510.             inc     di
  1511. DRDstHeadLoop:
  1512.             mov     ds:[di], ah             ; clear char box
  1513.             sub     di, APA_WIDTH
  1514.             loop    DRDstHeadLoop
  1515.             add     di, FONT_HEIGHT*APA_WIDTH-1
  1516.         .endif
  1517.  
  1518.         ; move APA contents
  1519.  
  1520.         call    SetupAPAMove                ; setup APA move mode
  1521.  
  1522.         mov     bx, FONT_HEIGHT
  1523. DnRightAPALoop:
  1524.         mov     cx, [bp].APAMoveCount       ; move one line
  1525.         rep     movsb
  1526.         sub     si,[bp].APAMoveSkip         ; skip to next line
  1527.         sub     di,[bp].APAMoveSkip
  1528.  
  1529.         dec     bx                          ; loop
  1530.         jnz     DnRightAPALoop
  1531.  
  1532.         add     si, FONT_HEIGHT*APA_WIDTH   ; restore src/dst ptrs
  1533.         add     di, FONT_HEIGHT*APA_WIDTH
  1534.         sub     si, [bp].APAMoveCount       ; skip APA src/dst ptrs to the end
  1535.         sub     di, [bp].APAMoveCount       ; 
  1536.  
  1537.         call    SetupAPAWrite               ; setup APA write mode
  1538.  
  1539.         .if     <bit [bp].MoveFlag and SRC_TAIL> ; clear source tail edge DBCS ?
  1540.  
  1541.             ; clear source tail - 1 char
  1542.  
  1543.             mov     al, [bp].ColSrcTail     ; set clear color
  1544.             shr     al, 4
  1545.             call    SetClsColor
  1546.             mov     cx, FONT_HEIGHT         ; set loop counter
  1547. DRSrcTailLoop1:
  1548.             mov     ds:[si], ah             ; clear char box
  1549.             sub     si, APA_WIDTH
  1550.             loop    DRSrcTailLoop1
  1551.             add     si, FONT_HEIGHT*APA_WIDTH+1
  1552.  
  1553.             ; clear source tail char
  1554.  
  1555.             mov     al, [bp].ColSrcTail     ; set clear color
  1556.             call    SetClsColor
  1557.             mov     cx, FONT_HEIGHT         ; set loop counter
  1558. DRSrcTailLoop2:
  1559.             mov     ds:[si], ah             ; clear char box
  1560.             sub     si, APA_WIDTH
  1561.             loop    DRSrcTailLoop2
  1562.             add     si, FONT_HEIGHT*APA_WIDTH-1
  1563.  
  1564.             ; clear destination tail char
  1565.  
  1566.             mov     al, [bp].ColDstTail     ; set clear color
  1567.             call    SetClsColor
  1568.             mov     cx, FONT_HEIGHT         ; set loop counter
  1569.             inc     di
  1570. DRSrcTailLoop3:
  1571.             mov     ds:[di], ah             ; clear char box
  1572.             sub     di, APA_WIDTH
  1573.             loop    DRSrcTailLoop3
  1574.             add     di, FONT_HEIGHT*APA_WIDTH-1
  1575.         .endif
  1576.  
  1577.         .if     <bit [bp].MoveFlag and DST_TAIL> ; clear dest   tail edge DBCS ?
  1578.  
  1579.             ; clear destination tail - 1 char
  1580.  
  1581.             mov     al, [bp].ColDstTail     ; set clear color
  1582.             call    SetClsColor
  1583.             mov     cx, FONT_HEIGHT         ; set loop counter
  1584. DRDstTailLoop:
  1585.             mov     ds:[di], ah             ; clear char box
  1586.             sub     di, APA_WIDTH
  1587.             loop    DRDstTailLoop
  1588.             add     di, FONT_HEIGHT*APA_WIDTH
  1589.         .endif
  1590.  
  1591.         sub     si, [bp].APAMoveSkip        ; skip APA src/dst ptrs to next row
  1592.         sub     si, (FONT_HEIGHT-1)*APA_WIDTH
  1593.         sub     di, [bp].APAMoveSkip
  1594.         sub     di, (FONT_HEIGHT-1)*APA_WIDTH
  1595.  
  1596.         xchg    si, [bp].MoveSrcOff         ; exchange src/dst ptr
  1597.         xchg    di, [bp].MoveDestOff        ; from APA to PVB
  1598.  
  1599.         dec     dx                          ; dec loop counter
  1600.         jz      DnRightExit
  1601.         jmp     DnRightLoop                 ; continue to loop
  1602.  
  1603. DnRightExit:
  1604.         call    ShowCursor                  ; show cursor
  1605.  
  1606.         ret
  1607.  
  1608. ATLAS_DnRightRSoft  endp
  1609.  
  1610. ;********************** START OF SPECIFICATIONS *************************
  1611. ;*                                                                      *
  1612. ;* SUBROUTINE NAME:     ATLAS_CFillR                                    *
  1613. ;*                                                                      *
  1614. ;* DESCRIPTIVE NAME:    Update PVB for Filling Cell at Scrolling        *
  1615. ;*                      This is called per line.                        *
  1616. ;* INPUT:                                                               *
  1617. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)      *
  1618. ;* ES:DI  --->  PVB Address  ( B0000:0000 : DI Points To Attr1/2 )      *
  1619. ;* CX     --->  Length Bytes                                            *
  1620. ;* Flag   --->  CLD or STD                                              *
  1621. ;*                                                                      *
  1622. ;* INTERNAL REFERENCES: MonoToColor, FillWithSBCS                       *
  1623. ;*                                                                      *
  1624. ;* EXTERNAL REFERENCES: None                                            *
  1625. ;*                                                                      *
  1626. ;********************** END OF SPECIFICATIONS ***************************
  1627. ATLAS_CFillR proc
  1628.         public  ATLAS_CFillR
  1629.  
  1630.         ; get PVB format cell to fill in ax:char/attr0 & dx:attr1/attr2
  1631.  
  1632.         mov     ax,[bp].FillCellLow
  1633.         .if     <[bp].Sub_colors ne 0>      ; Color or Black&White
  1634.             mov     dx, EXTRA_ATTR          ; Clear
  1635.         .else                               ; Mono Mode
  1636.             call    MonoToColor
  1637.             mov     dx, bx
  1638.         .endif
  1639.  
  1640.         call    FillWithSBCS                ; call shadow & APA update routine
  1641.  
  1642.         ret
  1643.  
  1644. ATLAS_CFillR endp
  1645.  
  1646. ;;---------------------------------------------------------------------------
  1647. ;; Conversion Routine.                                              J-KK0901
  1648. ;; MONO Attribute ---> Atlas Color Attribute
  1649. ;;  Input  : AX - Char/Attr
  1650. ;;  Output : AX - Char/Attr and BX - Attr1/2
  1651. ;;---------------------------------------------------------------------------
  1652. MonoToColor proc near
  1653.         public  MonoToColor
  1654.  
  1655.         xor     bh, bh
  1656.         mov     bl, ah
  1657.         .if     < bl a 7fh >            ; Blink ?
  1658.             sub     bl, 80h
  1659.             shl     bx, 1
  1660.             add     bx, offset MonoToColor_Table
  1661.             mov     ah, byte ptr cs:[bx]
  1662.             mov     bl, byte ptr cs:[bx+1]
  1663.             .if     <bit <byte ptr [bp].Sub_Option> and BLINK_STATE> ;Blink State On
  1664.                 or      bl, ATLAS_BLINK ; Set blink in attr1
  1665.             .else
  1666.                 or      ah, 80h         ; Set high intensity bit
  1667.             .endif
  1668.         .else
  1669.             shl     bx, 1
  1670.             add     bx, offset MonoToColor_Table
  1671.             mov     ah, byte ptr cs:[bx]
  1672.             mov     bl, byte ptr cs:[bx+1]
  1673.         .endif
  1674.         mov     bh, EXTRA_ATTR shr 8
  1675.  
  1676.         ret
  1677. MonoToColor endp
  1678.  
  1679. MonoToColor_Table:
  1680.         db      0,0                     ;0      Non Display
  1681.         db      07h,40h                 ;1      UnderLine
  1682.         db      07h,0                   ;2      Normal
  1683.         db      07h,0                   ;3      Normal
  1684.         db      07h,0                   ;4      Normal
  1685.         db      07h,0                   ;5      Normal
  1686.         db      07h,0                   ;6      Normal
  1687.         db      07h,0                   ;7      Normal
  1688.         db      0,0                     ;8      Non Display
  1689.         db      0fh,40h                 ;9      H-Int and Under
  1690.         db      0fh,0                   ;a      H-Int
  1691.         db      0fh,0                   ;b      H-Int
  1692.         db      0fh,0                   ;c      H-Int
  1693.         db      0fh,0                   ;d      H-Int
  1694.         db      0fh,0                   ;e      H-Int
  1695.         db      0fh,0                   ;f      H-Int
  1696.  
  1697.         db      070h,0                  ;10     Normal
  1698.         db      077h,40h                ;11     Under
  1699.         db      077h,0                  ;12     Normal
  1700.         db      077h,0                  ;13     Normal
  1701.         db      077h,0                  ;14     Normal
  1702.         db      077h,0                  ;15     Normal
  1703.         db      077h,0                  ;16     Normal
  1704.         db      077h,0                  ;17     Normal
  1705.         db      070h,0                  ;18     H-Int
  1706.         db      07fh,00h                ;19     H-Int & Under          J-KK1004
  1707.         db      07fh,0                  ;1a     H-Int
  1708.         db      07fh,0                  ;1b     H-Int
  1709.         db      07fh,0                  ;1c     H-Int
  1710.         db      07fh,0                  ;1d     H-Int
  1711.         db      07fh,0                  ;1e     H-Int
  1712.         db      07fh,0                  ;1f     H-Int
  1713.  
  1714.         db      070h,0                  ;20     Normal
  1715.         db      077h,40h                ;21     Under
  1716.         db      077h,0                  ;22     Normal
  1717.         db      077h,0                  ;23     Normal
  1718.         db      077h,0                  ;24     Normal
  1719.         db      077h,0                  ;25     Normal
  1720.         db      077h,0                  ;26     Normal
  1721.         db      077h,0                  ;27     Normal
  1722.         db      070h,0                  ;28     H-Int
  1723.         db      07fh,00h                ;29     H-Int & Under          J-KK1004
  1724.         db      07fh,0                  ;2a     H-Int
  1725.         db      07fh,0                  ;2b     H-Int
  1726.         db      07fh,0                  ;2c     H-Int
  1727.         db      07fh,0                  ;2d     H-Int
  1728.         db      07fh,0                  ;2e     H-Int
  1729.         db      07fh,0                  ;2f     H-Int
  1730.  
  1731.         db      070h,0                  ;30     Normal
  1732.         db      077h,40h                ;31     Under
  1733.         db      077h,0                  ;32     Normal
  1734.         db      077h,0                  ;33     Normal
  1735.         db      077h,0                  ;34     Normal
  1736.         db      077h,0                  ;35     Normal
  1737.         db      077h,0                  ;36     Normal
  1738.         db      077h,0                  ;37     Normal
  1739.         db      070h,0                  ;38     H-Int
  1740.         db      07fh,00h                ;39     H-Int & Under          J-KK1004
  1741.         db      07fh,0                  ;3a     H-Int
  1742.         db      07fh,0                  ;3b     H-Int
  1743.         db      07fh,0                  ;3c     H-Int
  1744.         db      07fh,0                  ;3d     H-Int
  1745.         db      07fh,0                  ;3e     H-Int
  1746.         db      07fh,0                  ;3f     H-Int
  1747.  
  1748.         db      070h,0                  ;40     Normal
  1749.         db      077h,40h                ;41     Under
  1750.         db      077h,0                  ;42     Normal
  1751.         db      077h,0                  ;43     Normal
  1752.         db      077h,0                  ;44     Normal
  1753.         db      077h,0                  ;45     Normal
  1754.         db      077h,0                  ;46     Normal
  1755.         db      077h,0                  ;47     Normal
  1756.         db      070h,0                  ;48     H-Int
  1757.         db      07fh,00h                ;49     H-Int & Under          J-KK1004
  1758.         db      07fh,0                  ;4a     H-Int
  1759.         db      07fh,0                  ;4b     H-Int
  1760.         db      07fh,0                  ;4c     H-Int
  1761.         db      07fh,0                  ;4d     H-Int
  1762.         db      07fh,0                  ;4e     H-Int
  1763.         db      07fh,0                  ;4f     H-Int
  1764.  
  1765.         db      070h,0                  ;50     Normal
  1766.         db      077h,40h                ;51     Under
  1767.         db      077h,0                  ;52     Normal
  1768.         db      077h,0                  ;53     Normal
  1769.         db      077h,0                  ;54     Normal
  1770.         db      077h,0                  ;55     Normal
  1771.         db      077h,0                  ;56     Normal
  1772.         db      077h,0                  ;57     Normal
  1773.         db      070h,0                  ;58     H-Int
  1774.         db      07fh,00h                ;59     H-Int & Under          J-KK1004
  1775.         db      07fh,0                  ;5a     H-Int
  1776.         db      07fh,0                  ;5b     H-Int
  1777.         db      07fh,0                  ;5c     H-Int
  1778.         db      07fh,0                  ;5d     H-Int
  1779.         db      07fh,0                  ;5e     H-Int
  1780.         db      07fh,0                  ;5f     H-Int
  1781.  
  1782.         db      070h,0                  ;60     Normal
  1783.         db      077h,40h                ;61     Under
  1784.         db      077h,0                  ;62     Normal
  1785.         db      077h,0                  ;63     Normal
  1786.         db      077h,0                  ;64     Normal
  1787.         db      077h,0                  ;65     Normal
  1788.         db      077h,0                  ;66     Normal
  1789.         db      077h,0                  ;67     Normal
  1790.         db      070h,0                  ;68     H-Int
  1791.         db      07fh,00h                ;69     H-Int & Under          J-KK1004
  1792.         db      07fh,0                  ;6a     H-Int
  1793.         db      07fh,0                  ;6b     H-Int
  1794.         db      07fh,0                  ;6c     H-Int
  1795.         db      07fh,0                  ;6d     H-Int
  1796.         db      07fh,0                  ;6e     H-Int
  1797.         db      07fh,0                  ;6f     H-Int
  1798.  
  1799.         db      070h,0                  ;70     Reverse
  1800.         db      77h,40h                 ;71     Under
  1801.         db      77h,0                   ;72     Normal
  1802.         db      77h,0                   ;73     Normal
  1803.         db      77h,0                   ;74     Normal
  1804.         db      77h,0                   ;75     Normal
  1805.         db      77h,0                   ;76     Normal
  1806.         db      77h,0                   ;77     Normal
  1807.         db      070h,0                  ;78     Reverse
  1808.         db      07fh,00h                ;79     H-Int & Under          J-KK1004
  1809.         db      07fh,0                  ;7a     H-Int
  1810.         db      07fh,0                  ;7b     H-Int
  1811.         db      07fh,0                  ;7c     H-Int
  1812.         db      07fh,0                  ;7d     H-Int
  1813.         db      07fh,0                  ;7e     H-Int
  1814.         db      07fh,0                  ;7f     H-Int
  1815.  
  1816. ;********************** START OF SPECIFICATIONS *************************
  1817. ;*                                                                      *
  1818. ;* SUBROUTINE NAME:     FillWithSBCS                                    *
  1819. ;*                                                                      *
  1820. ;* DESCRIPTIVE NAME:    Update Shadow & APA with SBCS character &       *
  1821. ;*                      ATLAS 3byte attributes.                         *
  1822. ;* INPUT:                                                               *
  1823. ;* AX     = char/attr0                                                  *
  1824. ;* DX     = attr1/attr2                                                 *
  1825. ;*                                                                      *
  1826. ;* INTERNAL REFERENCES: FontGetSBCS                                     *
  1827. ;*                                                                      *
  1828. ;* EXTERNAL REFERENCES: ShowCursor, HideCursor, SetupAPAWrite,          *
  1829. ;*                      SetAPAColor                                     *
  1830. ;*                                                                      *
  1831. ;********************** END OF SPECIFICATIONS ***************************
  1832. FillWithSBCS proc
  1833.         public  FillWithSBCS
  1834.  
  1835.         call    HideCursor                  ; hide cursor
  1836.  
  1837.         ; setup shadow buffer & APA access
  1838.  
  1839.         mov     cx, _DATA                   ; setup shadow buffer segment
  1840.         mov     ds, cx
  1841.         mov     ds, ds:VideoBuffSel
  1842.         mov     si, [bp].PVBFillOff         ; setup offset
  1843.         add     si, shadow
  1844.  
  1845.         mov     es, [bp].PVB_SEL            ; setup target APA selector
  1846.         mov     di, ds:VGA_APAStart         ; 
  1847.         add     di, [bp].APAFillOff         ; setup target APA offset
  1848.  
  1849.         push    ax
  1850.         push    dx
  1851.         push    si
  1852.         push    di
  1853.  
  1854.         call    SetupAPAWrite               ; setup APA write mode
  1855.  
  1856.         ; process fill area edge DBCS
  1857.  
  1858.         mov     bx, [bp].RowsToFill         ; setup row loop counter
  1859.  
  1860. FillEdgeLoop0:
  1861.         mov     al, ds:[si+3]
  1862.         and     al, dbcsA1+dbcsA2
  1863.         .if     <al eq dbcsA1+dbcsA2>       ; line head is DBCS 2nd ?
  1864.             mov     byte ptr ds:[si-4], ' ' ; Fill Blank to first
  1865.             mov     word ptr ds:[si-2], EXTRA_ATTR  ; reset flag
  1866.             mov     al, ds:[si-3]           ; clear APA
  1867.             dec     di
  1868.             call    SetAPAColor
  1869.             xor     al, al
  1870.             mov     cx, FONT_HEIGHT
  1871. FillEdgeLoop1:
  1872.             stosb
  1873.             add     di, APA_WIDTH-1
  1874.             loop    FillEdgeLoop1
  1875.             sub     di, APA_WIDTH*FONT_HEIGHT-1
  1876.         .endif
  1877.  
  1878.         mov     cx, [bp].PVBFillCount       ; skip to line end
  1879.         add     si, cx
  1880.         push    di
  1881.         shr     cx, 2
  1882.         add     di, cx
  1883.  
  1884.         mov     al, ds:[si-1]
  1885.         and     al, dbcsA1+dbcsA2
  1886.         .if     <al eq dbcsA1>              ; line tail is DBCS 1st ?
  1887.             mov     byte ptr ds:[si  ], ' ' ; Fill Blank to second
  1888.             mov     word ptr ds:[si+2], EXTRA_ATTR  ; reset flag
  1889.             mov     al, ds:[si+1]           ; clear APA
  1890.             call    SetAPAColor
  1891.             xor     al, al
  1892.             mov     cx, FONT_HEIGHT
  1893. FillEdgeLoop2:
  1894.             stosb
  1895.             add     di, APA_WIDTH-1
  1896.             loop    FillEdgeLoop2
  1897.             sub     di, APA_WIDTH*FONT_HEIGHT
  1898.         .endif
  1899.  
  1900.         add     si, [bp].PVBFillSkip        ; skip to next row
  1901.         pop     di
  1902.         add     di, APA_WIDTH*FONT_HEIGHT
  1903.  
  1904.         dec     bx                          ; dec row loop counter
  1905.         jnz     FillEdgeLoop0
  1906.  
  1907.         pop     di
  1908.         pop     si
  1909.         pop     dx
  1910.         pop     ax
  1911.  
  1912.         ; fill PVB (shadow buffer) with AX:DX
  1913.  
  1914.         mov     bx, [bp].RowsToFill         ; setup row loop counter
  1915.  
  1916. FillLoop1:
  1917.         mov     cx, [bp].PVBFillCount       ; setup column counter
  1918.         shr     cx, 2                       ; convert from byte to cell
  1919.  
  1920. FillLoop2:
  1921.         mov     ds:[si  ], ax               ; fill one cell
  1922.         mov     ds:[si+2], dx
  1923.         add     si, 4
  1924.         loop    FillLoop2                   ; continue to loop
  1925.  
  1926.         add     si, [bp].PVBFillSkip        ; skip to next row
  1927.         dec     bx                          ; dec row loop counter
  1928.         jnz     FillLoop1                   ; continue to loop
  1929.  
  1930.         ; First, fill with font image & underline
  1931.  
  1932.         push    dx                          ; save attr1/attr2
  1933.  
  1934.         ; get font image to fill in APA
  1935.  
  1936.         push    ax                          ; save char/attr0
  1937.         mov     ah, dh                      ; get SBCS font
  1938.         call    FontGetSBCS
  1939.         pop     ax                          ; restore char/attr0
  1940.  
  1941.         pop     dx                          ; restore attr1/attr2
  1942.         push    dx                          ; save attr1/attr2
  1943.  
  1944.         .if     <bit dl and A_UNDERLINE_BIT> ; prepare underline processing
  1945.             mov     bh, 0ffh
  1946.         .else
  1947.             mov     bh, ds:[si+FONT_HEIGHT-1]
  1948.         .endif
  1949.  
  1950.         ; setup APA write
  1951.  
  1952.         mov     al, ah                      ; set APA write color
  1953.         call    SetAPAColor
  1954.  
  1955.         mov     dx, [bp].RowsToFill         ; setup row counter
  1956.  
  1957.         ; process font image
  1958.  
  1959. FillLoop3:
  1960.         push    si                          ; save font top ptr
  1961.         mov     bl, FONT_HEIGHT-1           ; setup font height loop counter
  1962.  
  1963. FillLoop4:
  1964.         mov     cx, [bp].APAFillCount       ; setup one line counter
  1965.  
  1966.         lodsb                               ; get one line font
  1967.         rep     stosb                       ; store one line font
  1968.  
  1969.         add     di, [bp].APAFillSkip        ; skip to next line
  1970.         dec     bl                          ; dec font hight loop counter
  1971.         jnz     FillLoop4                   ; continue to loop
  1972.  
  1973.         ; process underline
  1974.  
  1975.         mov     cx, [bp].APAFillCount       ; setup one line counter
  1976.         mov     al, bh                      ; get lowermost line
  1977.         rep     stosb                       ; store it
  1978.         add     di, [bp].APAFillSkip        ; skip to next line
  1979.  
  1980.         pop     si                          ; restore font top ptr
  1981.         dec     dx                          ; dec row counter
  1982.         jnz     FillLoop3                   ; continue to loop
  1983.  
  1984.         pop     bx                          ; restore attr1/attr2
  1985.         mov     bh, bl                      ; save attr1 to bh
  1986.  
  1987.         ; Second, draw horizontal & vertical grid
  1988.  
  1989.         .if     <bit bh and A_VERT_BIT+A_HORZ_BIT>  ; grid on ?
  1990.  
  1991.             mov     ax, _DATA               ; setup global data segment
  1992.             mov     ds, ax
  1993.             mov     ds, ds:VideoBuffSel
  1994.  
  1995.             mov     di, [bp].APAFillOff     ; setup target APA offset
  1996.             add     di, ds:VGA_APAStart
  1997.  
  1998.             mov     al, ds:VGA_GridColor    ; set grid color
  1999.             call    SetGridColor
  2000.  
  2001.             mov     dx, [bp].RowsToFill     ; setup row counter
  2002.  
  2003. FillLoop5:
  2004.  
  2005.             ; process horizontal grid
  2006.  
  2007.             .if     <bit bh and A_HORZ_BIT> ; horizontal grid on ?
  2008.                 push    di                  ; save APA pointer
  2009.                 mov     al, 0ffh            ; setup grid pattern
  2010.                 mov     cx, [bp].APAFillCount ; setup one line counter
  2011.                 rep     stosb               ; store horizontal grid
  2012.                 pop     di                  ; restore APA pointer
  2013.             .endif
  2014.  
  2015.             ; process vertical grid
  2016.  
  2017.             .if     <bit bh and A_VERT_BIT> ; vertical grid on ?
  2018.  
  2019.                 mov     al, 080h            ; setup grid pattern
  2020.                 mov     bl, FONT_HEIGHT     ; setup font height loop counter
  2021.  
  2022. FillLoop6:
  2023.                 mov     cx, [bp].APAFillCount ; setup one line counter
  2024.  
  2025. FillLoop7:
  2026.                 mov     ah, es:[di]         ; get current image into comp reg.
  2027.                 stosb                       ; draw grid
  2028.                 loop    FillLoop7
  2029.  
  2030.                 add     di, [bp].APAFillSkip ; skip to next line
  2031.                 dec     bl                  ; dec font hight loop counter
  2032.                 jnz     FillLoop6           ; continue to loop
  2033.             .else
  2034.                 add     di, FONT_HEIGHT*APA_WIDTH ; skip to next line
  2035.             .endif
  2036.  
  2037.             dec     dx                      ; dec row counter
  2038.             jnz     FillLoop5               ; continue to loop
  2039.         .endif
  2040.  
  2041.         call    ShowCursor                  ; show cursor
  2042.  
  2043.         ret
  2044.  
  2045. FillWithSBCS endp
  2046.  
  2047. ;********************** START OF SPECIFICATIONS *************************
  2048. ;*                                                                      *
  2049. ;*   Store the start and end offset of the updated buffer      J-KK1017 *
  2050. ;*                                                                      *
  2051. ;*   Input   :  [bp].Sub_cols     - Cols                                *
  2052. ;*              [bp].Sub_offset   - Start Offset                        *
  2053. ;*              DI                - End Offset + 2 or 4        J-KK0205 *
  2054. ;*              AL = 1 or 2       - 1: 2 bytes cell or 2: 4 bytes cell  *
  2055. ;*                                                                      *
  2056. ;*   Output  :  [bp].XVS_StartRow                                       *
  2057. ;*              [bp].XVS_EndRow                                         *
  2058. ;********************** END OF SPECIFICATIONS ***************************
  2059. Set_StartEndRow proc near
  2060.         public  Set_StartEndRow
  2061.  
  2062.         push    cx                      ; 
  2063.         push    dx                      ; 
  2064.         push    di                      ;                               J-KK0205
  2065.         xor     ah, ah                  ;                               J-KK0205
  2066.         sub     di, ax                  ; Adjust End Offset             J-KK0205
  2067.         sub     di, ax                  ;                               J-KK0205
  2068.  
  2069.         mov     cl, al                  ; 
  2070.         mov     ax, [bp].Sub_cols       ; 
  2071.         shl     ax, cl                  ; X2 or X4
  2072.         mov     cx, ax                  ; 
  2073.  
  2074.         mov     ax, [bp].Sub_offset     ; 
  2075.         xor     dx, dx                  ; 
  2076.         div     cx                      ; 
  2077.         mov     [bp].XVS_StartRow, ax   ; 
  2078.         mov     ax, di                  ; 
  2079.         xor     dx, dx                  ; 
  2080.         div     cx                      ; 
  2081.         mov     [bp].XVS_EndRow, ax     ; 
  2082.  
  2083.         pop     di                      ;                               J-KK0205
  2084.         pop     dx                      ; 
  2085.         pop     cx                      ; 
  2086.         ret
  2087. Set_StartEndRow endp
  2088.  
  2089.  
  2090. ;********************** START OF SPECIFICATIONS *************************
  2091. ;*                                                                      *
  2092. ;* SUBROUTINE NAME:     UpdateCARegenB                          j-ys1106*
  2093. ;*                                                                      *
  2094. ;* DESCRIPTIVE NAME:    Call a Update Regen (PVB) routine for CA        *
  2095. ;*                                                                      *
  2096. ;* INPUT:                                                               *
  2097. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)      *
  2098. ;* ES:DI  --->  LVB Address                     (see XGAWRITE.ASM)      *
  2099. ;*                                                                      *
  2100. ;* INTERNAL REFERENCES: UpdateRegenB                                    *
  2101. ;*                                                                      *
  2102. ;* EXTERNAL REFERENCES: None                                            *
  2103. ;*                                                                      *
  2104. ;********************** END OF SPECIFICATIONS ***************************
  2105. UpdateCARegenB proc near
  2106.         public  UpdateCARegenB
  2107.  
  2108.         call    UpdateRegenB
  2109.  
  2110.         ret
  2111. UpdateCARegenB endp
  2112.  
  2113. ;********************** START OF SPECIFICATIONS *************************
  2114. ;*                                                                      *
  2115. ;* SUBROUTINE NAME:     UpdateCAAttrB                                   *
  2116. ;*                                                                      *
  2117. ;* DESCRIPTIVE NAME:    Call a Update Regen (PVB) routine for Attribute *
  2118. ;*                         for CA                                       *
  2119. ;* INPUT:                                                               *
  2120. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)      *
  2121. ;* ES:DI  --->  LVB Address                     (see XGAWRITE.ASM)      *
  2122. ;*                                                                      *
  2123. ;* INTERNAL REFERENCES: UpdateRegenB                                    *
  2124. ;*                                                                      *
  2125. ;* EXTERNAL REFERENCES: None                                            *
  2126. ;*                                                                      *
  2127. ;********************** END OF SPECIFICATIONS ***************************
  2128. UpdateCAAttrB proc near
  2129.         public  UpdateCAAttrB
  2130.  
  2131.         call    UpdateRegenB
  2132.  
  2133.         ret
  2134. UpdateCAAttrB endp
  2135.  
  2136. ;********************** START OF SPECIFICATIONS *************************
  2137. ;*                                                                      *
  2138. ;* SUBROUTINE NAME:     ATLAS_LVBrecttoPVB                              *
  2139. ;*                                                                      *
  2140. ;* DESCRIPTIVE NAME:    Call a Update Regen (PVB) routine from LVB      *
  2141. ;*                      For DBCS VGA mode.                              *
  2142. ;*                                                                      *
  2143. ;* INPUT:                                                               *
  2144. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)      *
  2145. ;* ES:DI  --->  LVB Address                     (see XGAWRITE.ASM)      *
  2146. ;*                                                                      *
  2147. ;* INTERNAL REFERENCES: ShowCursor, HideCursor, SetupAPAWrite           *
  2148. ;*                                                                      *
  2149. ;* EXTERNAL REFERENCES: UpdateRegenOneLineB                             *
  2150. ;*                                                                      *
  2151. ;********************** END OF SPECIFICATIONS ***************************
  2152. ATLAS_LVBrecttoPVB proc
  2153. public  ATLAS_LVBrecttoPVB
  2154.  
  2155.         call    HideCursor                  ; hide cursor
  2156.  
  2157.         call    SetupAPAWrite               ; setup APA write mode
  2158.         mov     [bp].APAPrevColor, -1       ; reset preset color
  2159.  
  2160.         mov     ds, [bp].LVB_SEL            ; setup selectors
  2161.         mov     ax, _DATA
  2162.         mov     es, ax
  2163.         mov     es, es:VideoBuffSel
  2164.  
  2165.         mov     si,[bp].LVBFillOff          ; setup ofsets
  2166.         mov     di,[bp].PVBFillOff
  2167.  
  2168.         shl     [bp].Sub_PVBend, 1          ; adjust PVB buffer end
  2169.  
  2170.         mov     dx,[bp].RowsToFill          ; set row loop counter
  2171.  
  2172. ATLASLPLoop:
  2173.         mov     cx,[bp].LVBFillCount        ; set column counter
  2174.         shr     cx, 1                                                   ;J-TS100391
  2175.  
  2176.         mov     bx, [bp].LVBFillCount
  2177.         add     bx, si
  2178.         .if     <bit [bp].Sub_option and f_restfromlvb>                 ;J-TS113092
  2179.             .if     <bx b [bp].Sub_Buffsize> and ; last char is DBCS 1st ?
  2180. ;J-TS011492        mov     al, byte ptr ds:[bx+1+TOEXT]
  2181.             mov     al, byte ptr ds:[bx+1+TOEXT-2]                      ;J-TS011492
  2182.             and     al, dbcsA1+dbcsA2
  2183.             .if     <al e dbcsA1>
  2184.                 inc     cx                  ; include DBCS 2nd
  2185.                 or      [bp].Sub_Option, f_end_adjust ; set adjust flag
  2186.             .endif
  2187.  
  2188.             .if     <si ge 2> and           ; first char is DBCS 2nd ?
  2189.             mov     al, byte ptr ds:[si+1+TOEXT]
  2190.             and     al, dbcsA1+dbcsA2
  2191.             .if     <al e dbcsA1+dbcsA2>
  2192.                 sub     si, 2               ; include DBCS 1st
  2193.                 sub     di, 4
  2194.                 inc     cx
  2195.             .endif
  2196.         .endif                                                          ;J-TS113092
  2197.  
  2198.         push    dx                                                      ;J-TS100391
  2199.         call    UpdateRegenOneLineB         ; update one line
  2200.         pop     dx                                                      ;J-TS100391
  2201.                                                                         ;J-TS100391
  2202.         add     si, [bp].LVBFillSkip        ; skip to next line         ;J-TS100391
  2203.         add     di, [bp].PVBFillSkip                                    ;J-TS100391
  2204.                                                                         ;J-TS100391
  2205.         .if     <bit [bp].Sub_option and f_restfromlvb> and             ;J-TS113092
  2206.         .if     <bit [bp].Sub_Option and f_end_adjust>
  2207.             sub     si, 2                   ; adjust ptrs
  2208.             sub     di, 4                   ; 
  2209.             and     [bp].Sub_Option, not f_end_adjust ; clear adjust flag
  2210.         .endif
  2211.  
  2212.         dec     dx                                                      ;J-TS100391
  2213.         jnz     ATLASLPLoop                                             ;J-TS100391
  2214.  
  2215.         call    ShowCursor                  ; show cursor
  2216.  
  2217.         ret
  2218.  
  2219. ATLAS_LVBrecttoPVB endp
  2220.  
  2221. ATLAS_CArecttoPVB   proc
  2222.         public  ATLAS_CArecttoPVB
  2223.         ret
  2224. ATLAS_CArecttoPVB   endp
  2225.  
  2226. ;********************** START OF SPECIFICATIONS *************************
  2227. ;*                                                                      *
  2228. ;* SUBROUTINE NAME:     FontGetSBCS                                     *
  2229. ;*                                                                      *
  2230. ;* DESCRIPTIVE NAME:    Get font image buffer address of SBCS.          *
  2231. ;*                                                                      *
  2232. ;* INPUT:                                                               *
  2233. ;* AL           Character Code                                          *
  2234. ;* AH           SBCS character set (attr2 of ATLAS 3byte format)        *
  2235. ;*                                                                      *
  2236. ;* OUTPUT                                                               *
  2237. ;* DS:SI  --->  Font Image buffer                                       *
  2238. ;*                                                                      *
  2239. ;* INTERNAL REFERENCES: None                                            *
  2240. ;*                                                                      *
  2241. ;* EXTERNAL REFERENCES: None                                            *
  2242. ;*                                                                      *
  2243. ;********************** END OF SPECIFICATIONS ***************************
  2244. FontGetSBCS proc    near
  2245.         public  FontGetSBCS
  2246.  
  2247.         mov     si, _DATA                   ; set font buffer selector
  2248.         mov     ds, si                      ; calc font buffer offset
  2249.         mov     ds, ds:VideoBuffSel
  2250.  
  2251.         and     ah, SBCS_TYPE_MASK          ; get SBCS font type
  2252.         .if     <ah eq TypeF>               ; extra SBCS
  2253.             mov     si, VGA_ExtensionFont.VGA_FontImage
  2254.         .else                               ; base SBCS
  2255.             mov     si, VGA_BaseFont.VGA_FontImage
  2256.         .endif
  2257.         xor     ah, ah                      ; CharCode
  2258.         add     si, ax                      ; offset = image + CharCode * 1
  2259.         shl     ax, 1                       ; CharCode * 2
  2260.         add     si, ax                      ; offset = image + CharCode * 3
  2261.         shl     ax, 3                       ; CharCode * 16
  2262.         add     si, ax                      ; offset = image + CharCode * 19
  2263.         ret
  2264. FontGetSBCS endp
  2265.  
  2266. ;********************** START OF SPECIFICATIONS *************************
  2267. ;*                                                                      *
  2268. ;* SUBROUTINE NAME:     FontGetDBCS                                     *
  2269. ;*                                                                      *
  2270. ;* DESCRIPTIVE NAME:    Get font image buffer address of DBCS.          *
  2271. ;*                                                                      *
  2272. ;* INPUT:                                                               *
  2273. ;* AX           Character Code                                          *
  2274. ;*                                                                      *
  2275. ;* OUTPUT                                                               *
  2276. ;* DS:SI  --->  Font Image buffer                                       *
  2277. ;*                                                                      *
  2278. ;* INTERNAL REFERENCES: None                                            *
  2279. ;*                                                                      *
  2280. ;* EXTERNAL REFERENCES: _FONTGET                                        *
  2281. ;*                                                                      *
  2282. ;********************** END OF SPECIFICATIONS ***************************
  2283. FontGetDBCS proc    near
  2284.         public  FontGetDBCS
  2285.  
  2286.         pusha                               ; save all registers
  2287.         push    es
  2288.  
  2289.         mov     [bp].DBCSGetStrucLen, 6     ; setup structure
  2290.         push    ax                          ; push character code
  2291.         push    ss                          ; push font buffer pointer address
  2292.         lea     si, [bp].DBCSGetStrucLen
  2293.         push    si
  2294.         call    FNTGETIMAGEADDR             ; get font image
  2295.  
  2296.         pop     es                          ; restore all registers
  2297.         popa
  2298.  
  2299.         lds     si, [bp].DBCSFont           ; get font address
  2300.         ret
  2301. FontGetDBCS endp
  2302.  
  2303. ;********************** START OF SPECIFICATIONS *************************
  2304. ;*                                                                      *
  2305. ;* SUBROUTINE NAME:     CLEARSHADOWAPA                                  *
  2306. ;*                                                                      *
  2307. ;* DESCRIPTIVE NAME:    Clear shadow buffer & APA.                      *
  2308. ;*                                                                      *
  2309. ;* INPUT:  None                                                         *
  2310. ;* OUTPUT: None                                                         *
  2311. ;*                                                                      *
  2312. ;* INTERNAL REFERENCES: None                                            *
  2313. ;*                                                                      *
  2314. ;* EXTERNAL REFERENCES: SetupAPAWrite                                   *
  2315. ;*                                                                      *
  2316. ;********************** END OF SPECIFICATIONS ***************************
  2317. CLEARSHADOWAPA  proc    near
  2318.         public  CLEARSHADOWAPA
  2319.  
  2320.         push    bp
  2321.         mov     bp, sp
  2322.         pusha
  2323.  
  2324.         ; clear APA
  2325.  
  2326.         call    SetupAPAWrite               ; setup APA write mode
  2327.  
  2328.         mov     es, [bp+4]                  ; setup APA pointer
  2329.         xor     di, di
  2330.         mov     al, 0                       ; set write color black
  2331.         call    SetClsColor
  2332.         mov     cx, 8000h                   ; set loop counter
  2333.         mov     ax, 0ffffh
  2334.         rep     stosw                       ; clear APA
  2335.  
  2336.         ; clear shadow buffer
  2337.  
  2338.         mov     ax, _DATA                   ; setup shadow buffer pointer
  2339.         mov     es, ax
  2340.         mov     es, es:VideoBuffSel
  2341.         mov     di, shadow
  2342.         mov     cx, SHADOW_LENGTH/4         ; set loop counter
  2343.  
  2344. ClearShadowAPALoop:
  2345.         mov     word ptr es:[di], 0720h     ; clear char/attr0
  2346.         add     di, 2
  2347.         mov     word ptr es:[di], EXTRA_ATTR+CHANGE_BIT ; clear attr1/attr2
  2348.         add     di, 2
  2349.         loop    ClearShadowAPALoop
  2350.  
  2351.         popa
  2352.         pop     bp
  2353.         ret     2
  2354.  
  2355. CLEARSHADOWAPA  endp
  2356.  
  2357. ;********************** START OF SPECIFICATIONS *************************
  2358. ;*                                                                      *
  2359. ;* SUBROUTINE NAME:     INITAPA                                         *
  2360. ;*                                                                      *
  2361. ;* DESCRIPTIVE NAME:    Re-initialize APA start address                 *
  2362. ;*                                                                      *
  2363. ;* INPUT:  None                                                         *
  2364. ;* OUTPUT: None                                                         *
  2365. ;*                                                                      *
  2366. ;* INTERNAL REFERENCES: None                                            *
  2367. ;*                                                                      *
  2368. ;* EXTERNAL REFERENCES: SetAPAStart                                     *
  2369. ;*                                                                      *
  2370. ;********************** END OF SPECIFICATIONS ***************************
  2371. INITAPA proc    near
  2372.         public  INITAPA
  2373.  
  2374.         push    ds
  2375.         mov     ax, _DATA
  2376.         mov     ds, ax
  2377.  
  2378.         mov     ax, FONT_HEIGHT*SCREEN_HEIGHT-1
  2379.         mov     ds:PrevLineComp, ax
  2380.         mov     ds:MaxLineComp, ax
  2381.  
  2382.         mov     ds, ds:VideoBuffSel
  2383.  
  2384.         xor     ax, ax
  2385.         mov     ds:VGA_APAStart, ax
  2386.  
  2387.         call    SetAPAStart
  2388.  
  2389.         pop     ds
  2390.         ret
  2391. INITAPA endp
  2392.  
  2393. R2CSEG  ENDS
  2394.         END
  2395.