lemm: move some routines into loader

This commit is contained in:
Vince Weaver 2022-03-16 23:40:34 -04:00
parent 90815dd181
commit 0cdc01d4d2
6 changed files with 142 additions and 58 deletions

View File

@ -40,9 +40,17 @@ qboot_sector.o: qboot_sector.s qboot_stage2.s
QLOAD: qload.o
ld65 -o QLOAD qload.o -C $(LINKER_SCRIPTS)/apple2_1200.inc
qload.o: qload.s qboot.inc
qload.o: qload.s qboot.inc \
audio.s decompress_fast_v2.s gr_offsets.s
ca65 -o qload.o qload.s -l qload.lst
###
qload.inc: generate_common QLOAD
./generate_common -a 0x1200 -s play_audio qload.lst > qload.inc
./generate_common -a 0x1200 -s decompress_lzsa2_fast qload.lst >> qload.inc
./generate_common -a 0x1200 -s getsrc_smc qload.lst >> qload.inc
###
@ -64,7 +72,7 @@ lemm_test.o: lemm_test.s zp.inc hardware.inc \
LEMM: lemm.o
ld65 -o LEMM lemm.o -C ../../linker_scripts/apple2_6000.inc
lemm.o: lemm.s zp.inc hardware.inc \
lemm.o: lemm.s zp.inc hardware.inc qload.inc \
graphics/graphics_test.inc graphics/sprites.inc \
intro_level1.s update_time.s hgr_sprite.s draw_flames.s \
draw_door.s move_lemming.s draw_lemming.s \
@ -75,6 +83,15 @@ lemm.o: lemm.s zp.inc hardware.inc \
ca65 -o lemm.o lemm.s -l lemm.lst
####
generate_common: generate_common.o
$(CC) $(LFLAGS) -o generate_common generate_common.o
generate_common.o: generate_common.c
$(CC) $(CFLAGS) -c generate_common.c
####
graphics/graphics_test.inc:

1
games/lemm/NOTES Normal file
View File

@ -0,0 +1 @@
LEMM: 23782 (original v0.01)

View File

@ -5,3 +5,6 @@
+ fill in some of the ground so we don't get stuck when digging
+ Update credits?
+ "Out" counter is only printed to page1 so gets erased by cursor
+ Level2
+ Falling too far and you go splat
+ Have loadable levels

View File

@ -0,0 +1,77 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
static FILE *fff;
static void find_address(char *symbol_name, int routine_offset) {
unsigned int addr=0;
char string[BUFSIZ],*result;
char temp_name[BUFSIZ];
strncpy(temp_name,symbol_name,BUFSIZ);
strncat(temp_name,":",2);
while(1) {
result=fgets(string,BUFSIZ,fff);
if (result==NULL) {
fprintf(stderr,"Error: %s not found!\n",symbol_name);
exit(-1);
}
result=strstr(string,temp_name);
if (result!=NULL) {
string[6]=0;
sscanf(string,"%x",&addr);
break;
}
}
printf("%s\t=$%04x\n",symbol_name,addr+routine_offset);
}
int main(int argc, char **argv) {
int c;
char *filename;
char symbol[BUFSIZ];
int routine_offset=0xd000;
while ( (c=getopt(argc, argv, "a:s:") ) != -1) {
switch(c) {
case 'a':
routine_offset=strtol(optarg, NULL, 0);
break;
case 's':
strncpy(symbol,optarg,BUFSIZ-1);
break;
default:
fprintf(stderr,"Unknown option %c\n",c);
exit(-1);
break;
}
}
filename=strdup(argv[optind]);
fff=fopen(filename,"r");
if (fff==NULL) {
fprintf(stderr,"ERROR! could not open %s\n",filename);
return -1;
}
find_address(symbol,routine_offset);
fclose(fff);
return 0;
}

View File

@ -5,6 +5,7 @@
; Zero Page
.include "zp.inc"
.include "hardware.inc"
.include "qload.inc"
lemm_test_start:
@ -288,7 +289,7 @@ load_song_chunk_good:
;==========================
.include "gr_offsets.s"
.include "decompress_fast_v2.s"
; .include "decompress_fast_v2.s"
.include "wait_keypress.s"
@ -324,7 +325,7 @@ load_song_chunk_good:
.include "update_menu.s"
.include "wait_a_bit.s"
.include "title.s"
.include "audio.s"
; .include "audio.s"
.include "letsgo.s"
.include "particle_hgr.s"
.include "wait.s"

View File

@ -180,70 +180,55 @@ error_string:
.endif
which_disk_array:
.byte 1,1,3,3 ; MIST_TITLE,MIST,MECHE,SELENA
.byte 1,1,3,2 ; OCTAGON,VIEWER,STONEY,CHANNEL
.byte 2,1,2,2 ; CABIN,DENTIST,ARBOR,NIBEL
.byte 1,1,1,3 ; SHIP,GENERATOR,D'NI,SUB
.byte 1 ; TEXT_TITLE
.byte 1,1,1,1,1 ; SAVE1,SAVE2,SAVE3,SAVE4,SAVE5
.byte $f ; FIRST_SECTOR
.byte 1,1,3,3 ; LEMM
.byte 1,1,3,2 ;
.byte 2,1,2,2 ;
.byte 1,1,1,3 ;
.byte 1 ;
.byte 1,1,1,1,1 ;
.byte $f ;
load_address_array:
.byte $60,$20,$20,$20 ; MIST_TITLE,MIST,MECHE,SELENA
.byte $20,$20,$20,$20 ; OCTAGON,VIEWER,STONEY,CHANNEL
.byte $20,$20,$20,$20 ; CABIN,DENTIST,ARBOR,NIBEL
.byte $20,$20,$20,$20 ; SHIP,GENERATOR,D'NI,SUB
.byte $08 ; TEXT_TITLE
.byte $0E,$0E,$0E,$0E
.byte $0E ; SAVE1,SAVE2,SAVE3,SAVE4,SAVE5
.byte $0C ; FIRST_SECTOR
.byte $60,$20,$20,$20 ; LEMM
.byte $20,$20,$20,$20 ;
.byte $20,$20,$20,$20 ;
.byte $20,$20,$20,$20 ;
.byte $08 ;
.byte $0E,$0E,$0E,$0E ;
.byte $0E ;
.byte $0C ;
track_array:
.byte 3, 8, 1,21 ; MIST_TITLE,MIST,MECHE,SELENA
.byte 18,31,11, 1 ; OCTAGON,VIEWER,STONEY,CHANNEL
.byte 27,26,10,20 ; CABIN,DENTIST,ARBOR,NIBEL
.byte 30,32,28,30 ; SHIP,GENERATOR,D'NI,SUB
.byte 0 ; TEXT_TITLE
.byte 0, 0, 0, 0, 0 ; SAVE1,SAVE2,SAVE3,SAVE4,SAVE5
.byte 0 ; FIRST_SECTOR
.byte 3, 8, 1,21 ; LEMM
.byte 18,31,11, 1 ;
.byte 27,26,10,20 ;
.byte 30,32,28,30 ;
.byte 0 ;
.byte 0, 0, 0, 0, 0 ;
.byte 0 ;
sector_array:
.byte 0, 0, 0, 0 ; MIST_TITLE,MIST,MECHE,SELENA
.byte 0, 8, 0, 0 ; OCTAGON,VIEWER,STONEY,CHANNEL
.byte 0, 0, 0, 0 ; CABIN,DENTIST,ARBOR,NIBEL
.byte 0,13, 0, 1 ; SHIP,GENERATOR,D'NI,SUB
.byte 6 ; TEXT_TITLE
.byte 11,12,13,14,15 ; SAVE1,SAVE2,SAVE3,SAVE4,SAVE5
.byte 0 ; FIRST_SECTOR
.byte 0, 0, 0, 0 ; LEMM
.byte 0, 8, 0, 0 ;
.byte 0, 0, 0, 0 ;
.byte 0,13, 0, 1 ;
.byte 6 ;
.byte 11,12,13,14,15 ;
.byte 0 ;
length_array:
.byte 96,159,157,145 ; MIST_TITLE,MIST,MECHE,SELENA
.byte 128, 20,158,135 ; OCTAGON,VIEWER,STONEY,CHANNEL
.byte 61, 31,159,109 ; CABIN,DENTIST,ARBOR,NIBEL
.byte 20, 33, 27, 78 ; SHIP,GENERATOR,D'NI,SUB
.byte 3 ; TEXT_TITLE
.byte 1,1,1,1,1 ; SAVE1,SAVE2,SAVE3,SAVE4,SAVE5
.byte 1 ; FIRST_SECTOR
.byte 96,159,157,145 ; LEMM
.byte 128, 20,158,135 ;
.byte 61, 31,159,109 ;
.byte 20, 33, 27, 78 ;
.byte 3 ;
.byte 1,1,1,1,1 ;
.byte 1 ;
; .include "audio.s"
; .include "linking_noise.s"
; .include "decompress_fast_v2.s"
; .include "draw_pointer.s"
; .include "end_level.s"
; .include "gr_copy.s"
; .include "gr_fast_clear.s"
; .include "gr_offsets.s"
; .include "gr_pageflip.s"
; .include "gr_putsprite_crop.s"
; .include "keyboard.s"
; .include "text_print.s"
; .include "loadstore.s"
; .include "joystick.s"
.include "audio.s"
.include "decompress_fast_v2.s"
.include "gr_offsets.s"
; .include "page_sprites.inc"
; .include "common_sprites.inc"
; .include "qkumba_popwr.s"
qload_end: