home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v2.zip / DDKX86 / DBCSDD / SRC_DBCS / VDHWNDW / XGASCROL.ASM < prev    next >
Assembly Source File  |  1995-04-14  |  90KB  |  1,990 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   XGASCROL.ASM -- Common Buffer Scroll Routines for EGA, VGA, BGA
  14.  
  15. ;/*****************************************************************************
  16. ;*
  17. ;* SOURCE FILE NAME = XGASCROL.ASM
  18. ;*
  19. ;* DESCRIPTIVE NAME = BUFFERUPDATE scroll routines
  20. ;*
  21. ;*
  22. ;* VERSION      V2.0
  23. ;*
  24. ;* DATE
  25. ;*
  26. ;* DESCRIPTION  This module contains routines that run at ring 2 in
  27. ;*              order to directly access the hardware.
  28. ;*
  29. ;* FUNCTIONS    ScrollUp, ScrollDown
  30. ;*              ScrollLeft, ScrollRight
  31. ;*
  32. ;* NOTES        NONE
  33. ;*
  34. ;* STRUCTURES   NONE
  35. ;*
  36. ;* EXTERNAL REFERENCES
  37. ;*
  38. ;*              NONE
  39. ;*
  40. ;* EXTERNAL FUNCTIONS
  41. ;*
  42. ;*              NONE
  43. ;*
  44. ;* CHANGE ACTIVIY =
  45. ;*   DATE      FLAG        APAR    CHANGE DESCRIPTION
  46. ;*   --------  ----------  -----   --------------------------------------
  47. ;*   mm/dd/yy  @Vr.mpppxx  xxxxx   xxxxxxx
  48. ;*   03/25/89  @P1         D132    PL, DCR 132 changes
  49. ;*   04/11/91              D1348   NAKADA, Enable DBCS support in Vio-Window
  50. ;*   04/19/93  KY02        PJ08380 KAZZ, Deleted the lines which may NOT be
  51. ;*                                 required to fix PTR #JS05303 by K. Yokomizo.
  52. ;****************************************************************************/
  53.  
  54.         .286c                           ; 286 protect mode instructions
  55.  
  56.         .xlist
  57.         INCLUDE struc.inc               ; Structure macro
  58.         INCLUDE error2.inc              ; Subsystem error equates
  59.         INCLUDE vdhstruc.inc            ; Buffer update data structures
  60.         INCLUDE vdhctl.inc              ; Conditional Assemply Control  ;MS01
  61.         INCLUDE vdhequ.inc              ; Buffer update equates
  62.         INCLUDE xgamac.inc                                              ;@P1
  63. IFDEF EPOCH                                                             ;;EPOCH ;; added for J-FUNC
  64.         INCLUDE cga2epo.inc                                             ;;EPOCH ;; added for J-FUNC
  65.         INCLUDE pmwinx.inc                                              ;;EPOCH ;; added for J-FUNC
  66.         INCLUDE pmaviop.inc                                             ;;EPOCH ;; added for J-FUNC
  67.         INCLUDE wdhequ.inc                                              ;;EPOCH ;; added for J-FUNC
  68.         extrn   DOSGETSEG:FAR                                           ;;EPOCH ;; added for J-FUNC
  69. ENDIF                                                                   ;;EPOCH ;; added for J-FUNC
  70.         .list
  71.  
  72.         EXTRN   SetGenParms:NEAR        ; Set up general buffer update parms @P1
  73. IFDEF EPOCH                                                             ;;EPOCH ;; added for J-FUNC
  74.                                                                         ;;EPOCH ;; added for J-FUNC
  75.         EXTRN   DOSGETSHRSEG:FAR        ; Get shared segment(s)         ;;EPOCH ;; added for J-FUNC
  76.         PUBLIC  BvscbSel                                                ;;EPOCH ;; added for J-FUNC
  77. ;@an07  PUBLIC  pBvscbSels              ;@an01                          ;;EPOCH ;; added for J-FUNC
  78.                                                                         ;;EPOCH ;; added for J-FUNC
  79. _DATA   SEGMENT WORD PUBLIC 'DATA'                                      ;;EPOCH ;; added for J-FUNC
  80. ;@an07 pBvscbSels      DD  0            ; offset:selector pointing at   ;;EPOCH ;; added for J-FUNC
  81.                                         ; a group of Bvscb selectors.   ;;EPOCH ;; added for J-FUNC
  82. BvscbSel DW     255 Dup (0)             ; Selector for BVSCBnn          ;;EPOCH ;; added for J-FUNC
  83.                                                                         ;;EPOCH ;; added for J-FUNC
  84. BvsSegLabel DB  '\SHAREMEM\BVS\BVS'     ; BVSCB segment label           ;;EPOCH ;; added for J-FUNC
  85. LNOFF   EQU     $ - BvsSegLabel                                         ;;EPOCH ;; added for J-FUNC
  86. Bvs_CP_ID LABEL WORD                                                    ;;EPOCH ;; added for J-FUNC
  87.         DB      '0'                                                     ;;EPOCH ;; added for J-FUNC
  88.         DB      '0'                                                     ;;EPOCH ;; added for J-FUNC
  89.         DB       0                                                      ;;EPOCH ;; added for J-FUNC
  90. HexDigit DB     '0123456789ABCDEF'      ; Look up Tbl for Hex digit     ;;EPOCH ;; added for J-FUNC
  91. _DATA   ENDS                                                            ;;EPOCH ;; added for J-FUNC
  92.                                                                         ;;EPOCH ;; added for J-FUNC
  93. ENDIF                                                                   ;;EPOCH ;; added for J-FUNC
  94.  
  95. IF VDHCGA AND (1 - CGA_ALWAYS_FAST) ; IF VDHCGA AND NOT CGA_ALWAYS_FAST ;@P1
  96.  
  97. ;/*
  98. ;** If CGA video memory accesses may need to wait for retrace,
  99. ;** these routines are necessary. (See MAKEFILE)
  100. ;*/
  101.  
  102.         extrn   CGA_REP_MOVSW:far                                       ;@P1
  103.         extrn   CGA_REP_STOSW:far                                       ;@P1
  104.         extrn   CGA_REP_MOVSB_INCSI_LOOP:far                            ;@P1
  105.         extrn   CGA_REP_MOVSW_STOSW_LOOP:far                            ;@P1
  106.         extrn   CGA_REP_INCDI_STOSB_LOOP:far                            ;@P1
  107.         extrn   CGA_REP_STOSB_INCDI_LOOP:far                            ;@P1
  108.         extrn   CGA_REP_LODSB_STOSW_LOOP:far                            ;@P1
  109.         extrn   CGA_REP_MOVSB_INCDI_LOOP:far                            ;@P1
  110.         extrn   CGA_REP_MOVSW_ADDSI2_LOOP:far                           ;@P1
  111. ENDIF   ;VDHCGA                                                         ;@P1
  112.  
  113. IFDEF D1348 ;BufferUpdate with dbcs bits handling
  114.         extrn   MoveUpLeftWrld:near
  115.         extrn   MoveDownRightWrld:near
  116. ENDIF ;D1348
  117.  
  118. R2CSEG  SEGMENT WORD    PUBLIC 'CODE'
  119.         ASSUME  CS:R2CSEG,DS:NOTHING,ES:NOTHING
  120.  
  121. ;/****************************************************************************
  122. ;*
  123. ;* SUBROUTINE NAME:     ScrollLeft
  124. ;*
  125. ;* DESCRIPTIVE NAME:    Video device handler scroll left routine
  126. ;*
  127. ;* FUNCTION:    Process scroll left sub-function
  128. ;*              Scrolls a portion of the PVB, LVB left a specified
  129. ;*              number of times and then fill the vacant portion
  130. ;*              with the user specified cell.
  131. ;*
  132. ;* ENTRY POINT: ScrollLeft
  133. ;*   LINKAGE:   Near Call from BUFFERUPDATE rouinte
  134. ;*
  135. ;* INPUT:
  136. ;*
  137. ;* AX = 0
  138. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)
  139. ;* DS:SI  --->  Parameter block buffer          (see XGABUFUP.ASM)
  140. ;* ES:DI  --->  Mode data in environment buffer (see XGABUFUP.ASM)
  141. ;*
  142. ;* PARAMETER BLOCK FORMAT:
  143. ;*
  144. ;*   SIZE   DESCRIPTION
  145. ;*   ----   -----------
  146. ;*
  147. ;*   WORD   Parameter length
  148. ;*   WORD   Flags                     (target buffer - LVB, PVB)
  149. ;*   DWORD  Application data address
  150. ;*   DWORD  Application data2 address (cell to be used to fill void)
  151. ;*   WORD   Index (5)
  152. ;*   WORD   Starting row              (top row)
  153. ;*   WORD   Starting column           (left column)
  154. ;*   WORD   Secondary row             (bottom row)
  155. ;*   WORD   Secondary column          (right column)
  156. ;*   WORD   RepeatFactor              (# of times to scroll)
  157. ;*   WORD   LogicalBufSel
  158. ;*
  159. ;* OUTPUT:
  160. ;*
  161. ;* EXIT-NORMAL: AX = 0
  162. ;*
  163. ;* EXIT-ERROR:  AX = SetForScroll
  164. ;*
  165. ;* EFFECTS:     All
  166. ;*
  167. ;* INTERNAL REFERENCES: SetForScroll,
  168. ;*
  169. ;* EXTERNAL REFERENCES: None
  170. ;*
  171. ;****************************************************************************/
  172.  
  173.                 PUBLIC  ScrollLeft
  174. ScrollLeft      PROC
  175.  
  176.         mov     bx,LEFT
  177.         call    SetForScroll
  178.         jc      sclfx
  179.  
  180.         test    [bp].ScrollFlags,DOMOVE
  181.         jz      sclf10
  182.  
  183.         push    bx
  184.         call    MoveUpLeft
  185.         pop     bx
  186.  
  187. sclf10: call    FillRectWithCell
  188.         xor     ax,ax
  189.  
  190. sclfx:  ret
  191.  
  192. ScrollLeft      ENDP
  193.  
  194.  
  195. ;/****************************************************************************
  196. ;*
  197. ;* SUBROUTINE NAME:     ScrollUp
  198. ;*
  199. ;* DESCRIPTIVE NAME:    Video device handler scroll up routine
  200. ;*
  201. ;* FUNCTION:    Process scroll up sub-function
  202. ;*              Scrolls a portion of the PVB, LVB up a specified
  203. ;*              number of times and then fill the vacant portion
  204. ;*              with the user specified cell.
  205. ;*
  206. ;* ENTRY POINT: ScrollUp
  207. ;*   LINKAGE:   Near Call from BUFFERUPDATE rouinte
  208. ;*
  209. ;* INPUT:
  210. ;*
  211. ;* AX = 0
  212. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)
  213. ;* DS:SI  --->  Parameter block buffer          (see XGABUFUP.ASM)
  214. ;* ES:DI  --->  Mode data in environment buffer (see XGABUFUP.ASM)
  215. ;*
  216. ;* PARAMETER BLOCK FORMAT:
  217. ;*
  218. ;*   SIZE   DESCRIPTION
  219. ;*   ----   -----------
  220. ;*
  221. ;*   WORD   Parameter length
  222. ;*   WORD   Flags                     (target buffer - LVB, PVB)
  223. ;*   DWORD  Application data address
  224. ;*   DWORD  Application data2 address (cell to be used to fill void)
  225. ;*   WORD   Index (3)
  226. ;*   WORD   Starting row              (top row)
  227. ;*   WORD   Starting column           (left column)
  228. ;*   WORD   Secondary row             (bottom row)
  229. ;*   WORD   Secondary column          (right column)
  230. ;*   WORD   RepeatFactor              (# of times to scroll)
  231. ;*   WORD   LogicalBufSel
  232. ;*
  233. ;* OUTPUT:
  234. ;*
  235. ;* EXIT-NORMAL: AX = 0
  236. ;*
  237. ;* EXIT-ERROR:  AX = SetForScroll
  238. ;*
  239. ;* EFFECTS:     All
  240. ;*
  241. ;* INTERNAL REFERENCES: SetForScroll,
  242. ;*
  243. ;* EXTERNAL REFERENCES: None
  244. ;*
  245. ;****************************************************************************/
  246.  
  247.                 PUBLIC  ScrollUp
  248. ScrollUp        PROC
  249.         mov     bx,UP
  250.         call    SetForScroll
  251.         jc      scupx
  252.  
  253.         test    [bp].ScrollFlags,DOMOVE
  254.         jz      scup10
  255.  
  256.         push    bx
  257.         call    MoveUpLeft
  258.         pop     bx
  259.  
  260. scup10: call    FillRectWithCell
  261.         xor     ax,ax
  262.  
  263. scupx:  ret
  264.  
  265. ScrollUp        ENDP
  266.  
  267.  
  268. ;/****************************************************************************
  269. ;*
  270. ;* SUBROUTINE NAME:     ScrollRight
  271. ;*
  272. ;* DESCRIPTIVE NAME:    Video device handler scroll right routine
  273. ;*
  274. ;* FUNCTION:    Process scroll right sub-function
  275. ;*              Scrolls a portion of the PVB, LVB right to a specified
  276. ;*              number of times and then fill the vacant portion with
  277. ;*              the user specified cell.
  278. ;*
  279. ;* ENTRY POINT: ScrollRight
  280. ;*   LINKAGE:   Near Call from BUFFERUPDATE rouinte
  281. ;*
  282. ;* INPUT:
  283. ;*
  284. ;* AX = 0
  285. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)
  286. ;* DS:SI  --->  Parameter block buffer          (see XGABUFUP.ASM)
  287. ;* ES:DI  --->  Mode data in environment buffer (see XGABUFUP.ASM)
  288. ;*
  289. ;* PARAMETER BLOCK FORMAT:
  290. ;*
  291. ;*   SIZE   DESCRIPTION
  292. ;*   ----   -----------
  293. ;*
  294. ;*   WORD   Parameter length
  295. ;*   WORD   Flags                     (target buffer - LVB, PVB)
  296. ;*   DWORD  Application data address
  297. ;*   DWORD  Application data2 address (cell to be used to fill void)
  298. ;*   WORD   Index (6)
  299. ;*   WORD   Starting row              (top row)
  300. ;*   WORD   Starting column           (left column)
  301. ;*   WORD   Secondary row             (bottom row)
  302. ;*   WORD   Secondary column          (right column)
  303. ;*   WORD   RepeatFactor              (# of times to scroll)
  304. ;*   WORD   LogicalBufSel
  305. ;*
  306. ;* OUTPUT:
  307. ;*
  308. ;* EXIT-NORMAL: AX = 0
  309. ;*
  310. ;* EXIT-ERROR:  AX = SetForScroll
  311. ;*
  312. ;* EFFECTS:     All
  313. ;*
  314. ;* INTERNAL REFERENCES: SetForScroll,
  315. ;*
  316. ;* EXTERNAL REFERENCES: None
  317. ;*
  318. ;****************************************************************************/
  319.  
  320.                 PUBLIC  ScrollRight
  321. ScrollRight     PROC
  322.  
  323.         mov     bx,RIGHT
  324.         call    SetForScroll
  325.         jc      scrtx
  326.  
  327.         test    [bp].ScrollFlags,DOMOVE
  328.         jz      scrt10
  329.  
  330.         push    bx
  331.         call    MoveDownRight
  332.         pop     bx
  333.  
  334. scrt10: call    FillRectWithCell
  335.         xor     ax,ax
  336.  
  337. scrtx:  ret
  338.  
  339. ScrollRight     ENDP
  340.  
  341.  
  342. ;/****************************************************************************
  343. ;*
  344. ;* SUBROUTINE NAME:     ScrollDown
  345. ;*
  346. ;* DESCRIPTIVE NAME:    Video device handler scroll down routine
  347. ;*
  348. ;* FUNCTION:    Process scroll down sub-function
  349. ;*              Scrolls a portion of the PVB, LVB down a specified
  350. ;*              number of times and then fill the vacant portion
  351. ;*              with the user specified cell.
  352. ;*
  353. ;* ENTRY POINT: ScrollDown
  354. ;*   LINKAGE:   Near Call from BUFFERUPDATE rouinte
  355. ;*
  356. ;* INPUT:
  357. ;*
  358. ;* AX = 0
  359. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)
  360. ;* DS:SI  --->  Parameter block buffer          (see XGABUFUP.ASM)
  361. ;* ES:DI  --->  Mode data in environment buffer (see XGABUFUP.ASM)
  362. ;*
  363. ;* PARAMETER BLOCK FORMAT:
  364. ;*
  365. ;*   SIZE   DESCRIPTION
  366. ;*   ----   -----------
  367. ;*
  368. ;*   WORD   Parameter length
  369. ;*   WORD   Flags                     (target buffer - LVB, PVB)
  370. ;*   DWORD  Application data address
  371. ;*   DWORD  Application data2 address (cell to be used to fill void)
  372. ;*   WORD   Index (4)
  373. ;*   WORD   Starting row              (top row)
  374. ;*   WORD   Starting column           (left column)
  375. ;*   WORD   Secondary row             (bottom row)
  376. ;*   WORD   Secondary column          (right column)
  377. ;*   WORD   RepeatFactor              (# of times to scroll)
  378. ;*   WORD   LogicalBufSel
  379. ;*
  380. ;* OUTPUT:
  381. ;*
  382. ;* EXIT-NORMAL: AX = 0
  383. ;*
  384. ;* EXIT-ERROR:  AX = SetForScroll
  385. ;*
  386. ;* EFFECTS:     All
  387. ;*
  388. ;* INTERNAL REFERENCES: SetForScroll,
  389. ;*
  390. ;* EXTERNAL REFERENCES: None
  391. ;*
  392. ;****************************************************************************/
  393.  
  394.                 PUBLIC  ScrollDown
  395. ScrollDown      PROC
  396.  
  397.         mov     bx,DOWN
  398.         call    SetForScroll
  399.         jc      scdnx
  400.  
  401.         test    [bp].ScrollFlags,DOMOVE
  402.         jz      scdn10
  403.  
  404.         push    bx
  405.         call    MoveDownRight
  406.         pop     bx
  407.  
  408. scdn10: call    FillRectWithCell
  409.         xor     ax,ax
  410.  
  411. scdnx:  ret
  412.  
  413. ScrollDown      ENDP
  414.  
  415. ;/****************************************************************************
  416. ;*
  417. ;* SUBROUTINE NAME:     LVBToPVB
  418. ;*
  419. ;* DESCRIPTIVE NAME:    Video device handler copy LVB rectangle to PVB
  420. ;*
  421. ;* FUNCTION:    Copy a rectangle from an LVB on to the PVB
  422. ;*
  423. ;* ENTRY POINT: LVBToPVB
  424. ;*   LINKAGE:   Near Call from BUFFERUPDATE rouinte
  425. ;*
  426. ;* INPUT:
  427. ;*
  428. ;* AX = 0
  429. ;* SS:BP  --->  Stack frame                     (see VDHSTRUC.INC)
  430. ;* DS:SI  --->  Parameter block buffer          (see XGABUFUP.ASM)
  431. ;* ES:DI  --->  Mode data in environment buffer (see XGABUFUP.ASM)
  432. ;*
  433. ;* PARAMETER BLOCK FORMAT:
  434. ;*
  435. ;*   SIZE   DESCRIPTION
  436. ;*   ----   -----------
  437. ;*
  438. ;*   WORD   Parameter length
  439. ;*   WORD   Flags                     (target buffer - LVB, PVB)
  440. ;*   DWORD  Application data address
  441. ;*   DWORD  Application data2 address (cell to be used to fill void)
  442. ;*   WORD   Index (4)
  443. ;*   WORD   Starting row              (top row)
  444. ;*   WORD   Starting column           (left column)
  445. ;*   WORD   Secondary row             (bottom row)
  446. ;*   WORD   Secondary column          (right column)
  447. ;*   WORD   RepeatFactor              (# of times to scroll)
  448. ;*   WORD   LogicalBufSel
  449. ;*
  450. ;* OUTPUT:
  451. ;*
  452. ;* EXIT-NORMAL: AX = 0
  453. ;*
  454. ;* EXIT-ERROR:  AX = SetForScroll
  455. ;*
  456. ;* EFFECTS:     All
  457. ;*
  458. ;* INTERNAL REFERENCES: SetForScroll,MoveLVBRectToPVB
  459. ;*
  460. ;* EXTERNAL REFERENCES: None
  461. ;*
  462. ;****************************************************************************/
  463.  
  464.                 PUBLIC  LVBToPVB                                ;@P1 begin
  465. LVBToPVB        PROC
  466.  
  467.         xor     ax,ax                   ; clear error code
  468.         push    ds:[si].RepeatFactor    ; save the old repeat factor
  469.         push    ds:[si].Flags           ; save the old flags
  470.         test    [si].Flags, PVB_SEL_BIT ; write to the PVB
  471.         jz      ltpx                    ;   NO, do nothing
  472.  
  473.         or      [si].Flags, LVB_SEL_BIT ; LVB bit needs to be set
  474.  
  475.         mov     ds:[si].RepeatFactor,-1 ; this will be a scroll without move
  476.         mov     bx,LVBPVB               ; pretend to be a scroll function
  477.         call    SetForScroll            ; get the scroll parameters
  478.         jc      ltpx
  479.  
  480.         call    MoveLVBRectToPVB        ; The fill rect is the rect to move
  481.         xor     ax,ax
  482.  
  483. ltpx:   lds     si,[bp].ParmBuf
  484.         pop     ds:[si].Flags           ; restore the old flags
  485.         pop     ds:[si].RepeatFactor    ; 
  486.         ret
  487.  
  488. LVBToPVB        ENDP                                            ;@P1 end
  489.  
  490.  
  491. ;/***************************************************************************
  492. ;*
  493. ;* FUNCTION NAME = SetForScroll
  494. ;*
  495. ;* DESCRIPTION   =
  496. ;*
  497. ;*      Set up parameters for a scroll
  498. ;*      SetForScroll does range checking and parameter adjustment for
  499. ;*      all scroll functions.  This is valid for 2 and 4 byte cell LVBs
  500. ;*      and for the fill cell supplied as 2 or 4 bytes.
  501. ;*
  502. ;*      All scrolls consist of two basic operations.  The first is
  503. ;*      move a rectangle.  The second is fill a rectangle.  The rectangle
  504. ;*      to be moved will be NULL if the scroll is greater than the
  505. ;*      depth of the rectangle in the direction of movement.
  506. ;*
  507. ;*      This routine calculates the source rectangle and destination
  508. ;*      rectangle for the move.  For UP and LEFT scrolling, the rectangle
  509. ;*      should be copied beginning to end.  For DOWN and RIGHT the copy
  510. ;*      should go from end to beginning.  This routine provides the
  511. ;*      correct buffer offset for the appropriate starting point of
  512. ;*      the rectangle.
  513. ;*
  514. ;* INPUT         =
  515. ;*
  516. ;*          BX - Flag indicating the type of scroll (UP,DOWN,LEFT,RIGHT)
  517. ;*          SS:BP - local data storage area
  518. ;*          DS:SI - user passed parameter block
  519. ;*          ES:DI - mode data structure
  520. ;*          [bp].minrow - index of top most row in LVB (PVB coordinates)
  521. ;*          [bp].mincol - index of left most row in LVB (PVB coordinates)
  522. ;*          [bp].maxrow - index of bottom most row in LVB (PVB coordinates)
  523. ;*          [bp].maxcol - index of right most row in LVB (PVB coordinates)
  524. ;*
  525. ;* OUTPUT        =
  526. ;*
  527. ;*       CARRY CLEAR
  528. ;*           BX = LVB selector if LVB scroll is indicated else 0
  529. ;*
  530. ;*           [bp].PVB_Sel = PVB selector if PVB scroll is indicated else 0
  531. ;*
  532. ;*           [bp].ScrollFlags  = either DOFILL or DOMOVE+DOFILL
  533. ;*
  534. ;*           [bp].RowsToFill   = rows to be filled with the default cell
  535. ;*
  536. ;*           [bp].PVBFillOff   = offset of start of PVB fill rectangle
  537. ;*           [bp].PVBFillCount = # of bytes per fill line in PVB
  538. ;*           [bp].PVBFillSkip  = # of bytes to skip to reach next PVB line
  539. ;*
  540. ;*           [bp].LVBFillOff   = offset of start of LVB fill rectangle
  541. ;*           [bp].LVBFillCount = # of bytes per fill line in LVB
  542. ;*           [bp].LVBFillSkip  = # of bytes to skip to reach next LVB line
  543. ;*
  544. ;*           [bp].FillCellLow  = first word of default fill cell
  545. ;*           [bp].FillCellHigh = second word of default fill cell
  546. ;*
  547. ;*         if DOMOVE is set in ScrollFlags
  548. ;*
  549. ;*           [bp].RowsToMove     = number of rows to move
  550. ;*
  551. ;*           [bp].PVBMoveCount   = # of bytes per PVB row to move
  552. ;*           [bp].PVBMoveSkip    = # of bytes to skip to get to the next row
  553. ;*           [bp].PVBMoveSrcOff  = offset to start of PVB source buffer
  554. ;*           [bp].PVBMoveDestOff = offset to start of PVB destination buffer
  555. ;*
  556. ;*           [bp].LVBMoveCount   = # of bytes per PVB row to move
  557. ;*           [bp].LVBMoveSkip    = # of bytes to skip to get to the next row
  558. ;*           [bp].LVBMoveSrcOff  = offset to start of PVB source buffer
  559. ;*           [bp].LVBMoveDestOff = offset to start of PVB destination buffer
  560. ;*
  561. ;*       CARRY SET
  562. ;*           [bp].ScrollFlags = 0
  563. ;*
  564. ;*   CALLS   SetBaseRects, AdjustRects, CalcMoveValues, CalcFillValues
  565. ;*
  566. ;*   USES    AX,CX,DX,SI,DS,FLAGS
  567. ;*
  568. ;* RETURN-NORMAL = NONE
  569. ;* RETURN-ERROR  = NONE
  570. ;*
  571. ;**************************************************************************/
  572.  
  573.                 PUBLIC  SetForScroll                            ;@P1 begin
  574. SetForScroll    PROC
  575.  
  576.         call    SetGenParms             ; set general parameters for all
  577.                                         ; buffer update functions
  578.         call    SetBaseRects            ; do basic value setting on source,
  579.                                         ; destination and fill rectangles
  580.  
  581.         .if     <nc>                    ; parms from SetBaseRects are good
  582.  
  583.             call    AdjustRects         ; adjust the rectangle values for the
  584.                                         ; specific type of scroll
  585.  
  586.                                         ; At this point we have source and
  587.                                         ; and destination rectangles that are
  588.                                         ; both entirely contained in the LVB.
  589.                                         ; We have also calculated the
  590.                                         ; rectangle that will be left void
  591.                                         ; when the moved rectangle is copied.
  592.  
  593.             test    [bp].ScrollFlags,DOMOVE ; Are move rectangles != NULL?
  594.             .if     <nz>                ;   Yes, calculate the move parms
  595.                 call    CalcMoveValues  ;   and buffer lengths
  596.             .endif
  597.             call    CalcFillValues      ; calculate the fill rectangle parms
  598.             mov     bx, [bp].LVB_SEL    ; (bx) = LVB selector
  599.  
  600.             clc
  601.  
  602.         .endif
  603.  
  604.         ret
  605.  
  606. SetForScroll    ENDP                                            ;@P1 end
  607.  
  608.  
  609. ;/***************************************************************************
  610. ;*
  611. ;* FUNCTION NAME = SetBaseRects
  612. ;*
  613. ;* DESCRIPTION   =
  614. ;*
  615. ;*      Set default values for source, dest and fill rectangles
  616. ;*
  617. ;*      SetBaseRects does basic rectangle value setting for the source
  618. ;*      and destination rectangles for the rectangle that needs to be
  619. ;*      moved as part of the scroll.  Default values for the fill
  620. ;*      rectangle are also set.
  621. ;*
  622. ;*      This routine also checks and adjusts the RepeatFactor, the number
  623. ;*      of rows or columns to be scrolled.  If it is 0, an error is returned.
  624. ;*
  625. ;* INPUT     =  BX - Flag indicating the type of scroll (UP,DOWN,LEFT,RIGHT)
  626. ;*              SS:BP - local data storage area
  627. ;*              DS:SI - user passed parameter block
  628. ;*              ES:DI - mode data structure
  629. ;*              [bp].minrow - index of top most row in LVB (PVB coordinates)
  630. ;*              [bp].mincol - index of left most row in LVB (PVB coordinates)
  631. ;*              [bp].maxrow - index of bottom most row in LVB (PVB coordinates)
  632. ;*              [bp].maxcol - index of right most row in LVB (PVB coordinates)
  633. ;*
  634. ;* OUTPUT   =
  635. ;*
  636. ;*          CARRY CLEAR
  637. ;*              CX = repeat factor
  638. ;*              [bp].ScrollFlags  = DOMOVE+DOFILL
  639. ;*              [bp].topscroll    = ParmBlock->Row
  640. ;*              [bp].topdest      =   "
  641. ;*              [bp].topfill      =   "
  642. ;*              [bp].leftscroll   = ParmBlock->Col
  643. ;*              [bp].leftdest     =   "
  644. ;*              [bp].leftfill     =   "
  645. ;*              [bp].rightscroll  = ParmBlock->Row2
  646. ;*              [bp].rightdest    =   "
  647. ;*              [bp].rightfill    =   "
  648. ;*              [bp].bottomscroll = ParmBlock->Col2
  649. ;*              [bp].bottomdest   =   "
  650. ;*              [bp].bottomfill   =   "
  651. ;*
  652. ;*          CARRY SET
  653. ;*              [bp].ScrollFlags = 0
  654. ;*
  655. ;*
  656. ;* CALLS   none
  657. ;*
  658. ;* USES    AX,CX,FLAGS
  659. ;*
  660. ;* NOTES
  661. ;*
  662. ;* PSEUDOCODE
  663. ;*
  664. ;*                 topscroll = parmrow
  665. ;*                 leftscroll = parmcol
  666. ;*                 bottomscroll = parmrow2
  667. ;*                 rightscroll = parmcol2
  668. ;*                 topdest = topscroll
  669. ;*                 leftdest = leftscroll
  670. ;*                 bottomdest = bottomscroll
  671. ;*                 rightdest = rightscroll
  672. ;*                 topfill = topscroll
  673. ;*                 leftfill = leftscroll
  674. ;*                 bottomfill = bottomscroll
  675. ;*                 rightfill = rightscroll
  676. ;*                 DoMoveFlag = TRUE
  677. ;*                 DoFillFlag = TRUE
  678. ;*                 if  (RepCount == 0)
  679. ;*                     DoMoveFlag = FALSE
  680. ;*                     DoFillFlag = FALSE
  681. ;*                     set error
  682. ;*
  683. ;* RETURN-NORMAL = NONE
  684. ;* RETURN-ERROR  = NONE
  685. ;*
  686. ;****************************************************************************/
  687.  
  688.                 PUBLIC  SetBaseRects                            ;@P1 begin
  689. SetBaseRects    PROC
  690.         mov     ax,[si].Row         ; set all of the top coordinates
  691.         .if     <ax b [bp].minrow> near
  692.             mov     ax,[bp].minrow
  693.         .endif
  694.                                         ; BUGBUG this is really should not be
  695.         .if     <ax a [bp].maxrow> near ; here, but it is necessary to pass
  696.             mov     ax,[bp].maxrow      ; the component tests.  Remove it at
  697.         .endif                          ; the first opertunity.
  698.  
  699.         test    bx,LVBPVB
  700.         .if     <z>                     ; NOT LVB to PVB
  701.             .if     <ax b es:[di].ScrlRectTop> near
  702.                 mov     ax,es:[di].ScrlRectTop
  703.             .endif
  704.  
  705.             .if     <ax a es:[di].ScrlRectBottom> near
  706.                 mov     ax,es:[di].ScrlRectBottom
  707.             .endif
  708.         .endif
  709.  
  710.         mov     [bp].topscroll,ax
  711.         mov     [bp].topdest,ax
  712.         mov     [bp].topfill,ax
  713.  
  714.         mov     cx,[si].Row2        ; set all of the bottom coordinates
  715.         .if     <cx a [bp].maxrow> near
  716.             mov     cx,[bp].maxrow
  717.         .endif
  718.         test    bx,LVBPVB
  719.         .if     <z>                     ; NOT LVB to PVB
  720.             .if     <cx a es:[di].ScrlRectBottom> near
  721.                 mov     cx,es:[di].ScrlRectBottom
  722.             .endif
  723.         .endif
  724.  
  725.         mov     [bp].bottomscroll,cx
  726.         mov     [bp].bottomdest,cx
  727.         mov     [bp].bottomfill,cx
  728.  
  729.         .if     <ax a cx> near      ; rectangle is not valid
  730.             mov     ax,ERROR_VIO_ROW
  731.             jmp     sbrerr
  732.         .endif
  733.  
  734.         mov     ax,[si].Col         ; set all of the left coordinates
  735.         .if     <ax b [bp].mincol> near
  736.             mov     ax,[bp].mincol
  737.         .endif
  738.                                         
  739.         .if     <ax a [bp].maxcol> near 
  740.             mov     ax,[bp].maxcol      
  741.         .endif                          
  742.  
  743.         test    bx,LVBPVB
  744.         .if     <z>                     ; NOT LVB to PVB
  745.             .if     <ax b es:[di].ScrlRectLeft> near
  746.                 mov     ax,es:[di].ScrlRectLeft
  747.             .endif
  748.  
  749.             .if     <ax a es:[di].ScrlRectRight> near
  750.                 mov     ax,es:[di].ScrlRectRight
  751.             .endif
  752.         .endif
  753.  
  754.         mov     [bp].leftscroll,ax
  755.         mov     [bp].leftdest,ax
  756.         mov     [bp].leftfill,ax
  757.  
  758.         mov     cx,[si].Col2        ; set all of the right coordinates
  759.         .if     <cx a [bp].maxcol> near
  760.             mov     cx,[bp].maxcol
  761.         .endif
  762.         test    bx,LVBPVB
  763.         .if     <z>                     ; NOT LVB to PVB
  764.             .if     <cx a es:[di].ScrlRectRight> near
  765.                 mov     cx,es:[di].ScrlRectRight
  766.             .endif
  767.         .endif
  768.         mov     [bp].rightscroll,cx
  769.         mov     [bp].rightdest,cx
  770.         mov     [bp].rightfill,cx
  771.  
  772.         .if     <ax a cx> near      ; rectangle is not valid
  773.             mov     ax,ERROR_VIO_COL
  774.             jmp     sbrerr
  775.         .endif
  776.  
  777.         cmp     ds:[si].ParmLength,LVBRowOff; Does caller want the touch rect?
  778.         .if     <ae>                        ;   Yes, return the Touch Rect
  779.             mov     ax,[bp].leftscroll
  780.             mov     ds:[si].TouchXLeft,ax
  781.             mov     ax,[bp].topscroll
  782.             mov     ds:[si].TouchYTop,ax
  783.             mov     ax,[bp].rightscroll
  784.             mov     ds:[si].TouchXRight,ax
  785.             mov     ax,[bp].bottomscroll
  786.             mov     ds:[si].TouchYBottom,ax
  787.         .endif
  788.  
  789.         mov     [bp].ScrollFlags, DOMOVE + DOFILL
  790.         mov     cx, [si].RepeatFactor
  791.         or      cx,cx               ; clears carry
  792.         .if     <z>
  793.             mov     [bp].ScrollFlags,cx ; do not Move or Fill
  794.             xor     ax,ax           ; not an error not to scroll
  795.             stc
  796.         .endif
  797.  
  798. sbrx:   ret
  799.  
  800. sbrerr: stc
  801.         jmp     sbrx
  802.  
  803. SetBaseRects    ENDP                                            ;@P1 end
  804.  
  805.  
  806. ;/***************************************************************************
  807. ;*
  808. ;* FUNCTION NAME = AdjustRects
  809. ;*
  810. ;* DESCRIPTION   =
  811. ;*
  812. ;*      Adjust values for source, dest and fill rectangles
  813. ;*
  814. ;*      AdjustRects does scroll specific rectangle value setting for the
  815. ;*      source and destination rectangles for the rectangle that needs to
  816. ;*      be moved as part of the scroll.  Values for the fill rectangle are
  817. ;*      also adjusted.
  818. ;*
  819. ;*      This routine also checks and adjusts the RepeatFactor, the number
  820. ;*      of rows or columns to be scrolled.  If the value would clear the
  821. ;*      entire scroll rectangle, (no area left to be moved) the DOMOVE
  822. ;*      flag in the scroll flags is cleared.
  823. ;*
  824. ;*      If the repeat factor is larger than the depth of the scroll rectangle
  825. ;*      in the direction it is being scrolled, the repeat factor is reduced
  826. ;*      to the depth of the scroll rectangle.
  827. ;*
  828. ;*
  829. ;* INPUT    =   BX - Flag indicating the type of scroll (UP,DOWN,LEFT,RIGHT)
  830. ;*              CX = repeat factor
  831. ;*              SS:BP - local data storage area
  832. ;*              DS:SI - user passed parameter block
  833. ;*              ES:DI - mode data structure
  834. ;*              [bp].topscroll  - source rectangle for move set to
  835. ;*              [bp].leftscroll   default values
  836. ;*              [bp].rightscroll
  837. ;*              [bp].bottomscroll
  838. ;*              [bp].topdest    - destination rectangle for move set
  839. ;*              [bp].leftdest     to default values
  840. ;*              [bp].rightdest
  841. ;*              [bp].bottomdest
  842. ;*              [bp].topfill    - rectangle left void by move set to
  843. ;*              [bp].leftfill     default values
  844. ;*              [bp].rightfill
  845. ;*              [bp].bottomfill
  846. ;*
  847. ;* OUTPUT    =
  848. ;*              CX = repeat factor adjusted to MIN (rect depth,repeat factor)
  849. ;*              [bp].ScrollFlags  =  DOMOVE clear if entire rectangle is vacant
  850. ;*
  851. ;*              [bp].topfill      = Rectangle that the scroll leaves vacant
  852. ;*              [bp].leftfill     =     "
  853. ;*              [bp].rightfill    =     "
  854. ;*              [bp].bottomfill   =     "
  855. ;*
  856. ;*            if  DOMOVE is set
  857. ;*              [bp].topscroll    = Rect adjusted to indicate source of move
  858. ;*              [bp].leftscroll   =     "
  859. ;*              [bp].rightscroll  =     "
  860. ;*              [bp].bottomscroll =     "
  861. ;*
  862. ;*              [bp].topdest      = Rect adjusted to indicate dest of move
  863. ;*              [bp].leftdest     =     "
  864. ;*              [bp].rightdest    =     "
  865. ;*              [bp].bottomdest   =     "
  866. ;*
  867. ;* CALLS   none
  868. ;*
  869. ;* USES    AX,CX,FLAGS
  870. ;*
  871. ;* NOTES
  872. ;*
  873. ;* PSEUDOCODE
  874. ;*
  875. ;* UP:
  876. ;* DOWN:
  877. ;*     if (RepCount > bottomscroll - topscroll + 1)
  878. ;*         RepCount = bottomscroll - topscroll + 1
  879. ;*         DoMoveFlag = FALSE
  880. ;*     UP:
  881. ;*         topscroll = topscroll + RepCount
  882. ;*         bottomdest = bottomscroll - RepCount
  883. ;*         topfill = bottomdest + 1
  884. ;*     DOWN:
  885. ;*         bottomscroll = bottomscroll - RepCount
  886. ;*         topdest = topscroll + RepCount
  887. ;*         bottomfill = topdest - 1
  888. ;* LEFT:
  889. ;* RIGHT:
  890. ;*     if (RepCount > rightscroll - leftscroll + 1)
  891. ;*         RepCount = rightscroll - leftscroll + 1
  892. ;*         DoMoveFlag = FALSE
  893. ;*     LEFT:
  894. ;*         leftscroll = leftscroll + RepCount
  895. ;*         rightdest = rightscroll - RepCount
  896. ;*         leftfill = rightdest + 1
  897. ;*     RIGHT:
  898. ;*         rightscroll = rightscroll - RepCount
  899. ;*         leftdest = leftscroll + RepCount
  900. ;*         rightfill = leftdest - 1
  901. ;*
  902. ;* RETURN-NORMAL = NONE
  903. ;* RETURN-ERROR  = NONE
  904. ;*
  905. ;****************************************************************************/
  906.  
  907.                 PUBLIC  AdjustRects                             ;@P1 begin
  908. AdjustRects     PROC
  909.                                     ; correct coordinates for scroll type
  910.  
  911.         test    bx,UP+DOWN          ; Is this a scroll up or scroll down
  912.         .if     <nz>                ;   Yes, do the up-down thing
  913.             mov     ax,[bp].bottomscroll
  914.             sub     ax,[bp].topscroll   ; (ax) = maximum possible scroll w/move
  915.             .if     <cx a ax>
  916.                 and     [bp].ScrollFlags,NOT DOMOVE
  917.                 inc     ax          ; (ax) = scroll to clear entire rect
  918.                 mov     cx,ax       ; (cx) = maximum repcount
  919.             .else
  920.                 test    bx,UP           ; Is this a scroll up?
  921.                 .if     <nz>            ;   Yes, do the up thing
  922.                     add     [bp].topscroll,cx
  923.                     mov     ax,[bp].bottomscroll
  924.                     sub     ax,cx
  925.                     mov     [bp].bottomdest,ax
  926.                     inc     ax
  927.                     mov     [bp].topfill,ax
  928.                 .else
  929.                     sub     [bp].bottomscroll,cx
  930.                     mov     ax,[bp].topscroll
  931.                     add     ax,cx
  932.                     mov     [bp].topdest,ax
  933.                     dec     ax
  934.                     mov     [bp].bottomfill,ax
  935.                 .endif
  936.             .endif
  937.         .else                           ; Do the left-right thing
  938.             mov     ax,[bp].rightscroll
  939.             sub     ax,[bp].leftscroll  ; (ax) = maximum possible scroll w/move
  940.             .if     <cx a ax>
  941.                 and     [bp].ScrollFlags,NOT DOMOVE
  942.                 inc     ax              ; (ax) = scroll to clear entire rect
  943.                 mov     cx,ax           ; (cx) = maximum repcount
  944.             .else
  945.                 test    bx,LEFT         ; Is this a scroll left?
  946.                 .if     <nz>            ;   Yes, do the left thing
  947.                     add     [bp].leftscroll,cx
  948.                     mov     ax,[bp].rightscroll
  949.                     sub     ax,cx
  950.                     mov     [bp].rightdest,ax
  951.                     inc     ax
  952.                     mov     [bp].leftfill,ax
  953.                 .else                   ; Do the Right thing
  954.                     sub     [bp].rightscroll,cx
  955.                     mov     ax,[bp].leftscroll
  956.                     add     ax,cx
  957.                     mov     [bp].leftdest,ax
  958.                     dec     ax
  959.                     mov     [bp].rightfill,ax
  960.                 .endif
  961.             .endif
  962.         .endif
  963.  
  964.         ret
  965.  
  966. AdjustRects     ENDP                                            ;@P1 end
  967.  
  968.  
  969. ;/***************************************************************************
  970. ;*
  971. ;* FUNCTION NAME = CalcMoveValues
  972. ;*
  973. ;* DESCRIPTION   =
  974. ;*
  975. ;*      Calculate values the move rectangle functions need
  976. ;*
  977. ;*      CalcMoveValues calculates the offsets into the source and destination
  978. ;*      rectangles used by the move functions.  The UP and LEFT scroll
  979. ;*      functions copy from the beginning of the buffer to the end.  The
  980. ;*      DOWN and RIGHT functions copy from the end of the buffer to the
  981. ;*      beginning.  This function provides the correct starting point
  982. ;*      for the scroll requested.
  983. ;*
  984. ;*      This routine also calculates the number of rows that need to
  985. ;*      be copied.  This value will always be at least one.
  986. ;*
  987. ;*      The number of bytes in each row is calculated.  The value of
  988. ;*      this number is always at least one * cellsize (2 or 4 bytes)
  989. ;*      and is always a multiple of cell size.
  990. ;*
  991. ;*      The number of bytes that need to be skipped to reach the start
  992. ;*      of the next row to be copied is calculated.  This value may be
  993. ;*      zero.
  994. ;*
  995. ;*      With the exception of the number of rows to move, all of the
  996. ;*      values above are calculated separately for the LVB and the PVB
  997. ;*      because the cell size may be different between the two.
  998. ;*
  999. ;* INPUT    =   BX - Flag indicating the type of scroll (UP,DOWN,LEFT,RIGHT)
  1000. ;*              SS:BP - local data storage area
  1001. ;*              DS:SI - user passed parameter block
  1002. ;*              ES:DI - mode data structure
  1003. ;*              [bp].lvb_width - width of the LVB in cells
  1004. ;*              [bp].cellsize - number of bytes per cell in the LVB
  1005. ;*
  1006. ;*              [bp].minrow - index of top most row in LVB (PVB coordinates)
  1007. ;*              [bp].mincol - index of left most row in LVB (PVB coordinates)
  1008. ;*              [bp].maxrow - index of bottom most row in LVB (PVB coordinates)
  1009. ;*              [bp].maxcol - index of right most row in LVB (PVB coordinates)
  1010. ;*
  1011. ;*              [bp].topscroll    = Rect adjusted to indicate source of move
  1012. ;*              [bp].leftscroll   =     "
  1013. ;*              [bp].rightscroll  =     "
  1014. ;*              [bp].bottomscroll =     "
  1015. ;*
  1016. ;*              [bp].topdest      = Rect adjusted to indicate dest of move
  1017. ;*              [bp].leftdest     =     "
  1018. ;*              [bp].rightdest    =     "
  1019. ;*              [bp].bottomdest   =     "
  1020. ;*
  1021. ;* OUTPUT   =
  1022. ;*              [bp].RowsToMove     = number of rows to move
  1023. ;*
  1024. ;*              [bp].PVBMoveCount   = # of bytes per PVB row to move
  1025. ;*              [bp].PVBMoveSkip    = # of bytes to skip to get to the next row
  1026. ;*              [bp].PVBMoveSrcOff  = offset to start of PVB source buffer
  1027. ;*              [bp].PVBMoveDestOff = offset to start of PVB destination buffer
  1028. ;*
  1029. ;*              [bp].LVBMoveCount   = # of bytes per PVB row to move
  1030. ;*              [bp].LVBMoveSkip    = # of bytes to skip to get to the next row
  1031. ;*              [bp].LVBMoveSrcOff  = offset to start of PVB source buffer
  1032. ;*              [bp].LVBMoveDestOff = offset to start of PVB destination buffer
  1033. ;*
  1034. ;* CALLS   none
  1035. ;*
  1036. ;* USES    AX,CX,DX,FLAGS
  1037. ;*
  1038. ;* NOTES
  1039. ;*
  1040. ;* PSEUDOCODE
  1041. ;*
  1042. ;*          RowsToMove = bottomscroll - topscroll + 1
  1043. ;*          PVBMoveCount = (rightscroll - leftscroll) * cellsize
  1044. ;*          PVBRowSkip = modeCols * cellsize - PVBMoveCount
  1045. ;*          LVBMoveCount = (rightscroll - leftscroll) * cellsize
  1046. ;*          LVBRowSkip = lvb_width * cellsize - LVBMoveCount
  1047. ;*          UP:
  1048. ;*          LEFT:
  1049. ;*              LVBMoveSrcOff = ((topscroll - minrow) * lvb_width +
  1050. ;*                               (leftscroll - mincol)) * cellsize
  1051. ;*              PVBMoveSrcOff = (topscroll * modeCols + leftscroll) *
  1052. ;*                              cellsize
  1053. ;*              LVBMoveDestOff = ((topdest - minrow) * lvb_width +
  1054. ;*                                (leftdest - mincol)) * cellsize
  1055. ;*              PVBMoveDestOff = (topdest * modeCols + leftdest) *
  1056. ;*                              cellsize
  1057. ;*          DOWN:
  1058. ;*          RIGHT:
  1059. ;*              LVBMoveSrcOff = ((bottomscroll - minrow) * lvb_width +
  1060. ;*                               (rightscroll - mincol)) * cellsize
  1061. ;*              PVBMoveSrcOff = (bottomscroll * modeCols + rightscroll) *
  1062. ;*                              cellsize
  1063. ;*              LVBMoveDestOff = ((bottomdest - minrow) * lvb_width +
  1064. ;*                                (rightdest - mincol)) * cellsize
  1065. ;*              PVBMoveDestOff = (bottomdest * modeCols + rightdest) *
  1066. ;*                              cellsize
  1067. ;*
  1068. ;* RETURN-NORMAL = NONE
  1069. ;* RETURN-ERROR  = NONE
  1070. ;*
  1071. ;****************************************************************************/
  1072.  
  1073.                     PUBLIC  CalcMoveValues                      ;@P1 begin
  1074. CalcMoveValues      PROC
  1075.  
  1076.         mov     ax,[bp].bottomscroll    ; calculate the number of rows
  1077.         sub     ax,[bp].topscroll       ; to move
  1078.         inc     ax
  1079.         mov     [bp].RowsToMove,ax
  1080.  
  1081.         mov     cx,[bp].rightscroll     ; calculate bytes to move in PVB
  1082.         sub     cx,[bp].leftscroll
  1083.         inc     cx
  1084.         shl     cx,1
  1085.         mov     [bp].PVBMoveCount,cx
  1086.  
  1087.  
  1088.         mov     ax,es:[di].TextCols     ; calculate bytes to skip in PVB
  1089.         shl     ax,1
  1090.         sub     ax,cx
  1091.         mov     [bp].PVBMoveSkip,ax
  1092.  
  1093.         mov     ax,[bp].lvb_width       ; calculate bytes to skip in LVB
  1094.         shl     ax,1
  1095.         sub     ax,cx
  1096.         .if     <[bp].cellsize e WorldCellSize>
  1097.             shl     cx,1
  1098.             shl     ax,1
  1099.         .endif
  1100.         mov     [bp].LVBMoveCount,cx    ; bytes to move in LVB
  1101.         mov     [bp].LVBMoveSkip,ax
  1102.                                         ; calculate buffer copy addresses
  1103.         test    bx,UP+LEFT
  1104.         .if     <nz>                    ; Do the UP-LEFT thing
  1105.             mov     ax,[bp].topscroll   ; calculate PVB source offset
  1106.             mul     es:[di].TextCols
  1107.             add     ax,[bp].leftscroll
  1108.             shl     ax,1
  1109.             mov     [bp].PVBMoveSrcOff,ax
  1110.  
  1111.             mov     ax,[bp].topdest     ; calculate PVB destination offset
  1112.             mul     [bp].lvb_width
  1113.             add     ax,[bp].leftdest
  1114.             shl     ax,1
  1115.             mov     [bp].PVBMoveDestOff,ax
  1116.  
  1117.             mov     ax,[bp].topscroll   ; calculate LVB source offset
  1118.             sub     ax,[bp].minrow
  1119.             mul     [bp].lvb_width
  1120.             add     ax,[bp].leftscroll
  1121.             sub     ax,[bp].mincol
  1122.             shl     ax,1                ; (ax) = LVB src off for 2 byte cell
  1123.             mov     [bp].LVBMoveSrcOff,ax
  1124.  
  1125.             mov     ax,[bp].topdest     ; calculate LVB destination offset
  1126.             sub     ax,[bp].minrow
  1127.             mul     [bp].lvb_width
  1128.             add     ax,[bp].leftdest
  1129.             sub     ax,[bp].mincol
  1130.             shl     ax,1                ; (cx)= LVB dest off for 2 byte cell
  1131.             mov     [bp].LVBMoveDestOff,ax
  1132.  
  1133.             .if     <[bp].cellsize e WorldCellSize>
  1134.                 shl     [bp].LVBMoveSrcOff,1    ; 4 bytes per cell
  1135.                 shl     [bp].LVBMoveDestOff,1   ; 4 bytes per cell
  1136.             .endif
  1137.  
  1138.         .else                           ; Do the DOWN-RIGHT thing
  1139.             mov     ax,[bp].bottomscroll; calculate PVB source offset
  1140.             mul     es:[di].TextCols
  1141.             add     ax,[bp].rightscroll
  1142.             shl     ax,1
  1143.             mov     [bp].PVBMoveSrcOff,ax
  1144.  
  1145.             mov     ax,[bp].bottomdest  ; calculate PVB destination offset
  1146.             mul     [bp].lvb_width
  1147.             add     ax,[bp].rightdest
  1148.             shl     ax,1
  1149.             mov     [bp].PVBMoveDestOff,ax
  1150.  
  1151.             mov     ax,[bp].bottomscroll; calculate LVB source offset
  1152.             sub     ax,[bp].minrow
  1153.             mul     [bp].lvb_width
  1154.             add     ax,[bp].rightscroll
  1155.             sub     ax,[bp].mincol
  1156.             shl     ax,1                ; (ax) = LVB src off for 2 byte cell
  1157.             mov     [bp].LVBMoveSrcOff,ax
  1158.  
  1159.             mov     ax,[bp].bottomdest  ; calculate LVB destination offset
  1160.             sub     ax,[bp].minrow
  1161.             mul     [bp].lvb_width
  1162.             add     ax,[bp].rightdest
  1163.             sub     ax,[bp].mincol
  1164.             shl     ax,1                ; (cx)= LVB dest off for 2 byte cell
  1165.             mov     [bp].LVBMoveDestOff,ax
  1166.             .if     <[bp].cellsize e WorldCellSize>
  1167.                 inc     [bp].LVBMoveSrcOff  ; start at last word of cell
  1168.                 inc     [bp].LVBMoveDestOff ; start at last word of cell
  1169.                 shl     [bp].LVBMoveSrcOff,1    ; 4 bytes per cell
  1170.                 shl     [bp].LVBMoveDestOff,1   ; 4 bytes per cell
  1171.             .endif
  1172.  
  1173.         .endif
  1174.         ret
  1175.  
  1176. CalcMoveValues      ENDP                                        ;@P1 end
  1177.  
  1178. ;/***************************************************************************
  1179. ;*
  1180. ;* FUNCTION NAME = CalcFillValues
  1181. ;*
  1182. ;* DESCRIPTION   =
  1183. ;*
  1184. ;*      Calculate values the fill rectangle function needs
  1185. ;*
  1186. ;*      CalcFillValues calculates the offset into the fill rectangle that
  1187. ;*      is used by the fill function.
  1188. ;*
  1189. ;*      This routine also calculates the number of rows that need to
  1190. ;*      be filled.  This value will always be at least one.
  1191. ;*
  1192. ;*      The number of bytes in each row is calculated.  The value of
  1193. ;*      this number is always at least one * cellsize (2 or 4 bytes)
  1194. ;*      and is always a multiple of cell size.
  1195. ;*
  1196. ;*      The number of bytes that need to be skipped to reach the start
  1197. ;*      of the next row to be copied is calculated.  This value may be
  1198. ;*      zero.
  1199. ;*
  1200. ;*      With the exception of the number of rows to move, all of the
  1201. ;*      values above are calculated separately for the LVB and the PVB
  1202. ;*      because the cell size may be different between the two.
  1203. ;*
  1204. ;* INPUT    =   BX - Flag indicating the type of scroll (UP,DOWN,LEFT,RIGHT)
  1205. ;*              SS:BP - local data storage area
  1206. ;*              DS:SI - user passed parameter block
  1207. ;*              ES:DI - mode data structure
  1208. ;*              [bp].lvb_width - width of the LVB in cells
  1209. ;*              [bp].cellsize - number of bytes per cell in the LVB
  1210. ;*
  1211. ;*              [bp].minrow - index of top most row in LVB (PVB coordinates)
  1212. ;*              [bp].mincol - index of left most row in LVB (PVB coordinates)
  1213. ;*
  1214. ;*              [bp].topfill      = Rect adjusted to indicate fill region
  1215. ;*              [bp].leftfill     =     "
  1216. ;*              [bp].rightfill    =     "
  1217. ;*              [bp].bottomfill   =     "
  1218. ;*
  1219. ;* OUTPUT   =
  1220. ;*              [bp].RowsToFill   = rows to be filled with the default cell
  1221. ;*
  1222. ;*              [bp].PVBFillCount = # of bytes per fill line in PVB
  1223. ;*              [bp].PVBFillSkip  = # of bytes to skip to reach next PVB line
  1224. ;*              [bp].PVBFillOff   = offset of beginning of PVB fill rectangle
  1225. ;*
  1226. ;*              [bp].LVBFillCount = # of bytes per fill line in LVB
  1227. ;*              [bp].LVBFillSkip  = # of bytes to skip to reach next LVB line
  1228. ;*              [bp].LVBFillOff   = offset of beginning of LVB fill rectangle
  1229. ;*
  1230. ;*              [bp].FillCellLow  = first word of default fill cell
  1231. ;*              [bp].FillCellHigh = second word of default fill cell
  1232. ;*
  1233. ;* CALLS   none
  1234. ;*
  1235. ;* USES    AX,CX,DX,SI,FLAGS
  1236. ;*
  1237. ;* NOTES
  1238. ;*
  1239. ;* PSEUDOCODE
  1240. ;*
  1241. ;*       RowsToFill = bottomfill - topfill + 1
  1242. ;*       PVBFillOff = (topfill * modeCols + leftfill) * cellsize
  1243. ;*       PVBFillCount = rightfill - leftfill * cellsize
  1244. ;*       PVBFillSkip = modeCols * cellsize - PVBFillCount
  1245. ;*       LVBFillOff = (leftfill - minrow) * lvb_width +
  1246. ;*                    (topfill - mincol) * cellsize
  1247. ;*       LVBFillCount = rightfill - leftfill * cellsize
  1248. ;*       LVBFillSkip = modeCols * cellsize - LVBFillCount
  1249. ;*       FillCellLow = first word of cell
  1250. ;*       if (inputcellsize = 4)
  1251. ;*           FillCellHigh = second word of cell
  1252. ;*       else
  1253. ;*           FillCellHigh = 0
  1254. ;*
  1255. ;* RETURN-NORMAL = NONE
  1256. ;* RETURN-ERROR  = NONE
  1257. ;*
  1258. ;****************************************************************************/
  1259.  
  1260.                     PUBLIC  CalcFillValues                      ;@P1 begin
  1261. CalcFillValues      PROC
  1262.  
  1263.         mov     ax,[bp].bottomfill      ; calculate the number of rows
  1264.         sub     ax,[bp].topfill         ; to fill
  1265.         inc     ax
  1266.         mov     [bp].RowsToFill,ax
  1267.  
  1268.         mov     ax,[bp].topfill         ; calculate PVB source offset
  1269.         mul     es:[di].TextCols
  1270.         add     ax,[bp].leftfill
  1271.         shl     ax,1
  1272.         mov     [bp].PVBFillOff,ax
  1273.  
  1274.         mov     cx,[bp].rightfill       ; calculate byte per PVB fill row
  1275.         sub     cx,[bp].leftfill
  1276.         inc     cx
  1277.         shl     cx,1
  1278.         mov     [bp].PVBFillCount,cx
  1279.  
  1280.         mov     ax,es:[di].TextCols     ; calculate bytes to skip in PVB
  1281.         shl     ax,1
  1282.         sub     ax,cx
  1283.         mov     [bp].PVBFillSkip,ax
  1284.  
  1285.         mov     ax,[bp].lvb_width       ; calculate bytes to skip in LVB
  1286.         shl     ax,1
  1287.         sub     ax,cx
  1288.         .if     <[bp].cellsize e WorldCellSize>
  1289.             shl     cx,1
  1290.             shl     ax,1
  1291.         .endif
  1292.         mov     [bp].LVBFillCount,cx    ; bytes to fill in LVB
  1293.         mov     [bp].LVBFillSkip,ax
  1294.  
  1295.         mov     ax,[bp].topfill         ; calculate LVB source offset
  1296.         sub     ax,[bp].minrow
  1297.         mul     [bp].lvb_width
  1298.         add     ax,[bp].leftfill
  1299.         sub     ax,[bp].mincol
  1300.         shl     ax,1
  1301.  
  1302.         .if     <[bp].cellsize e WorldCellSize>
  1303.             shl     ax,1
  1304.         .endif
  1305.         mov     [bp].LVBFillOff,ax
  1306.  
  1307.         test    bx,LVBPVB
  1308.         .if     <z>
  1309. IFDEF EPOCH                                                             ;;EPOCH ;; added for J-FUNC
  1310.             lds     si,[si].AppCellAddr                                 ;;EPOCH ;; added for J-FUNC
  1311.             Call    Get_BVSCB           ; Get BVSCB Selecter            ;;EPOCH ;; added for J-FUNC
  1312.             .if     <nonzero ax> and    ; GetShrSeg is Complete !!!     ;;EPOCH ;; added for J-FUNC
  1313.             push    bx                                                  ;;EPOCH ;; added for J-FUNC
  1314.             mov     bx,ds               ; BX = DS                       ;;EPOCH ;; added for J-FUNC
  1315.             cmp     bx,ax               ; AX = BVSCB Selecter           ;;EPOCH ;; added for J-FUNC
  1316.             pop     bx                                                  ;;EPOCH ;; added for J-FUNC
  1317.             .if     <z> and             ; DS = BVSCB selecter !!!       ;;EPOCH ;; added for J-FUNC
  1318.             .if     <<byte ptr ds:[si+3]> e 0FFh> ;Handle for CGA Attr. ;;EPOCH ;; added for J-FUNC
  1319.                 ;This request is from ANSICALL.DLL.                     ;;EPOCH ;; added for J-FUNC
  1320.                 lodsw                   ; Get Cell                      ;;EPOCH ;; added for J-FUNC
  1321.                 mov     [bp].FillCellLow,ax                             ;;EPOCH ;; added for J-FUNC
  1322.                                                                         ;;EPOCH ;; added for J-FUNC
  1323.                 .if     <[bp].shadowFMTID eq PSFormat> ;EPOCH ?         ;;EPOCH ;; added for J-FUNC
  1324.                     xchg    ah,al       ; AL - Attr0                    ;;EPOCH ;; added for J-FUNC
  1325.                     mov     ah,ds:[si]  ; AH - Attr1                    ;;EPOCH ;; added for J-FUNC
  1326.                     Call    Translate   ; Common AX -> EPOCH AL         ;;EPOCH ;; added for J-FUNC
  1327.                     mov     byte ptr [bp+1].FillCellLow,al              ;;EPOCH ;; added for J-FUNC
  1328.                     mov     [bp].FillCellHigh,0                         ;;EPOCH ;; added for J-FUNC
  1329.                 .else                                                   ;;EPOCH ;; added for J-FUNC
  1330.                     lodsw                                               ;;EPOCH ;; added for J-FUNC
  1331.                     xor     ah,ah                                       ;;EPOCH ;; added for J-FUNC
  1332.                     mov     [bp].FillCellHigh,ax                        ;;EPOCH ;; added for J-FUNC
  1333.                 .endif                                                  ;;EPOCH ;; added for J-FUNC
  1334.                                                                         ;;EPOCH ;; added for J-FUNC
  1335.             .else                       ; Not From ANSICALL             ;;EPOCH ;; added for J-FUNC
  1336.                 lds     si,[bp].ParmBuf ; (ds:si) -> parameter buffer   ;;EPOCH ;; added for J-FUNC
  1337. ENDIF                                                                   ;;EPOCH ;; added for J-FUNC
  1338.                 test    [si].Flags,CGAAttr      ; the jump is 5 lines down
  1339.  
  1340.                 lds     si,[si].AppCellAddr
  1341.                 lodsw
  1342.                 mov     [bp].FillCellLow,ax
  1343.                 mov     [bp].FillCellHigh,0
  1344.  
  1345. IFNDEF EPOCH                                                            ;;EPOCH ;; added for J-FUNC
  1346.                 .if     <z> and
  1347.                 .if     <[bp].cellsize e WorldCellSize>
  1348. ELSE                                                                    ;;EPOCH ;; added for J-FUNC
  1349.                 .if     <z>                                             ;;EPOCH ;; added for J-FUNC
  1350.                     .if     <[bp].cellsize e WorldCellSize>             ;;EPOCH ;; added for J-FUNC
  1351. ENDIF                                                                   ;;EPOCH ;; added for J-FUNC
  1352.                         lodsw
  1353. IFDEF EPOCH                                                             ;;EPOCH ;; added for J-FUNC
  1354.                         xor     ah,ah                                   ;;EPOCH ;; added for J-FUNC
  1355. ENDIF                                                                   ;;EPOCH ;; added for J-FUNC
  1356.                         mov     [bp].FillCellHigh,ax
  1357.                     .endif
  1358. IFDEF EPOCH                                                             ;;EPOCH ;; added for J-FUNC
  1359.                 .else                   ; From WrtTTY                   ;;EPOCH ;; added for J-FUNC
  1360.                     .if     <[bp].shadowFMTID eq PSFormat> ;EPOCH ?     ;;EPOCH ;; added for J-FUNC
  1361.                         xchg    ah,al   ; AL - Attr0                    ;;EPOCH ;; added for J-FUNC
  1362.                         mov     ah, ds:[si] ; AH - Attr1                ;;EPOCH ;; added for J-FUNC
  1363.                         Call    Translate   ; Common AX -> EPOCH AL     ;;EPOCH ;; added for J-FUNC
  1364.                         mov     byte ptr [bp+1].FillCellLow,al          ;;EPOCH ;; added for J-FUNC
  1365.                         mov     [bp].FillCellHigh,0                     ;;EPOCH ;; added for J-FUNC
  1366.                     .else                                               ;;EPOCH ;; added for J-FUNC
  1367.                         lodsw                                           ;;EPOCH ;; added for J-FUNC
  1368.                         xor     ah, ah                                  ;;EPOCH ;; added for J-FUNC
  1369.                         mov     [bp].FillCellHigh,ax                    ;;EPOCH ;; added for J-FUNC
  1370.                     .endif                                              ;;EPOCH ;; added for J-FUNC
  1371.                 .endif                                                  ;;EPOCH ;; added for J-FUNC
  1372. ENDIF                                                                   ;;EPOCH ;; added for J-FUNC
  1373.                 lds     si,[bp].ParmBuf         ; (ds:si) -> parameter buffer
  1374. IFDEF EPOCH                                                             ;;EPOCH ;; added for J-FUNC
  1375.             .endif                                                      ;;EPOCH ;; added for J-FUNC
  1376. ENDIF                                                                   ;;EPOCH ;; added for J-FUNC
  1377.         .endif
  1378.  
  1379.         ret
  1380.  
  1381. CalcFillValues      ENDP                                        ;@P1 end
  1382.  
  1383.  
  1384. ;/***************************************************************************
  1385. ;*
  1386. ;* FUNCTION NAME = MoveUpLeft
  1387. ;*
  1388. ;* DESCRIPTION   =
  1389. ;*
  1390. ;*      Move a rectangle for ScrollUp or ScrollLeft
  1391. ;*
  1392. ;*      MoveUpLeft copys a rectangle in the LVB and/or PVB from beginning
  1393. ;*      to end, one line at a time.
  1394. ;*
  1395. ;* INPUT     =  BX = LVB selector or 0 if no LVB write indicated
  1396. ;*              SS:BP - local data storage area
  1397. ;*
  1398. ;*              [bp].PVB_Sel = PVB selector if PVB scroll is indicated else 0
  1399. ;*
  1400. ;*              [bp].RowsToMove     = number of rows to move
  1401. ;*
  1402. ;*              [bp].PVBMoveCount   = # of bytes per PVB row to move
  1403. ;*              [bp].PVBMoveSkip    = # of bytes to skip to get to the next row
  1404. ;*              [bp].PVBMoveSrcOff  = offset to start of PVB source buffer
  1405. ;*              [bp].PVBMoveDestOff = offset to start of PVB destination buffer
  1406. ;*
  1407. ;*              [bp].LVBMoveCount   = # of bytes per PVB row to move
  1408. ;*              [bp].LVBMoveSkip    = # of bytes to skip to get to the next row
  1409. ;*              [bp].LVBMoveSrcOff  = offset to start of PVB source buffer
  1410. ;*              [bp].LVBMoveDestOff = offset to start of PVB destination buffer
  1411. ;*
  1412. ;* OUTPUT    =
  1413. ;*              The rectangle in the LVB or PVB is moved as appropriate
  1414. ;*
  1415. ;* CALLS   none
  1416. ;*
  1417. ;* USES    AX,BX,CX,DX,SI,DI,DS,ES,FLAGS
  1418. ;*
  1419. ;* NOTES
  1420. ;*
  1421. ;* PSEUDOCODE
  1422. ;*
  1423. ;*        cursrcoff  = FirstMoveSrcOff
  1424. ;*        curdestoff  = FirstMoveDestOff
  1425. ;*        while (RowsToMove--)
  1426. ;*            curcount = MoveCount
  1427. ;*            while (curcount--)
  1428. ;*                *curdestoff++ = *cursrcoff++
  1429. ;*            cursrcoff += NextLineMove
  1430. ;*            curdestoff += NextLineMove
  1431. ;*
  1432. ;* RETURN-NORMAL = NONE
  1433. ;* RETURN-ERROR  = NONE
  1434. ;*
  1435. ;****************************************************************************/
  1436.  
  1437.                 PUBLIC  MoveUpLeft                              ;@P1 begin
  1438. MoveUpLeft      PROC
  1439.  
  1440.         cld                                 ; increment si, di
  1441.         .if     <nonzero bx>
  1442.             mov     ds,bx
  1443.             mov     es,bx
  1444.             mov     bx,[bp].RowsToMove
  1445.             mov     si,[bp].LVBMoveSrcOff
  1446.             mov     di,[bp].LVBMoveDestOff
  1447.             mov     dx,[bp].LVBMoveCount
  1448.             shr     dx,1                    ; convert bytes to words
  1449.  
  1450. mulf10:     mov     cx,dx                   ; (cx) = bytes to move this row
  1451. IFDEF D1348 ;check if DBCS && common lvb.
  1452. IFNDEF MSKK                                                             ;;MSKK  ;; added for J-FUNC
  1453.             .if    <bit <[bp].flgDBCS> and anyDBCS> and
  1454.             .if    <[bp].j_funcindx eq WorldFmtIndx>
  1455. ELSE                                                                    ;;MSKK  ;; added for J-FUNC
  1456.             .if    <bit <[bp].flgDBCS> and anyDBCS>                     ;;MSKK  ;; added for J-FUNC
  1457. ENDIF ; MSKK                                                            ;;MSKK  ;; added for J-FUNC
  1458.                 push    bx                  ; save row count
  1459.                 call    MoveUpLeftWrld
  1460.                 pop     bx                  ; restore row count
  1461.             .else
  1462.                 rep     movsw               ; move the line
  1463.             .endif
  1464. ELSE  ;D1348
  1465.             rep     movsw                   ; move the line
  1466. ENDIF ;D1348
  1467.             add     si,[bp].LVBMoveSkip     ; advance to the next source line
  1468.             add     di,[bp].LVBMoveSkip     ; advance to the next dest line
  1469.             dec     bx                      ; Are there more rows to move?
  1470.             jnz     mulf10                  ;   Yes, go do the next one
  1471.  
  1472.         .endif
  1473.         mov     bx,[bp].PVB_SEL
  1474.         .if     <nonzero bx>
  1475.             mov     ds,bx
  1476.             mov     es,bx
  1477.             mov     bx,[bp].RowsToMove
  1478.             mov     si,[bp].PVBMoveSrcOff
  1479.             mov     di,[bp].PVBMoveDestOff
  1480.             mov     dx,[bp].PVBMoveCount
  1481.             shr     dx,1                    ; convert bytes to words
  1482.  
  1483. mulf20:     mov     cx,dx                   ; (cx) = bytes to move this row
  1484.             REP_MOVSW                       ; Use this macro so CGA can share
  1485.                                             ; the same set of sources
  1486.             add     si,[bp].PVBMoveSkip     ; advance to the next source line
  1487.             add     di,[bp].PVBMoveSkip     ; advance to the next dest line
  1488.             dec     bx                      ; Are there more rows to move?
  1489.             jnz     mulf20                  ;   Yes, go do the next one
  1490.  
  1491.         .endif
  1492.  
  1493.         ret
  1494.  
  1495. MoveUpLeft      ENDP                                            ;@P1 end
  1496.  
  1497.  
  1498. ;/***************************************************************************
  1499. ;*
  1500. ;* FUNCTION NAME = MoveDownRight
  1501. ;*
  1502. ;* DESCRIPTION   =
  1503. ;*
  1504. ;*      Move a rectangle for ScrollDown or ScrollRight
  1505. ;*
  1506. ;*      MoveDownRight copys a rectangle in the LVB and/or PVB from beginning
  1507. ;*      to end, one line at a time.
  1508. ;*
  1509. ;* INPUT     =  BX = LVB selector or 0 if no LVB write indicated
  1510. ;*              SS:BP - local data storage area
  1511. ;*
  1512. ;*              [bp].PVB_Sel = PVB selector if PVB scroll is indicated else 0
  1513. ;*
  1514. ;*              [bp].RowsToMove     = number of rows to move
  1515. ;*
  1516. ;*              [bp].PVBMoveCount   = # of bytes per PVB row to move
  1517. ;*              [bp].PVBMoveSkip    = # of bytes to skip to get to the next row
  1518. ;*              [bp].PVBMoveSrcOff  = offset to start of PVB source buffer
  1519. ;*              [bp].PVBMoveDestOff = offset to start of PVB destination buffer
  1520. ;*
  1521. ;*              [bp].LVBMoveCount   = # of bytes per PVB row to move
  1522. ;*              [bp].LVBMoveSkip    = # of bytes to skip to get to the next row
  1523. ;*              [bp].LVBMoveSrcOff  = offset to start of PVB source buffer
  1524. ;*              [bp].LVBMoveDestOff = offset to start of PVB destination buffer
  1525. ;*
  1526. ;* OUTPUT    =
  1527. ;*              The rectangle in the LVB or PVB is moved as appropriate
  1528. ;*
  1529. ;* CALLS   none
  1530. ;*
  1531. ;* USES    AX,BX,CX,DX,SI,DI,DS,ES,FLAGS
  1532. ;*
  1533. ;* NOTES
  1534. ;*
  1535. ;* PSEUDOCODE
  1536. ;*
  1537. ;*        cursrcoff  = LastMoveSrcOff
  1538. ;*        curdestoff  = LastMoveDestOff
  1539. ;*        while (RowsToMove--)
  1540. ;*            curcount = MoveCount
  1541. ;*            while (curcount--)
  1542. ;*                *curdestoff-- = *cursrcoff--
  1543. ;*            cursrcoff -= NextLineMove
  1544. ;*            curdestoff -= NextLineMove
  1545. ;*
  1546. ;* RETURN-NORMAL = NONE
  1547. ;* RETURN-ERROR  = NONE
  1548. ;*
  1549. ;****************************************************************************/
  1550.  
  1551.                 PUBLIC  MoveDownRight                           ;@P1 begin
  1552. MoveDownRight   PROC
  1553.  
  1554.         std                                 ; decrement si, di
  1555.         .if     <nonzero bx>
  1556.             mov     ds,bx
  1557.             mov     es,bx
  1558.             mov     bx,[bp].RowsToMove
  1559.             mov     si,[bp].LVBMoveSrcOff
  1560.             mov     di,[bp].LVBMoveDestOff
  1561.             mov     dx,[bp].LVBMoveCount
  1562.             shr     dx,1                    ; convert bytes to words
  1563.  
  1564. mdrt10:     mov     cx,dx                   ; (cx) = bytes to move this row
  1565. IFDEF D1348 ;check if DBCS && common lvb.
  1566. IFNDEF MSKK                                                             ;;MSKK  ;; added for J-FUNC
  1567.             .if    <bit <[bp].flgDBCS> and anyDBCS> and
  1568.             .if    <[bp].j_funcindx eq WorldFmtIndx>
  1569. ELSE                                                                    ;;MSKK  ;; added for J-FUNC
  1570.             .if    <bit <[bp].flgDBCS> and anyDBCS>                     ;;MSKK  ;; added for J-FUNC
  1571. ENDIF ; MSKK                                                            ;;MSKK  ;; added for J-FUNC
  1572.                 push    bx                  ; save row count
  1573.                 call    MoveDownRightWrld
  1574.                 pop     bx                  ; restore row count
  1575.             .else
  1576.                 rep     movsw               ; move the line
  1577.             .endif
  1578. ELSE  ;D1348
  1579.             rep     movsw                   ; move the line
  1580. ENDIF ;D1348
  1581.             sub     si,[bp].LVBMoveSkip     ; advance to the next source line
  1582.             sub     di,[bp].LVBMoveSkip     ; advance to the next dest line
  1583.             dec     bx                      ; Are there more rows to move?
  1584.             jnz     mdrt10                  ;   Yes, go do the next one
  1585.  
  1586.         .endif
  1587.         mov     bx,[bp].PVB_SEL
  1588.         .if     <nonzero bx>
  1589.             mov     ds,bx
  1590.             mov     es,bx
  1591.             mov     bx,[bp].RowsToMove
  1592.             mov     si,[bp].PVBMoveSrcOff
  1593.             mov     di,[bp].PVBMoveDestOff
  1594.             mov     dx,[bp].PVBMoveCount
  1595.             shr     dx,1                    ; convert bytes to words
  1596.  
  1597. mdrt20:     mov     cx,dx                   ; (cx) = bytes to move this row
  1598.             REP_MOVSW                       ; Use this macro so CGA can share
  1599.                                             ; the same set of sources
  1600.             sub     si,[bp].PVBMoveSkip     ; advance to the next source line
  1601.             sub     di,[bp].PVBMoveSkip     ; advance to the next dest line
  1602.             dec     bx                      ; Are there more rows to move?
  1603.             jnz     mdrt20                  ;   Yes, go do the next one
  1604.  
  1605.         .endif
  1606.  
  1607.         ret
  1608.  
  1609. MoveDownRight   ENDP                                            ;@P1 end
  1610.  
  1611.  
  1612. ;/***************************************************************************
  1613. ;*
  1614. ;* FUNCTION NAME = FillRectWithCell
  1615. ;*
  1616. ;* DESCRIPTION   =
  1617. ;*
  1618. ;*      Fill a rectangle for with the default cell
  1619. ;*
  1620. ;*      FillRectWithCell fills the specified rectangle in the LVB and/or
  1621. ;*      PVB with the given cell, beginning to end, one line at a time.
  1622. ;*
  1623. ;* INPUT     =  BX = LVB selector or 0 if no LVB write indicated
  1624. ;*              SS:BP - local data storage area
  1625. ;*
  1626. ;*              [bp].PVB_Sel = PVB selector if PVB scroll is indicated else 0
  1627. ;*
  1628. ;*              [bp].RowsToFill   = rows to be filled with the default cell
  1629. ;*
  1630. ;*              [bp].PVBFillCount = # of bytes per fill line in PVB
  1631. ;*              [bp].PVBFillSkip  = # of bytes to skip to reach next PVB line
  1632. ;*              [bp].PVBFillOff   = offset of beginning of PVB fill rectangle
  1633. ;*
  1634. ;*              [bp].LVBFillCount = # of bytes per fill line in LVB
  1635. ;*              [bp].LVBFillSkip  = # of bytes to skip to reach next LVB line
  1636. ;*              [bp].LVBFillOff   = offset of beginning of LVB fill rectangle
  1637. ;*
  1638. ;*              [bp].FillCellLow  = first word of default fill cell
  1639. ;*              [bp].FillCellHigh = second word of default fill cell
  1640. ;*
  1641. ;* OUTPUT     =
  1642. ;*              The rectangle in the LVB or PVB is moved as appropriate
  1643. ;*
  1644. ;*
  1645. ;*      CALLS   none
  1646. ;*
  1647. ;*      USES    AX,BX,CX,DX,SI,DI,DS,ES,FLAGS
  1648. ;*
  1649. ;*      NOTES
  1650. ;*
  1651. ;*      PSEUDOCODE
  1652. ;*
  1653. ;*           curdestoff = FirstFillDestOff
  1654. ;*           while (RowsToFill)
  1655. ;*           for (curline = FirstFillLine; curline <= LastFillLine; curline++)
  1656. ;*               curcount = FillCount
  1657. ;*               while (curcount--)
  1658. ;*                   *curdestoff = fillcell
  1659. ;*               curdestoff += NextLineFill
  1660. ;*
  1661. ;*
  1662. ;* RETURN-NORMAL = NONE
  1663. ;* RETURN-ERROR  = NONE
  1664. ;*
  1665. ;****************************************************************************/
  1666.  
  1667.                 PUBLIC  FillRectWithCell                        ;@P1 begin
  1668. FillRectWithCell    PROC
  1669.  
  1670.         cld                                 ; increment si, di
  1671.         mov     ax,[bp].FillCellLow
  1672.         .if     <nonzero bx>
  1673.             mov     ds,bx
  1674.             mov     es,bx
  1675.             mov     bx,[bp].RowsToFill
  1676.             mov     di,[bp].LVBFillOff
  1677.             mov     dx,[bp].LVBFillCount
  1678.             .if     <[bp].cellsize e WorldCellSize>
  1679.                 mov     si,[bp].FillCellHigh
  1680.                 shr     dx,2                ; convert bytes to cells
  1681.  
  1682. frwc10:         mov     cx,dx               ; (cx) = bytes to move this row
  1683. ;; IFDEF EPOCH  ;26Sep91 +                                                      ;;KY02D ;;EPOCH
  1684. ;;              and     ah,not (epochDBCSLead+epochDBCSTrail)                   ;;KY02D ;;EPOCH
  1685. ;; ENDIF        ;26Sep91 -                                                      ;;KY02D ;;EPOCH
  1686.                 .repeat                     ; fill the line with the cell
  1687.                     stosw
  1688.                     xchg    ax,si
  1689.                     stosw
  1690.                     xchg    ax,si
  1691.                 .loop
  1692.                 add     di,[bp].LVBFillSkip ; advance to the next source line
  1693.                 dec     bx                  ; Are there more rows to move?
  1694.                 jnz     frwc10              ;   Yes, go do the next one
  1695.             .else
  1696.                 shr     dx,1                ; convert bytes to cells
  1697.  
  1698. frwc20:         mov     cx,dx               ; (cx) = bytes to move this row
  1699.                 rep     stosw               ; fill the line with the cell
  1700.                 add     di,[bp].LVBFillSkip ; advance to the next source line
  1701.                 dec     bx                  ; Are there more rows to move?
  1702.                 jnz     frwc20              ;   Yes, go do the next one
  1703. IFDEF MSKK                                                              ;;MSKK  ;; added for J-FUNC
  1704.                 mov     bx,[bp].RowsToFill                              ;;MSKK  ;; added for J-FUNC
  1705.                 mov     di,[bp].LVBFillOff                              ;;MSKK  ;; added for J-FUNC
  1706.                 push    es                                              ;;MSKK  ;; added for J-FUNC
  1707.                 mov     es,[bp].j_dbcslvbsel; use DBCS flag LVB         ;;MSKK  ;; added for J-FUNC
  1708.                 push    ax                                              ;;MSKK  ;; added for J-FUNC
  1709.                 xor     ax,ax                                           ;;MSKK  ;; added for J-FUNC
  1710.                                                                         ;;MSKK  ;; added for J-FUNC
  1711. @@:             mov     cx,dx               ; (cx) = bytes to move this row     ;; added for J-FUNC
  1712.                 rep     stosw               ; fill the line with the cell       ;; added for J-FUNC
  1713.                 add     di,[bp].LVBFillSkip ; advance to the next source line   ;; added for J-FUNC
  1714.                 dec     bx                  ; Are there more rows to move?      ;; added for J-FUNC
  1715.                 jnz     @B                  ; Yes, go do the next one   ;;MSKK  ;; added for J-FUNC
  1716.                 pop     ax                                              ;;MSKK  ;; added for J-FUNC
  1717.                 pop     es                                              ;;MSKK  ;; added for J-FUNC
  1718. ENDIF ; MSKK                                                            ;;MSKK  ;; added for J-FUNC
  1719.             .endif
  1720.         .endif
  1721.         mov     bx,[bp].PVB_SEL
  1722.         .if     <nonzero bx>
  1723.             mov     ds,bx
  1724.             mov     es,bx
  1725.             mov     bx,[bp].RowsToFill
  1726.             mov     di,[bp].PVBFillOff
  1727.             mov     dx,[bp].PVBFillCount
  1728.             shr     dx,1                    ; convert bytes to words
  1729.  
  1730. frwc30:     mov     cx,dx                   ; (cx) = bytes to move this row
  1731.             REP_STOSW                       ; Use this macro so CGA can share
  1732.                                             ; the same set of sources
  1733.             add     di,[bp].PVBFillSkip     ; advance to the next dest line
  1734.             dec     bx                      ; Are there more rows to move?
  1735.             jnz     frwc30                  ;   Yes, go do the next one
  1736.         .endif
  1737.  
  1738.         ret
  1739.  
  1740. FillRectWithCell    ENDP                                        ;@P1 end
  1741.  
  1742.  
  1743. ;/***************************************************************************
  1744. ;*
  1745. ;* FUNCTION NAME = MoveLVBRectToPVB
  1746. ;*
  1747. ;*      Copy a rectangle from LVB to PVB
  1748. ;*
  1749. ;*      MoveLVBRectToPVB copys the FillRect in the LVB to the FillRect in
  1750. ;*      the PVB.  Conversions for different cell sizes are done at this time.
  1751. ;*
  1752. ;* INPUT    =   BX = LVB selector or 0 if no LVB write indicated
  1753. ;*              SS:BP - local data storage area
  1754. ;*
  1755. ;*              [bp].PVB_Sel = PVB selector if PVB scroll is indicated else 0
  1756. ;*
  1757. ;*              [bp].RowsToFill   = rows to be filled with the default cell
  1758. ;*
  1759. ;*              [bp].PVBFillCount = # of bytes per fill line in PVB
  1760. ;*              [bp].PVBFillSkip  = # of bytes to skip to reach next PVB line
  1761. ;*              [bp].PVBFillOff   = offset of beginning of PVB fill rectangle
  1762. ;*
  1763. ;*              [bp].LVBFillCount = # of bytes per fill line in LVB
  1764. ;*              [bp].LVBFillSkip  = # of bytes to skip to reach next LVB line
  1765. ;*              [bp].LVBFillOff   = offset of beginning of LVB fill rectangle
  1766. ;*
  1767. ;*              [bp].FillCellLow  = first word of default fill cell
  1768. ;*              [bp].FillCellHigh = second word of default fill cell
  1769. ;*
  1770. ;* OUTPUT    =
  1771. ;*              The rectangle in the LVB or PVB is moved as appropriate
  1772. ;*
  1773. ;*
  1774. ;*      CALLS   none
  1775. ;*
  1776. ;*      USES    AX,BX,CX,DX,SI,DI,DS,ES,FLAGS
  1777. ;*
  1778. ;*      NOTES
  1779. ;*
  1780. ;*      PSEUDOCODE
  1781. ;*
  1782. ;*          cursrcoff = LVBFillOff
  1783. ;*          curdestoff = PVBFillOff
  1784. ;*          while (RowsToFill)
  1785. ;*              curcount = FillCount
  1786. ;*              while (curcount--)
  1787. ;*                  *curdestoff = *cursrcoff
  1788. ;*              curdestoff += PVBFillSkip
  1789. ;*              cursrcoff += LVBFillSkip
  1790. ;*
  1791. ;*
  1792. ;* RETURN-NORMAL = NONE
  1793. ;* RETURN-ERROR  = NONE
  1794. ;*
  1795. ;****************************************************************************/
  1796.  
  1797.                 PUBLIC  MoveLVBRectToPVB                        ;@P1 begin
  1798. MoveLVBRectToPVB    PROC
  1799.  
  1800.         cld                                 ; increment si, di
  1801.         .if     <nonzero bx> and
  1802.         mov     ds,bx                       ; (ds) = LVB segment
  1803.         mov     bx,[bp].PVB_Sel
  1804.         .if     <nonzero bx>
  1805.             mov     es,bx                   ; (es) = PVB segment
  1806.             mov     si,[bp].LVBFillOff      ; (si) = LVB rectangle offset
  1807.             mov     di,[bp].PVBFillOff      ; (di) = PVB rectangle offset
  1808.             mov     bx,[bp].RowsToFill
  1809.             mov     dx,[bp].LVBFillCount
  1810.             .if     <[bp].cellsize e WorldCellSize>
  1811.                 shr     dx,2                ; convert bytes to cells
  1812.  
  1813. lrtp10:         mov     cx,dx               ; (cx) = bytes to move this row
  1814.                 REP_MOVSW_ADDSI2_LOOP       ; Use this macro so CGA can share
  1815.                                             ; the same set of sources
  1816.                 add     si,[bp].LVBFillSkip ; advance to the next LVB line
  1817.                 add     di,[bp].PVBFillSkip ; advance to the next PVB line
  1818.                 dec     bx                  ; Are there more rows to move?
  1819.                 jnz     lrtp10              ;   Yes, go do the next one
  1820.             .else
  1821.                 shr     dx,1                ; convert bytes to cells
  1822.  
  1823. lrtp20:         mov     cx,dx               ; (cx) = bytes to move this row
  1824.                 REP_MOVSW                   ; Use this macro so CGA can share
  1825.                                             ; the same set of sources
  1826.                 add     si,[bp].LVBFillSkip ; advance to the next LVB line
  1827.                 add     di,[bp].PVBFillSkip ; advance to the next PVB line
  1828.                 dec     bx                  ; Are there more rows to move?
  1829.                 jnz     lrtp20              ;   Yes, go do the next one
  1830.             .endif
  1831.         .endif
  1832.  
  1833.         ret
  1834.  
  1835. MoveLVBRectToPVB    ENDP                                        ;@P1 end
  1836.  
  1837. IFDEF EPOCH                                                             ;;EPOCH ;; added for J-FUNC
  1838. ;/********************************************************************* ;;EPOCH ;; added for J-FUNC
  1839. ;*                                                                      ;;EPOCH ;; added for J-FUNC
  1840. ;*  Attribute Translation.                                              ;;EPOCH ;; added for J-FUNC
  1841. ;*  This procedure is used only for Epoch attribute translation.        ;;EPOCH ;; added for J-FUNC
  1842. ;*                                                                      ;;EPOCH ;; added for J-FUNC
  1843. ;*    Input  : AX - Attr0 and 1 of Common Format                        ;;EPOCH ;; added for J-FUNC
  1844. ;*             These are set by WrtTTY of ANSI.                         ;;EPOCH ;; added for J-FUNC
  1845. ;*                                                                      ;;EPOCH ;; added for J-FUNC
  1846. ;*      AL - 7 : BG Hint    AH - 7 : Underline                          ;;EPOCH ;; added for J-FUNC
  1847. ;*           6 : BG Red          6 : Reverse                            ;;EPOCH ;; added for J-FUNC
  1848. ;*           5 : BG Green        5 : Blink                              ;;EPOCH ;; added for J-FUNC
  1849. ;*           4 : BG Blue         4 :                FG Red              ;;EPOCH ;; added for J-FUNC
  1850. ;*           3 : FG Hint         3 : V-Grid                             ;;EPOCH ;; added for J-FUNC
  1851. ;*           2 : FG Red          2 : H-Grid                             ;;EPOCH ;; added for J-FUNC
  1852. ;*           1 : FG Green        1 :                FG Green            ;;EPOCH ;; added for J-FUNC
  1853. ;*           0 : FG Blue         0 :                FG Blue             ;;EPOCH ;; added for J-FUNC
  1854. ;*                                                                      ;;EPOCH ;; added for J-FUNC
  1855. ;*                                                                      ;;EPOCH ;; added for J-FUNC
  1856. ;*      Note:                                                           ;;EPOCH ;; added for J-FUNC
  1857. ;*          Bit 0,1, and 4 of AH are embezzled by ANSI as RGB.          ;;EPOCH ;; added for J-FUNC
  1858. ;*                                                                      ;;EPOCH ;; added for J-FUNC
  1859. ;*                                                                      ;;EPOCH ;; added for J-FUNC
  1860. ;*    Output : AL - Epoch Attr                                          ;;EPOCH ;; added for J-FUNC
  1861. ;*                                                                      ;;EPOCH ;; added for J-FUNC
  1862. ;**********************************************************************/;;EPOCH ;; added for J-FUNC
  1863. Translate proc  near                                                    ;;EPOCH ;; added for J-FUNC
  1864.         PUBLIC  Translate                                               ;;EPOCH ;; added for J-FUNC
  1865.         push    bx                                                      ;;EPOCH ;; added for J-FUNC
  1866.         push    ds                                                      ;;EPOCH ;; added for J-FUNC
  1867.         push    _data                                                   ;;EPOCH ;; added for J-FUNC
  1868.         pop     ds                                                      ;;EPOCH ;; added for J-FUNC
  1869.                                                                         ;;EPOCH ;; added for J-FUNC
  1870.         .if     <[bp].shadowColor eq 4>     ; Epoch Color               ;;EPOCH ;; added for J-FUNC
  1871.                                                                         ;;EPOCH ;; added for J-FUNC
  1872.             .if     <bit ah and 40h>        ; Reverse ?                 ;;EPOCH ;; added for J-FUNC
  1873.                 .if     <bit al nand 07h>   ; FG Color Off              ;;EPOCH ;; added for J-FUNC
  1874.                     mov     bl, ah                                      ;;EPOCH ;; added for J-FUNC
  1875.                     mov     bh, ah                                      ;;EPOCH ;; added for J-FUNC
  1876.                     shr     bh, 2           ; Get Red Bit               ;;EPOCH ;; added for J-FUNC
  1877.                     and     bx, 0403h       ; Get Red, Green & Blue     ;;EPOCH ;; added for J-FUNC
  1878.                     or      bl, bh                                      ;;EPOCH ;; added for J-FUNC
  1879.                     mov     al, bl          ; Change Attr               ;;EPOCH ;; added for J-FUNC
  1880.                 .endif                                                  ;;EPOCH ;; added for J-FUNC
  1881.                 mov     bx, offset cga2epoch                            ;;EPOCH ;; added for J-FUNC
  1882.                 xlat                        ; Get Color                 ;;EPOCH ;; added for J-FUNC
  1883.                 or      al, 04h             ; Force Reverse             ;;EPOCH ;; added for J-FUNC
  1884.                                                                         ;;EPOCH ;; added for J-FUNC
  1885.             .else                           ; Not Reverse               ;;EPOCH ;; added for J-FUNC
  1886.                 and     al, 07h             ; Only ForeGround Attr      ;;EPOCH ;; added for J-FUNC
  1887.                 mov     bx, offset cga2epoch                            ;;EPOCH ;; added for J-FUNC
  1888.                 xlat                        ; Get Color                 ;;EPOCH ;; added for J-FUNC
  1889.             .endif                                                      ;;EPOCH ;; added for J-FUNC
  1890.                                                                         ;;EPOCH ;; added for J-FUNC
  1891.         .else                               ; Epoch Mono                ;;EPOCH ;; added for J-FUNC
  1892.                                                                         ;;EPOCH ;; added for J-FUNC
  1893.             .if     <bit al nand 77h> or    ; Invisible ?               ;;EPOCH ;; added for J-FUNC
  1894.             .if     <bit ah and 40h> and    ; Reverse ?                 ;;EPOCH ;; added for J-FUNC
  1895.             .if     <bit ah nand 13h>       ; FG Color Off              ;;EPOCH ;; added for J-FUNC
  1896.                 mov     al, 0cch                                        ;;EPOCH ;; added for J-FUNC
  1897.             .else                                                       ;;EPOCH ;; added for J-FUNC
  1898.                 and     al, 08h             ; Only Mask For Intensity   ;;EPOCH ;; added for J-FUNC
  1899.                 .if     <bit ah and 20h>    ; Blink                     ;;EPOCH ;; added for J-FUNC
  1900.                     or      al, 80h         ; Set                       ;;EPOCH ;; added for J-FUNC
  1901.                 .endif                                                  ;;EPOCH ;; added for J-FUNC
  1902.                 .if     <bit ah and 80h>    ; UnderScore                ;;EPOCH ;; added for J-FUNC
  1903.                     or      al, 40h         ; Set                       ;;EPOCH ;; added for J-FUNC
  1904.                 .endif                                                  ;;EPOCH ;; added for J-FUNC
  1905.                 .if     <bit ah and 40h>    ; Reverse                   ;;EPOCH ;; added for J-FUNC
  1906.                     or      al, 04h         ; Set                       ;;EPOCH ;; added for J-FUNC
  1907.                 .endif                                                  ;;EPOCH ;; added for J-FUNC
  1908.             .endif                                                      ;;EPOCH ;; added for J-FUNC
  1909.                                                                         ;;EPOCH ;; added for J-FUNC
  1910.         .endif                                                          ;;EPOCH ;; added for J-FUNC
  1911.                                                                         ;;EPOCH ;; added for J-FUNC
  1912.         .if     <bit ah and 08h>            ; V-Grid                    ;;EPOCH ;; added for J-FUNC
  1913.             or      al, 10h                 ; Set                       ;;EPOCH ;; added for J-FUNC
  1914.         .endif                                                          ;;EPOCH ;; added for J-FUNC
  1915.         .if     <bit ah and 04h>            ; H-Grid                    ;;EPOCH ;; added for J-FUNC
  1916.             or      al, 20h                 ; Set                       ;;EPOCH ;; added for J-FUNC
  1917.         .endif                                                          ;;EPOCH ;; added for J-FUNC
  1918.                                                                         ;;EPOCH ;; added for J-FUNC
  1919.         pop     ds                                                      ;;EPOCH ;; added for J-FUNC
  1920.         pop     bx                                                      ;;EPOCH ;; added for J-FUNC
  1921.         ret                                                             ;;EPOCH ;; added for J-FUNC
  1922. Translate endp                                                          ;;EPOCH ;; added for J-FUNC
  1923.                                                                         ;;EPOCH ;; added for J-FUNC
  1924. Get_BVSCB proc  near                                                    ;;EPOCH ;; added for J-FUNC
  1925.         public  Get_BVSCB                                               ;;EPOCH ;; added for J-FUNC
  1926. ;***********************************************************************;;EPOCH ;; added for J-FUNC
  1927. ;* Output : AX - BVSCB Selector                                         ;;EPOCH ;; added for J-FUNC
  1928. ;*               0 means Error.                                         ;;EPOCH ;; added for J-FUNC
  1929. ;***********************************************************************;;EPOCH ;; added for J-FUNC
  1930.         push    bx                                                      ;;EPOCH ;; added for J-FUNC
  1931.         push    ds                                                      ;;EPOCH ;; added for J-FUNC
  1932.         push    si                                                      ;;EPOCH ;; added for J-FUNC
  1933.                                                                         ;;EPOCH ;; added for J-FUNC
  1934.         lds     si, [bp].EnvBufParm     ; ES:DI -> environment buffer   ;;EPOCH ;; added for J-FUNC
  1935.         mov     ax, ds:[si].env_sessionNum ; Get Session Number         ;;EPOCH ;; added for J-FUNC
  1936.         push    _DATA                   ; Global Segment                ;;EPOCH ;; added for J-FUNC
  1937.         pop     ds                                                      ;;EPOCH ;; added for J-FUNC
  1938.                                                                         ;;EPOCH ;; added for J-FUNC
  1939.         mov     si,OFFSET BvscbSel      ; (CX) = offset of selector save word   ;; added for J-FUNC
  1940.         shl     ax, 1                   ; To Word                       ;;EPOCH ;; added for J-FUNC
  1941.         add     si, ax                  ; Add Session Number            ;;EPOCH ;; added for J-FUNC
  1942.         .if     <<word ptr ds:[si]> e 0> ; IF  bvscbSel in this session > 0     ;; added for J-FUNC
  1943.             shr     ax, 1               ; Resume - Session Number       ;;EPOCH ;; added for J-FUNC
  1944.             mov     bx,offset bvsSegLabel ; (BX) = offset of selector label     ;; added for J-FUNC
  1945.             call    BinToHx             ; Convert binary in AX into Hex ASCII   ;; added for J-FUNC
  1946.             mov     word ptr ds:[bx+LNOFF],AX ; move 2 chars to segment label   ;; added for J-FUNC
  1947.             push    ds                  ; push selector (DS) for label string   ;; added for J-FUNC
  1948.             push    bx                  ; push offset to segment label string   ;; added for J-FUNC
  1949.             push    ds                  ; push selector (DS) for selector save  ;; added for J-FUNC
  1950.             push    si                  ; push offset for selector save word    ;; added for J-FUNC
  1951.             call    DOSGETSHRSEG        ; get the shared segment        ;;EPOCH ;; added for J-FUNC
  1952.             .if     < zero ax >                                         ;;EPOCH ;; added for J-FUNC
  1953.                 mov     ax, ds:[si]     ; Get Returned Selector         ;;EPOCH ;; added for J-FUNC
  1954.             .else                                                       ;;EPOCH ;; added for J-FUNC
  1955.                 xor     ax, ax          ; Error                         ;;EPOCH ;; added for J-FUNC
  1956.                 mov     ds:[si], ax                                     ;;EPOCH ;; added for J-FUNC
  1957.             .endif                                                      ;;EPOCH ;; added for J-FUNC
  1958.         .else                                                           ;;EPOCH ;; added for J-FUNC
  1959.             mov     ax, ds:[si]         ; Get Returned Selector         ;;EPOCH ;; added for J-FUNC
  1960.         .endif                                                          ;;EPOCH ;; added for J-FUNC
  1961.                                                                         ;;EPOCH ;; added for J-FUNC
  1962.         pop     si                                                      ;;EPOCH ;; added for J-FUNC
  1963.         pop     ds                                                      ;;EPOCH ;; added for J-FUNC
  1964.         pop     bx                                                      ;;EPOCH ;; added for J-FUNC
  1965.         ret                                                             ;;EPOCH ;; added for J-FUNC
  1966. Get_BVSCB endp                                                          ;;EPOCH ;; added for J-FUNC
  1967.                                                                         ;;EPOCH ;; added for J-FUNC
  1968.         PUBLIC  BinToHx                                                 ;;EPOCH ;; added for J-FUNC
  1969. BinToHx PROC    NEAR                                                    ;;EPOCH ;; added for J-FUNC
  1970. ;***********************************************************************;;EPOCH ;; added for J-FUNC
  1971. ;*      Convert binary in AX into Hex ASCII equivalent.                 ;;EPOCH ;; added for J-FUNC
  1972. ;*      DS must contained the _DATA selector.                           ;;EPOCH ;; added for J-FUNC
  1973. ;***********************************************************************;;EPOCH ;; added for J-FUNC
  1974.         push    BX                                                      ;;EPOCH ;; added for J-FUNC
  1975.         mov     BX,16                   ; Convert codepage ID index to  ;;EPOCH ;; added for J-FUNC
  1976.         div     BL                      ;   Hex ASCII                   ;;EPOCH ;; added for J-FUNC
  1977.         mov     BL,AL                                                   ;;EPOCH ;; added for J-FUNC
  1978.         mov     AL,ds:[bx].HexDigit     ; High order Hex                ;;EPOCH ;; added for J-FUNC
  1979.         mov     BL,AH                                                   ;;EPOCH ;; added for J-FUNC
  1980.         mov     AH,ds:[bx].HexDigit     ; Low order Hex                 ;;EPOCH ;; added for J-FUNC
  1981.         pop     BX                                                      ;;EPOCH ;; added for J-FUNC
  1982.         ret                                                             ;;EPOCH ;; added for J-FUNC
  1983. BinToHx ENDP                                                            ;;EPOCH ;; added for J-FUNC
  1984.                                                                         ;;EPOCH ;; added for J-FUNC
  1985. ENDIF                                                                   ;;EPOCH ;; added for J-FUNC
  1986.                                                                         ;;EPOCH ;; added for J-FUNC
  1987. R2CSEG  ENDS
  1988.         END
  1989.  
  1990.