Clear the screen and move the screen location

This commit is contained in:
Natt Akuma 2025-11-24 16:55:11 +07:00
parent 4bf8e30636
commit a640d58d08

View file

@ -164,11 +164,11 @@ code_start:
cli cli
;lda #64 lda #64
;sta frame_delay sta frame_delay
;jsr wait_loop jsr wait_loop
; jsr intro jsr intro
lda #$0b lda #$0b
sta $d011 sta $d011
@ -200,7 +200,6 @@ code_start:
jsr init_2x jsr init_2x
lda #$0b lda #$0b
sta $d011 sta $d011
jmp part_9 ; TEMP
jsr clr_txt jsr clr_txt
ldx #<story_writ ldx #<story_writ
@ -506,7 +505,29 @@ code_start:
beq :- beq :-
part_9: part_9:
jsr init_bmp ; $0400-$07ff buffer 0 tilemap
; $2000-$3fff buffer 0 bitmap
; $4000-$5fff buffer 1 bitmap
; $6000-$63ff buffer 1 tilemap
; $6400-$6417 next buffer CRAM
; $7000-$77ff tileset bitmap
; $7800-$78ff tileset tile colors
; $7900-$79ff tileset CRAM colors
; $9000- compressed tilemap
ldx #<skyscrname
ldy #>skyscrname
lda #$70
jsr load_8000_zx02
ldx #<skyscrmapname
ldy #>skyscrmapname
jsr loadraw
ldx #0
ldy #$90
jsr LZ_init_decomp
lda #0
sta $d011
jsr clear_2bufs
; set up sprites to cover scrolling ; set up sprites to cover scrolling
lda #$ff lda #$ff
@ -532,7 +553,7 @@ part_9:
ldx #7 ldx #7
: :
lda #$80 lda #$80
sta $0ff8,x sta $07f8,x
lda #0 lda #0
sta $63f8,x sta $63f8,x
sta $d027,x sta $d027,x
@ -547,32 +568,11 @@ part_9:
stx $d01c stx $d01c
stx frame stx frame
ldx #<skyscrname lda #$18
ldy #>skyscrname
lda #$70
jsr load_8000_zx02
ldx #<skyscrmapname
ldy #>skyscrmapname
jsr loadraw
ldx #0
ldy #$90
jsr LZ_init_decomp
; $0c00-$0fff buffer 0 tilemap
; $2000-$3fff buffer 0 bitmap
; $4000-$5fff buffer 1 bitmap
; $6000-$63ff buffer 1 tilemap
; $6400-$6417 next buffer CRAM
; $7000-$77ff tileset bitmap
; $7800-$78ff tileset tile colors
; $7900-$79ff tileset CRAM colors
; $9000- compressed tilemap
lda #$38
sta $d018 sta $d018
lda #<((17+4)*40+$c08) lda #<((17+4)*40+$408)
sta text_ptr sta text_ptr
lda #>((17+4)*40+$c08) lda #>((17+4)*40+$408)
sta text_ptr+1 sta text_ptr+1
ldx #16 ldx #16
: :
@ -589,7 +589,7 @@ part_9:
sta text_ptr+1 sta text_ptr+1
sta scr_ptr+1 sta scr_ptr+1
; carry is always set here ; carry is always set here
adc #$d8-$0c-1 adc #$d8-$04-1
sta cram_ptr+1 sta cram_ptr+1
adc #<(($20>>3)-$d8) adc #<(($20>>3)-$d8)
asl bmp_ptr asl bmp_ptr
@ -613,12 +613,18 @@ part_9:
bpl :- bpl :-
lda #$38 lda #$38
sta $d011 sta $d011
lda #$18
sta $d016
lda #3 lda #3
sta timer_mode sta timer_mode
@loop: @loop:
lda #0 lda #0
sta vbl sta vbl
lda frame lda frame
cmp #$e0 ; TODO
bcc :+
jmp @finish
:
and #1 and #1
tax tax
jsr copybuf jsr copybuf
@ -640,7 +646,7 @@ part_9:
inc frame inc frame
lda frame lda frame
lsr a lsr a
lda #$38 lda #$18
ldx #3 ldx #3
bcc :+ bcc :+
lda #$80 lda #$80
@ -649,7 +655,13 @@ part_9:
sta $d018 sta $d018
stx $dd00 stx $dd00
jmp @loop jmp @loop
@finish: @finish:
lda #0
sta timer_mode
; TODO is there a delay here
part_10:
jmp * jmp *
drawrow: drawrow:
@ -1417,6 +1429,31 @@ load_8000_zx02:
pla pla
jmp zx02 jmp zx02
clear_2bufs:
ldy #$44
.byte $2c ; skip next instruction
clear_buf:
ldy #$20
lda #$20
sta @dst+2
lda #0
tax
:
sta $400,x
sta $500,x
sta $600,x
sta $700,x
inx
bne :-
@dst:
sta $2000,x
inx
bne @dst
inc @dst+2
dey
bne @dst
rts
copybuf: copybuf:
lda @bsrclo,x lda @bsrclo,x
sta bmp_addr sta bmp_addr
@ -1483,14 +1520,14 @@ copybuf:
bne @loop bne @loop
rts rts
@bsrclo: .lobytes (15+4)*320+$2040, (15+4)*320+$4040 @bsrclo: .lobytes (15+4)*320+$2040, (15+4)*320+$4040
@bsrchi: .hibytes (15+4)*320+$2040, (15+4)*320+$4040 @bsrchi: .hibytes (15+4)*320+$2040, (15+4)*320+$4040
@bdstlo: .lobytes (16+4)*320+$4040, (16+4)*320+$2040 @bdstlo: .lobytes (16+4)*320+$4040, (16+4)*320+$2040
@bdsthi: .hibytes (16+4)*320+$4040, (16+4)*320+$2040 @bdsthi: .hibytes (16+4)*320+$4040, (16+4)*320+$2040
@tsrclo: .lobytes (15+4)*40+$0c08, (15+4)*40+$6008 @tsrclo: .lobytes (15+4)*40+$0408, (15+4)*40+$6008
@tsrchi: .hibytes (15+4)*40+$0c08, (15+4)*40+$6008 @tsrchi: .hibytes (15+4)*40+$0408, (15+4)*40+$6008
@tdstlo: .lobytes (16+4)*40+$6008, (16+4)*40+$0c08 @tdstlo: .lobytes (16+4)*40+$6008, (16+4)*40+$0408
@tdsthi: .hibytes (16+4)*40+$6008, (16+4)*40+$0c08 @tdsthi: .hibytes (16+4)*40+$6008, (16+4)*40+$0408
story_writ: story_writ:
.res 11, ' ' .res 11, ' '