home *** CD-ROM | disk | FTP | other *** search
/ Mega A/V / mega_av.zip / mega_av / GRAPHUTL / FRASR172.ZIP / TPLUS_A.ASM < prev    next >
Assembly Source File  |  1991-12-03  |  5KB  |  259 lines

  1.  
  2. IFDEF ??version   ; EAN
  3. MASM51
  4. QUIRKS
  5. EMUL
  6. ENDIF
  7.  
  8. .model medium, c
  9.  
  10. .DATA
  11.  
  12. XDOTS         =         0
  13. YDOTS         =         1    SHL 1
  14. ASP_RATIO    =         2    SHL 1
  15. DEPTH         =         4    SHL 1
  16. TPAGE         =         5    SHL 1
  17. BOTBANK      =         7    SHL 1
  18. TOPBANK      =         8    SHL 1
  19. ZOOM         =         10 SHL 1
  20. DISPMODE     =         11 SHL 1
  21. DAC567DATA   =         15 SHL 1
  22. TOP         =         51 SHL 1
  23. BOT         =         53 SHL 1
  24. VPAN         =         55 SHL 1
  25. NOT_INT      =         56 SHL 1
  26. HIRES         =         61 SHL 1
  27. PERM         =         64 SHL 1
  28. BYCAP         =         68 SHL 1
  29. PE         =         69 SHL 1
  30. OVLE         =         70 SHL 1
  31. HPAN         =         71 SHL 1
  32. MEM_BASE     =         73 SHL 1
  33. MEM_MAP      =         74 SHL 1
  34. LIVEMIXSRC   =         91 SHL 1
  35. RGB         =         93 SHL 1
  36. SVIDEO         =         97 SHL 1
  37. BUFFPORTSRC  =         98 SHL 1
  38. CM1         =         101 SHL 1
  39. CM2         =         102 SHL 1
  40. LUTBYPASS    =         107 SHL 1
  41. CM3         =         113 SHL 1
  42. LIVEPORTSRC  =         115 SHL 1
  43. LIVE8         =         116 SHL 1
  44. VGASRC         =         123 SHL 1
  45.  
  46. BOARD     STRUC
  47.    ThisBoard      dw    ?
  48.    ClearScreen      dw    ?
  49.    Screen      dd    ?
  50.    VerPan      dw    ?
  51.    HorPan      dw    ?
  52.    Top          dw    ?
  53.    Bottom      dw    ?
  54.    xdots      dw    ?
  55.    ydots      dw    ?
  56.    Bank64k      dw    ?
  57.    RowBytes      dw    ?
  58.    RowsPerBank      dw    ?
  59.    Reg          dw    128 DUP (?)
  60.    Plot       dd    ?
  61.    GetColor      dd    ?
  62.       rVIDSTAT    dw    ?
  63.       rCTL    dw    ?
  64.       rMASKL    dw    ?
  65.       rLBNK    dw    ?
  66.       rREADAD    dw    ?
  67.       rMODE1    dw    ?
  68.       rOVSTRT    dw    ?
  69.       rUSCAN    dw    ?
  70.       rMASKH    dw    ?
  71.       rOSCAN    dw    ?
  72.       rHBNK    dw    ?
  73.       rROWCNT    dw    ?
  74.       rMODE2    dw    ?
  75.       rRBL    dw    ?
  76.       rRBH    dw    ?
  77.       wCOLOR0    dw    ?
  78.       wCOLOR1    dw    ?
  79.       wCOLOR2    dw    ?
  80.       wCOLOR3    dw    ?
  81.       wVIDCON    dw    ?
  82.       wINDIRECT dw    ?
  83.       wHUESAT    dw    ?
  84.       wOVSTRT    dw    ?
  85.       wMASKL    dw    ?
  86.       wMASKH    dw    ?
  87.       wLBNK    dw    ?
  88.       wHBNK    dw    ?
  89.       wMODE1    dw    ?
  90.       wMODE2    dw    ?
  91.       wWBL    dw    ?
  92.       wWBH    dw    ?
  93. BOARD     ENDS
  94.  
  95. .FARDATA
  96.  
  97. extrn TPlus:WORD
  98.  
  99. .CODE
  100.  
  101. ReadTPlusBankedPixel      PROC       uses si di es ds, x:WORD, y:WORD
  102.    mov     ax, SEG TPlus
  103.    mov     ds, ax
  104.    mov     di, OFFSET TPlus
  105.    mov     bx, [di].Reg[YDOTS]
  106.    dec     bx
  107.    sub     bx, y
  108.    mov     ax, [di].Reg[TPAGE]
  109.    mov     cl, 9
  110.    shl     ax, cl
  111.    add     bx, ax
  112.    mov     si, bx
  113.  
  114.    mov     cx, 16
  115.    sub     cx, [di].RowBytes
  116.    shr     si, cl
  117.    cmp     si, [di].Bank64k
  118.    je     CorrectBank
  119.  
  120.    mov     [di].Bank64k, si
  121.    mov     ax, si
  122.    shl     ax, 1
  123.    mov     dx, [di].wLBNK
  124.    mov     ah, al
  125.    inc     ah
  126.    out     dx, ax
  127.  
  128. CorrectBank:
  129.    mov     cx, [di].RowsPerBank
  130.    shl     si, cl
  131.    sub     bx, si
  132.    mov     cx, [di].RowBytes
  133.    shl     bx, cl
  134.    mov     ax, WORD PTR [[di].Screen+2]
  135.    mov     es, ax
  136.    mov     cx, [di].Reg[DEPTH]
  137.    dec     cx
  138.    jnz     CheckDepth2
  139.  
  140.    add     bx, x
  141.    mov     al, es:[bx]
  142.    xor     ah, ah
  143.    jmp     ExitPlotBankedPixel
  144.  
  145. CheckDepth2:
  146.    dec     cx
  147.    jnz     Read4Bytes
  148.  
  149.    mov     cx, x
  150.    shl     cx, 1
  151.    add     bx, cx
  152.    mov     ax, es:[bx]
  153.  
  154.    mov   dx, ax
  155.    mov   cl, 10
  156.    shr   dx, cl
  157.    mov   cl, 3
  158.    shl   dx, cl
  159.    shl   ax, cl
  160.    shl   ah, cl
  161.  
  162.    jmp     ExitPlotBankedPixel
  163.  
  164. Read4Bytes:
  165.    mov     cx, x
  166.    shl     cx, 1
  167.    shl     cx, 1
  168.    add     bx, cx
  169.    mov     ax, es:[bx]
  170.    mov     dx, es:[bx+2]
  171.  
  172. ExitPlotBankedPixel:
  173.    ret
  174. ReadTPlusBankedPixel      ENDP
  175.  
  176.  
  177.  
  178. WriteTPlusBankedPixel       PROC     uses si di es ds, x:WORD, y:WORD, Color:WORD
  179.    mov     ax, SEG TPlus
  180.    mov     ds, ax
  181.    mov     di, OFFSET TPlus
  182.    mov     bx, [di].Reg[YDOTS]
  183.    dec     bx
  184.    sub     bx, y
  185.    mov     ax, [di].Reg[TPAGE]
  186.    mov     cl, 9
  187.    shl     ax, cl
  188.    add     bx, ax
  189.    mov     si, bx
  190.  
  191.    mov     cx, 16
  192.    sub     cx, [di].RowBytes
  193.    shr     si, cl
  194.    cmp     si, [di].Bank64k
  195.    je     CorrectBank
  196.  
  197.    mov     [di].Bank64k, si
  198.    mov     ax, si
  199.    shl     ax, 1
  200.    mov     dx, [di].wLBNK
  201.    mov     ah, al
  202.    inc     ah
  203.    out     dx, ax
  204.  
  205. CorrectBank:
  206.    mov     cx, [di].RowsPerBank
  207.    shl     si, cl
  208.    sub     bx, si
  209.    mov     cx, [di].RowBytes
  210.    shl     bx, cl
  211.    mov     ax, WORD PTR [[di].Screen+2]
  212.    mov     es, ax
  213.    mov     cx, [di].Reg[DEPTH]
  214.    dec     cx
  215.    jnz     CheckDepth2
  216.  
  217.    mov     ax, Color
  218.    add     bx, x
  219.    mov     es:[bx], al
  220.    jmp     ExitPlotBankedPixel
  221.  
  222. CheckDepth2:
  223.    dec     cx
  224.    jnz     Write4Bytes
  225.  
  226.    mov     ax, Color
  227.    mov   cl, 3
  228.    shr   ah, cl
  229.    shr   ax, cl
  230.    mov   dx, Color+2
  231.    shr   dx, cl
  232.    mov   cx, 10
  233.    shl   dx, cl
  234.    or    ax, dx
  235.  
  236.    mov     cx, x
  237.    shl     cx, 1
  238.    add     bx, cx
  239.    mov     es:[bx], ax
  240.    jmp     ExitPlotBankedPixel
  241.  
  242. Write4Bytes:
  243.    mov     ax, Color
  244.    mov     cx, x
  245.    shl     cx, 1
  246.    shl     cx, 1
  247.    add     bx, cx
  248.    mov     es:[bx], ax
  249.    mov     ax, Color+2
  250.    mov     es:[bx+2], ax
  251.  
  252. ExitPlotBankedPixel:
  253.    ret
  254. WriteTPlusBankedPixel       ENDP
  255.  
  256.  
  257.  
  258. END
  259.