# HG changeset patch # User boisy # Date 1180279663 0 # Node ID 8b36468b2edb5ec5b32bf0092db3a2d1ccb7264a # Parent 6f39160e90961c9bc75f24df31f57830edeead96 realigned tabs diff -r 6f39160e9096 -r 8b36468b2edb level2/modules/covdg.asm --- a/level2/modules/covdg.asm Thu Apr 19 03:07:40 2007 +0000 +++ b/level2/modules/covdg.asm Sun May 27 15:27:43 2007 +0000 @@ -24,8 +24,13 @@ * * 2006/01/17 Robert Gault * Changed the Select routine to permit the use of display 1b 21 within -* scripts when changing from a window to a vdg screen. See discriptions +* scripts when changing from a window to a vdg screen. See descriptions * in cowin.asm. RG +* +* 2007/02/28 Robert Gault +* Changed the Line drawing routine to set the error at half the largest +* change to improve symmetry. Most noticeable in lines with either dX or +* dY = 1. nam CoVDG ttl CoCo 3 VDG I/O module @@ -37,14 +42,14 @@ use vdgdefs endc -FFStSz equ 512 flood fill stack size in bytes +FFStSz equ 512 flood fill stack size in bytes tylg set Systm+Objct atrv set ReEnt+rev rev set $00 edition set 1 -skip2 equ $8C cmpx instruction +skip2 equ $8C cmpx instruction mod eom,name,tylg,atrv,start,size @@ -56,7 +61,7 @@ name fcs /CoVDG/ fcb edition -start lbra Read actually more like INIZ... +start lbra Read actually more like INIZ... lbra Write lbra GetStat lbra SetStat @@ -71,24 +76,24 @@ * U = device memory pointer * X = path descriptor pointer - tsta zero? - bne L0035 branch if not - ldb 256,x else point 100 bytes into mem - bra IsOdd and free -IsEven leau >512,u we only need 2 pages for the screen memory -IsOdd ldd #256 1 page return - os9 F$SRtMem return system memory + bita #$01 test to see if on even page + beq IsEven branch if even + leax >256,x else point 100 bytes into mem + bra IsOdd and free +IsEven leau >512,u we only need 2 pages for the screen memory +IsOdd ldd #256 1 page return + os9 F$SRtMem return system memory puls u - stx 512,x point to end of screen - stx 512,x point to end of screen + stx L011A,pcr default palette + leax >L011A,pcr default palette leay L00F8,pcr CMP to RGB conversion +L00E6 leau >L00F8,pcr CMP to RGB conversion IFNE H6309 L00EA tfr u,w ELSE @@ -183,26 +188,26 @@ ELSE jmp [,s] ENDC -L00F6 lda a,u remap to CMP values -L00F8 sta ,y+ and save RGB data +L00F6 lda a,u remap to CMP values +L00F8 sta ,y+ and save RGB data decb bne L00F2 IFEQ H6309 - leas $02,s clean up stack + leas $02,s clean up stack ENDC L00FF puls pc,u,y,x,b,a -SetPals pshs u,y,x,b,a puts palette data in. - lda >WGlobal+G.CrDvFl is this screen active? - beq L00FF 0 = not active - leax WGlobal+G.MonTyp universal RGB/CMP 0 = CMP, 1 = RGB, 2 = MONO - bne L00E6 if not 0 (CMP) don't re-map colors - leau >L00F6,pcr else do re-map colors +SetPals pshs u,y,x,b,a puts palette data in. + lda >WGlobal+G.CrDvFl is this screen active? + beq L00FF 0 = not active + leax WGlobal+G.MonTyp universal RGB/CMP 0 = CMP, 1 = RGB, 2 = MONO + bne L00E6 if not 0 (CMP) don't re-map colors + leau >L00F6,pcr else do re-map colors bra L00EA -L011A fcb $12,$36,$09,$24 default palette data +L011A fcb $12,$36,$09,$24 default palette data fcb $3f,$1b,$2d,$26 fcb $00,$12,$00,$3f fcb $00,$12,$00,$26 @@ -226,8 +231,8 @@ cmpa #$0E ENDC bls Dispatch - cmpa #$1B escape code? - lbeq Escape yes, do escape immediately + cmpa #$1B escape code? + lbeq Escape yes, do escape immediately IFNE COCO2 cmpa #$1E bcs Do1E @@ -235,14 +240,14 @@ bls Dispatch ELSE cmpa #$1F - lbls NoOp ignore gfx codes if not CoCo 2 compatible + lbls NoOp ignore gfx codes if not CoCo 2 compatible ENDC tsta bmi L01BA ldb P$SelP,x compare against selected path -* beq L0249 branch if empty - ldb >P$SelP,x else load selected path from process descriptor - sta >P$SelP,x and store passed path - pshs y save our path desc ptr - bsr L024A get device table entry for path - ldy V$STAT,y get driver statics - ldx P$SelP,x compare against selected path +* beq L0249 branch if empty + ldb >P$SelP,x else load selected path from process descriptor + sta >P$SelP,x and store passed path + pshs y save our path desc ptr + bsr L024A get device table entry for path + ldy V$STAT,y get driver statics + ldx WGlobal+G.CrDvFl is this screen currently showing? + ora WGlobal+G.CrDvFl is this screen currently showing? lbeq L0440 - sta >PIA1Base+2 set lowercase in hardware - ldy #$FFC6 Ok, now set up via old CoCo 2 mode + sta >PIA1Base+2 set lowercase in hardware + ldy #$FFC6 Ok, now set up via old CoCo 2 mode IFNE COCO2 tstb bne L03CB ENDC * Set up VDG screen for text - stb -6,y $FFC0 - stb -4,y $FFC2 - stb -2,y $FFC4 + stb -6,y $FFC0 + stb -4,y $FFC2 + stb -2,y $FFC4 lda $FF90 ldb $FF99 set resolution AND border color + std >$FF99 set resolution AND border color std 512K systems, Robert Gault - ldb 1,x get block number to use + ldb 1,x get block number to use pshs b - andb #$F8 keep high bits only + andb #$F8 keep high bits only clra lslb rola @@ -674,7 +679,7 @@ tfr b,a clrb * PATCH END: Mod for >512K systems, Robert Gault - std $FF9D ldd #$0F07 sta Mode1Clr,pcr point to mask byte table - lda a,x get byte - sta Mode1Clr,pcr point to mask byte table + lda a,x get byte + sta 512K - Robert Gault - stb >WGlobal+G.CrDvFl is this screen currently showing? + stb >WGlobal+G.CrDvFl is this screen currently showing? lbra DispAlfa L04D9 pshs x,b,a @@ -804,31 +809,31 @@ * $11 - set color Do11 leax Mode1Clr,pcr point to color table - ldb a,x get appropriate byte - bra L0564 and start the clearing +PrstScrn lda Mode1Clr,pcr point to color table + ldb a,x get appropriate byte + bra L0564 and start the clearing * $13 - erase graphics Do13 clrb @@ -895,14 +900,14 @@ * Fix X/Y coords: * - if Y > 191 then cap it at 191 * - adjust X coord if in 128x192 mode -FixXY ldd dY + pshs cc save answer + IFNE H6309 assume true and negate regD + negd + ELSE + nega + negb + sbca #0 + ENDC + puls cc + bhs ch1 + ldd $08,s get dY +ch1 equ * + IFNE H6309 + asrd + ELSE + asra + rorb + ENDC + cmpd #0 + beq L0632 error must not be zero +* End of new routine RG + std $04,s bra L0632 L062A sta ,s ldd $04,s @@ -1022,16 +1051,16 @@ ldb $06,s bpl L0665 lsla - ldb DTabl,pcr point to display table - lslb multiply index by 2 (word entries) - abx point to display code, #blocks - ldb $01,x get number of blocks -* stb $01,y VD.NBlk - stb (VD.NBlk-VD.HiRes),y VD.NBlk - lda #$FF start off with zero screens allocated -BA010 inca count up by one - ldb (VD.NBlk-VD.HiRes),y get number of blocks + leay DTabl,pcr point to display table + lslb multiply index by 2 (word entries) + abx point to display code, #blocks + ldb $01,x get number of blocks +* stb $01,y VD.NBlk + stb (VD.NBlk-VD.HiRes),y VD.NBlk + lda #$FF start off with zero screens allocated +BA010 inca count up by one + ldb (VD.NBlk-VD.HiRes),y get number of blocks pshs a needed to protect regA; RG. - os9 F$AlHRAM allocate a screen + os9 F$AlHRAM allocate a screen puls a - bcs DeAll de-allocate ALL allocated blocks on error - pshs b save starting block number of the screen - andb #$3F keep block BL= block MOD 63 + bcs DeAll de-allocate ALL allocated blocks on error + pshs b save starting block number of the screen + andb #$3F keep block BL= block MOD 63 pshs b - addb (VD.NBlk-VD.HiRes),y add in the block size of the screen - decb in case last block is $3F,$7F,$BF,$FF; RG. - andb #$3F (BL+S) mod 63 < BL? (overlap 512k bank) - cmpb ,s+ is all of it in this bank? - blo BA010 if not, allocate another screen - puls b restore the block number for this screen - stb ,y VD.HiRes - save starting block number + addb (VD.NBlk-VD.HiRes),y add in the block size of the screen + decb in case last block is $3F,$7F,$BF,$FF; RG. + andb #$3F (BL+S) mod 63 < BL? (overlap 512k bank) + cmpb ,s+ is all of it in this bank? + blo BA010 if not, allocate another screen + puls b restore the block number for this screen + stb ,y VD.HiRes - save starting block number bsr DeMost deallocate all of the other screens - leas a,s move from within DeMost; RG. - ldb ,y restore the starting block number again + leas a,s move from within DeMost; RG. + ldb ,y restore the starting block number again - lda $01,x number of blocks + lda $01,x number of blocks lbsr L06E3 bcs L05AF ldx $02,s @@ -1751,39 +1780,39 @@ rts * De-allocate the screens -DeAll bsr DeMost de-allocate all of the screens - bra L05AF restore stack and exit +DeAll bsr DeMost de-allocate all of the screens + bra L05AF restore stack and exit DeMost tsta - beq DA020 quick exit if zero additional screens + beq DA020 quick exit if zero additional screens - ldb (VD.NBlk-VD.HiRes),y get # blocks of screen to de-allocate - pshs a save count of blocks for later - pshs d,y,x save rest of regs - leay 9,s account for d,y,x,a,calling PC + ldb (VD.NBlk-VD.HiRes),y get # blocks of screen to de-allocate + pshs a save count of blocks for later + pshs d,y,x save rest of regs + leay 9,s account for d,y,x,a,calling PC clra -DA010 ldb ,y+ get starting block number - tfr d,x in X - ldb 1,s get size of the screen to de-allocate - pshs a needed to protect regA; RG. - os9 F$DelRAM de-allocate the blocks *** IGNORING ERRORS *** +DA010 ldb ,y+ get starting block number + tfr d,x in X + ldb 1,s get size of the screen to de-allocate + pshs a needed to protect regA; RG. + os9 F$DelRAM de-allocate the blocks *** IGNORING ERRORS *** puls a - dec ,s count down + dec ,s count down bne DA010 - puls d,y,x restore registers - puls a and count of extra bytes on the stack -* leas a,s removed because it yanks wrong data; RG. -DA020 rts and exit + puls d,y,x restore registers + puls a and count of extra bytes on the stack +* leas a,s removed because it yanks wrong data; RG. +DA020 rts and exit * Get current screen info for direct writes - added in NitrOS-9 -Rt.ScInf pshs x save caller's regs ptr - ldd R$Y,x get screen +Rt.ScInf pshs x save caller's regs ptr + ldd R$Y,x get screen bmi L05C8 bsr L05DE bcs L05DC lbsr L06FF bcs L05DC -L05C8 ldx ,s get caller's regs ptr from stack +L05C8 ldx ,s get caller's regs ptr from stack ldb R$Y+1,x bmi L05DB bsr L05DE @@ -1810,18 +1839,18 @@ Rt.PScrn ldd R$X,x cmpd #$0004 bhi IllArg - pshs b,a save screen type, and a zero + pshs b,a save screen type, and a zero leax >DTabl,pcr lslb incb - lda b,x get number of blocks the screen requires - sta ,s kill 'A' on the stack + lda b,x get number of blocks the screen requires + sta ,s kill 'A' on the stack ldx PD.RGS,y bsr L061B bcs L05B3X lda ,s cmpa $01,x - lbhi L05B3X if new one takes more blocks than old + lbhi L05B3X if new one takes more blocks than old lda $01,s sta $02,x leas $02,s @@ -1830,7 +1859,7 @@ beq L0633 cmpd #$0003 lbgt IllArg - bsr GetScrn point X to 3 byte screen descriptor + bsr GetScrn point X to 3 byte screen descriptor lbeq IllArg clra rts @@ -1851,11 +1880,11 @@ * mul * leax b,x * puls pc,b,a -GetScrn leax DTabl,pcr - lda b,x get proper display code + lda b,x get proper display code puls x clrb - std >$FF99 set border color, too + std >$FF99 set border color, too std >D.VIDRS lda >D.HINIT - anda #$7F make coco 3 only mode + anda #$7F make coco 3 only mode sta >D.HINIT sta >$FF90 lda >D.VIDMD - ora #$80 graphics mode - anda #$F8 1 line/character row + ora #$80 graphics mode + anda #$F8 1 line/character row sta >D.VIDMD sta >$FF98 -* lda ,x get block # +* lda ,x get block # * lsla * lsla *** start of 2MB patch by RG - ldb ,x get block # (2Meg patch) + ldb ,x get block # (2Meg patch) clra lslb rola @@ -1917,20 +1946,20 @@ tfr b,a *** end of 2MB patch by RG clrb - std $FF9D clr >D.VOFF2 clr >$FF9C lbra SetPals * Get next free screen descriptor -L06C7 clr ,-s clear an area on the stack - inc ,s set to 1 -L06CB tst ,y check block # - beq L06D9 if not used yet - leay b,y go to next screen descriptor - inc ,s increment count on stack - deca decrement A +L06C7 clr ,-s clear an area on the stack + inc ,s set to 1 +L06CB tst ,y check block # + beq L06D9 if not used yet + leay b,y go to next screen descriptor + inc ,s increment count on stack + deca decrement A bne L06CB comb ldb #E$BMode @@ -1938,10 +1967,10 @@ * Get B 8K blocks from high RAM Get8KHi ldb #$01 -L06DDX os9 F$AlHRAM allocate a screen +L06DDX os9 F$AlHRAM allocate a screen rts -L06E1 lda #$01 map screen into memory +L06E1 lda #$01 map screen into memory L06E3 pshs u,x,b,a bsr L0710 bcc L06F9 @@ -1950,18 +1979,18 @@ tfr d,x ldb ,s os9 F$MapBlk - stb $01,s save error code if any + stb $01,s save error code if any tfr u,d bcs L06FD -L06F9 leas $02,s destroy D on no error +L06F9 leas $02,s destroy D on no error puls pc,u,x -L06FD puls pc,u,x,b,a if error, then restore D +L06FD puls pc,u,x,b,a if error, then restore D -L06FF pshs y,x,a deallocate screen +L06FF pshs y,x,a deallocate screen bsr L0710 bcs L070E - ldd #DAT.Free set memory to unused + ldd #DAT.Free set memory to unused L0708 std ,x++ dec ,s bne L0708 @@ -1973,11 +2002,11 @@ lde #$08 ELSE pshs b,a - lda #$08 number of blocks to check + lda #$08 number of blocks to check sta $01,s ENDC ldx