# HG changeset patch # User David Ladd # Date 1518913167 21600 # Node ID b05e48458203c9fa2c73d1ca93cf6220593fe956 # Parent d1c60028af6ef508b7ff970f045e3e94e30de9fe Updated Level 1 GrfDrv & VTIO for performance and bug fixes. diff -r d1c60028af6e -r b05e48458203 level1/cmds/grfdrv.asm --- a/level1/cmds/grfdrv.asm Thu Feb 15 23:06:22 2018 -0600 +++ b/level1/cmds/grfdrv.asm Sat Feb 17 18:19:27 2018 -0600 @@ -19,361 +19,417 @@ use cocovtio.d endc -tylg set Systm+Objct +tylg set Systm+Objct atrv set ReEnt+rev rev set $00 edition set 1 mod eom,name,tylg,atrv,start,size +* Stack offsets for LINE command org 0 size equ . +LnPxMsk1 rmb 1 (0) Pixel mask for byte from current Gfx Cursor X,Y coord of line +LnPxMsk2 rmb 1 (1) Pixel mask for byte from caller specified X,Y coord +LnAddr1 rmb 2 (2-3) Address on screen for user specified X,Y coord byte +LnCoords rmb 2 (4-5) Inited to $0000 +LnXDir rmb 1 (6) X direction/offset (-1 or +1) +LnYDir rmb 1 (7) Y direction/offset (-32 or +32) +LnXDist rmb 2 (8-9) Distance between X coords +LnYDist rmb 2 ($A-$B) Distance between Y coords +LnX1 rmb 1 ($C) User specified X coord for start of line +LnY1 rmb 1 ($D) User specified Y coord for start of line +LnUnk3 rmb 1 ($E) Unknown so far +LnStkSz equ . Size of Line temp stack - fcb $07 + fcb $07 name fcs /GrfDrv/ fcb edition * Dispatch table -start lbra Init - lbra Write - lbra GetStat - lbra SetStat - lbra Term - -* 128x192 4 color pixel table -Mode1Clr fdb $0055,$aaff +start bra Term Init will just exit w/o error + NOP + bra Write + NOP + bra GetStat + NOP + bra SetStat + NOP +Term clrb Exit without error + rts +* Shouldn't need to pad Term (last entry) with 3rd byte +* NOP GetStat -SetStat comb +SetStat comb No GetStat/SetStat calls in Grfdrv, exit with "Unknown Service" error ldb #E$UnkSvc rts -Write suba #$15 - leax 191 then cap it at 191 * - adjust X coord if in 128x192 mode -FixXY ldd 0, skip ahead + addd LnXDist,s Add to distance between X coords + std LnCoords,s Save overtop as new value + lda LnYDir,s Get Y direction/increment + leax a,x Bump Y coord up or down as appropriate (SIGNED, so can't use abx) + bra L0100 Draw next pixel + +L011D lda ,s Get current pixel mask for Gfx Cursor X,Y coord + ldb LnXDir,s Get X direction/offset + bpl L0133 If positive, skip ahead + lsla If negative, shift pixel mask left 1 bit + ldb Mode1Clr,pcr - lda a,x -L0267 sta 6144,u Point to end of screen+1 -* ldd #$0600 6 blocks of 256 (how many 4 byte chunks to clear) -*InCLSLp pshu x,y 4 bytes cleared -* decb -* bne InCLSLp Not done 256*4 (1k) bytes -* deca Dec 1K blocks ctr -* bne InCLSLp Do till done -* puls x,y,u Restore regs - Do13 -EraseGfx clrb value to clear screen with -L07B2 ldx 6144+1,x point to end of gfx mem + 1 -L07B9 stb ,-x clear - cmpx 6144,u Point to end of screen+1 + ldd #$0600 6 blocks of 256 (how many 4 byte chunks to clear) +InCLSLp pshu x,y 4 bytes cleared + decb + bne InCLSLp Not done 256*4 (1k) bytes + deca Dec 1K blocks ctr + bne InCLSLp Do till done + puls x,y,u Restore regs * Home Graphics cursor Do14 clra