File: dos\tplus_a.asm

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