mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-10-12 05:24:02 +00:00
sprites: ship now moves
just don't move it too fast
This commit is contained in:
parent
a9c39a4c32
commit
337f37fc1c
@ -2,3 +2,4 @@ gr_offsets:
|
|||||||
.word $400,$480,$500,$580,$600,$680,$700,$780
|
.word $400,$480,$500,$580,$600,$680,$700,$780
|
||||||
.word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8
|
.word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8
|
||||||
.word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0
|
.word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0
|
||||||
|
gr_offsets_done:
|
||||||
|
@ -7,7 +7,7 @@ static int gr_offsets[]={
|
|||||||
0x450,0x4d0,0x550,0x5d0,0x650,0x6d0,0x750,0x7d0,
|
0x450,0x4d0,0x550,0x5d0,0x650,0x6d0,0x750,0x7d0,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define X_OFFSET 0
|
#define X_OFFSET 1
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
@ -18,9 +18,9 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
printf("; %d\n",i*2);
|
printf("; %d\n",i*2);
|
||||||
printf("\tbit\tPAGE0\t; 4\n");
|
printf("\tbit\tPAGE0\t; 4\n");
|
||||||
printf("smc%03d:\tldx\t#$00\t; 2\n",i*2);
|
printf("smc%03d:\tldx\t#$%02x\t; 2\n",i*2,X_OFFSET);
|
||||||
for(j=0;j<7;j++) {
|
for(j=0;j<7;j++) {
|
||||||
address=gr_offsets[lookup]+0x400+j+X_OFFSET;
|
address=gr_offsets[lookup]+0x400+j;
|
||||||
if (i<15) address=0xc00;
|
if (i<15) address=0xc00;
|
||||||
if (i>77) address=0xc00;
|
if (i>77) address=0xc00;
|
||||||
printf("\tlda\t#$00\t; 2\n");
|
printf("\tlda\t#$00\t; 2\n");
|
||||||
@ -28,7 +28,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
printf("\tldx\t#$00\t; 2\n");
|
printf("\tldx\t#$00\t; 2\n");
|
||||||
printf("\tlda\tZERO\t; 3\n");
|
printf("\tlda\tZERO\t; 3\n");
|
||||||
address=gr_offsets[lookup]+0x400+X_OFFSET;
|
address=gr_offsets[lookup]+0x400;
|
||||||
if (i<15) address=0xc00;
|
if (i<15) address=0xc00;
|
||||||
if (i>77) address=0xc00;
|
if (i>77) address=0xc00;
|
||||||
printf("\tsta\t$%3x,X\t; 5\n",address);
|
printf("\tsta\t$%3x,X\t; 5\n",address);
|
||||||
@ -68,9 +68,9 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
printf("; %d\n",(i*2)+1);
|
printf("; %d\n",(i*2)+1);
|
||||||
printf("\tbit\tPAGE1\t; 4\n");
|
printf("\tbit\tPAGE1\t; 4\n");
|
||||||
printf("smc%03d:\tldx\t#$00\t; 2\n",(i*2)+1);
|
printf("smc%03d:\tldx\t#$%02x\t; 2\n",(i*2)+1,X_OFFSET);
|
||||||
for(j=0;j<7;j++) {
|
for(j=0;j<7;j++) {
|
||||||
address=gr_offsets[lookup]+j+X_OFFSET;
|
address=gr_offsets[lookup]+j;
|
||||||
if (i<15) address=0xc00;
|
if (i<15) address=0xc00;
|
||||||
if (i>77) address=0xc00;
|
if (i>77) address=0xc00;
|
||||||
printf("\tlda\t#$00\t; 2\n");
|
printf("\tlda\t#$00\t; 2\n");
|
||||||
@ -78,7 +78,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
printf("\tldx\t#$00\t; 2\n");
|
printf("\tldx\t#$00\t; 2\n");
|
||||||
printf("\tlda\tZERO\t; 3\n");
|
printf("\tlda\tZERO\t; 3\n");
|
||||||
address=gr_offsets[lookup]+X_OFFSET;
|
address=gr_offsets[lookup];
|
||||||
if (i<15) address=0xc00;
|
if (i<15) address=0xc00;
|
||||||
if (i>77) address=0xc00;
|
if (i>77) address=0xc00;
|
||||||
printf("\tsta\t$%3x,X\t; 5\n",address);
|
printf("\tsta\t$%3x,X\t; 5\n",address);
|
||||||
|
@ -197,11 +197,49 @@ display_loop:
|
|||||||
|
|
||||||
; 4550 -- VBLANK
|
; 4550 -- VBLANK
|
||||||
; 1821 -- draw ship (130*14)+1
|
; 1821 -- draw ship (130*14)+1
|
||||||
|
; 829 -- erase ship (100*8)+(14*2)+1
|
||||||
; -31 -- move ship
|
; -31 -- move ship
|
||||||
; -61 -- keypress
|
; -61 -- keypress
|
||||||
; -8 -- loop
|
; -8 -- loop
|
||||||
;=======
|
;=======
|
||||||
; 2629
|
; 1800
|
||||||
|
|
||||||
|
;================
|
||||||
|
; erase old ship
|
||||||
|
|
||||||
|
ldy YPOS ; 3 ; 0
|
||||||
|
jsr erase_line ; 6+94
|
||||||
|
|
||||||
|
iny ; 2 ; 1
|
||||||
|
jsr erase_line ; 6+94
|
||||||
|
|
||||||
|
iny ; 2 ; 2
|
||||||
|
jsr erase_line ; 6+94
|
||||||
|
|
||||||
|
iny ; 2 ; 3
|
||||||
|
jsr erase_line ; 6+94
|
||||||
|
|
||||||
|
iny ; 2 ; 4
|
||||||
|
; jsr erase_line ; 6+94
|
||||||
|
iny ; 2 ; 5
|
||||||
|
; jsr erase_line ; 6+94
|
||||||
|
iny ; 2 ; 6
|
||||||
|
; jsr erase_line ; 6+94
|
||||||
|
iny ; 2 ; 7
|
||||||
|
; jsr erase_line ; 6+94
|
||||||
|
iny ; 2 ; 8
|
||||||
|
; jsr erase_line ; 6+94
|
||||||
|
iny ; 2 ; 9
|
||||||
|
; jsr erase_line ; 6+94
|
||||||
|
iny ; 2 ; 10
|
||||||
|
jsr erase_line ; 6+94
|
||||||
|
iny ; 2 ; 11
|
||||||
|
jsr erase_line ; 6+94
|
||||||
|
iny ; 2 ; 12
|
||||||
|
jsr erase_line ; 6+94
|
||||||
|
iny ; 2 ; 13
|
||||||
|
jsr erase_line ; 6+94
|
||||||
|
|
||||||
|
|
||||||
;==========================
|
;==========================
|
||||||
; move the ship
|
; move the ship
|
||||||
@ -222,12 +260,12 @@ minus:
|
|||||||
sta YADD ; 3
|
sta YADD ; 3
|
||||||
jmp done_move_delay_7 ; 3
|
jmp done_move_delay_7 ; 3
|
||||||
not_minus:
|
not_minus:
|
||||||
cmp #111 ; 2
|
cmp #104 ; 2
|
||||||
bcc done_move_delay_12 ; blt ; 3
|
bcc done_move_delay_12 ; blt ; 3
|
||||||
; -1
|
; -1
|
||||||
lda #$0 ; 2
|
lda #$0 ; 2
|
||||||
sta YADD ; 3
|
sta YADD ; 3
|
||||||
lda #110 ; 2
|
lda #103 ; 2
|
||||||
sta YPOS ; 3
|
sta YPOS ; 3
|
||||||
jmp done_move ; 3
|
jmp done_move ; 3
|
||||||
done_move_delay_12:
|
done_move_delay_12:
|
||||||
@ -354,15 +392,29 @@ pad_time:
|
|||||||
;============================
|
;============================
|
||||||
; WAIT for VBLANK to finish
|
; WAIT for VBLANK to finish
|
||||||
;============================
|
;============================
|
||||||
|
wait_loop:
|
||||||
; Try X=6 Y=73 cycles=2629
|
; Try X=6 Y=73 cycles=2629
|
||||||
|
; Try X=19 Y=25 cycles=2526
|
||||||
|
; Try X=1 Y=109 cycles=1200
|
||||||
|
|
||||||
ldy #73 ; 2
|
; Try X=7 Y=54 cycles=2215 R5
|
||||||
loop1: ldx #6 ; 2
|
|
||||||
|
; Try X=1 Y=163 cycles=1794 R6
|
||||||
|
|
||||||
|
lda TEMP
|
||||||
|
lda TEMP
|
||||||
|
|
||||||
|
|
||||||
|
ldy #163 ; 2
|
||||||
|
loop1: ldx #1 ; 2
|
||||||
loop2: dex ; 2
|
loop2: dex ; 2
|
||||||
bne loop2 ; 2nt/3
|
bne loop2 ; 2nt/3
|
||||||
dey ; 2
|
dey ; 2
|
||||||
bne loop1 ; 2nt/3
|
bne loop1 ; 2nt/3
|
||||||
|
wait_loop_end:
|
||||||
|
|
||||||
|
;===============
|
||||||
|
; check keypress
|
||||||
|
|
||||||
jsr handle_keypress ; 6+55
|
jsr handle_keypress ; 6+55
|
||||||
|
|
||||||
@ -477,6 +529,7 @@ keypress_done:
|
|||||||
rts ; 6
|
rts ; 6
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;========================
|
;========================
|
||||||
; Draw a line of a sprite
|
; Draw a line of a sprite
|
||||||
;========================
|
;========================
|
||||||
@ -505,34 +558,96 @@ sprite_line:
|
|||||||
sta (OUTL),Y ; 6
|
sta (OUTL),Y ; 6
|
||||||
;=======
|
;=======
|
||||||
; 12
|
; 12
|
||||||
|
|
||||||
; COL1
|
; COL1
|
||||||
ldy #7 ; 2
|
ldy #7 ; 2
|
||||||
lda ship_sprite+1,X ; 4
|
lda ship_sprite+1,X ; 4
|
||||||
sta (OUTL),Y ; 6
|
sta (OUTL),Y ; 6
|
||||||
|
;=======
|
||||||
|
; 12
|
||||||
|
|
||||||
; COL2
|
; COL2
|
||||||
ldy #12 ; 2
|
ldy #12 ; 2
|
||||||
lda ship_sprite+2,X ; 4
|
lda ship_sprite+2,X ; 4
|
||||||
sta (OUTL),Y ; 6
|
sta (OUTL),Y ; 6
|
||||||
|
;=======
|
||||||
|
; 12
|
||||||
|
|
||||||
; COL3
|
; COL3
|
||||||
ldy #17 ; 2
|
ldy #17 ; 2
|
||||||
lda ship_sprite+3,X ; 4
|
lda ship_sprite+3,X ; 4
|
||||||
sta (OUTL),Y ; 6
|
sta (OUTL),Y ; 6
|
||||||
|
;=======
|
||||||
|
; 12
|
||||||
|
|
||||||
; COL4
|
; COL4
|
||||||
ldy #22 ; 2
|
ldy #22 ; 2
|
||||||
lda ship_sprite+4,X ; 4
|
lda ship_sprite+4,X ; 4
|
||||||
sta (OUTL),Y ; 6
|
sta (OUTL),Y ; 6
|
||||||
|
;=======
|
||||||
|
; 12
|
||||||
|
|
||||||
; COL5
|
; COL5
|
||||||
ldy #27 ; 2
|
ldy #27 ; 2
|
||||||
lda ship_sprite+5,X ; 4
|
lda ship_sprite+5,X ; 4
|
||||||
sta (OUTL),Y ; 6
|
sta (OUTL),Y ; 6
|
||||||
|
;=======
|
||||||
|
; 12
|
||||||
|
|
||||||
; COL6
|
; COL6
|
||||||
ldy #32 ; 2
|
ldy #32 ; 2
|
||||||
lda ship_sprite+6,X ; 4
|
lda ship_sprite+6,X ; 4
|
||||||
|
sta (OUTL),Y ; 6
|
||||||
|
;=======
|
||||||
|
; 12
|
||||||
|
|
||||||
|
ldy TEMPY ; 3
|
||||||
|
rts ; 6
|
||||||
|
|
||||||
|
;========================
|
||||||
|
; Erase a line of a sprite
|
||||||
|
;========================
|
||||||
|
; Y = y value
|
||||||
|
; 17+10+2+(7*8)+3+6 = 94
|
||||||
|
erase_line:
|
||||||
|
sty TEMPY ; 3
|
||||||
|
|
||||||
|
lda y_lookup_l,Y ; 4
|
||||||
|
sta OUTL ; 3
|
||||||
|
lda y_lookup_h,Y ; 4
|
||||||
|
sta OUTH ; 3
|
||||||
|
;=======
|
||||||
|
; 17
|
||||||
|
|
||||||
|
; XPOS
|
||||||
|
lda #1 ; xpos=1 ; 2
|
||||||
|
ldy #0 ; 2
|
||||||
|
sta (OUTL),Y ; 6
|
||||||
|
;=======
|
||||||
|
; 10
|
||||||
|
|
||||||
|
lda #0 ; 2
|
||||||
|
|
||||||
|
; COL0
|
||||||
|
ldy #2 ; 2
|
||||||
|
sta (OUTL),Y ; 6
|
||||||
|
; COL1
|
||||||
|
ldy #7 ; 2
|
||||||
|
sta (OUTL),Y ; 6
|
||||||
|
; COL2
|
||||||
|
ldy #12 ; 2
|
||||||
|
sta (OUTL),Y ; 6
|
||||||
|
; COL3
|
||||||
|
ldy #17 ; 2
|
||||||
|
sta (OUTL),Y ; 6
|
||||||
|
; COL4
|
||||||
|
ldy #22 ; 2
|
||||||
|
sta (OUTL),Y ; 6
|
||||||
|
; COL5
|
||||||
|
ldy #27 ; 2
|
||||||
|
sta (OUTL),Y ; 6
|
||||||
|
; COL6
|
||||||
|
ldy #32 ; 2
|
||||||
sta (OUTL),Y ; 6
|
sta (OUTL),Y ; 6
|
||||||
|
|
||||||
ldy TEMPY ; 3
|
ldy TEMPY ; 3
|
||||||
@ -540,18 +655,23 @@ sprite_line:
|
|||||||
|
|
||||||
|
|
||||||
.include "gr_simple_clear.s"
|
.include "gr_simple_clear.s"
|
||||||
.include "gr_offsets.s"
|
|
||||||
|
|
||||||
|
|
||||||
.include "../asm_routines/gr_unrle.s"
|
.include "../asm_routines/gr_unrle.s"
|
||||||
.include "../asm_routines/keypress.s"
|
;.include "../asm_routines/keypress.s"
|
||||||
.align $100
|
.align $100
|
||||||
.include "sprites_table.s"
|
.include "sprites_table.s"
|
||||||
.include "movement_table.s"
|
.include "gr_offsets.s"
|
||||||
|
|
||||||
|
;.include "movement_table.s"
|
||||||
.include "gr_copy.s"
|
.include "gr_copy.s"
|
||||||
.include "vapor_lock.s"
|
.include "vapor_lock.s"
|
||||||
.include "delay_a.s"
|
.include "delay_a.s"
|
||||||
|
|
||||||
|
|
||||||
|
.assert >gr_offsets = >gr_offsets_done, error, "gr_offsets crosses page"
|
||||||
|
.assert >wait_loop = >(wait_loop_end-1), error, "wait_loop crosses page"
|
||||||
|
|
||||||
pictures:
|
pictures:
|
||||||
.word earth_low,earth_high
|
.word earth_low,earth_high
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user