home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / fractint / fras1611.zip / TPLUS_A.ASM < prev    next >
Assembly Source File  |  1991-05-31  |  5KB  |  257 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. extrn TPlus:FAR
  96.  
  97. .CODE
  98.  
  99. ReadTPlusBankedPixel      PROC       uses si di es ds, x:WORD, y:WORD
  100.    mov     ax, SEG TPlus
  101.    mov     ds, ax
  102.    mov     di, OFFSET TPlus
  103.    mov     bx, [di].Reg[YDOTS]
  104.    dec     bx
  105.    sub     bx, y
  106.    mov     ax, [di].Reg[TPAGE]
  107.    mov     cl, 9
  108.    shl     ax, cl
  109.    add     bx, ax
  110.    mov     si, bx
  111.  
  112.    mov     cx, 16
  113.    sub     cx, [di].RowBytes
  114.    shr     si, cl
  115.    cmp     si, [di].Bank64k
  116.    je     CorrectBank
  117.  
  118.    mov     [di].Bank64k, si
  119.    mov     ax, si
  120.    shl     ax, 1
  121.    mov     dx, [di].wLBNK
  122.    mov     ah, al
  123.    inc     ah
  124.    out     dx, ax
  125.  
  126. CorrectBank:
  127.    mov     cx, [di].RowsPerBank
  128.    shl     si, cl
  129.    sub     bx, si
  130.    mov     cx, [di].RowBytes
  131.    shl     bx, cl
  132.    mov     ax, WORD PTR [[di].Screen+2]
  133.    mov     es, ax
  134.    mov     cx, [di].Reg[DEPTH]
  135.    dec     cx
  136.    jnz     CheckDepth2
  137.  
  138.    add     bx, x
  139.    mov     al, es:[bx]
  140.    xor     ah, ah
  141.    jmp     ExitPlotBankedPixel
  142.  
  143. CheckDepth2:
  144.    dec     cx
  145.    jnz     Read4Bytes
  146.  
  147.    mov     cx, x
  148.    shl     cx, 1
  149.    add     bx, cx
  150.    mov     ax, es:[bx]
  151.  
  152.    mov   dx, ax
  153.    mov   cl, 10
  154.    shr   dx, cl
  155.    mov   cl, 3
  156.    shl   dx, cl
  157.    shl   ax, cl
  158.    shl   ah, cl
  159.  
  160.    jmp     ExitPlotBankedPixel
  161.  
  162. Read4Bytes:
  163.    mov     cx, x
  164.    shl     cx, 1
  165.    shl     cx, 1
  166.    add     bx, cx
  167.    mov     ax, es:[bx]
  168.    mov     dx, es:[bx+2]
  169.  
  170. ExitPlotBankedPixel:
  171.    ret
  172. ReadTPlusBankedPixel      ENDP
  173.  
  174.  
  175.  
  176. WriteTPlusBankedPixel       PROC     uses si di es ds, x:WORD, y:WORD, Color:WORD
  177.    mov     ax, SEG TPlus
  178.    mov     ds, ax
  179.    mov     di, OFFSET TPlus
  180.    mov     bx, [di].Reg[YDOTS]
  181.    dec     bx
  182.    sub     bx, y
  183.    mov     ax, [di].Reg[TPAGE]
  184.    mov     cl, 9
  185.    shl     ax, cl
  186.    add     bx, ax
  187.    mov     si, bx
  188.  
  189.    mov     cx, 16
  190.    sub     cx, [di].RowBytes
  191.    shr     si, cl
  192.    cmp     si, [di].Bank64k
  193.    je     CorrectBank
  194.  
  195.    mov     [di].Bank64k, si
  196.    mov     ax, si
  197.    shl     ax, 1
  198.    mov     dx, [di].wLBNK
  199.    mov     ah, al
  200.    inc     ah
  201.    out     dx, ax
  202.  
  203. CorrectBank:
  204.    mov     cx, [di].RowsPerBank
  205.    shl     si, cl
  206.    sub     bx, si
  207.    mov     cx, [di].RowBytes
  208.    shl     bx, cl
  209.    mov     ax, WORD PTR [[di].Screen+2]
  210.    mov     es, ax
  211.    mov     cx, [di].Reg[DEPTH]
  212.    dec     cx
  213.    jnz     CheckDepth2
  214.  
  215.    mov     ax, Color
  216.    add     bx, x
  217.    mov     es:[bx], al
  218.    jmp     ExitPlotBankedPixel
  219.  
  220. CheckDepth2:
  221.    dec     cx
  222.    jnz     Write4Bytes
  223.  
  224.    mov     ax, Color
  225.    mov   cl, 3
  226.    shr   ah, cl
  227.    shr   ax, cl
  228.    mov   dx, Color+2
  229.    shr   dx, cl
  230.    mov   cx, 10
  231.    shl   dx, cl
  232.    or    ax, dx
  233.  
  234.    mov     cx, x
  235.    shl     cx, 1
  236.    add     bx, cx
  237.    mov     es:[bx], ax
  238.    jmp     ExitPlotBankedPixel
  239.  
  240. Write4Bytes:
  241.    mov     ax, Color
  242.    mov     cx, x
  243.    shl     cx, 1
  244.    shl     cx, 1
  245.    add     bx, cx
  246.    mov     es:[bx], ax
  247.    mov     ax, Color+2
  248.    mov     es:[bx+2], ax
  249.  
  250. ExitPlotBankedPixel:
  251.    ret
  252. WriteTPlusBankedPixel       ENDP
  253.  
  254.  
  255.  
  256. END
  257.