mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-05-28 17:41:29 +00:00
glados: start work on some assembly code
having trouble figuring out the cycle counts on the sound routine
This commit is contained in:
parent
af33a4874f
commit
18a66c1427
|
@ -36,9 +36,13 @@ SOUND_TEST.BAS: sound_test.bas
|
|||
|
||||
$(TXT2BAS) < sound_test.bas > SOUND_TEST.BAS
|
||||
|
||||
asm/STILL_ALIVE.BIN: asm/still_alive.s
|
||||
cd asm && make
|
||||
|
||||
glados33.dsk: STILL_ALIVE.BAS OBJECTS.SHAPE SHAPE_TEST.BAS SOUND_TEST.BAS \
|
||||
PORTAL.BAS CUBE.BAS PORTAL_TITLE.HGR GLADOS.HGR MOUSE_TEST.BAS \
|
||||
JOYSTICK_TEST.BAS
|
||||
JOYSTICK_TEST.BAS \
|
||||
asm/STILL_ALIVE.BIN
|
||||
$(DOS33) -y glados33.dsk SAVE A STILL_ALIVE.BAS
|
||||
$(DOS33) -y glados33.dsk SAVE B OBJECTS.SHAPE
|
||||
$(DOS33) -y glados33.dsk SAVE B PORTAL_TITLE.HGR
|
||||
|
@ -49,7 +53,9 @@ glados33.dsk: STILL_ALIVE.BAS OBJECTS.SHAPE SHAPE_TEST.BAS SOUND_TEST.BAS \
|
|||
$(DOS33) -y glados33.dsk SAVE A CUBE.BAS
|
||||
$(DOS33) -y glados33.dsk SAVE A MOUSE_TEST.BAS
|
||||
$(DOS33) -y glados33.dsk SAVE A JOYSTICK_TEST.BAS
|
||||
$(DOS33) -y glados33.dsk BSAVE -a 0xc00 asm/STILL_ALIVE.BIN
|
||||
|
||||
clean:
|
||||
cd asm && make clean
|
||||
rm -f *~ *.BAS *.SHAPE sound_test.bas shape_test.bas *.lst
|
||||
|
||||
|
|
12
glados3.3/asm/Makefile
Normal file
12
glados3.3/asm/Makefile
Normal file
|
@ -0,0 +1,12 @@
|
|||
all: STILL_ALIVE.BIN
|
||||
|
||||
STILL_ALIVE.BIN: still_alive.o
|
||||
ld65 -o STILL_ALIVE.BIN still_alive.o -C ./apple2_c00.inc
|
||||
|
||||
still_alive.o: still_alive.s
|
||||
ca65 -o still_alive.o still_alive.s -l still_alive.lst
|
||||
|
||||
clean:
|
||||
rm -f *.lst *.o *~ STILL_ALIVE.BIN speaker_timing
|
||||
|
||||
|
12
glados3.3/asm/apple2_c00.inc
Normal file
12
glados3.3/asm/apple2_c00.inc
Normal file
|
@ -0,0 +1,12 @@
|
|||
MEMORY {
|
||||
ZP: start = $00, size = $1A, type = rw;
|
||||
RAM: start = $C00, size = $8E00, file = %O;
|
||||
}
|
||||
|
||||
SEGMENTS {
|
||||
CODE: load = RAM, type = ro;
|
||||
RODATA: load = RAM, type = ro;
|
||||
DATA: load = RAM, type = rw;
|
||||
BSS: load = RAM, type = bss, define = yes;
|
||||
ZEROPAGE: load = ZP, type = zp;
|
||||
}
|
74
glados3.3/asm/speaker_timing.c
Normal file
74
glados3.3/asm/speaker_timing.c
Normal file
|
@ -0,0 +1,74 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
long long cycles=0,last=0;
|
||||
int x,y;
|
||||
int f,d;
|
||||
|
||||
f=76; // a (should be 440Hz?)
|
||||
// f=128; // c (should be 261Hz?)
|
||||
d=108; // 1/2 note
|
||||
|
||||
x=f;
|
||||
y=d;
|
||||
|
||||
while(1) {
|
||||
|
||||
//
|
||||
// f=1/T
|
||||
//
|
||||
|
||||
//music_loop:
|
||||
y--; //dey ; Y never set?
|
||||
if (y<0) y=255;
|
||||
cycles+=2;
|
||||
|
||||
cycles+=2;
|
||||
if (y!=0) {
|
||||
cycles++;
|
||||
//goto loop; //bne loop
|
||||
}
|
||||
else {
|
||||
d--; // dec $0301
|
||||
cycles+=6;
|
||||
|
||||
// printf("d=%d cycles=%lld\n",d,cycles);
|
||||
|
||||
cycles+=2;
|
||||
if (d==0) { // beq music_done
|
||||
cycles++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// loop
|
||||
x--; // dex
|
||||
cycles+=2;
|
||||
|
||||
cycles+=2;
|
||||
if (x!=0) { // bne music_loop
|
||||
cycles++;
|
||||
//goto music_loop;
|
||||
}
|
||||
else {
|
||||
x=f; // ldx $0300
|
||||
cycles+=4;
|
||||
|
||||
//jmp click_speaker
|
||||
cycles+=3;
|
||||
|
||||
cycles+=4; //lda $C030 ; click the speaker
|
||||
printf("period=%lld us, f=%lf Hz, should be %lf\n",
|
||||
cycles-last,1023000.0/((cycles-last)*2),
|
||||
1000000.0/880);
|
||||
last=cycles;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Total cycles: %lld, %lf seconds\n",
|
||||
cycles,cycles/1023000.0);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
1046
glados3.3/asm/still_alive.s
Normal file
1046
glados3.3/asm/still_alive.s
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user