mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-12 15:30:55 +00:00
peasant: move music playing to the language card
this was a huge pain also had to remove all calls to the firmware
This commit is contained in:
parent
d0a2b111c0
commit
9ece0ceb8c
@ -69,7 +69,16 @@ wrong_boot2.o: wrong_boot2.s
|
||||
|
||||
###
|
||||
|
||||
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
|
||||
|
||||
####
|
||||
|
||||
music.inc: generate_common MUSIC
|
||||
./generate_common > music.inc
|
||||
|
||||
###
|
||||
|
||||
@ -85,10 +94,11 @@ vid_logo.o: vid_logo.s decompress_fast_v2.s hgr_overlay.s speaker_beeps.s \
|
||||
TITLE: title.o
|
||||
ld65 -o TITLE title.o -C $(LINKER_SCRIPTS)/apple2_6000.inc
|
||||
|
||||
title.o: title.s \
|
||||
title.o: title.s music.inc \
|
||||
graphics_title/title_graphics.inc \
|
||||
graphics_title/altfire.inc \
|
||||
directions.s
|
||||
directions.s \
|
||||
pt3_lib_mockingboard_patch.s
|
||||
ca65 -o title.o title.s -l title.lst
|
||||
|
||||
###
|
||||
@ -96,7 +106,7 @@ title.o: title.s \
|
||||
INTRO: intro.o
|
||||
ld65 -o INTRO intro.o -C $(LINKER_SCRIPTS)/apple2_6000.inc
|
||||
|
||||
intro.o: intro.s zp.inc \
|
||||
intro.o: intro.s zp.inc qload.inc music.inc \
|
||||
graphics/graphics_intro.inc sprites/peasant_sprite.inc \
|
||||
draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \
|
||||
hgr_7x28_sprite.s hgr_1x5_sprite.s hgr_save_restore.s \
|
||||
@ -208,7 +218,7 @@ trogdor.o: trogdor.s zp.inc \
|
||||
ENDING: ending.o
|
||||
ld65 -o ENDING ending.o -C $(LINKER_SCRIPTS)/apple2_6000.inc
|
||||
|
||||
ending.o: ending.s zp.inc \
|
||||
ending.o: ending.s zp.inc qload.inc music.inc \
|
||||
graphics_end/ending_graphics.inc sprites/peasant_sprite.inc \
|
||||
sprites/ending_sprites.inc \
|
||||
draw_box.s hgr_rectangle.s hgr_font.s hgr_input.s \
|
||||
@ -299,5 +309,5 @@ sprites/trogdor_sprites.inc:
|
||||
clean:
|
||||
rm -f *~ *.o *.lst HELLO VID_LOGO TITLE INTRO COPY_CHECK \
|
||||
PEASANT1 PEASANT2 PEASANT3 PEASANT4 \
|
||||
TROGDOR ENDING
|
||||
TROGDOR ENDING MUSIC
|
||||
|
||||
|
@ -21,8 +21,7 @@ copy_check:
|
||||
|
||||
jsr hgr_make_tables
|
||||
|
||||
jsr HGR2 ; Hi-res graphics, no text at bottom
|
||||
; Y=0, A=0 after this called
|
||||
jsr hgr2
|
||||
|
||||
|
||||
trogdor_question:
|
||||
@ -121,6 +120,7 @@ forever:
|
||||
.include "hgr_tables.s"
|
||||
.include "hgr_text_box.s"
|
||||
.include "hgr_partial_save.s"
|
||||
.include "hgr_hgr2.s"
|
||||
|
||||
.include "graphics_copy/copy_graphics.inc"
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
.include "zp.inc"
|
||||
|
||||
.include "qload.inc"
|
||||
.include "music.inc"
|
||||
|
||||
ending:
|
||||
|
||||
@ -15,8 +16,7 @@ ending:
|
||||
|
||||
jsr hgr_make_tables
|
||||
|
||||
jsr HGR2 ; Hi-res graphics, no text at bottom
|
||||
; Y=0, A=0 after this called
|
||||
jsr hgr2
|
||||
|
||||
|
||||
lda #0
|
||||
@ -331,7 +331,7 @@ same_baby:
|
||||
no_draw_baby:
|
||||
|
||||
lda #150
|
||||
jsr WAIT
|
||||
jsr wait
|
||||
|
||||
inc FRAME
|
||||
|
||||
@ -557,9 +557,11 @@ peasant_text:
|
||||
|
||||
.include "hgr_14x14_sprite_mask.s"
|
||||
.include "hgr_sprite.s"
|
||||
.include "hgr_hgr2.s"
|
||||
|
||||
.include "score.s"
|
||||
|
||||
.include "wait.s"
|
||||
.include "wait_a_bit.s"
|
||||
|
||||
.include "speaker_beeps.s"
|
||||
|
92
games/peasant/generate_common.c
Normal file
92
games/peasant/generate_common.c
Normal file
@ -0,0 +1,92 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* music */
|
||||
static char filename[]="music.lst";
|
||||
static int routine_offset=0xD000;
|
||||
|
||||
|
||||
static FILE *fff;
|
||||
|
||||
|
||||
static void find_address(char *symbol_name) {
|
||||
|
||||
unsigned int addr=0;
|
||||
char string[BUFSIZ],*result;
|
||||
char temp_name[BUFSIZ];
|
||||
|
||||
sprintf(temp_name,"%s:",symbol_name);
|
||||
|
||||
while(1) {
|
||||
|
||||
result=fgets(string,BUFSIZ,fff);
|
||||
if (result==NULL) break;
|
||||
|
||||
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) {
|
||||
|
||||
fff=fopen(filename,"r");
|
||||
if (fff==NULL) {
|
||||
fprintf(stderr,"ERROR! could not open %s\n",filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf(";=============================\n");
|
||||
printf("; external routines\n");
|
||||
printf("\n");
|
||||
|
||||
// printf("; loader.s\n");
|
||||
// find_address("opendir_filename");
|
||||
// printf("\n");
|
||||
|
||||
// printf("; audio.s\n");
|
||||
// find_address("play_audio");
|
||||
// printf("\n");
|
||||
|
||||
printf(";\n");
|
||||
find_address("pt3_init_song");
|
||||
printf("\n");
|
||||
|
||||
printf(";\n");
|
||||
find_address("mockingboard_init");
|
||||
printf("\n");
|
||||
|
||||
printf(";\n");
|
||||
find_address("reset_ay_both");
|
||||
printf("\n");
|
||||
|
||||
printf(";\n");
|
||||
find_address("clear_ay_both");
|
||||
printf("\n");
|
||||
|
||||
printf(";\n");
|
||||
find_address("mockingboard_setup_interrupt");
|
||||
printf("\n");
|
||||
|
||||
printf(";\n");
|
||||
find_address("mockingboard_disable_interrupt");
|
||||
printf("\n");
|
||||
|
||||
printf(";\n");
|
||||
find_address("done_pt3_irq_handler");
|
||||
printf("\n");
|
||||
|
||||
printf(";\n");
|
||||
find_address("PT3_LOC");
|
||||
printf("\n");
|
||||
|
||||
fclose(fff);
|
||||
|
||||
return 0;
|
||||
}
|
@ -29,10 +29,10 @@ PTRIG = $C070
|
||||
; APPLESOFT BASIC ROUTINES
|
||||
|
||||
;NORMAL = $F273
|
||||
HGR2 = $F3D8
|
||||
;HGR2 = $F3D8
|
||||
;HGR = $F3E2
|
||||
;BKGND0 = $F3F4 ; clear current page to A
|
||||
HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
;HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
HPLOT0 = $F457 ; plot at (Y,X), (A)
|
||||
;COLOR_SHIFT = $F47E
|
||||
;HLINRL = $F530 ; (X,A),(Y)
|
||||
@ -55,7 +55,7 @@ ROM_MACHINEID = $FBB3 ; iigs
|
||||
;BASCALC = $FBC1 ;
|
||||
;VTAB = $FC22 ; VTAB to CV
|
||||
HOME = $FC58 ; Clear the text screen ; qboot
|
||||
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
|
||||
;WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
|
||||
;CROUT1 = $FD8B
|
||||
;SETINV = $FE80 ; INVERSE
|
||||
;SETNORM = $FE84 ; NORMAL
|
||||
|
58
games/peasant/hgr_hgr2.s
Normal file
58
games/peasant/hgr_hgr2.s
Normal file
@ -0,0 +1,58 @@
|
||||
;=======================
|
||||
; HGR2 Clearscreen
|
||||
;=======================
|
||||
; note, using BKGND0 for this takes 0x44198 = 278,936 cycles
|
||||
; unrolled here takes 0x0A501 = 42,241 cycles
|
||||
|
||||
hgr2:
|
||||
bit SET_GR
|
||||
bit HIRES
|
||||
bit PAGE2
|
||||
|
||||
lda #$40
|
||||
sta HGR_PAGE
|
||||
|
||||
lda #$00
|
||||
|
||||
hgr2_clearscreen:
|
||||
|
||||
before:
|
||||
ldy #0
|
||||
hgr_cls_loop:
|
||||
sta $2000,Y
|
||||
sta $2100,Y
|
||||
sta $2200,Y
|
||||
sta $2300,Y
|
||||
sta $2400,Y
|
||||
sta $2500,Y
|
||||
sta $2600,Y
|
||||
sta $2700,Y
|
||||
sta $2800,Y
|
||||
sta $2900,Y
|
||||
sta $2A00,Y
|
||||
sta $2B00,Y
|
||||
sta $2C00,Y
|
||||
sta $2D00,Y
|
||||
sta $2E00,Y
|
||||
sta $2F00,Y
|
||||
sta $3000,Y
|
||||
sta $3100,Y
|
||||
sta $3200,Y
|
||||
sta $3300,Y
|
||||
sta $3400,Y
|
||||
sta $3500,Y
|
||||
sta $3600,Y
|
||||
sta $3700,Y
|
||||
sta $3800,Y
|
||||
sta $3900,Y
|
||||
sta $3A00,Y
|
||||
sta $3B00,Y
|
||||
sta $3C00,Y
|
||||
sta $3D00,Y
|
||||
sta $3E00,Y
|
||||
sta $3F00,Y
|
||||
iny
|
||||
bne hgr_cls_loop
|
||||
|
||||
after:
|
||||
rts
|
@ -50,7 +50,7 @@ hposn_loop:
|
||||
ldy #0
|
||||
ldx #0
|
||||
pha
|
||||
jsr HPOSN ; (Y,X),(A)
|
||||
jsr hposn ; (Y,X),(A)
|
||||
pla
|
||||
tax
|
||||
|
||||
@ -91,3 +91,51 @@ right_masks:
|
||||
.byte $81,$83,$87, $8F,$9F,$BF,$FF
|
||||
|
||||
|
||||
|
||||
|
||||
; from the Apple II firmware
|
||||
hposn:
|
||||
; sta HGR_Y ; save Y and X positions
|
||||
; stx HGR_X
|
||||
; sty HGR_X+1
|
||||
|
||||
pha ; Y pos on stack
|
||||
|
||||
and #$C0 ; calc base addr for Y-pos
|
||||
|
||||
sta GBASL
|
||||
lsr
|
||||
lsr
|
||||
ora GBASL
|
||||
sta GBASL
|
||||
pla
|
||||
|
||||
sta GBASH
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
rol GBASH
|
||||
asl
|
||||
rol GBASH
|
||||
asl
|
||||
ror GBASL
|
||||
lda GBASH
|
||||
|
||||
and #$1F
|
||||
|
||||
ora HGR_PAGE
|
||||
sta GBASH
|
||||
|
||||
; txa
|
||||
; cpy #0
|
||||
; beq xpos_lessthan_256
|
||||
; ldy #35
|
||||
; adc #4
|
||||
;label_1:
|
||||
; iny
|
||||
;xpos_lessthan_256:
|
||||
; sbc #7
|
||||
; bcs label_1
|
||||
|
||||
rts
|
||||
|
||||
|
@ -27,8 +27,6 @@ interrupt_handler:
|
||||
tya
|
||||
pha ; save Y
|
||||
|
||||
|
||||
|
||||
; inc $0404 ; debug (flashes char onscreen)
|
||||
|
||||
|
||||
@ -67,3 +65,5 @@ interrupt_smc:
|
||||
; typical
|
||||
; ???? cycles
|
||||
|
||||
|
||||
|
||||
|
@ -8,8 +8,7 @@
|
||||
.include "zp.inc"
|
||||
|
||||
.include "qload.inc"
|
||||
|
||||
|
||||
.include "music.inc"
|
||||
|
||||
peasant_quest_intro:
|
||||
|
||||
@ -18,8 +17,7 @@ peasant_quest_intro:
|
||||
|
||||
jsr hgr_make_tables
|
||||
|
||||
jsr HGR2 ; Hi-res graphics, no text at bottom
|
||||
; Y=0, A=0 after this called
|
||||
jsr hgr2
|
||||
|
||||
|
||||
;*******************************
|
||||
@ -174,7 +172,9 @@ escape_handler:
|
||||
.include "hgr_input.s"
|
||||
.include "hgr_tables.s"
|
||||
.include "hgr_text_box.s"
|
||||
.include "hgr_hgr2.s"
|
||||
|
||||
.include "wait.s"
|
||||
.include "wait_a_bit.s"
|
||||
|
||||
.include "graphics/graphics_intro.inc"
|
||||
|
@ -1,14 +1,27 @@
|
||||
; Danger: if you mess with MUSIC you'll have to update these
|
||||
;=============================
|
||||
; external routines
|
||||
|
||||
MUSIC_LOC=$D000
|
||||
pt3_init_song=MUSIC_LOC+$8E8
|
||||
clear_ay_both=MUSIC_LOC+$B71
|
||||
reset_ay_both=MUSIC_LOC+$B2F
|
||||
mockingboard_setup_interrupt=MUSIC_LOC+$B7E
|
||||
mockingboard_disable_interrupt=MUSIC_LOC+$BA6
|
||||
mockingboard_init=MUSIC_LOC+$B20
|
||||
mockingboard_patch=MUSIC_LOC+$BB2
|
||||
mockingboard_detect=MUSIC_LOC+$C5D
|
||||
;
|
||||
pt3_init_song =$d8e9
|
||||
|
||||
PT3_LOC=MUSIC_LOC+$D00
|
||||
;
|
||||
mockingboard_init =$db21
|
||||
|
||||
;
|
||||
reset_ay_both =$db30
|
||||
|
||||
;
|
||||
clear_ay_both =$db72
|
||||
|
||||
;
|
||||
mockingboard_setup_interrupt =$db7f
|
||||
|
||||
;
|
||||
mockingboard_disable_interrupt =$dbb9
|
||||
|
||||
;
|
||||
done_pt3_irq_handler =$dc31
|
||||
|
||||
;
|
||||
PT3_LOC =$dd00
|
||||
|
||||
|
@ -8,6 +8,10 @@
|
||||
;.include "qload.inc"
|
||||
|
||||
music_lib:
|
||||
|
||||
nop ; urgh to keep interrupt_handler from starting at $C4
|
||||
; which broke auto-patcher
|
||||
|
||||
; pt3 player
|
||||
; .include "pt3_lib_detect_model.s"
|
||||
.include "pt3_lib_core.s"
|
||||
|
@ -21,7 +21,7 @@ peasant_quest:
|
||||
|
||||
jsr hgr_make_tables
|
||||
|
||||
jsr HGR2 ; Hi-res graphics, no text at bottom
|
||||
jsr hgr2 ; Hi-res graphics, no text at bottom
|
||||
; Y=0, A=0 after this called
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ game_loop:
|
||||
; delay
|
||||
|
||||
lda #200
|
||||
jsr WAIT
|
||||
jsr wait
|
||||
|
||||
|
||||
jmp game_loop
|
||||
@ -164,6 +164,7 @@ peasant_text:
|
||||
.include "hgr_tables.s"
|
||||
.include "hgr_text_box.s"
|
||||
.include "clear_bottom.s"
|
||||
.include "hgr_hgr2.s"
|
||||
|
||||
.include "gr_copy.s"
|
||||
|
||||
@ -179,6 +180,7 @@ peasant_text:
|
||||
|
||||
.include "keyboard.s"
|
||||
|
||||
.include "wait.s"
|
||||
.include "wait_a_bit.s"
|
||||
|
||||
.include "graphics/graphics_peasant1.inc"
|
||||
|
@ -20,11 +20,7 @@ peasant_quest:
|
||||
|
||||
jsr hgr_make_tables
|
||||
|
||||
jsr HGR2 ; Hi-res graphics, no text at bottom
|
||||
; Y=0, A=0 after this called
|
||||
|
||||
|
||||
|
||||
jsr hgr2
|
||||
|
||||
|
||||
lda #0
|
||||
@ -130,7 +126,7 @@ game_loop:
|
||||
; delay
|
||||
|
||||
lda #200
|
||||
jsr WAIT
|
||||
jsr wait
|
||||
|
||||
|
||||
jmp game_loop
|
||||
@ -169,6 +165,7 @@ peasant_text:
|
||||
.include "hgr_tables.s"
|
||||
.include "hgr_text_box.s"
|
||||
.include "clear_bottom.s"
|
||||
.include "hgr_hgr2.s"
|
||||
|
||||
.include "gr_copy.s"
|
||||
|
||||
@ -181,6 +178,7 @@ peasant_text:
|
||||
|
||||
.include "keyboard.s"
|
||||
|
||||
.include "wait.s"
|
||||
.include "wait_a_bit.s"
|
||||
|
||||
.include "graphics/graphics_peasant2.inc"
|
||||
|
@ -20,9 +20,7 @@ peasant_quest:
|
||||
|
||||
jsr hgr_make_tables
|
||||
|
||||
jsr HGR2 ; Hi-res graphics, no text at bottom
|
||||
; Y=0, A=0 after this called
|
||||
|
||||
jsr hgr2
|
||||
|
||||
|
||||
|
||||
@ -130,8 +128,7 @@ game_loop:
|
||||
; delay
|
||||
|
||||
lda #200
|
||||
jsr WAIT
|
||||
|
||||
jsr wait
|
||||
|
||||
jmp game_loop
|
||||
|
||||
@ -167,6 +164,7 @@ peasant_text:
|
||||
.include "hgr_tables.s"
|
||||
.include "hgr_text_box.s"
|
||||
.include "clear_bottom.s"
|
||||
.include "hgr_hgr2.s"
|
||||
|
||||
.include "gr_copy.s"
|
||||
|
||||
@ -181,6 +179,7 @@ peasant_text:
|
||||
|
||||
.include "keyboard.s"
|
||||
|
||||
.include "wait.s"
|
||||
.include "wait_a_bit.s"
|
||||
|
||||
.include "graphics/graphics_peasant3.inc"
|
||||
|
@ -20,9 +20,7 @@ peasant_quest:
|
||||
|
||||
jsr hgr_make_tables
|
||||
|
||||
jsr HGR2 ; Hi-res graphics, no text at bottom
|
||||
; Y=0, A=0 after this called
|
||||
|
||||
jsr hgr2
|
||||
|
||||
|
||||
|
||||
@ -129,7 +127,7 @@ game_loop:
|
||||
; delay
|
||||
|
||||
lda #200
|
||||
jsr WAIT
|
||||
jsr wait
|
||||
|
||||
|
||||
jmp game_loop
|
||||
@ -169,6 +167,7 @@ peasant_text:
|
||||
.include "hgr_tables.s"
|
||||
.include "hgr_text_box.s"
|
||||
.include "clear_bottom.s"
|
||||
.include "hgr_hgr2.s"
|
||||
|
||||
.include "gr_copy.s"
|
||||
|
||||
@ -184,6 +183,7 @@ peasant_text:
|
||||
|
||||
.include "keyboard.s"
|
||||
|
||||
.include "wait.s"
|
||||
.include "wait_a_bit.s"
|
||||
|
||||
.include "graphics/graphics_peasant4.inc"
|
||||
|
120
games/peasant/pt3_lib_mockingboard_patch.s
Normal file
120
games/peasant/pt3_lib_mockingboard_patch.s
Normal file
@ -0,0 +1,120 @@
|
||||
|
||||
;===================================================================
|
||||
; code to patch mockingboard if not in slot#4
|
||||
;===================================================================
|
||||
; this is the brute force version, we have to patch 39 locations
|
||||
; see further below if you want to try a smaller, more dangerous, patch
|
||||
|
||||
.if 0
|
||||
mockingboard_patch:
|
||||
|
||||
lda MB_ADDR_H
|
||||
|
||||
sta pt3_irq_smc1+2 ; 1
|
||||
|
||||
sta pt3_irq_smc2+2 ; 2
|
||||
sta pt3_irq_smc2+5 ; 3
|
||||
|
||||
sta pt3_irq_smc3+2 ; 4
|
||||
sta pt3_irq_smc3+5 ; 5
|
||||
|
||||
sta pt3_irq_smc4+2 ; 6
|
||||
sta pt3_irq_smc4+5 ; 7
|
||||
|
||||
sta pt3_irq_smc5+2 ; 8
|
||||
sta pt3_irq_smc5+5 ; 9
|
||||
|
||||
sta pt3_irq_smc6+2 ; 10
|
||||
sta pt3_irq_smc6+5 ; 11
|
||||
|
||||
sta pt3_irq_smc7+2 ; 12
|
||||
sta pt3_irq_smc7+5 ; 13
|
||||
|
||||
sta mock_init_smc1+2 ; 14
|
||||
sta mock_init_smc1+5 ; 15
|
||||
|
||||
sta mock_init_smc2+2 ; 16
|
||||
sta mock_init_smc2+5 ; 17
|
||||
|
||||
sta reset_ay_smc1+2 ; 18
|
||||
sta reset_ay_smc2+2 ; 19
|
||||
sta reset_ay_smc3+2 ; 20
|
||||
sta reset_ay_smc4+2 ; 21
|
||||
|
||||
sta write_ay_smc1+2 ; 22
|
||||
sta write_ay_smc1+5 ; 23
|
||||
|
||||
sta write_ay_smc2+2 ; 24
|
||||
sta write_ay_smc2+5 ; 25
|
||||
|
||||
sta write_ay_smc3+2 ; 26
|
||||
sta write_ay_smc3+5 ; 27
|
||||
|
||||
sta write_ay_smc4+2 ; 28
|
||||
sta write_ay_smc4+5 ; 29
|
||||
|
||||
sta write_ay_smc5+2 ; 30
|
||||
sta write_ay_smc5+5 ; 31
|
||||
|
||||
sta write_ay_smc6+2 ; 32
|
||||
sta write_ay_smc6+5 ; 33
|
||||
|
||||
sta setup_irq_smc1+2 ; 34
|
||||
sta setup_irq_smc2+2 ; 35
|
||||
sta setup_irq_smc3+2 ; 36
|
||||
sta setup_irq_smc4+2 ; 37
|
||||
sta setup_irq_smc5+2 ; 38
|
||||
sta setup_irq_smc6+2 ; 39
|
||||
|
||||
rts
|
||||
.endif
|
||||
|
||||
;===================================================================
|
||||
; dangerous code to patch mockingboard if not in slot#4
|
||||
;===================================================================
|
||||
; this code patches any $C4 value to the proper slot# if not slot4
|
||||
; this can be dangerous, it might over-write other important values
|
||||
; that should be $C4
|
||||
|
||||
; safer ways to do this:
|
||||
; only do this if 2 bytes after a LDA/STA/LDX/STX
|
||||
; count total and if not 39 then print error message
|
||||
|
||||
mockingboard_patch:
|
||||
; from mockingboard_init $1BBF
|
||||
; to done_pt3_irq_handler $1D85
|
||||
|
||||
ldx MB_ADDR_H
|
||||
ldy #0
|
||||
|
||||
lda #<mockingboard_init
|
||||
sta MB_ADDR_L
|
||||
lda #>mockingboard_init
|
||||
sta MB_ADDR_H
|
||||
|
||||
mb_patch_loop:
|
||||
lda (MB_ADDR_L),Y
|
||||
cmp #$C4
|
||||
bne mb_patch_nomatch
|
||||
|
||||
txa
|
||||
sta (MB_ADDR_L),Y
|
||||
mb_patch_nomatch:
|
||||
|
||||
; 16-bit increment
|
||||
|
||||
inc MB_ADDR_L
|
||||
bne mb_patch_oflo
|
||||
inc MB_ADDR_H
|
||||
|
||||
mb_patch_oflo:
|
||||
lda MB_ADDR_H
|
||||
cmp #>done_pt3_irq_handler
|
||||
bne mb_patch_loop
|
||||
lda MB_ADDR_L
|
||||
cmp #<done_pt3_irq_handler
|
||||
bne mb_patch_loop
|
||||
|
||||
mb_patch_done:
|
||||
rts
|
||||
|
@ -170,16 +170,20 @@ clear_ay_end:
|
||||
;=============================
|
||||
mockingboard_setup_interrupt:
|
||||
|
||||
.ifdef PT3_ENABLE_APPLE_IIC
|
||||
lda APPLEII_MODEL
|
||||
cmp #'C'
|
||||
bne done_iic_hack
|
||||
|
||||
; for this game with things in language card including
|
||||
; irq handler, always force IIc mode
|
||||
|
||||
;.ifdef PT3_ENABLE_APPLE_IIC
|
||||
; lda APPLEII_MODEL
|
||||
; cmp #'C'
|
||||
; bne done_iic_hack
|
||||
|
||||
; bypass the firmware interrupt handler
|
||||
; should we do this on IIe too? probably faster
|
||||
|
||||
; first we have to copy the ROM to the language card
|
||||
|
||||
.if 0
|
||||
sei ; disable interrupts
|
||||
|
||||
copy_rom_loop:
|
||||
@ -206,7 +210,7 @@ write_rom_loop:
|
||||
inc read_rom_loop+2
|
||||
inc write_rom_loop+5
|
||||
bne copy_rom_loop
|
||||
|
||||
.endif
|
||||
lda #<interrupt_handler
|
||||
sta $fffe
|
||||
lda #>interrupt_handler
|
||||
@ -217,7 +221,7 @@ write_rom_loop:
|
||||
lda #$EA
|
||||
sta interrupt_smc
|
||||
sta interrupt_smc+1
|
||||
.endif
|
||||
;.endif
|
||||
done_iic_hack:
|
||||
|
||||
|
||||
@ -293,124 +297,3 @@ disable_irq_smc2:
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
||||
|
||||
;===================================================================
|
||||
; code to patch mockingboard if not in slot#4
|
||||
;===================================================================
|
||||
; this is the brute force version, we have to patch 39 locations
|
||||
; see further below if you want to try a smaller, more dangerous, patch
|
||||
|
||||
.if 0
|
||||
mockingboard_patch:
|
||||
|
||||
lda MB_ADDR_H
|
||||
|
||||
sta pt3_irq_smc1+2 ; 1
|
||||
|
||||
sta pt3_irq_smc2+2 ; 2
|
||||
sta pt3_irq_smc2+5 ; 3
|
||||
|
||||
sta pt3_irq_smc3+2 ; 4
|
||||
sta pt3_irq_smc3+5 ; 5
|
||||
|
||||
sta pt3_irq_smc4+2 ; 6
|
||||
sta pt3_irq_smc4+5 ; 7
|
||||
|
||||
sta pt3_irq_smc5+2 ; 8
|
||||
sta pt3_irq_smc5+5 ; 9
|
||||
|
||||
sta pt3_irq_smc6+2 ; 10
|
||||
sta pt3_irq_smc6+5 ; 11
|
||||
|
||||
sta pt3_irq_smc7+2 ; 12
|
||||
sta pt3_irq_smc7+5 ; 13
|
||||
|
||||
sta mock_init_smc1+2 ; 14
|
||||
sta mock_init_smc1+5 ; 15
|
||||
|
||||
sta mock_init_smc2+2 ; 16
|
||||
sta mock_init_smc2+5 ; 17
|
||||
|
||||
sta reset_ay_smc1+2 ; 18
|
||||
sta reset_ay_smc2+2 ; 19
|
||||
sta reset_ay_smc3+2 ; 20
|
||||
sta reset_ay_smc4+2 ; 21
|
||||
|
||||
sta write_ay_smc1+2 ; 22
|
||||
sta write_ay_smc1+5 ; 23
|
||||
|
||||
sta write_ay_smc2+2 ; 24
|
||||
sta write_ay_smc2+5 ; 25
|
||||
|
||||
sta write_ay_smc3+2 ; 26
|
||||
sta write_ay_smc3+5 ; 27
|
||||
|
||||
sta write_ay_smc4+2 ; 28
|
||||
sta write_ay_smc4+5 ; 29
|
||||
|
||||
sta write_ay_smc5+2 ; 30
|
||||
sta write_ay_smc5+5 ; 31
|
||||
|
||||
sta write_ay_smc6+2 ; 32
|
||||
sta write_ay_smc6+5 ; 33
|
||||
|
||||
sta setup_irq_smc1+2 ; 34
|
||||
sta setup_irq_smc2+2 ; 35
|
||||
sta setup_irq_smc3+2 ; 36
|
||||
sta setup_irq_smc4+2 ; 37
|
||||
sta setup_irq_smc5+2 ; 38
|
||||
sta setup_irq_smc6+2 ; 39
|
||||
|
||||
rts
|
||||
.endif
|
||||
|
||||
;===================================================================
|
||||
; dangerous code to patch mockingboard if not in slot#4
|
||||
;===================================================================
|
||||
; this code patches any $C4 value to the proper slot# if not slot4
|
||||
; this can be dangerous, it might over-write other important values
|
||||
; that should be $C4
|
||||
|
||||
; safer ways to do this:
|
||||
; only do this if 2 bytes after a LDA/STA/LDX/STX
|
||||
; count total and if not 39 then print error message
|
||||
|
||||
mockingboard_patch:
|
||||
; from mockingboard_init $1BBF
|
||||
; to done_pt3_irq_handler $1D85
|
||||
|
||||
ldx MB_ADDR_H
|
||||
ldy #0
|
||||
|
||||
lda #<mockingboard_init
|
||||
sta MB_ADDR_L
|
||||
lda #>mockingboard_init
|
||||
sta MB_ADDR_H
|
||||
|
||||
mb_patch_loop:
|
||||
lda (MB_ADDR_L),Y
|
||||
cmp #$C4
|
||||
bne mb_patch_nomatch
|
||||
|
||||
txa
|
||||
sta (MB_ADDR_L),Y
|
||||
mb_patch_nomatch:
|
||||
|
||||
inc MB_ADDR_L
|
||||
lda MB_ADDR_L
|
||||
bne mb_patch_oflo
|
||||
inc MB_ADDR_H
|
||||
|
||||
mb_patch_oflo:
|
||||
lda MB_ADDR_H
|
||||
cmp #>done_pt3_irq_handler
|
||||
bne mb_patch_loop
|
||||
lda MB_ADDR_L
|
||||
cmp #<done_pt3_irq_handler
|
||||
bne mb_patch_loop
|
||||
|
||||
mb_patch_done:
|
||||
rts
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
; p86 (dos reference)
|
||||
;
|
||||
|
||||
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
|
||||
;WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
|
||||
|
||||
.org $900
|
||||
|
||||
@ -326,7 +326,7 @@ slotpatch9:
|
||||
ldx #6
|
||||
wait_1s:
|
||||
lda #255
|
||||
jsr WAIT
|
||||
jsr wait
|
||||
dex
|
||||
bne wait_1s
|
||||
|
||||
@ -361,3 +361,4 @@ load_sector:
|
||||
load_length:
|
||||
.byte $00
|
||||
|
||||
.include "wait.s"
|
||||
|
@ -1,14 +1,18 @@
|
||||
; Danger: if you mess with QLOAD you'll have to update these
|
||||
|
||||
QLOAD_LOC=$B00
|
||||
pt3_init_song=QLOAD_LOC+$BF9
|
||||
clear_ay_both=QLOAD_LOC+$E82
|
||||
reset_ay_both=QLOAD_LOC+$E40
|
||||
mockingboard_setup_interrupt=QLOAD_LOC+$E8F
|
||||
mockingboard_disable_interrupt=QLOAD_LOC+$EB7
|
||||
mockingboard_init=QLOAD_LOC+$E31
|
||||
mockingboard_patch=QLOAD_LOC+$F73
|
||||
mockingboard_detect=QLOAD_LOC+$F44
|
||||
|
||||
PT3_LOC=QLOAD_LOC+$1000
|
||||
load_file = QLOAD_LOC+$20
|
||||
|
||||
;pt3_init_song=QLOAD_LOC+$BF9
|
||||
;mockingboard_init=QLOAD_LOC+$E31
|
||||
;reset_ay_both=QLOAD_LOC+$E40
|
||||
;clear_ay_both=QLOAD_LOC+$E82
|
||||
;mockingboard_setup_interrupt=QLOAD_LOC+$E8F
|
||||
;mockingboard_disable_interrupt=QLOAD_LOC+$EC1
|
||||
;interrupt_handler=QLOAD_LOC+$ECD
|
||||
;mockingboard_patch=QLOAD_LOC+$F4E
|
||||
;mockingboard_detect=QLOAD_LOC+$F76
|
||||
|
||||
;PT3_LOC=QLOAD_LOC+$1000
|
||||
|
||||
|
@ -236,20 +236,21 @@ length_array:
|
||||
.include "qkumba_popwr.s"
|
||||
|
||||
; pt3 player
|
||||
.include "pt3_lib_detect_model.s"
|
||||
.include "pt3_lib_core.s"
|
||||
.include "pt3_lib_init.s"
|
||||
.include "pt3_lib_mockingboard_setup.s"
|
||||
.include "interrupt_handler.s"
|
||||
.include "pt3_lib_mockingboard_detect.s"
|
||||
; .include "pt3_lib_detect_model.s"
|
||||
; .include "pt3_lib_core.s"
|
||||
; .include "pt3_lib_init.s"
|
||||
; .include "pt3_lib_mockingboard_setup.s"
|
||||
; .include "interrupt_handler.s"
|
||||
; .include "pt3_lib_mockingboard_patch.s"
|
||||
; .include "pt3_lib_mockingboard_detect.s"
|
||||
|
||||
|
||||
; only load one music track, self modify to make other
|
||||
|
||||
.align $100
|
||||
PT3_LOC:
|
||||
peasant_pt3:
|
||||
.incbin "music/peasant.pt3"
|
||||
;.align $100
|
||||
;PT3_LOC:
|
||||
;peasant_pt3:
|
||||
;.incbin "music/peasant.pt3"
|
||||
|
||||
|
||||
|
||||
|
@ -6,10 +6,10 @@
|
||||
.include "zp.inc"
|
||||
|
||||
.include "qload.inc"
|
||||
.include "music.inc"
|
||||
|
||||
title:
|
||||
jsr HGR2 ; Hi-res graphics, no text at bottom
|
||||
; Y=0, A=0 after this called
|
||||
jsr hgr2
|
||||
|
||||
;=========================
|
||||
; set up hgr lookup tables
|
||||
@ -33,6 +33,27 @@ PT3_ENABLE_APPLE_IIC = 1
|
||||
and #SOUND_MOCKINGBOARD
|
||||
beq mockingboard_notfound
|
||||
|
||||
;==================================
|
||||
; load music into the language card
|
||||
; into $D000 set 2
|
||||
;==================================
|
||||
|
||||
; switch in language card
|
||||
; read/write RAM, $d000 bank 2
|
||||
|
||||
lda $C083
|
||||
lda $C083
|
||||
|
||||
; lda $C081 ; enable ROM
|
||||
; lda $C081 ; enable write
|
||||
|
||||
; actually load it
|
||||
lda #LOAD_MUSIC
|
||||
sta WHICH_LOAD
|
||||
|
||||
jsr load_file
|
||||
|
||||
|
||||
lda #0
|
||||
sta DONE_PLAYING
|
||||
|
||||
@ -48,6 +69,9 @@ PT3_ENABLE_APPLE_IIC = 1
|
||||
jsr mockingboard_init
|
||||
jsr mockingboard_setup_interrupt
|
||||
|
||||
|
||||
zurg:
|
||||
|
||||
;============================
|
||||
; Init the Mockingboard
|
||||
;============================
|
||||
@ -61,6 +85,8 @@ PT3_ENABLE_APPLE_IIC = 1
|
||||
|
||||
jsr pt3_init_song
|
||||
|
||||
|
||||
|
||||
;=======================
|
||||
; start music
|
||||
;=======================
|
||||
@ -70,9 +96,11 @@ PT3_ENABLE_APPLE_IIC = 1
|
||||
mockingboard_notfound:
|
||||
|
||||
|
||||
;************************
|
||||
;=========================
|
||||
;=========================
|
||||
; Title
|
||||
;************************
|
||||
;=========================
|
||||
;=========================
|
||||
|
||||
do_title:
|
||||
|
||||
@ -221,6 +249,11 @@ altfire_good:
|
||||
.include "hgr_font.s"
|
||||
.include "hgr_tables.s"
|
||||
|
||||
.include "hgr_hgr2.s"
|
||||
|
||||
.include "pt3_lib_mockingboard_patch.s"
|
||||
|
||||
.include "graphics_title/title_graphics.inc"
|
||||
|
||||
altfire:
|
||||
.include "graphics_title/altfire.inc"
|
||||
|
@ -17,8 +17,7 @@ trogdor:
|
||||
|
||||
jsr hgr_make_tables
|
||||
|
||||
jsr HGR2 ; Hi-res graphics, no text at bottom
|
||||
; Y=0, A=0 after this called
|
||||
jsr hgr2
|
||||
|
||||
|
||||
lda #0
|
||||
@ -262,7 +261,7 @@ dashing_loop:
|
||||
jsr hgr_draw_sprite
|
||||
|
||||
lda #220
|
||||
jsr WAIT
|
||||
jsr wait
|
||||
|
||||
ldy BABY_COUNT
|
||||
cpy #7
|
||||
@ -333,11 +332,13 @@ peasant_text:
|
||||
.include "hgr_text_box.s"
|
||||
.include "clear_bottom.s"
|
||||
.include "gr_offsets.s"
|
||||
.include "hgr_hgr2.s"
|
||||
|
||||
.include "gr_copy.s"
|
||||
|
||||
.include "score.s"
|
||||
|
||||
.include "wait.s"
|
||||
.include "wait_a_bit.s"
|
||||
|
||||
.include "version.inc"
|
||||
|
@ -155,10 +155,19 @@ mockingboard_found:
|
||||
|
||||
sta $7d0+31 ; 23,31
|
||||
|
||||
; NOTE: in this game we need both language card && mockingboard
|
||||
; to enable mockingboard music
|
||||
|
||||
lda SOUND_STATUS
|
||||
and #SOUND_IN_LC
|
||||
beq dont_enable_mc
|
||||
|
||||
lda SOUND_STATUS
|
||||
ora #SOUND_MOCKINGBOARD
|
||||
sta SOUND_STATUS
|
||||
|
||||
dont_enable_mc:
|
||||
|
||||
;===========================
|
||||
; detect SSI-263 too
|
||||
;===========================
|
||||
@ -185,9 +194,7 @@ mockingboard_notfound:
|
||||
jsr wait_a_bit
|
||||
|
||||
videlectrix_intro:
|
||||
jsr HGR2 ; Hi-res graphics, no text at bottom
|
||||
; Y=0, A=0 after this called
|
||||
; HGR_PAGE=$40
|
||||
jsr hgr2 ; HGR_PAGE=$40
|
||||
|
||||
lda #$20
|
||||
sta DISP_PAGE
|
||||
@ -420,6 +427,10 @@ delays:
|
||||
.include "ssi263.inc"
|
||||
.include "ssi263_detect.s"
|
||||
|
||||
.include "wait.s"
|
||||
|
||||
.include "hgr_hgr2.s"
|
||||
|
||||
.include "graphics_vid/vid_graphics.inc"
|
||||
|
||||
|
||||
|
14
games/peasant/wait.s
Normal file
14
games/peasant/wait.s
Normal file
@ -0,0 +1,14 @@
|
||||
; copy of ROM wait
|
||||
; because we might disable ROM
|
||||
|
||||
wait:
|
||||
sec
|
||||
wait2:
|
||||
pha
|
||||
wait3:
|
||||
sbc #$01
|
||||
bne wait3
|
||||
pla
|
||||
sbc #$01
|
||||
bne wait2
|
||||
rts
|
@ -10,7 +10,7 @@ wait_a_bit:
|
||||
|
||||
keyloop:
|
||||
lda #200 ; delay a bit
|
||||
jsr WAIT
|
||||
jsr wait
|
||||
|
||||
lda KEYPRESS
|
||||
bmi done_keyloop
|
||||
|
@ -214,6 +214,7 @@ LOAD_PEASANT3 = 6
|
||||
LOAD_PEASANT4 = 7
|
||||
LOAD_TROGDOR = 8
|
||||
LOAD_ENDING = 9
|
||||
LOAD_MUSIC = 10
|
||||
|
||||
VGI_RCOLOR = P0
|
||||
VGI_RX1 = P1
|
||||
|
Loading…
x
Reference in New Issue
Block a user