diff --git a/loader/samples/minexample/minexample.s b/loader/samples/minexample/minexample.s index e109807..f52b617 100644 --- a/loader/samples/minexample/minexample.s +++ b/loader/samples/minexample/minexample.s @@ -164,11 +164,11 @@ code_start: cli - ;lda #64 - ;sta frame_delay - ;jsr wait_loop + lda #64 + sta frame_delay + jsr wait_loop - ; jsr intro + jsr intro lda #$0b sta $d011 @@ -200,7 +200,6 @@ code_start: jsr init_2x lda #$0b sta $d011 - jmp part_9 ; TEMP jsr clr_txt ldx #skyscrname + lda #$70 + jsr load_8000_zx02 + ldx #skyscrmapname + jsr loadraw + ldx #0 + ldy #$90 + jsr LZ_init_decomp + + lda #0 + sta $d011 + jsr clear_2bufs ; set up sprites to cover scrolling lda #$ff @@ -532,7 +553,7 @@ part_9: ldx #7 : lda #$80 - sta $0ff8,x + sta $07f8,x lda #0 sta $63f8,x sta $d027,x @@ -547,32 +568,11 @@ part_9: stx $d01c stx frame - ldx #skyscrname - lda #$70 - jsr load_8000_zx02 - ldx #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 + lda #$18 sta $d018 - lda #<((17+4)*40+$c08) + lda #<((17+4)*40+$408) sta text_ptr - lda #>((17+4)*40+$c08) + lda #>((17+4)*40+$408) sta text_ptr+1 ldx #16 : @@ -589,7 +589,7 @@ part_9: sta text_ptr+1 sta scr_ptr+1 ; carry is always set here - adc #$d8-$0c-1 + adc #$d8-$04-1 sta cram_ptr+1 adc #<(($20>>3)-$d8) asl bmp_ptr @@ -613,12 +613,18 @@ part_9: bpl :- lda #$38 sta $d011 + lda #$18 + sta $d016 lda #3 sta timer_mode @loop: lda #0 sta vbl lda frame + cmp #$e0 ; TODO + bcc :+ + jmp @finish +: and #1 tax jsr copybuf @@ -640,7 +646,7 @@ part_9: inc frame lda frame lsr a - lda #$38 + lda #$18 ldx #3 bcc :+ lda #$80 @@ -649,7 +655,13 @@ part_9: sta $d018 stx $dd00 jmp @loop + @finish: + lda #0 + sta timer_mode + ; TODO is there a delay here + +part_10: jmp * drawrow: @@ -1417,6 +1429,31 @@ load_8000_zx02: pla 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: lda @bsrclo,x sta bmp_addr @@ -1483,14 +1520,14 @@ copybuf: bne @loop rts -@bsrclo: .lobytes (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 -@bdsthi: .hibytes (16+4)*320+$4040, (16+4)*320+$2040 -@tsrclo: .lobytes (15+4)*40+$0c08, (15+4)*40+$6008 -@tsrchi: .hibytes (15+4)*40+$0c08, (15+4)*40+$6008 -@tdstlo: .lobytes (16+4)*40+$6008, (16+4)*40+$0c08 -@tdsthi: .hibytes (16+4)*40+$6008, (16+4)*40+$0c08 +@bsrclo: .lobytes (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 +@bdsthi: .hibytes (16+4)*320+$4040, (16+4)*320+$2040 +@tsrclo: .lobytes (15+4)*40+$0408, (15+4)*40+$6008 +@tsrchi: .hibytes (15+4)*40+$0408, (15+4)*40+$6008 +@tdstlo: .lobytes (16+4)*40+$6008, (16+4)*40+$0408 +@tdsthi: .hibytes (16+4)*40+$6008, (16+4)*40+$0408 story_writ: .res 11, ' '