High/lo fixes, and dithered ground.

This commit is contained in:
Martin Haye 2013-09-09 13:04:31 -07:00
parent 99333da6aa
commit 5bd05308af
2 changed files with 53 additions and 19 deletions

View File

@ -64,8 +64,10 @@ textures = $4000
;--------------------------------- ;---------------------------------
; Main-mem tables and buffers ; Main-mem tables and buffers
decodeTo01 = $A900 decodeTo01 = $A700
decodeTo23 = $AA00 decodeTo01b = $A800
decodeTo23 = $A900
decodeTo23b = $AA00
decodeTo45 = $AB00 decodeTo45 = $AB00
decodeTo56 = $AC00 decodeTo56 = $AC00
decodeTo57 = $AD00 decodeTo57 = $AD00

View File

@ -652,8 +652,8 @@ blitTemplate: ; comments show byte offset
ora decodeTo45 ; 10: pixel 2 ora decodeTo45 ; 10: pixel 2
sta (0),y ; 13: even column sta (0),y ; 13: even column
iny ; 15: prep for odd iny ; 15: prep for odd
lda decodeTo01 ; 16: pixel 4 lda decodeTo01b ; 16: pixel 4
ora decodeTo23 ; 19: pixel 5 ora decodeTo23b ; 19: pixel 5
rol ; 22: recover half of pix 3 rol ; 22: recover half of pix 3
ora decodeTo56 ; 23: pixel 6 - after rol to ensure right hi bit ora decodeTo56 ; 23: pixel 6 - after rol to ensure right hi bit
sta (0),y ; 26: odd column sta (0),y ; 26: odd column
@ -773,19 +773,45 @@ makeClrBlit:
; Clear the blit ; Clear the blit
clearBlit: clearBlit:
lda byteNum
and #2
bne @alt
ldx #BLIT_OFF0 ldx #BLIT_OFF0
jsr @clear2 jsr @clear1
ldx #BLIT_OFF1 ldx #BLIT_OFF1
jsr @clear2 jsr @clear2
ldx #BLIT_OFF2 ldx #BLIT_OFF2
jsr @clear2 jsr @clear1
ldx #BLIT_OFF3 ldx #BLIT_OFF3
jsr @clear2 jsr @clear2
ldx #BLIT_OFF4 ldx #BLIT_OFF4
jsr @clear2 jsr @clear1
ldx #BLIT_OFF5 ldx #BLIT_OFF5
jsr @clear2 jsr @clear2
ldx #BLIT_OFF6 ldx #BLIT_OFF6
jmp @clear1
@alt:
ldx #BLIT_OFF0
jsr @clear2
ldx #BLIT_OFF1
jsr @clear1
ldx #BLIT_OFF2
jsr @clear2
ldx #BLIT_OFF3
jsr @clear1
ldx #BLIT_OFF4
jsr @clear2
ldx #BLIT_OFF5
jsr @clear1
ldx #BLIT_OFF6
jmp @clear2
@clear1:
ldy #GROUND_COLOR_E
lda #SKY_COLOR_E
jsr clrBlitRollO
ldy #GROUND_COLOR_O
lda #SKY_COLOR_O
jmp clrBlitRollE
@clear2: @clear2:
ldy #GROUND_COLOR_E ldy #GROUND_COLOR_E
lda #SKY_COLOR_E lda #SKY_COLOR_E
@ -816,11 +842,19 @@ makeDecodeTbls:
@decodeTo01: @decodeTo01:
ora tmp+1 ora tmp+1
sta decodeTo01,x sta decodeTo01,x
@decodeTo01b: ; put hi bit in bit 6 instead of 7
bpl :+
ora #$40
: sta decodeTo01b,x
@decodeTo23: @decodeTo23:
asl asl
asl asl
ora tmp+1 ora tmp+1
sta decodeTo23,x sta decodeTo23,x
@decodeTo23b: ; put hi bit in bit 6 instead of 7
bpl :+
ora #$40
: sta decodeTo23b,x
@decodeTo45: @decodeTo45:
asl asl
asl asl
@ -1022,17 +1056,17 @@ initMem:
setPlayerPos: setPlayerPos:
.if 1 ; for testing only .if 1 ; for testing only
; X=blah ; X=blah
lda #8 lda #$C
sta playerX+1 sta playerX+1
lda #$2C lda #$F4
sta playerX sta playerX
; Y=blah ; Y=blah
lda #3 lda #8
sta playerY+1 sta playerY+1
lda #$CE lda #$67
sta playerY sta playerY
; direction=blah ; direction=blah
lda #1 lda #$7
sta playerDir sta playerDir
.else .else
; X=1.5 ; X=1.5
@ -1201,10 +1235,7 @@ graphInit:
bit clrText bit clrText
bit setHires bit setHires
.endif .endif
rts
lda #63
sta lineCt
jmp clearBlit
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
; Render one whole frame ; Render one whole frame
@ -1263,7 +1294,10 @@ renderFrame:
pha ; save ray offset pha ; save ray offset
tay ; ray offset where it needs to be tay ; ray offset where it needs to be
jsr castRay ; cast the ray across the map jsr castRay ; cast the ray across the map
jsr drawRay ; and draw it lda pixNum
bne :+
jsr clearBlit ; clear blit on the first pixel
: jsr drawRay ; and draw the ray
.if DEBUG .if DEBUG
DEBUG_STR "Done drawing ray " DEBUG_STR "Done drawing ray "
pla pla
@ -1286,8 +1320,6 @@ renderFrame:
sta setAuxZP sta setAuxZP
jsr blitRoll jsr blitRoll
sta clrAuxZP sta clrAuxZP
DEBUG_STR "Clearing blit."
jsr clearBlit
lda #0 lda #0
sta pixNum sta pixNum
inc byteNum inc byteNum