diff --git a/cfg/plus4-hires.cfg b/cfg/plus4-hires.cfg index f3040a2db..054e8c7f5 100644 --- a/cfg/plus4-hires.cfg +++ b/cfg/plus4-hires.cfg @@ -38,7 +38,7 @@ SEGMENTS { # Allow data between bitmap and top of memory to be used as a second BSS # space. Define symbols for it so that it can be supplied to _heapadd(). - HIBSS: load = HIRAM, type = bss, optional = yes, define = yes; + HIBSS: load = HIRAM, type = bss, optional = yes, define = yes; } FEATURES { CONDES: type = constructor, diff --git a/libsrc/plus4/crt0.s b/libsrc/plus4/crt0.s index 610bc3116..539c12641 100644 --- a/libsrc/plus4/crt0.s +++ b/libsrc/plus4/crt0.s @@ -58,20 +58,20 @@ L1: lda sp,x ; Set up the IRQ vector in the banked RAM; and, switch off the ROM. - ldx #IRQ + lda #IRQ sei ; No ints, handler not yet in place sta ENABLE_RAM - stx $FFFE ; Install interrupt handler - sty $FFFF - ldx IRQVec - ldy IRQVec+1 - stx IRQInd+1 - sty IRQInd+2 - ldx #IRQStub - stx IRQVec - sty IRQVec+1 + sta $FFFE ; Install interrupt handler + stx $FFFF + lda IRQVec + ldx IRQVec+1 + sta IRQInd+1 + stx IRQInd+2 + lda #IRQStub + sta IRQVec + stx IRQVec+1 cli ; Allow interrupts @@ -194,18 +194,20 @@ nohandler: jmp (BRKVec) ; Jump indirect to the break vector -; IRQ stub called by the Kernal IRQ handler, via $314. +; IRQ stub installed at $314, called by our handler above if RAM is banked in, +; or the Kernal IRQ handler if ROM is banked in. + ; If we have handlers, call them. We will use a flag here instead of loading ; __INTERRUPTOR_COUNT__ directly, since the condes function is not reentrant. ; The irqcount flag will be set/reset from the main code, to avoid races. IRQStub: - cld ; Just to be sure + cld ; Just to be sure sta ENABLE_RAM ldy irqcount beq @L1 - jsr callirq_y ; Call the IRQ functions + jsr callirq_y ; Call the IRQ functions @L1: sta ENABLE_ROM - jmp (IRQInd+1) ; Jump to the saved IRQ vector + jmp (IRQInd+1) ; Jump to the saved IRQ vector ; ------------------------------------------------------------------------ ; Data diff --git a/libsrc/plus4/ser/plus4-stdser.s b/libsrc/plus4/ser/plus4-stdser.s index 9cdde2fc1..ceb997214 100644 --- a/libsrc/plus4/ser/plus4-stdser.s +++ b/libsrc/plus4/ser/plus4-stdser.s @@ -88,7 +88,7 @@ SendBuf: .res 256 ; Tables used to translate RS232 params into register values -BaudTable: ; bit7 = 1 means setting is invalid +BaudTable: ; Bit7 = 1 means setting is invalid .byte $FF ; SER_BAUD_45_5 .byte $01 ; SER_BAUD_50 .byte $02 ; SER_BAUD_75 @@ -353,26 +353,26 @@ SER_IOCTL: ; SER_IRQ: - lda ACIA_STATUS ;(4) ;status ;check for byte received - and #$08 ;(2) - beq @L9 ;(2*) + lda ACIA_STATUS ; (4) Check for byte received + and #$08 ; (2) + beq @L9 ; (2*) -@L1: lda ACIA_DATA ;(4) data ;get byte and put into receive buffer - ldy RecvTail ;(4) - ldx RecvFreeCnt ;(4) - beq @L3 ;(2*) Jump if no space in receive buffer - sta RecvBuf,y ;(5) - inc RecvTail ;(6) - dec RecvFreeCnt ;(6) - cpx #33 ;(2) check for buffer space low - bcc @L2 ;(2*) + lda ACIA_DATA ; (4) Get byte and put into receive buffer + ldy RecvTail ; (4) + ldx RecvFreeCnt ; (4) + beq @L3 ; (2*) Jump if no space in receive buffer + sta RecvBuf,y ; (5) + inc RecvTail ; (6) + dec RecvFreeCnt ; (6) + cpx #33 ; (2) Check for buffer space low + bcc @L2 ; (2*) rts ; Return with carry set (interrupt handled) ; Assert flow control if buffer space too low -@L2: lda RtsOff ;(3) assert flow control if buffer space too low - sta ACIA_CMD ;(4) command - sta Stopped ;(3) +@L2: lda RtsOff ; (3) + sta ACIA_CMD ; (4) + sta Stopped ; (3) @L3: sec ; Interrupt handled @L9: rts @@ -396,7 +396,7 @@ SER_IRQ: @L2: lda ACIA_STATUS and #$10 bne @L4 - bit tmp1 ;keep trying if must try hard + bit tmp1 ; Keep trying if must try hard bmi @L0 @L3: rts diff --git a/libsrc/plus4/tgi/ted-hi.s b/libsrc/plus4/tgi/ted-hi.s index e3207600a..5a804c304 100644 --- a/libsrc/plus4/tgi/ted-hi.s +++ b/libsrc/plus4/tgi/ted-hi.s @@ -129,11 +129,11 @@ CHARROM := $D000 ; Character rom base address ; bitmap at $E000 like we do on the C64, and have to use the next lowest ; position at $C000. -LBASE := $0800 ; Luminance memory base address -VBASE := $C000 ; Bitmap base address +LBASE := $0800 ; Luminance memory base address +VBASE := $C000 ; Bitmap base address -CBASE := LBASE + $400 ; Chrominance memory base address (fixed relative to LBASE) -CHRBASE := $0800 ; Base address of text mode data +CBASE := LBASE + $400 ; Chrominance memory base address (fixed relative to LBASE) +CHRBASE := $0800 ; Base address of text mode data .assert LBASE .mod $0800 = 0, error, "Luma/Chroma memory base address must be a multiple of 2K" .assert VBASE .mod $2000 = 0, error, "Bitmap base address must be a multiple of 8K" @@ -151,7 +151,7 @@ CHRBASE := $0800 ; Base address of text mode data ; INSTALL: -; rts ; fall through +; rts ; Fall through ; ------------------------------------------------------------------------ @@ -216,7 +216,7 @@ INIT: ; DONE: lda $FF12 - ora #%00000100 ; fetch from ROM + ora #%00000100 ; Fetch from ROM sta $FF12 .if LBASE <> CHRBASE @@ -229,7 +229,7 @@ DONE: lda $FF12 .endif lda $FF06 - and #%11011111 ; exit bitmap mode + and #%11011111 ; Exit bitmap mode sta $FF06 rts @@ -306,7 +306,7 @@ CLEAR: ldy #$00 ; SETVIEWPAGE: -; rts ; fall through +; rts ; Fall through ; ------------------------------------------------------------------------ ; SETDRAWPAGE: Set the drawable page. Called with the new page in A (0..n). @@ -472,14 +472,14 @@ GETPIXEL: LINE: -@CHECK: lda X2 ;Make sure x1=y1? - lda Y1 ;Otherwise dy=y1-y2 + bpl @DYPOS ; Is y2>=y1? + lda Y1 ; Otherwise dy=y1-y2 sec sbc Y2 tay - ldx #$88 ;DEY + ldx #$88 ; DEY @DYPOS: sty DY ; 8-bit DY -- FIX ME? stx YINCDEC @@ -524,8 +524,8 @@ LINE: sta CHUNK ldx DY - cpx DX ;Who's bigger: dy or dx? - bcc STEPINX ;If dx, then... + cpx DX ; Who's bigger: dy or dx? + bcc STEPINX ; If dx, then... lda DX+1 bne STEPINX @@ -543,14 +543,14 @@ LINE: ; Y1 AND #$07 STEPINY: lda #00 - sta OLDCHUNK ;So plotting routine will work right + sta OLDCHUNK ; So plotting routine will work right lda CHUNK - lsr ;Strip the bit + lsr ; Strip the bit eor CHUNK sta CHUNK txa - beq YCONT2 ;If dy=0, it's just a point -@CONT: lsr ;Init counter to dy/2 + beq YCONT2 ; If dy=0, it's just a point +@CONT: lsr ; Init counter to dy/2 ; ; Main loop ; @@ -562,30 +562,30 @@ YLOOP: sta TEMP eor (POINT),y sta (POINT),y YINCDEC: - iny ;Advance Y coordinate + iny ; Advance Y coordinate cpy #8 - bcc @CONT ;No prob if Y=0..7 + bcc @CONT ; No prob if Y=0..7 jsr FIXY -@CONT: lda TEMP ;Restore A +@CONT: lda TEMP ; Restore A sec sbc DX bcc YFIXX -YCONT: dex ;X is counter +YCONT: dex ; X is counter bne YLOOP -YCONT2: lda (POINT),y ;Plot endpoint +YCONT2: lda (POINT),y ; Plot endpoint eor BITMASK and CHUNK eor (POINT),y sta (POINT),y rts -YFIXX: ;x=x+1 +YFIXX: ; X=x+1 adc DY lsr CHUNK - bne YCONT ;If we pass a column boundary... - ror CHUNK ;then reset CHUNK to $80 + bne YCONT ; If we pass a column boundary... + ror CHUNK ; Then reset CHUNK to $80 sta TEMP2 - lda POINT ;And add 8 to POINT + lda POINT ; And add 8 to POINT adc #8 sta POINT bcc @CONT @@ -603,34 +603,33 @@ YFIXX: ;x=x+1 .bss COUNTHI: - .byte $00 ;Temporary counter - ;only used once + .byte $00 ; Temporary counter, only used once. .code STEPINX: ldx DX lda DX+1 sta COUNTHI cmp #$80 - ror ;Need bit for initialization - sta Y1 ;High byte of counter + ror ; Need bit for initialization + sta Y1 ; High byte of counter txa - bne @CONT ;Could be $100 + bne @CONT ; Could be $100 dec COUNTHI @CONT: ror ; ; Main loop ; XLOOP: lsr CHUNK - beq XFIXC ;If we pass a column boundary... + beq XFIXC ; If we pass a column boundary... XCONT1: sbc DY - bcc XFIXY ;Time to step in Y? + bcc XFIXY ; Time to step in Y? XCONT2: dex bne XLOOP - dec COUNTHI ;High bits set? + dec COUNTHI ; High bits set? bpl XLOOP - lsr CHUNK ;Advance to last point - jmp LINEPLOT ;Plot the last chunk + lsr CHUNK ; Advance to last point + jmp LINEPLOT ; Plot the last chunk ; ; CHUNK has passed a column, so plot and increment pointer ; and fix up CHUNK, OLDCHUNK. @@ -652,22 +651,22 @@ XFIXC: sta TEMP ; Check to make sure there isn't a high bit, plot chunk, ; and update Y-coordinate. ; -XFIXY: dec Y1 ;Maybe high bit set +XFIXY: dec Y1 ; Maybe high bit set bpl XCONT2 adc DX sta TEMP lda DX+1 - adc #$FF ;Hi byte + adc #$FF ; Hi byte sta Y1 - jsr LINEPLOT ;Plot chunk + jsr LINEPLOT ; Plot chunk lda CHUNK sta OLDCHUNK lda TEMP XINCDEC: - iny ;Y-coord - cpy #8 ;0..7 is ok + iny ; Y-coord + cpy #8 ; 0..7 is ok bcc XCONT2 sta TEMP jsr FIXY @@ -692,11 +691,11 @@ LINEPLOT: ; Plot the line chunk ; Subroutine to fix up pointer when Y decreases through ; zero or increases through 7. ; -FIXY: cpy #255 ;Y=255 or Y=8 +FIXY: cpy #255 ; Y=255 or Y=8 beq @DECPTR -@INCPTR: ;Add 320 to pointer - ldy #0 ;Y increased through 7 +@INCPTR: ; Add 320 to pointer + ldy #0 ; Y increased through 7 lda POINT adc #<320 sta POINT @@ -705,8 +704,8 @@ FIXY: cpy #255 ;Y=255 or Y=8 sta POINT+1 rts -@DECPTR: ;Okay, subtract 320 then - ldy #7 ;Y decreased through 0 +@DECPTR: ; Okay, subtract 320 then + ldy #7 ; Y decreased through 0 lda POINT sec sbc #<320 @@ -815,28 +814,6 @@ TEXTSTYLE: ; OUTTEXT: - -; Calculate a pointer to the representation of the character in the -; character ROM - -; ldx #((>(CHARROM + $0800)) >> 3) -; ldy #0 -; lda (TEXT),y -; bmi @L1 -; ldx #((>(CHARROM + $0000)) >> 3) -; @L1: stx ptr4+1 -; asl a -; rol ptr4+1 -; asl a -; rol ptr4+1 -; asl a -; rol ptr4+1 -; sta ptr4 - - - - - rts ; ------------------------------------------------------------------------ @@ -862,10 +839,10 @@ CALC: lda Y1 ror POINT cmp #$80 ror - ror POINT ; row*64 - adc TEMP2 ; +row*256 + ror POINT ; Row * 64 + adc TEMP2 ; + Row * 256 clc - adc #>VBASE ; +bitmap base + adc #>VBASE ; + Bitmap base sta POINT+1 lda X1