xmas2018: sorta get scrolling working

really slow :(
This commit is contained in:
Vince Weaver 2018-12-20 10:15:18 -05:00
parent a850f76121
commit b6b492934b
2 changed files with 126 additions and 106 deletions

View File

@ -9,7 +9,7 @@ all: xmas2018.dsk
xmas2018.dsk: HELLO XMAS2018 wreath.img.lz4t ball.img.lz4 merry.img.lz4t MUSIC.lz4t
$(DOS33) -y xmas2018.dsk SAVE A HELLO
$(DOS33) -y xmas2018.dsk BSAVE -a 0x1000 XMAS2018
$(DOS33) -y xmas2018.dsk BSAVE -a 0x0c00 XMAS2018
$(DOS33) -y xmas2018.dsk BSAVE -a 0xa000 wreath.img.lz4t WREATH.LZ4
$(DOS33) -y xmas2018.dsk BSAVE -a 0xa000 ball.img.lz4 BALL.LZ4
$(DOS33) -y xmas2018.dsk BSAVE -a 0x4000 merry.img.lz4t MERRY.LZ4
@ -20,7 +20,7 @@ xmas2018.dsk: HELLO XMAS2018 wreath.img.lz4t ball.img.lz4 merry.img.lz4t MUSIC.l
####
XMAS2018: xmas2018.o
ld65 -o XMAS2018 xmas2018.o -C ../linker_scripts/apple2_1000.inc
ld65 -o XMAS2018 xmas2018.o -C ../linker_scripts/apple2_c00.inc
xmas2018.o: xmas2018.s \
zp.inc hardware.inc \

View File

@ -107,6 +107,9 @@ meloopF:dex ; 2
; jsr play_music ; 6+1032
jsr scroll_hgr_loop
; Try X=9 Y=89 cycles=4540
ldy #89 ; 2
@ -118,100 +121,120 @@ meloop2:dex ; 2
; no keypress = 10+(24) = 34
bit KEYRESET ; clear keypress ; 4
me_keyloop:
lda KEYPRESS ; 4
bpl me_no_keypress ; 3
bpl me_keyloop ; 3
; -1
jmp me_handle_keypress ; 3
; jmp me_handle_keypress ; 3
me_no_keypress:
jmp merry_display_loop ; 3
; jmp merry_display_loop ; 3
me_handle_keypress:
bit KEYRESET ; clear keypress ; 4
rts ; 6
.if 0
/* 0 1 2 3 4 5 6 7
00 = $2000 $2400 $2800 $2c00 $3000 $3400 $3800 $3c00
08 = $2080 $2480 $2880 $2c80 $3080 $3480 $3880 $3c80
16 = $2100 $2500 $2900 $2d00 $3100 $3500 $3900 $3d00
24 = $2180 $2580 $2980 $2d80 $3180 $3580 $3980 $3d80
32 = $2200 $2600 $2a00 $2e00 $3200 $3600 $3a00 $3e00
40 = $2280 $2680 $2a80 $2e80 $3280 $3680 $3a80 $3e80
48 = $2300 $2700 $2b00 $2f00 $3300 $3700 $3b00 $3f00
56 = $2380 $2780 $2b80 $2f80 $3380 $3780 $3b80 $3f80
-----
64 = $2028 $2428 $2828 $2c28 $3028 $3428 $3828 $3c28
72 = $20a8 $24a8 $28a8 $2ca8 $30a8 $34a8 $38a8 $3ca8
80 = $2128 $2528 $2928 $2d28 $3128 $3528 $3928 $3d28
88 = $21a8 $25a8 $29a8 $2da8 $31a8 $35a8 $39a8 $3da8
96 = $2228 $2628 $2a28 $2e28 $3228 $3628 $3a28 $3e28
104 = $22a8 $26a8 $2aa8 $2ea8 $32a8 $36a8 $3aa8 $3ea8
112 = $2328 $2728 $2b28 $2f28 $3328 $3728 $3b28 $3f28
120 = $23a8 $27a8 $2ba8 $2fa8 $33a8 $37a8 $3ba8 $3fa8
-----
128 = $2050 $2450 $2850 $2c50 $3050 $3450 $3850 $3c50
136 = $20d0 $24d0 $28d0 $2cd0 $30d0 $34d0 $38d0 $3cd0
144 = $2150 $2550 $2950 $2d50 $3150 $3550 $3950 $3d50
152 = $21d0 $25d0 $29d0 $2dd0 $31d0 $35d0 $39d0 $3dd0
160 = $2250 $2650 $2a50 $2e50 $3250 $3650 $3a50 $3e50
168 = $22d0 $26d0 $2ad0 $2ed0 $32d0 $36d0 $3ad0 $3ed0
176 = $2350 $2750 $2b50 $2f50 $3350 $3750 $3b50 $3f50
184 = $23d0 $27d0 $2bd0 $2fd0 $33d0 $37d0 $3bd0 $3fd0
-----
*/
int count=0;
; 0 1 2 3 4 5 6 7
; 00 = $2000 $2400 $2800 $2c00 $3000 $3400 $3800 $3c00
; 08 = $2080 $2480 $2880 $2c80 $3080 $3480 $3880 $3c80
; 16 = $2100 $2500 $2900 $2d00 $3100 $3500 $3900 $3d00
; 24 = $2180 $2580 $2980 $2d80 $3180 $3580 $3980 $3d80
; 32 = $2200 $2600 $2a00 $2e00 $3200 $3600 $3a00 $3e00
; 40 = $2280 $2680 $2a80 $2e80 $3280 $3680 $3a80 $3e80
; 48 = $2300 $2700 $2b00 $2f00 $3300 $3700 $3b00 $3f00
; 56 = $2380 $2780 $2b80 $2f80 $3380 $3780 $3b80 $3f80
; -----
; 64 = $2028 $2428 $2828 $2c28 $3028 $3428 $3828 $3c28
; 72 = $20a8 $24a8 $28a8 $2ca8 $30a8 $34a8 $38a8 $3ca8
; 80 = $2128 $2528 $2928 $2d28 $3128 $3528 $3928 $3d28
; 88 = $21a8 $25a8 $29a8 $2da8 $31a8 $35a8 $39a8 $3da8
; 96 = $2228 $2628 $2a28 $2e28 $3228 $3628 $3a28 $3e28
; 104 = $22a8 $26a8 $2aa8 $2ea8 $32a8 $36a8 $3aa8 $3ea8
; 112 = $2328 $2728 $2b28 $2f28 $3328 $3728 $3b28 $3f28
; 120 = $23a8 $27a8 $2ba8 $2fa8 $33a8 $37a8 $3ba8 $3fa8
; -----
; 128 = $2050 $2450 $2850 $2c50 $3050 $3450 $3850 $3c50
; 136 = $20d0 $24d0 $28d0 $2cd0 $30d0 $34d0 $38d0 $3cd0
; 144 = $2150 $2550 $2950 $2d50 $3150 $3550 $3950 $3d50
; 152 = $21d0 $25d0 $29d0 $2dd0 $31d0 $35d0 $39d0 $3dd0
; 160 = $2250 $2650 $2a50 $2e50 $3250 $3650 $3a50 $3e50
; 168 = $22d0 $26d0 $2ad0 $2ed0 $32d0 $36d0 $3ad0 $3ed0
; 176 = $2350 $2750 $2b50 $2f50 $3350 $3750 $3b50 $3f50
; 184 = $23d0 $27d0 $2bd0 $2fd0 $33d0 $37d0 $3bd0 $3fd0
; -----
#define HIGH 0x00
#define CURRENT 0x01
#define NEXT 0x02
#define INL 0xfc
#define INH 0xfd
#define OUTL 0xfe
#define OUTH 0xff
; int count=0;
//ram[y_indirect(OUTL,y)]
HIGH = $00
CURRENT = $01
NEXT = $02
scroll_loop:
;===========================================
;===========================================
;===========================================
scroll_hgr_loop:
lda #$40 ; 2
sta OUTH ; 3
lda #$60 ; 2
sta INH ; 3
lda #$0 ; 2
sta INL ; 3
sta OUTL ; 3
sta COUNT
ram[OUTH]=0x40;
ram[OUTL]=0x00;
ram[INH]=0x60;
ram[INL]=0x00;
left_one_loop:
// printf("%d %02x:%02x\n",count,ram[OUTH],ram[OUTL]);
for(y=0;y<40;y++) {
ram[CURRENT]=ram[y_indirect(OUTL,y)];
ram[NEXT]=ram[y_indirect(OUTL,y+1)];
if ((count mod 7==2) || (count mod 7==6)) {
ram[HIGH]=ram[NEXT]&0x80;
}
else {
ram[HIGH]=ram[CURRENT]&0x80;
}
if (y==39) ram[NEXT]=ram[y_indirect(INL,0)];
ldy #0 ; 2
page1_loop:
lda (OUTL),Y ; get pixel block of interest ; 5
sta CURRENT ; 3
a=ram[NEXT];
and(0x3);
asl();
asl();
asl();
asl();
asl();
ram[NEXT]=a;
iny ; 2
lda (OUTL),Y ; get subsequent pixel block ; 5
;(note, 6 if off end?)
sta NEXT ; 3
dey ; restore Y ; 2
a=ram[CURRENT];
lsr();
lsr(); // current>>=2;
and(0x1f); // current&=0x1f;
ora_mem(HIGH);
ora_mem(NEXT);
ram[y_indirect(OUTL,y)]=a;
}
; if ((count mod 7==2) || (count mod 7==6)) {
; ram[HIGH]=ram[NEXT]&0x80;
;}
; else {
lda CURRENT ; 3
and #$80 ; 2
sta HIGH ; 3
; }
; if (y==39) ram[NEXT]=ram[y_indirect(INL,0)];
lda NEXT ; 3
and #$3 ; 2
asl ; 2
asl ; 2
asl ; 2
asl ; 2
asl ; 2
sta NEXT ; 3
lda CURRENT ; 3
lsr ; 2
lsr ; 2
and #$1f ; 2
ora HIGH ; 3
ora NEXT ; 3
sta (OUTL),Y ; 6
iny ; 2
cpy #40 ; 2
bne page1_loop ; 3
; -1
.if 0
for(y=0;y<40;y++) {
ram[CURRENT]=ram[y_indirect(INL,y)];
@ -240,40 +263,37 @@ left_one_loop:
ora_mem(NEXT);
ram[y_indirect(INL,y)]=a;
}
.endif
clc ; 2
lda INL ; 3
adc #$80 ; 2
sta INL ; 3
lda INH ; 3
adc #$0 ; 2
sta INH ; 3
clc ; needed? ; 2
lda OUTL ; 3
adc #$80 ; 2
sta OUTL ; 3
lda OUTH ; 3
adc #$0 ; 2
sta OUTH ; 3
clc();
a=ram[INL];
adc(0x80);
ram[INL]=a;
a=ram[INH];
adc(0x0);
ram[INH]=a;
cmp #$60 ; 2
bne left_one_loop
clc();
a=ram[OUTL];
adc(0x80);
ram[OUTL]=a;
a=ram[OUTH];
adc(0x0);
ram[OUTH]=a;
lda KEYPRESS ; 4
bmi scroll_done ; 3
if (a!=0x60) goto left_one_loop;
inc COUNT ; 5
lda COUNT ; 3
cmp #140 ; 2
beq scroll_done ; 3
grsim_update();
ch=grsim_input();
if (ch) goto scroll_done;
usleep(17000); // 60Hz = 17ms
count++;
if (count==140) goto scroll_done;
goto scroll_loop;
;-1
jmp scroll_hgr_loop ; 3
scroll_done:
while(1) {
ch=grsim_input();
if (ch) break;
}
return 0;
.endif
rts ; 6