home *** CD-ROM | disk | FTP | other *** search
/ Fractal Creations (Second Edition) / FRACTALS_2E.iso / frasrc.exe / TPLUS_A.ASM < prev    next >
Assembly Source File  |  1992-12-19  |  5KB  |  258 lines

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