diff --git a/assets/clouds.png b/assets/clouds.png new file mode 100644 index 0000000..311418f Binary files /dev/null and b/assets/clouds.png differ diff --git a/assets/clouds.prg b/assets/clouds.prg new file mode 100644 index 0000000..0cd92cb Binary files /dev/null and b/assets/clouds.prg differ diff --git a/assets/clouds_sprites.png b/assets/clouds_sprites.png new file mode 100644 index 0000000..121b654 Binary files /dev/null and b/assets/clouds_sprites.png differ diff --git a/assets/clouds_sprites.prg b/assets/clouds_sprites.prg new file mode 100644 index 0000000..c651a6b Binary files /dev/null and b/assets/clouds_sprites.prg differ diff --git a/loader/samples/minexample/Makefile b/loader/samples/minexample/Makefile index a82fee3..34d520d 100644 --- a/loader/samples/minexample/Makefile +++ b/loader/samples/minexample/Makefile @@ -138,7 +138,8 @@ ZX0PRGS = \ falling_star.zx0.prg \ lilia.zx0.prg \ lilia_hero.zx0.prg \ - island.zx0.prg + island.zx0.prg \ + clouds.zx0.prg LZPRGS = \ island_map.lz.prg @@ -189,6 +190,7 @@ $(DISKIMAGE): $(ASSEMBLE) $(CC1541) $(ZX0PRGS) $(LZPRGS) -f "lilhero" -w lilia_hero.zx0.prg \ -f "island" -w island.zx0.prg \ -f "islandmap" -w island_map.lz.prg \ + -f "clouds" -w clouds.zx0.prg \ $@ diff --git a/loader/samples/minexample/clouds.bin b/loader/samples/minexample/clouds.bin new file mode 100644 index 0000000..81495c1 Binary files /dev/null and b/loader/samples/minexample/clouds.bin differ diff --git a/loader/samples/minexample/minexample.s b/loader/samples/minexample/minexample.s index 16bd582..50354a3 100644 --- a/loader/samples/minexample/minexample.s +++ b/loader/samples/minexample/minexample.s @@ -659,10 +659,11 @@ part_9: @finish: lda #0 sta timer_mode + sta $d015 ; TODO is there a delay here -part_10: - jmp * + ; we run out of space before the fixed location vector return now + jmp part_10 drawrow: ldy #0 @@ -810,13 +811,15 @@ init_2x: lda #$00 sta $d012 +position_2x_to_display: + lda #51 +position_2x: : bit $d011 bpl :- : bit $d011 bmi :- - lda #51 : cmp $d012 bne :- @@ -1259,18 +1262,19 @@ irq_badguy: pla rti -badguy: .byte "badguy",0 -fontname: .byte "font",0 -sidname: .byte "sid", 0 -introname: .byte "intrbmp", 0 -towername: .byte "tower", 0 -towerbeamname: .byte "towerbm", 0 -fieldname: .byte "field", 0 -fallingstarname: .byte "fallstar", 0 -lilianame: .byte "lilia", 0 -liliaheroname: .byte "lilhero", 0 -islandname: .byte "island", 0 -islandmapname: .byte "islandmap", 0 +badguy: .byte "badguy",0 +fontname: .byte "font",0 +sidname: .byte "sid", 0 +introname: .byte "intrbmp", 0 +towername: .byte "tower", 0 +towerbeamname: .byte "towerbm", 0 +fieldname: .byte "field", 0 +fallingstarname: .byte "fallstar", 0 +lilianame: .byte "lilia", 0 +liliaheroname: .byte "lilhero", 0 +islandname: .byte "island", 0 +islandmapname: .byte "islandmap", 0 +cloudsname: .byte "clouds", 0 darmtower_txt: @@ -1429,6 +1433,107 @@ load_8000_zx02: pla jmp zx02 +part_10: + ; the sprite data is embedded into first few bitmap pixels + ; which are hidden by black border attributes +@y = $60 + ldx #cloudsname + jsr load_8000_zx02_2000 + jsr init_bmp + ldx #0 + stx $d010 + stx $d017 + stx $d01d + stx $d025 + stx frame + dex + stx $d01b + stx $d01c + lda #11 + sta $d026 + lda #@y+50 + jsr position_2x + ; draw top half +@loop: + bit $d011 + bpl @loop + ldx #0 + ldy #0 + lda frame + cmp #200 ; TODO + bcc :+ + jmp @finish +: + adc @sprxs,x + sta $d000,y + sta temp + lda @sprys,x + sta $d001,y + txa + ora #$80 + sta $7f8,x + lda @sprcols,x + sta $d027,x + lda temp + iny + iny + inx + cpx #8 + bcc :- + lda #$ff + sta $d015 + + ; draw bottom half +: + bit $d011 + bmi :- + lda #@y+37 +: + cmp $d012 + bcs :- + + ldx #0 + ldy #0 + lda frame + clc +: + adc @sprxs+8,x + sta $d000,y + sta temp + lda @sprys+8,x + sta $d001,y + txa + ora #$88 + sta $7f8,x + lda @sprcols+8,x + sta $d027,x + lda temp + iny + iny + inx + cpx #6 + nop + bcc :- + + inc frame + jmp @loop + +@sprxs: + .byte 200, <-24, 24, 24, <-64, 24, 24, 24 + .byte 200-40, 24, 24, 24, <-44, 24 + +@sprys: + .byte @y-8, @y, @y, @y, @y+21, @y+21, @y+21, @y+21 + .byte @y+42, @y+42, @y+42, @y+42, @y+63, @y+63 + +@sprcols: + .byte 2, 5, 5, 5, 14, 14, 14, 6 + .byte 2, 2, 2, 9, 2, 2 + +@finish: + jmp * + clear_2bufs: ldy #$44 .byte $2c ; skip next instruction