Final KFest demo commit

- Added text mode
- Added some sprites
- Fixed a bug in high-bit detection
- High bit detection now smarter
This commit is contained in:
Quinn Dunki 2017-07-18 11:33:57 -07:00
parent b8ae24af14
commit 6976747a86
8 changed files with 1163 additions and 1192 deletions

View File

@ -142,8 +142,7 @@ def byteStreamsFromPixels(pixelData,width,height,shift,bitDelegate,highBitDelega
bitChunk = bitChunk[::-1] bitChunk = bitChunk[::-1]
# Determine palette bit from first pixel on each row # Determine palette bit from first pixel on each row
highBit = highBitDelegate(pixelData[row][0]) highBit = highBitDelegate(pixelData,row,width)
byteSplits[byteIndex] = highBit + bitChunk byteSplits[byteIndex] = highBit + bitChunk
bitPos += 7 bitPos += 7
@ -267,17 +266,19 @@ def bitsForMask(pixel):
return "11" return "11"
def highBitForColor(pixel): def highBitForColor(pixelData,rowIndex,width):
# Note that we prefer high-bit white because blue fringe is less noticeable than magenta. for pixelIndex in range(width):
highBit = "0" pixel = pixelColor(pixelData,rowIndex,pixelIndex)
if pixel == Colors.orange or pixel == Colors.blue or pixel == Colors.white:
highBit = "1" # Note that we prefer high-bit white because blue fringe is less noticeable than magenta.
if pixel == Colors.orange or pixel == Colors.blue or pixel == Colors.white:
return "1"
return highBit return "0"
def highBitForMask(pixel): def highBitForMask(pixelData,rowIndex,width):
return "1" return "1"

View File

@ -8,12 +8,18 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; EnableHires ; EnableHires
; Trashes A
; ;
EnableHires: EnableHires:
lda TEXT sta TEXT
lda HIRES1 sta HIRES1
lda HIRES2 sta HIRES2
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; EnableText
;
EnableText:
sta TEXT2
rts rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

BIN
hamburger.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

View File

@ -12,6 +12,7 @@
; Softswitches ; Softswitches
TEXT = $c050 TEXT = $c050
TEXT2 = $c051
HIRES1 = $c057 HIRES1 = $c057
HIRES2 = $c058 HIRES2 = $c058
@ -33,7 +34,7 @@ SPRITEPTR_H = $1c
MAXSPRITEINDEX = 3 ; Sprite count - 1 MAXSPRITEINDEX = 3 ; Sprite count - 1
MAXPOSX = 127 ; This demo doesn't wanna do 16 bit math MAXPOSX = 127 ; This demo doesn't wanna do 16 bit math
MAXPOSY = 127 MAXPOSY = 127
MAXLOCALBATCHINDEX = 4 ; Sprites in batch - 1 MAXLOCALBATCHINDEX = 3 ; Sprites in batch - 1
MAXBATCHINDEX = 0 ; Number of batches - 1 MAXBATCHINDEX = 0 ; Number of batches - 1
; Macros ; Macros
@ -76,7 +77,7 @@ main:
jsr VenetianFill jsr VenetianFill
mainLoop: mainLoop:
jsr checkKbd
renderLoop: renderLoop:
@ -99,7 +100,7 @@ renderLoop:
lda (SPRITEPTR_L),y ; 5 lda (SPRITEPTR_L),y ; 5
sta PARAM0 ; 3 sta PARAM0 ; 3
jsr BOXW_MAG ; 6 48 cycles overhead to here jsr SPACESHIP ; 6 48 cycles overhead to here
; Next sprite ; Next sprite
dec spriteNum ; 6 dec spriteNum ; 6
@ -232,33 +233,32 @@ batchContinue:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; delayShort ; checkKbd
; Sleeps for ~1/30th second ; Exits app on a keystroke
; ;
delayShort: checkKbd:
SAVE_AXY ; rts
lda $c000
bpl checkKbdDone
sta $c010
ldy #$06 ; Loop a bit cmp #241 ; 'q' with high bit set
delayShortOuter: bne checkKbdDone
ldx #$ff
delayShortInner:
nop
nop
nop
nop
nop
nop
nop
dex
bne delayShortInner
dey
bne delayShortOuter
RESTORE_AXY jsr EnableText
; pla ; Pull our own frame off the stack...
; pla
; pla
; pla
pla ; ...four local variables + return address...
pla
rts ; ...so we can quit to ProDOS from here
checkKbdDone:
rts rts
spriteNum: spriteNum:
.byte MAXSPRITEINDEX .byte MAXSPRITEINDEX
batchIndex: batchIndex:

BIN
spaceship.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

File diff suppressed because it is too large Load Diff

View File

@ -69,12 +69,31 @@ BLACK_SHIFT0:
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
lda #0
sta (SCRATCH0),y
iny
iny
iny
iny
inx
lda HGRROWS_H1,x
sta SCRATCH1
lda HGRROWS_L,x
sta SCRATCH0
ldy PARAM0
lda DIV7_2,y
tay
lda #0
sta (SCRATCH0),y
iny iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
iny iny
iny iny
iny
inx inx
lda HGRROWS_H1,x lda HGRROWS_H1,x
@ -133,8 +152,6 @@ BLACK_SHIFT0:
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
lda #0
sta (SCRATCH0),y
iny iny
iny iny
iny iny
@ -154,27 +171,6 @@ BLACK_SHIFT0:
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
lda #0
sta (SCRATCH0),y
iny
iny
iny
inx
lda HGRROWS_H1,x
sta SCRATCH1
lda HGRROWS_L,x
sta SCRATCH0
ldy PARAM0
lda DIV7_2,y
tay
lda #0
sta (SCRATCH0),y
iny
iny
lda #0
sta (SCRATCH0),y
iny iny
iny iny
iny iny
@ -201,7 +197,7 @@ BLACK_SHIFT0:
iny iny
RESTORE_AXY RESTORE_AXY
rts ;Cycle count: 497, Optimized 26 rows. rts ;Cycle count: 481, Optimized 28 rows.
@ -239,6 +235,27 @@ BLACK_SHIFT1:
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
lda #0
sta (SCRATCH0),y
iny
iny
iny
iny
inx
lda HGRROWS_H1,x
sta SCRATCH1
lda HGRROWS_L,x
sta SCRATCH0
ldy PARAM0
lda DIV7_2,y
tay
lda #0
sta (SCRATCH0),y
iny
lda #0
sta (SCRATCH0),y
iny iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
@ -349,27 +366,6 @@ BLACK_SHIFT1:
iny iny
iny iny
inx
lda HGRROWS_H1,x
sta SCRATCH1
lda HGRROWS_L,x
sta SCRATCH0
ldy PARAM0
lda DIV7_2,y
tay
lda #0
sta (SCRATCH0),y
iny
lda #0
sta (SCRATCH0),y
iny
lda #0
sta (SCRATCH0),y
iny
iny
iny
RESTORE_AXY RESTORE_AXY
rts ;Cycle count: 497, Optimized 26 rows. rts ;Cycle count: 497, Optimized 26 rows.
@ -406,9 +402,28 @@ BLACK_SHIFT2:
lda DIV7_2,y lda DIV7_2,y
tay tay
iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
lda #0
sta (SCRATCH0),y
iny
iny
iny
inx
lda HGRROWS_H1,x
sta SCRATCH1
lda HGRROWS_L,x
sta SCRATCH0
ldy PARAM0
lda DIV7_2,y
tay
iny
lda #0
sta (SCRATCH0),y
iny iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
@ -488,8 +503,6 @@ BLACK_SHIFT2:
lda DIV7_2,y lda DIV7_2,y
tay tay
lda #0
sta (SCRATCH0),y
iny iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
@ -509,25 +522,6 @@ BLACK_SHIFT2:
lda DIV7_2,y lda DIV7_2,y
tay tay
lda #0
sta (SCRATCH0),y
iny
iny
lda #0
sta (SCRATCH0),y
iny
iny
iny
inx
lda HGRROWS_H1,x
sta SCRATCH1
lda HGRROWS_L,x
sta SCRATCH0
ldy PARAM0
lda DIV7_2,y
tay
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
@ -541,7 +535,7 @@ BLACK_SHIFT2:
iny iny
RESTORE_AXY RESTORE_AXY
rts ;Cycle count: 497, Optimized 26 rows. rts ;Cycle count: 489, Optimized 27 rows.
@ -576,9 +570,28 @@ BLACK_SHIFT3:
lda DIV7_2,y lda DIV7_2,y
tay tay
iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
lda #0
sta (SCRATCH0),y
iny
iny
iny
inx
lda HGRROWS_H1,x
sta SCRATCH1
lda HGRROWS_L,x
sta SCRATCH0
ldy PARAM0
lda DIV7_2,y
tay
iny
lda #0
sta (SCRATCH0),y
iny iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
@ -637,8 +650,6 @@ BLACK_SHIFT3:
lda DIV7_2,y lda DIV7_2,y
tay tay
lda #0
sta (SCRATCH0),y
iny iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
@ -658,8 +669,6 @@ BLACK_SHIFT3:
lda DIV7_2,y lda DIV7_2,y
tay tay
lda #0
sta (SCRATCH0),y
iny iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
@ -679,25 +688,7 @@ BLACK_SHIFT3:
lda DIV7_2,y lda DIV7_2,y
tay tay
lda #0
sta (SCRATCH0),y
iny iny
iny
lda #0
sta (SCRATCH0),y
iny
iny
iny
inx
lda HGRROWS_H1,x
sta SCRATCH1
lda HGRROWS_L,x
sta SCRATCH0
ldy PARAM0
lda DIV7_2,y
tay
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
@ -708,10 +699,9 @@ BLACK_SHIFT3:
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
iny iny
iny
RESTORE_AXY RESTORE_AXY
rts ;Cycle count: 497, Optimized 26 rows. rts ;Cycle count: 481, Optimized 28 rows.
@ -750,11 +740,11 @@ BLACK_SHIFT4:
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
iny iny
iny
inx inx
lda HGRROWS_H1,x lda HGRROWS_H1,x
@ -835,8 +825,6 @@ BLACK_SHIFT4:
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
lda #0
sta (SCRATCH0),y
iny iny
iny iny
@ -853,6 +841,8 @@ BLACK_SHIFT4:
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
lda #0
sta (SCRATCH0),y
iny iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
@ -872,8 +862,6 @@ BLACK_SHIFT4:
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
lda #0
sta (SCRATCH0),y
iny iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
@ -881,7 +869,7 @@ BLACK_SHIFT4:
iny iny
RESTORE_AXY RESTORE_AXY
rts ;Cycle count: 497, Optimized 26 rows. rts ;Cycle count: 489, Optimized 27 rows.
@ -916,11 +904,30 @@ BLACK_SHIFT5:
lda DIV7_2,y lda DIV7_2,y
tay tay
iny
iny iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
iny iny
iny
inx
lda HGRROWS_H1,x
sta SCRATCH1
lda HGRROWS_L,x
sta SCRATCH0
ldy PARAM0
lda DIV7_2,y
tay
iny
lda #0
sta (SCRATCH0),y
iny
lda #0
sta (SCRATCH0),y
iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
@ -1029,29 +1036,8 @@ BLACK_SHIFT5:
iny iny
iny iny
inx
lda HGRROWS_H1,x
sta SCRATCH1
lda HGRROWS_L,x
sta SCRATCH0
ldy PARAM0
lda DIV7_2,y
tay
iny
lda #0
sta (SCRATCH0),y
iny
lda #0
sta (SCRATCH0),y
iny
lda #0
sta (SCRATCH0),y
iny
iny
RESTORE_AXY RESTORE_AXY
rts ;Cycle count: 497, Optimized 26 rows. rts ;Cycle count: 489, Optimized 27 rows.
@ -1086,10 +1072,29 @@ BLACK_SHIFT6:
lda DIV7_2,y lda DIV7_2,y
tay tay
iny
iny iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
iny iny
lda #0
sta (SCRATCH0),y
iny
iny
inx
lda HGRROWS_H1,x
sta SCRATCH1
lda HGRROWS_L,x
sta SCRATCH0
ldy PARAM0
lda DIV7_2,y
tay
iny
iny
lda #0
sta (SCRATCH0),y
iny iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
@ -1148,8 +1153,6 @@ BLACK_SHIFT6:
tay tay
iny iny
lda #0
sta (SCRATCH0),y
iny iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
@ -1169,8 +1172,6 @@ BLACK_SHIFT6:
tay tay
iny iny
lda #0
sta (SCRATCH0),y
iny iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
@ -1189,25 +1190,6 @@ BLACK_SHIFT6:
lda DIV7_2,y lda DIV7_2,y
tay tay
iny
lda #0
sta (SCRATCH0),y
iny
iny
lda #0
sta (SCRATCH0),y
iny
iny
inx
lda HGRROWS_H1,x
sta SCRATCH1
lda HGRROWS_L,x
sta SCRATCH0
ldy PARAM0
lda DIV7_2,y
tay
iny iny
lda #0 lda #0
sta (SCRATCH0),y sta (SCRATCH0),y
@ -1221,7 +1203,7 @@ BLACK_SHIFT6:
iny iny
RESTORE_AXY RESTORE_AXY
rts ;Cycle count: 497, Optimized 26 rows. rts ;Cycle count: 481, Optimized 28 rows.