Can now cycle through sky and ground colors.

This commit is contained in:
Martin Haye 2014-07-06 17:04:26 -07:00
parent 655fe7946f
commit af0c26944f
2 changed files with 67 additions and 64 deletions

View File

@ -99,6 +99,42 @@ word = $0018, $FFC5
word = $002D, $FFD3
word = $003B, $FFE8
byte skyGndTbl1[] = $00 ; lo-bit black
byte = $00 ; lo-bit black
byte = $00 ; lo-bit black
byte = $02 ; violet
byte = $08 ; green
byte = $0A ; lo-bit white
byte = $0A ; lo-bit white
byte = $0A ; lo-bit white
byte = $20 ; hi-bit black
byte = $20 ; hi-bit black
byte = $20 ; hi-bit black
byte = $22 ; blue
byte = $28 ; orange
byte = $2A ; hi-bit white
byte = $2A ; hi-bit white
byte = $2A ; hi-bit white
byte skyGndTbl2[] = $00 ; lo-bit black
byte = $02 ; violet
byte = $08 ; green
byte = $02 ; violet
byte = $08 ; green
byte = $02 ; violet
byte = $08 ; green
byte = $0A ; lo-bit white
byte = $20 ; hi-bit black
byte = $22 ; blue
byte = $28 ; orange
byte = $22 ; blue
byte = $28 ; orange
byte = $22 ; blue
byte = $28 ; orange
byte = $2A ; hi-bit white
word skyNum = 0
word groundNum = 0
;==================================================================================================
; Definitions used by assembly code
asm __defs
@ -252,6 +288,19 @@ asm isBlocked
rts
end
asm setColor
txa
pha
bit setROM
lda evalStkL,x
ldy evalStkH,x
jsr $6009
bit setLcRW+lcBank2
pla
tax
rts
end
asm goMon
bit setROM
jmp $FF69
@ -373,6 +422,18 @@ def nextMap()
initMap()
end
def nextSky()
skyNum = (skyNum + 1) & $F
setColor(0<<8 | skyGndTbl1[skyNum])
setColor(1<<8 | skyGndTbl2[skyNum])
end
def nextGround()
groundNum = (groundNum + 1) & $F
setColor(2<<8 | skyGndTbl1[groundNum])
setColor(3<<8 | skyGndTbl2[groundNum])
end
def kbdLoop()
word key, func
while TRUE
@ -418,6 +479,9 @@ initCmd('.', @strafeRight)
initCmd('N', @nextMap)
initCmd('Y', @nextSky)
initCmd('G', @nextGround)
initMap()
; Main keyboard loop

View File

@ -12,6 +12,7 @@ start:
jmp initMap
jmp renderFrame
jmp getMapCell
jmp setColor
; Conditional assembly flags
DOUBLE_BUFFER = 1 ; whether to double-buffer
@ -61,40 +62,6 @@ mapNameLen: !byte 0 ; length of map name
nMapSprites: !byte 0 ; number of sprite entries on map to fix up
nextLink: !byte 0 ; next link to allocate
; Sky / ground colors
skyGndTbl1: !byte $00 ; lo-bit black
!byte $00 ; lo-bit black
!byte $00 ; lo-bit black
!byte $02 ; violet
!byte $08 ; green
!byte $0A ; lo-bit white
!byte $0A ; lo-bit white
!byte $0A ; lo-bit white
!byte $20 ; hi-bit black
!byte $20 ; hi-bit black
!byte $20 ; hi-bit black
!byte $22 ; blue
!byte $28 ; orange
!byte $2A ; hi-bit white
!byte $2A ; hi-bit white
!byte $2A ; hi-bit white
skyGndTbl2: !byte $00 ; lo-bit black
!byte $02 ; violet
!byte $08 ; green
!byte $02 ; violet
!byte $08 ; green
!byte $02 ; violet
!byte $08 ; green
!byte $0A ; lo-bit white
!byte $20 ; hi-bit black
!byte $22 ; blue
!byte $28 ; orange
!byte $22 ; blue
!byte $28 ; orange
!byte $22 ; blue
!byte $28 ; orange
!byte $2A ; hi-bit white
skyColorEven: !byte $20
skyColorOdd: !byte $22
gndColorEven: !byte $20
@ -1850,36 +1817,8 @@ copyScreen: !zone
rts
;-------------------------------------------------------------------------------
setGndColor: !zone
jsr readKbdColor
bcs +
sta gndColorEven
stx gndColorOdd
+ rts
setSkyColor: !zone
jsr readKbdColor
bcs +
sta skyColorEven
stx skyColorOdd
+ rts
readKbdColor: !zone
jsr rdkey
sec
sbc #'0'
bcc .bad
cmp #8
bcs .bad
bit opnApple
bpl +
ora #8
+ tay
ldx skyGndTbl1,y
lda skyGndTbl2,y
rts
.bad: jsr bell
sec
setColor: !zone
sta skyColorEven,y
rts
;-------------------------------------------------------------------------------