Levels now load… without graphics :/
Posted by GreaseMonkey
August 24th, 2012 10:55 pm
I’m not QUITE up to that stage yet.
What I DO have, however, is a level loader.
lvl_load: movea.l a0,a1 ; blank out entities move.w #(ent_sizeof*rENT_MAX)/4-1,d0 movea.l #rENT_START, a0 clr.l d1 lp_lvl_load_clearents: move.l d1, (a0)+ dbra d0, lp_lvl_load_clearents ; clear USED pointer move.l #0, rENT_USED ; prep entities clr.w d0 move.b (a1)+,d0 addq.l #1,a1 movea.l #rENT_START,a0 lp_lvl_load_entities: ; load X/Y clr.w d1 clr.w d2 move.b (a1)+,d1 move.b (a1)+,d2 lsl.w #5,d1 lsl.w #5,d2 move.w d1,ent_x(a0) move.w d2,ent_y(a0) ; load init pointer and run movea.l (a1)+,a3 jsr (a3) moveq.l #ent_sizeof,d1 ; set "next" pointer move.l rENT_USED,ent_next(a0) move.l a0,rENT_USED ; advance adda.l d1, a0 dbra d0,lp_lvl_load_entities ; set FREE pointer move.l a0, rENT_FREE ; skip header and whatnot clr.l d0 move.b 5(a1),d0 move.b d0,d1 add.b d1,d1 add.b d1,d0 lea $12(a1,d0), a1 ; ok, in this part we need to decode the RLE. ; it's easier than encoding it, trust memove.w #(64*64)-1,d0 movea.l #rLVL_START,a0 move.b #0,d1 ; RLELEN lp_lvl_load_tiles: cmpi.b #$00,d1 beq.b lp_lvl_load_tiles_reload cmpi.b #$80,d1 beq.b lp_lvl_load_tiles_reload bcs.b lp_lvl_load_tiles_literal ; RLE: copy last tile ; someone will kill me for doing it THIS way XD move.b -1(a0),(a0)+ bra.b lpc_lvl_load_tiles lp_lvl_load_tiles_reload: ; load new tile move.b (a1)+,d1 move.b (a1)+,(a0)+ bra.b lps_lvl_load_tiles lp_lvl_load_tiles_literal: ; LITERAL: copy tile move.b (a1)+,(a0)+ bra.b lpc_lvl_load_tiles lpc_lvl_load_tiles: subq #1,d1 lps_lvl_load_tiles: dbra d0, lp_lvl_load_tiles ; draw level jsr lvl_draw rts lvl_draw: ; TODO! rts
Kudos to anyone who can guess the format
Looks like 680xx assembly. Atari? Amiga?
Sega Mega Drive. It *is* 68000 assembly, of course
Now guess the level format.
No idea! Tell me!