home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v2.zip / DDKX86 / DBCSDD / SRC_DBCS / SEAMLESS / HWS2S.BLT
Text File  |  1995-04-10  |  16KB  |  822 lines

  1. ifdef  cross_seg
  2. MEMORY_WIDTH    equ    800
  3. else
  4. MEMORY_WIDTH    equ    1024
  5. endif
  6.  
  7. SW_HAVE_ACCEL   equ     0008h           ; display card have accelerater
  8.  
  9. ;-----------------------------------------------------------------------;
  10. ;    Copy screen source to screen destination without any bit oparation.
  11. ;    (WD90C31A Special Version)
  12. ;-----------------------------------------------------------------------;
  13. INDEX_CTRL    equ    023c0h
  14. ACCESS_PORT    equ    023c2h
  15. BR_CTRL_1    equ    00000h
  16. BR_CTRL_2    equ    01000h
  17. BR_SRC_LOW    equ    02000h
  18. BR_SRC_HIGH    equ    03000h
  19. BR_DST_LOW    equ    04000h
  20. BR_DST_HIGH    equ    05000h
  21. BR_WIDTH    equ    06000h
  22. BR_HEIGHT    equ    07000h
  23. BR_ROW_PITCH    equ    08000h
  24. BR_RAS_OP    equ    09000h
  25. BR_MASK     equ    0e000h
  26.  
  27.  
  28. public    cdsc_cc_src_hw_wd31
  29. cdsc_cc_src_hw_wd31:
  30.  
  31.     cmp    Rop.lo,SOURCE_COPY
  32.     jne    wsts_go_default
  33. ifdef  SEAMLESS
  34.     mov    ax,DataBASE
  35.     mov    ds,ax
  36.     assumes    ds,Data
  37.     lds    si,init_struct.pmdd_io
  38.     les    bx,[si].pmdd_swFlags
  39.     test    word ptr es:[bx],SW_HAVE_ACCEL
  40.     jnz    @F
  41. endif ;SEAMLESS
  42. wsts_go_default:
  43.     jmp    cdsc_cc_src
  44. @@:
  45.     push    SrcxOrg            ;
  46.     push    SrcyOrg            ;
  47.     push    DestxOrg        ;
  48.     push    DestyOrg        ;
  49. ifdef  SEAMLESS
  50.     lds    si,[si].pmdd_screen_busy
  51.     xor    ax,ax
  52. @@:
  53.     xchg    al,[si]        ;; try to grab screen
  54.     or    al,al
  55.     jz    @B        ;; loop until we've gotten the sempahore
  56. endif ;SEAMLESS
  57.     mov    al,gl_direction
  58.     mov    iDir,al
  59.     mov    ax,SrcyOrg
  60.     cmp    ax,DestyOrg
  61.     jne    @F
  62.     mov    ax,SrcxOrg
  63.     cmp    ax,DestxOrg
  64.     jae    @F
  65.     mov    iDir,DECREASING
  66. @@:
  67.         cmp     iDir,INCREASING
  68.     je    wsts_prepare
  69.     mov    ax,xExt
  70.     dec    ax
  71.     mov    dx,yExt
  72.     dec    dx
  73.     add    SrcxOrg,ax
  74.     add    SrcyOrg,dx
  75.     add    DestxOrg,ax
  76.     add    DestyOrg,dx
  77. wsts_prepare:
  78.     mov    ax,SrcyOrg
  79.     mov    dx,MEMORY_WIDTH
  80.     mul    dx
  81.     add    ax,SrcxOrg
  82.     adc    dx,0
  83.     mov    word ptr SrcAddr,ax
  84.     mov    word ptr SrcAddr[2],dx
  85.  
  86.     mov    ax,DestyOrg
  87.     mov    dx,MEMORY_WIDTH
  88.     mul    dx
  89.     add    ax,DestxOrg
  90.     adc    dx,0
  91.     mov    word ptr DstAddr,ax
  92.     mov    word ptr DstAddr[2],dx
  93.  
  94.     mov    dx,INDEX_CTRL
  95.     mov    ax,0001000000000001b    ; select BitBlt registers
  96.     out    dx,ax
  97.     mov    dx,ACCESS_PORT
  98.  
  99.     mov    ax,BR_CTRL_1 or 000100000000b    ; stop BitBlt
  100.     out    dx,ax
  101. @@:
  102.     in    ax,dx
  103.     test    ax,100000000000b    ; still in progress ?
  104.     jnz    @B
  105.  
  106.     mov    ax,word ptr SrcAddr
  107.     and    ax,0fffh
  108.     or    ax,BR_SRC_LOW
  109.     out    dx,ax
  110.     .386
  111.     mov    eax,dword ptr SrcAddr
  112.     shr    eax,12
  113.     .286
  114.     and    ax,1ffh
  115.     or    ax,BR_SRC_HIGH
  116.     out    dx,ax
  117.  
  118.     mov    ax,word ptr DstAddr
  119.     and    ax,0fffh
  120.     or    ax,BR_DST_LOW
  121.     out    dx,ax
  122.     .386
  123.     mov    eax,dword ptr DstAddr
  124.     shr    eax,12
  125.     .286
  126.     and    ax,1ffh
  127.     or    ax,BR_DST_HIGH
  128.     out    dx,ax
  129.  
  130.     mov    ax,xExt
  131.     or    ax,BR_WIDTH
  132.     out    dx,ax
  133.     mov    ax,yExt
  134.     or    ax,BR_HEIGHT
  135.     out    dx,ax
  136.  
  137.     mov    ax,MEMORY_WIDTH
  138.     or    ax,BR_ROW_PITCH
  139.     out    dx,ax
  140.  
  141.     mov    ax,BR_MASK or 0ffh    ; enable all planes
  142.     out    dx,ax
  143.  
  144.     mov    ax,BR_RAS_OP or 001100000000b
  145.                     ; src -> dst
  146.     out    dx,ax
  147.  
  148.     mov    ax,BR_CTRL_2 or 000000000010b
  149.                     ; Do not interrupt when finish
  150.     out    dx,ax
  151.  
  152.     mov    ax,BR_CTRL_1 or 100100000000b
  153.                     ; Start BitBlt
  154.                     ; Packed pixel mode
  155.                     ; src: rect, dst: rect
  156.                     ; src: screen, dst: screen
  157.         cmp     iDir,INCREASING
  158.     je    @F
  159.     or    ax,010000000000b    ; bottom -> top direction
  160. @@:
  161.     out    dx,ax
  162. @@:
  163.     in    ax,dx
  164.     test    ax,100000000000b    ; still in progress ?
  165.     jnz    @B
  166.     mov    dx,INDEX_CTRL
  167.     mov    ax,0001000000000000b    ; select System control registers
  168.     out    dx,ax
  169.  
  170. ifdef  SEAMLESS
  171.     mov    [si],byte ptr 1        ; NOT_BUSY
  172. endif ;SEAMLESS
  173.     pop    DestyOrg        ;
  174.     pop    DestxOrg        ;
  175.     pop    SrcyOrg            ;
  176.     pop    SrcxOrg            ;
  177.         jmp     cdsc_done
  178.  
  179.  
  180. ;-----------------------------------------------------------------------;
  181. ;    Copy screen source to screen destination without any bit oparation.
  182. ;    (Cirrus GD5426 Special Version)
  183. ;-----------------------------------------------------------------------;
  184. GRAPH_CTRL    equ    03ceh
  185. WIDTH_LOW    equ    20h
  186. WIDTH_HIGH    equ    21h
  187. HEIGHT_LOW    equ    22h
  188. HEIGHT_HIGH    equ    23h
  189. DST_PITCH_LOW    equ    24h
  190. DST_PITCH_HIGH    equ    25h
  191. SRC_PITCH_LOW    equ    26h
  192. SRC_PITCH_HIGH    equ    27h
  193. DST_START_LOW    equ    28h
  194. DST_START_MID    equ    29h
  195. DST_START_HIGH    equ    2ah
  196. SRC_START_LOW    equ    2ch
  197. SRC_START_MID    equ    2dh
  198. SRC_START_HIGH    equ    2eh
  199. BLT_MODE    equ    30h
  200. INC_DIRECTION    equ    0
  201. DEC_DIRECTION    equ    1
  202. BLT_STATUS    equ    31h
  203. BLT_BUSY    equ    1
  204. BLT_START    equ    2
  205. BLT_RASTER_OP    equ    32h
  206. SRC_COPY    equ    0dh
  207.  
  208.  
  209. public    cdsc_cc_src_hw_cl26
  210. cdsc_cc_src_hw_cl26:
  211.  
  212.     cmp    Rop.lo,SOURCE_COPY
  213.     jne    csts_go_default
  214. ifdef  SEAMLESS
  215.     mov    ax,DataBASE
  216.     mov    ds,ax
  217.     assumes    ds,Data
  218.     lds    si,init_struct.pmdd_io
  219.     les    bx,[si].pmdd_swFlags
  220.     test    word ptr es:[bx],SW_HAVE_ACCEL
  221.     jnz    @F
  222. endif ;SEAMLESS
  223. csts_go_default:
  224.     jmp    cdsc_cc_src
  225. @@:
  226.     push    SrcxOrg            ;
  227.     push    SrcyOrg            ;
  228.     push    DestxOrg        ;
  229.     push    DestyOrg        ;
  230. ifdef  SEAMLESS
  231.     lds    si,[si].pmdd_screen_busy
  232.     xor    ax,ax
  233. @@:
  234.     xchg    al,[si]        ;; try to grab screen
  235.     or    al,al
  236.     jz    @B        ;; loop until we've gotten the sempahore
  237. endif ;SEAMLESS
  238.     mov    al,gl_direction
  239.     mov    iDir,al
  240.     mov    ax,SrcyOrg
  241.     cmp    ax,DestyOrg
  242.     jne    @F
  243.     mov    ax,SrcxOrg
  244.     cmp    ax,DestxOrg
  245.     jae    @F
  246.     mov    iDir,DECREASING
  247. @@:
  248.         cmp     iDir,INCREASING
  249.     je    csts_prepare
  250.     mov    ax,xExt
  251.     dec    ax
  252.     mov    dx,yExt
  253.     dec    dx
  254.     add    SrcxOrg,ax
  255.     add    SrcyOrg,dx
  256.     add    DestxOrg,ax
  257.     add    DestyOrg,dx
  258. csts_prepare:
  259.     mov    ax,SrcyOrg
  260.     mov    dx,MEMORY_WIDTH
  261.     mul    dx
  262.     add    ax,SrcxOrg
  263.     adc    dx,0
  264.     mov    word ptr SrcAddr,ax
  265.     mov    word ptr SrcAddr[2],dx
  266.  
  267.     mov    ax,DestyOrg
  268.     mov    dx,MEMORY_WIDTH
  269.     mul    dx
  270.     add    ax,DestxOrg
  271.     adc    dx,0
  272.     mov    word ptr DstAddr,ax
  273.     mov    word ptr DstAddr[2],dx
  274.  
  275.     mov    dx,GRAPH_CTRL
  276.     mov    al,BLT_STATUS
  277.     out    dx,al
  278.     inc    dx
  279. @@:
  280.     in    al,dx
  281.     test    al,BLT_BUSY        ; still in progress ?
  282.     jnz    @B
  283.     dec    dx
  284.  
  285.     mov    ax,xExt
  286.     dec    ax
  287.     shl    ax,8
  288.     mov    al,WIDTH_LOW
  289.     out    dx,ax
  290.     mov    ax,xExt
  291.     dec    ax
  292.     mov    al,WIDTH_HIGH
  293.     out    dx,ax
  294.  
  295.     mov    ax,yExt
  296.     dec    ax
  297.     shl    ax,8
  298.     mov    al,HEIGHT_LOW
  299.     out    dx,ax
  300.     mov    ax,yExt
  301.     dec    ax
  302.     mov    al,HEIGHT_HIGH
  303.     out    dx,ax
  304.  
  305.     mov    ax,MEMORY_WIDTH
  306.     shl    ax,8
  307.     mov    al,DST_PITCH_LOW
  308.     out    dx,ax
  309.     mov    al,SRC_PITCH_LOW
  310.     out    dx,ax
  311.     mov    ax,MEMORY_WIDTH
  312.     mov    al,DST_PITCH_HIGH
  313.     out    dx,ax
  314.     mov    al,SRC_PITCH_HIGH
  315.     out    dx,ax
  316.  
  317.     mov    ax,word ptr DstAddr
  318.     shl    ax,8
  319.     mov    al,DST_START_LOW
  320.     out    dx,ax
  321.     mov    ax,word ptr DstAddr
  322.     mov    al,DST_START_MID
  323.     out    dx,ax
  324.     mov    ax,word ptr DstAddr[1]
  325.     mov    al,DST_START_HIGH
  326.     out    dx,ax
  327.  
  328.     mov    ax,word ptr SrcAddr
  329.     shl    ax,8
  330.     mov    al,SRC_START_LOW
  331.     out    dx,ax
  332.     mov    ax,word ptr SrcAddr
  333.     mov    al,SRC_START_MID
  334.     out    dx,ax
  335.     mov    ax,word ptr SrcAddr[1]
  336.     mov    al,SRC_START_HIGH
  337.     out    dx,ax
  338.  
  339.     mov    al,BLT_MODE
  340.     mov    ah,INC_DIRECTION    ; top -> bottom direction
  341.         cmp     iDir,INCREASING
  342.     je    @F
  343.     mov    ah,DEC_DIRECTION    ; bottom -> top direction
  344. @@:
  345.     out    dx,ax
  346.  
  347.     mov    al,BLT_RASTER_OP
  348.     mov    ah,SRC_COPY        ; src -> dst
  349.     out    dx,ax
  350.  
  351.     mov    al,BLT_STATUS
  352.     mov    ah,BLT_START
  353.     out    dx,ax            ; Start BitBlt
  354.  
  355.     inc    dx
  356. @@:
  357.     in    al,dx
  358.     test    al,BLT_BUSY        ; still in progress ?
  359.     jnz    @B
  360.  
  361. ifdef  SEAMLESS
  362.     mov    [si],byte ptr 1        ; NOT_BUSY
  363. endif ;SEAMLESS
  364.     pop    DestyOrg        ;
  365.     pop    DestxOrg        ;
  366.     pop    SrcyOrg            ;
  367.     pop    SrcxOrg            ;
  368.         jmp     cdsc_done
  369.  
  370.  
  371. ;-----------------------------------------------------------------------;
  372. ;    Copy screen source to screen destination without any bit oparation.
  373. ;    (8514/A Special Version)
  374. ;-----------------------------------------------------------------------;
  375. QSTATUS        equ    09ae8h            ; queue status register (r)
  376. QS_BUSY        equ    0000001000000000b    ; reset when input queue empty
  377.  
  378. CMD_FLAGS    equ    09ae8h            ; command/flags register (w)
  379. CMD_C_CRECT    equ    1100000000000000b    ; copy rectangle
  380. CMD_FV_FIX    equ    0000000000000000b    ; use fixed data
  381. CMD_DY        equ    0000000010000000b    ; y increment
  382. CMD_DX        equ    0000000000100000b    ; x increment
  383. CMD_MA_ACCESS    equ    0000000000010000b    ; access bit planes
  384. CMD_PA_FOUR    equ    0000000000000010b    ; r/w 4 pels at a time
  385. CMD_RW_W    equ    0000000000000001b    ; write bit planes
  386. CMDSRCSCR    = (CMD_C_CRECT+CMD_FV_FIX+CMD_PA_FOUR+\
  387.         CMD_MA_ACCESS+CMD_RW_W)
  388.  
  389. FUNCTION_0    equ    0b6e8h        ; background mix (w)
  390. FUNCTION_1    equ    0bae8h        ; foreground mix (w)
  391. FUNC_2OP_COPY    equ    01100000b    ; second operand src is copy rectangle
  392. FUNC_S        equ    00000111b    ; src -> dest
  393.  
  394. MODE        equ    0bee8h            ; mode register (w)
  395. MODE_2DECODE    equ    1010000000000000b    ; secondary decode
  396. MD_PS_ONES    equ    00000000b        ; pattern = ONEs
  397.  
  398. Y0        equ    082e8h        ; src y coordinate for primitives
  399. X0        equ    086e8h        ; src x coordinate for primitives
  400. Y1        equ    08ae8h        ; dest y coordinate for Copy Rectangle
  401. X1        equ    08ee8h        ; dest x coordinate for Copy Rectangle
  402. LY        equ    0bee8h        ; y-axis length for primitives (w)
  403. LX        equ    096e8h        ; x-axis length for primitives
  404.  
  405. public    cdsc_cc_src_hw_8514
  406. cdsc_cc_src_hw_8514:
  407.  
  408.     cmp    Rop.lo,SOURCE_COPY
  409.     jne    bsts_go_default
  410. ifdef  SEAMLESS
  411.     mov    ax,DataBASE
  412.     mov    ds,ax
  413.     assumes    ds,Data
  414.     lds    si,init_struct.pmdd_io
  415.     les    bx,[si].pmdd_swFlags
  416.     test    word ptr es:[bx],SW_HAVE_ACCEL
  417.     jnz    @F
  418. endif ;SEAMLESS
  419. bsts_go_default:
  420.     jmp    cdsc_cc_src
  421. @@:
  422.     push    SrcxOrg            ;
  423.     push    SrcyOrg            ;
  424.     push    DestxOrg        ;
  425.     push    DestyOrg        ;
  426. ifdef  SEAMLESS
  427.     lds    si,[si].pmdd_screen_busy
  428.     xor    ax,ax
  429. @@:
  430.     xchg    al,[si]        ;; try to grab screen
  431.     or    al,al
  432.     jz    @B        ;; loop until we've gotten the sempahore
  433. endif ;SEAMLESS
  434.     mov    al,gl_direction
  435.     mov    iDir,al
  436.     mov    ax,SrcyOrg
  437.     cmp    ax,DestyOrg
  438.     jne    @F
  439.     mov    ax,SrcxOrg
  440.     cmp    ax,DestxOrg
  441.     jae    @F
  442.     mov    iDir,DECREASING
  443. @@:
  444.     mov    ax,CMD_DX+CMD_DY            ; set my flag to +x +y
  445.         cmp     iDir,INCREASING
  446.     je    @F
  447.     mov    ax,xExt
  448.     dec    ax
  449.     mov    dx,yExt
  450.     dec    dx
  451.     add    SrcxOrg,ax
  452.     add    SrcyOrg,dx
  453.     add    DestxOrg,ax
  454.     add    DestyOrg,dx
  455.     xor    ax,ax
  456. @@:
  457.     push    ax                    ; blt_dir -> (*)
  458.  
  459.     mov    dx,QSTATUS
  460. @@:    in    ax,dx
  461.     and    ax,QS_BUSY
  462.     jnz    @B
  463.  
  464. @@:    in    ax,dx
  465.     and    ax,80h Shr (2 - 1)
  466.     jnz    @B
  467.  
  468.     mov    ax,FUNC_2OP_COPY+FUNC_S
  469.     mov    dx,FUNCTION_0
  470.     out    dx,ax
  471.     mov    dx,FUNCTION_1
  472.     out    dx,ax
  473.  
  474.     mov    dx,QSTATUS
  475. @@:    in    ax,dx
  476.     and    ax,80h Shr (8 - 1)
  477.     jnz    @B
  478.  
  479.     mov    dx,MODE
  480.     mov    ax,(MODE_2DECODE+MD_PS_ONES)
  481.     out    dx,ax
  482.  
  483.     mov    ax,word ptr SrcxOrg
  484.     mov    dx,X0
  485.     out    dx,ax
  486.     mov    ax,word ptr SrcyOrg
  487.     mov    dx,Y0
  488.     out    dx,ax
  489.     mov    ax,word ptr DestxOrg
  490.     mov    dx,X1
  491.     out    dx,ax
  492.     mov    ax,word ptr DestyOrg
  493.     mov    dx,Y1
  494.     out    dx,ax
  495.     mov    ax,word ptr xExt
  496.     dec    ax
  497.     mov    dx,LX
  498.     out    dx,ax
  499.     mov    ax,word ptr yExt
  500.     dec    ax
  501.     mov    dx,LY
  502.     out    dx,ax
  503.  
  504.     pop    ax            ; blt directions <- (*)
  505.     or    ax,CMDSRCSCR        ; src is screen command
  506.     mov    dx,CMD_FLAGS
  507.     out    dx,ax            ; kick command
  508.  
  509.     mov    dx,QSTATUS
  510. @@:    in    ax,dx
  511.     and    ax,QS_BUSY
  512.     jnz    @B
  513.  
  514. ifdef  SEAMLESS
  515.     mov    [si],byte ptr 1        ; NOT_BUSY
  516. endif ;SEAMLESS
  517.     pop    DestyOrg        ;
  518.     pop    DestxOrg        ;
  519.     pop    SrcyOrg            ;
  520.     pop    SrcxOrg            ;
  521.         jmp     cdsc_done
  522.  
  523.  
  524. ifdef    INCL_S3                                ;IBMJ
  525. public    cdsc_cc_src_hw_s3
  526. cdsc_cc_src_hw_s3:
  527.  
  528.     cmp    Rop.lo,SOURCE_COPY
  529.     jne    ssts_go_default
  530. ifdef  SEAMLESS
  531.     mov    ax,DataBASE
  532.     mov    ds,ax
  533.     assumes    ds,Data
  534.     lds    si,init_struct.pmdd_io
  535.     les    bx,[si].pmdd_swFlags
  536.     test    word ptr es:[bx],SW_HAVE_ACCEL
  537.     jnz    @F
  538. endif ;SEAMLESS
  539. ssts_go_default:
  540.     jmp    cdsc_cc_src
  541. @@:
  542.     push    SrcxOrg            ;
  543.     push    SrcyOrg            ;
  544.     push    DestxOrg        ;
  545.     push    DestyOrg        ;
  546. ifdef  SEAMLESS
  547.     lds    si,[si].pmdd_screen_busy
  548.     xor    ax,ax
  549. @@:
  550.     xchg    al,[si]        ;; try to grab screen
  551.     or    al,al
  552.     jz    @B        ;; loop until we've gotten the sempahore
  553. endif ;SEAMLESS
  554.     mov    al,gl_direction
  555.     mov    iDir,al
  556.     mov    ax,SrcyOrg
  557.     cmp    ax,DestyOrg
  558.     jne    @F
  559.     mov    ax,SrcxOrg
  560.     cmp    ax,DestxOrg
  561.     jae    @F
  562.     mov    iDir,DECREASING
  563. @@:
  564.     mov    ax,CMD_DX+CMD_DY            ; set my flag to +x +y
  565.         cmp     iDir,INCREASING
  566.     je    @F
  567.     mov    ax,xExt
  568.     dec    ax
  569.     mov    dx,yExt
  570.     dec    dx
  571.     add    SrcxOrg,ax
  572.     add    SrcyOrg,dx
  573.     add    DestxOrg,ax
  574.     add    DestyOrg,dx
  575.     xor    ax,ax
  576. @@:
  577.     push    ax                    ; blt_dir -> (*)
  578.  
  579.     mov    dx,3d4h
  580.     mov    al,58h
  581.     out    dx,al
  582.     inc    dx
  583.     in    al,dx
  584.     and    al,11101100b    ; disable linear addressing
  585.     out    dx,al
  586.  
  587.     mov    dx,QSTATUS
  588. @@:    in    ax,dx
  589.     and    ax,QS_BUSY
  590.     jnz    @B
  591.  
  592. @@:    in    ax,dx
  593.     and    ax,80h Shr (2 - 1)
  594.     jnz    @B
  595.  
  596.     mov    ax,FUNC_2OP_COPY+FUNC_S
  597.     mov    dx,FUNCTION_0
  598.     out    dx,ax
  599.     mov    dx,FUNCTION_1
  600.     out    dx,ax
  601.  
  602.     mov    dx,QSTATUS
  603. @@:    in    ax,dx
  604.     and    ax,80h Shr (8 - 1)
  605.     jnz    @B
  606.  
  607.     mov    dx,MODE
  608.     mov    ax,(MODE_2DECODE+MD_PS_ONES)
  609.     out    dx,ax
  610.  
  611.     mov    ax,word ptr SrcxOrg
  612.     mov    dx,X0
  613.     out    dx,ax
  614.     mov    ax,word ptr SrcyOrg
  615.     mov    dx,Y0
  616.     out    dx,ax
  617.     mov    ax,word ptr DestxOrg
  618.     mov    dx,X1
  619.     out    dx,ax
  620.     mov    ax,word ptr DestyOrg
  621.     mov    dx,Y1
  622.     out    dx,ax
  623.     mov    ax,word ptr xExt
  624.     dec    ax
  625.     mov    dx,LX
  626.     out    dx,ax
  627.     mov    ax,word ptr yExt
  628.     dec    ax
  629.     mov    dx,LY
  630.     out    dx,ax
  631.  
  632.     pop    ax            ; blt directions <- (*)
  633.     or    ax,CMDSRCSCR        ; src is screen command
  634.     mov    dx,CMD_FLAGS
  635.     out    dx,ax            ; kick command
  636.  
  637.     mov    dx,QSTATUS
  638. @@:    in    ax,dx
  639.     and    ax,QS_BUSY
  640.     jnz    @B
  641.  
  642.     mov    dx,3d4h
  643.     mov    al,58h
  644.     out    dx,al
  645.     inc    dx
  646.     in    al,dx
  647.     or    al,00010000b    ; enable linear addressing
  648.     out    dx,al
  649.  
  650. ifdef  SEAMLESS
  651.     mov    [si],byte ptr 1        ; NOT_BUSY
  652. endif ;SEAMLESS
  653.     pop    DestyOrg        ;
  654.     pop    DestxOrg        ;
  655.     pop    SrcyOrg            ;
  656.     pop    SrcxOrg            ;
  657.         jmp     cdsc_done
  658. endif    ;INCL_S3                            ;IBMJ
  659.  
  660.  
  661. ;-----------------------------------------------------------------------;
  662. ;    Copy screen source to screen destination without any bit oparation.
  663. ;    (Tseng ET-4000/W32 Special Version)
  664. ;-----------------------------------------------------------------------;
  665. REGS_BASE        equ    0ff00h    ; memory mapped register base address.
  666. SUSPEND_TERMINATE    equ    30h
  667. OPERATION_STATE        equ    31h
  668. SYNC_ENABLE        equ    32h
  669. INTERRUPT_MASK        equ    34h
  670. INTERRUPT_STATUS    equ    35h
  671. ACCELERATOR_STATUS    equ    36h
  672. SRC_ADDRESS        equ    84h
  673. SRC_OFFSET        equ    8ah
  674. DST_OFFSET        equ    8ch
  675. XY_DIRECTION        equ    8fh
  676. SRC_WRAP        equ    92h
  677. X_POSITION        equ    94h
  678. Y_POSITION        equ    96h
  679. X_COUNT            equ    98h
  680. Y_COUNT            equ    9ah
  681. ROUTING_CONTROL        equ    9ch
  682. RELOAD_CONTROL        equ    9dh
  683. BACKGROUND_ROP        equ    9eh
  684. FOREGROUND_ROP        equ    9fh
  685. DST_ADDRESS        equ    0a0h
  686.  
  687. public    cdsc_cc_src_hw_w32
  688. cdsc_cc_src_hw_w32:
  689.  
  690.     cmp    Rop.lo,SOURCE_COPY
  691.     jne    w32_go_default
  692. ifdef  SEAMLESS
  693.     mov    ax,DataBASE
  694.     mov    ds,ax
  695.     assumes    ds,Data
  696.     lds    si,init_struct.pmdd_io
  697.     les    bx,[si].pmdd_swFlags
  698.     test    word ptr es:[bx],SW_HAVE_ACCEL
  699.     jnz    @F
  700. endif ;SEAMLESS
  701. w32_go_default:
  702.     jmp    cdsc_cc_src
  703. @@:
  704.     push    SrcxOrg            ;
  705.     push    SrcyOrg            ;
  706.     push    DestxOrg        ;
  707.     push    DestyOrg        ;
  708. ifdef  SEAMLESS
  709.     mov    ax,[si].pmdd_2ndsel
  710.     mov    es,ax
  711.  
  712.     lds    si,[si].pmdd_screen_busy
  713.     xor    ax,ax
  714. @@:
  715.     xchg    al,[si]        ;; try to grab screen
  716.     or    al,al
  717.     jz    @B        ;; loop until we've gotten the sempahore
  718. endif ;SEAMLESS
  719.     mov    al,gl_direction
  720.     mov    iDir,al
  721.     mov    ax,SrcyOrg
  722.     cmp    ax,DestyOrg
  723.     jne    @F
  724.     mov    ax,SrcxOrg
  725.     cmp    ax,DestxOrg
  726.     jae    @F
  727.     mov    iDir,DECREASING
  728. @@:
  729.         cmp     iDir,INCREASING
  730.     je    @F
  731.     mov    ax,xExt
  732.     dec    ax
  733.     mov    dx,yExt
  734.     dec    dx
  735.     add    SrcxOrg,ax
  736.     add    SrcyOrg,dx
  737.     add    DestxOrg,ax
  738.     add    DestyOrg,dx
  739. @@:
  740.     mov    ax,SrcyOrg
  741.     mov    dx,MEMORY_WIDTH
  742.     mul    dx
  743.     add    ax,SrcxOrg
  744.     adc    dx,0
  745.     mov    word ptr SrcAddr,ax
  746.     mov    word ptr SrcAddr[2],dx
  747.  
  748.     mov    ax,DestyOrg
  749.     mov    dx,MEMORY_WIDTH
  750.     mul    dx
  751.     add    ax,DestxOrg
  752.     adc    dx,0
  753.     mov    word ptr DstAddr,ax
  754.     mov    word ptr DstAddr[2],dx
  755.  
  756.     mov    di,REGS_BASE
  757.     mov    byte ptr es:[di+SUSPEND_TERMINATE],10h    ; terminate
  758. @@:
  759.     mov    al,byte ptr es:[di+ACCELERATOR_STATUS]
  760.     test    al,11b            ; Busy ?
  761.     jnz    @B
  762.  
  763.     mov    byte ptr es:[di+SUSPEND_TERMINATE],0
  764.     mov    byte ptr es:[di+OPERATION_STATE],0
  765.     mov    byte ptr es:[di+SYNC_ENABLE],1
  766.     mov    byte ptr es:[di+INTERRUPT_MASK],0
  767.     mov    byte ptr es:[di+INTERRUPT_STATUS],0
  768.  
  769.     mov    ax,MEMORY_WIDTH
  770.     dec    ax
  771.     mov    word ptr es:[di+SRC_OFFSET],ax
  772.     mov    word ptr es:[di+DST_OFFSET],ax
  773.  
  774.     xor    al,al            ; top -> bottom direction
  775.     cmp    iDir,INCREASING
  776.     je    @F
  777.     mov    al,11b            ; bottom -> top direction
  778. @@:
  779.     mov    byte ptr es:[di+XY_DIRECTION],al
  780.  
  781.     mov    byte ptr es:[di+SRC_WRAP],77h    ; no wrap
  782.  
  783.     mov    word ptr es:[di+X_POSITION],0
  784.     mov    word ptr es:[di+Y_POSITION],0
  785.  
  786.     mov    ax,xExt
  787.     dec    ax
  788.     mov    word ptr es:[di+X_COUNT],ax
  789.     mov    ax,yExt
  790.     dec    ax
  791.     mov    word ptr es:[di+Y_COUNT],ax
  792.  
  793.     mov    byte ptr es:[di+ROUTING_CONTROL],0
  794.     mov    byte ptr es:[di+RELOAD_CONTROL],0
  795.  
  796.     mov    byte ptr es:[di+BACKGROUND_ROP],0cch    ; src copy
  797.     mov    byte ptr es:[di+FOREGROUND_ROP],0cch    ; src copy
  798.  
  799.     mov    ax,word ptr SrcAddr
  800.     mov    word ptr es:[di+SRC_ADDRESS],ax
  801.     mov    ax,word ptr SrcAddr[2]
  802.     mov    word ptr es:[di+SRC_ADDRESS+2],ax
  803.     mov    ax,word ptr DstAddr
  804.     mov    word ptr es:[di+DST_ADDRESS],ax
  805.     mov    ax,word ptr DstAddr[2]
  806.     mov    word ptr es:[di+DST_ADDRESS+2],ax
  807.  
  808.     mov    byte ptr es:[di+OPERATION_STATE],1001b    ; Start BitBlt
  809. @@:
  810.     mov    al,byte ptr es:[di+ACCELERATOR_STATUS]
  811.     test    al,11b            ; Busy ?
  812.     jnz    @B
  813.  
  814. ifdef  SEAMLESS
  815.     mov    [si],byte ptr 1        ; NOT_BUSY
  816. endif ;SEAMLESS
  817.     pop    DestyOrg        ;
  818.     pop    DestxOrg        ;
  819.     pop    SrcyOrg            ;
  820.     pop    SrcxOrg            ;
  821.         jmp     cdsc_done
  822.