Skip to content

Commit

Permalink
Intial pass at working 80 column draw
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Plummer authored and Dave Plummer committed Sep 27, 2023
1 parent 4554255 commit f89da18
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 44 deletions.
90 changes: 60 additions & 30 deletions petrock.asm
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ drawLoop:

@notDemo: cmp #$42 ; Letter "B"
bne @notborder
jsr ToggleBorder
jsr SwitchDemoMode ; HACHACK
jmp drawLoop

@notborder: cmp #$03
Expand Down Expand Up @@ -520,6 +520,9 @@ GotSerialPacket:
bne BogusData

lda SerialBuf+MAGIC_LEN
.ifdef COL80
asl
.endif
sta VU

PeakDataNibbles = SerialBuf + MAGIC_LEN + VU_LEN
Expand Down Expand Up @@ -606,6 +609,9 @@ FillPeaks:
sta zptmpB+1
ldy DataIndex
lda (zptmpB), y
.ifdef COL80
asl
.endif
sta VU

lda #1
Expand Down Expand Up @@ -1296,6 +1302,9 @@ FcColorMem: lda #YSIZE-TOP_MARGIN-BOTTOM_MARGIN ; Count of rows to paint c
DrawBand: sta Height ; Height is height of bar itself
txa
asl
.ifdef COL80
asl
.endif
sta SquareX ; Bar xPos on screen

; Square Y will be the screen line number of the top of the bar
Expand All @@ -1322,8 +1331,9 @@ lineSwitch: ldy SquareX ; Y will be the X-pos (zp addr mode not su
cmp #YSIZE - BOTTOM_MARGIN - 1
bne @notlastline
lda Height ; If 0 height, write blanks instead of band base
beq drawLastBlanks
cmp #1
bne :+
jmp drawLastBlanks
: cmp #1
beq drawOneLine
bne drawLastLine
@notlastline: cmp SquareY ; Compare to screen line of top of bar
Expand All @@ -1334,13 +1344,26 @@ drawBlanks:
lda #' '
sta (zptmp),y
iny
.ifdef COL80
sta (zptmp),y
iny
sta (zptmp),y
iny
.endif
sta (zptmp),y
inc tempY
bne lineLoop
drawFirstLine:
lda CharDefs + visualDef::TOPLEFTSYMBOL
sta (zptmp),y
iny
.ifdef COL80
lda CharDefs + visualDef::TOPMIDDLESYMBOL ; Draw center pieces on 80 column screens only
sta (zptmp),y
iny
sta (zptmp),y
iny
.endif
lda CharDefs + visualDef::TOPRIGHTSYMBOL
sta (zptmp),y
inc tempY
Expand All @@ -1349,6 +1372,13 @@ drawMiddleLine:
lda CharDefs + visualDef::VLINE1SYMBOL
sta (zptmp),y
iny
.ifdef COL80
lda CharDefs + visualDef::VLINE1MIDDLESYMBOL ; Draw center pieces on 80 column screens only
sta (zptmp),y
iny
sta (zptmp),y
iny
.endif
lda CharDefs + visualDef::VLINE2SYMBOL
sta (zptmp),y
inc tempY
Expand All @@ -1359,6 +1389,13 @@ drawLastLine:
lda CharDefs + visualDef::BOTTOMLEFTSYMBOL
sta (zptmp),y
iny
.ifdef COL80
lda CharDefs + visualDef::BOTTOMMIDDLESYMBOL ; Draw center pieces on 80 column screens only
sta (zptmp),y
iny
sta (zptmp),y
iny
.endif
lda CharDefs + visualDef::BOTTOMRIGHTSYMBOL
sta (zptmp),y
rts
Expand All @@ -1367,13 +1404,25 @@ drawOneLine:
lda CharDefs + visualDef::ONELINE1SYMBOL
sta (zptmp),y
iny
.ifdef COL80
sta (zptmp),y
iny
sta (zptmp),y
iny
.endif
lda CharDefs + visualDef::ONELINE2SYMBOL
sta (zptmp),y
rts
drawLastBlanks:
lda #' '
sta (zptmp),y
iny
.ifdef COL80
sta (zptmp),y
iny
sta (zptmp),y
iny
.endif
sta (zptmp),y
rts

Expand Down Expand Up @@ -1407,10 +1456,9 @@ PlotEx:
sty CURS_X
stx CURS_Y
ldy CURS_Y
lda ScrLo,y
lda ScreenLineAddresses,y
sta SCREEN_PTR
lda ScrHi,y
ora #$80 ; Screen at $8000
lda ScreenLineAddresses+1,y
sta SCREEN_PTR+1
rts

Expand Down Expand Up @@ -1667,25 +1715,25 @@ SetNextStyle: lda NextStyle ; Take the style index and multiply by 2

SkinnyRoundStyle: ; PETSCII screen codes for round tube bar style
.if C64
.byte 85, 73, 74, 75, 66, 66, 74, 75, 32, 32
.byte 85, 73, 74, 75, 66, 66, 74, 75, 32, 32, 32, 32, 32
.endif
.if PET
.byte 85, 73, 74, 75, 93, 93, 74, 75, 32, 32
.byte 85, 73, 74, 75, 93, 93, 74, 75, 32, 32, 67, 70, 32
.endif

DrawSquareStyle: ; PETSCII screen codes for square linedraw style
.byte 79, 80, 76, 122, 101, 103, 76, 122, 32, 32
.byte 111, 112, 76, 122, 101, 103, 76, 122, 32, 32, 247

BreakoutStyle: ; PETSCII screen codes for style that looks like breakout
.if C64
.byte 239, 250, 239, 250, 239, 250, 239, 250, 239, 250
.byte 239, 250, 239, 250, 239, 250, 239, 250, 239, 250, 32, 32, 32
.endif
.if PET
.byte 228, 250, 228, 250, 228, 250, 228, 250, 228, 250
.byte 228, 250, 228, 250, 228, 250, 228, 250, 228, 250, 32, 32, 32
.endif

CheckerboardStyle: ; PETSCII screen codes for checkerboard style
.byte 102, 92, 102, 92, 102, 92,102, 92, 102, 92
.byte 102, 92, 102, 92, 102, 92,102, 92, 102, 92, 32, 32, 32

; Lookup table - each of the above mini tables is listed in this lookup table so that
; we can easily find items 0-3
Expand Down Expand Up @@ -1769,21 +1817,3 @@ HelpText1: .literal "C: COLOR - S: STYLE - D: DEMO", 0
HelpText1: .literal "S: STYLE - D: DEMO", 0
.endif
HelpText2: .literal "B: BORDER - RUN/STOP: EXIT", 0

.if PET ; This is used by the PlotEx routine for the PET

; Screen address tables - offset to real screen

.rodata

ScrLo: .byte $00, $28, $50, $78, $A0, $C8, $F0, $18
.byte $40, $68, $90, $B8, $E0, $08, $30, $58
.byte $80, $A8, $D0, $F8, $20, $48, $70, $98
.byte $C0

ScrHi: .byte $00, $00, $00, $00, $00, $00, $00, $01
.byte $01, $01, $01, $01, $01, $02, $02, $02
.byte $02, $02, $02, $02, $03, $03, $03, $03
.byte $03

.endif
47 changes: 33 additions & 14 deletions petrock.inc
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@

CLRSCR = $E015
YSIZE = 25
.ifdef COL80
XSIZE = 80
.else
XSIZE = 40

.endif
.endif
; Includes --------------------------------------------------------------------------
Expand Down Expand Up @@ -127,19 +130,24 @@ CLRHOME = $93 ; Clear screen
; Defines below this line should generally not require changing

NUM_BANDS = 16 ; 16 bands in the spectrum data
MAX_VU = 17 ; Maximum size per side of the VU meter

; Center the VU meter on the second screen line

VUPOS1 = SCREEN_MEM + XSIZE + XSIZE / 2 + 1
.ifdef COL80
VUPOS2 = SCREEN_MEM + XSIZE + 6
.else
VUPOS2 = SCREEN_MEM + XSIZE + 2
.endif

.if C64
VUCOLORPOS = COLOR_MEM + XSIZE + 2
.endif

; Symbol definitions for square drawing - PETSCI for graphics that make a square

TOPLEFTSYMBOL = 79
TOPLEFTSYMBOL = 79
TOPMIDDLESYMBOL = 247
TOPRIGHTSYMBOL = 80
BOTTOMLEFTSYMBOL = 76
BOTTOMRIGHTSYMBOL = 122
Expand All @@ -160,29 +168,40 @@ VUSYMBOL = 244 ; Symbol for a filled VU square


.struct visualDef
TOPLEFTSYMBOL .byte
TOPRIGHTSYMBOL .byte
BOTTOMLEFTSYMBOL .byte
BOTTOMRIGHTSYMBOL .byte
VLINE1SYMBOL .byte
VLINE2SYMBOL .byte
HLINE1SYMBOL .byte
HLINE2SYMBOL .byte
ONELINE1SYMBOL .byte
ONELINE2SYMBOL .byte
TOPLEFTSYMBOL .byte
TOPRIGHTSYMBOL .byte
BOTTOMLEFTSYMBOL .byte
BOTTOMRIGHTSYMBOL .byte
VLINE1SYMBOL .byte
VLINE2SYMBOL .byte
HLINE1SYMBOL .byte
HLINE2SYMBOL .byte
ONELINE1SYMBOL .byte
ONELINE2SYMBOL .byte
TOPMIDDLESYMBOL .byte
BOTTOMMIDDLESYMBOL .byte
VLINE1MIDDLESYMBOL .byte
.endstruct
VISUALDEF_SIZE = .sizeof(visualDef)

; Our UI Definitions ------------------------------------------------------

.ifdef COL80
LEFT_MARGIN = 8
RIGHT_MARGIN = LEFT_MARGIN
BAND_WIDTH = 4
TOP_MARGIN = 3
BOTTOM_MARGIN = 4
.else
LEFT_MARGIN = 4
RIGHT_MARGIN = LEFT_MARGIN
BAND_WIDTH = 2
TOP_MARGIN = 3
BOTTOM_MARGIN = 4
.endif
BAND_HEIGHT = YSIZE-TOP_MARGIN-BOTTOM_MARGIN
TEXT_WIDTH = XSIZE-LEFT_MARGIN-RIGHT_MARGIN

MAX_VU = (((XSIZE-LEFT_MARGIN-RIGHT_MARGIN)/2)-1)

;----------------------------------------------------------------------------
; Common definitions for all Commodore BASICs
Expand Down

0 comments on commit f89da18

Please sign in to comment.