ds: more work on escape

getting closer
This commit is contained in:
Vince Weaver 2019-11-03 11:23:53 -05:00
parent 1dce4d689c
commit 28d0d81ad2
7 changed files with 210 additions and 27 deletions

View File

@ -53,8 +53,8 @@ demosplash.o: demosplash.s \
pt3_lib_init.s pt3_lib_core.s pt3_lib_mockingboard.s \
pt3_lib_play_frame.s pt3_lib_write_frame.s \
interrupt_handler.s \
missing.s k_40_48d.inc \
create_update_type1.s \
missing.s k_40_48d.inc create_update_type1.s \
escape.s create_update_type2.s offsets_table2.s \
book.s book_40_48d.inc \
credits.s credits_bg.inc offsets_table.s \
dya_space_demo2.pt3

View File

@ -155,6 +155,3 @@ book_no_keypress:
.include "book_40_48d.inc"

View File

@ -0,0 +1,143 @@
; Autogenerates code for Type2 (escape)
; First 9 (?) lines = text mode
;
UPDATE2_START = $9000
;DEFAULT_COLOR = $0
create_update_type2:
ldx #192
lda #<UPDATE2_START
sta OUTL
lda #>UPDATE2_START
sta OUTH
lda #<another_scanline
sta INL
lda #>another_scanline
sta INH
create_update2_outer_loop:
ldy #0
create_update2_inner_loop:
lda (INL),Y
sta (OUTL),Y
iny
cpy #47
bne create_update2_inner_loop
; toggle PAGE0/PAGE1
txa
and #$1 ; ror?
clc
adc #$54
ldy #1
sta (OUTL),Y
clc
lda #47
adc OUTL
sta OUTL
lda OUTH
adc #0
sta OUTH
dex
bne create_update2_outer_loop
ldy #0
lda #$60 ; rts
sta (OUTL),Y
rts
;BARS_START = 46
.if 0
;===========================
; from 40 to 168?
setup_rasterbars:
lda #4 ; which page
sta RASTER_PAGE
ldx #BARS_START
lda #<(UPDATE_START+(BARS_START*49))
sta OUTL
lda #>(UPDATE_START+(BARS_START*49))
sta OUTH
setup_rasterbars_outer_loop:
ldy #6
lda #13
sta RASTER_X
setup_rasterbars_inner_loop:
txa
pha
inx
txa ; start one earlier
lsr
lsr
and #$fe
tax
clc
lda gr_offsets,X
adc RASTER_X
inc RASTER_X
sta (OUTL),Y
iny
clc
lda gr_offsets+1,X
adc RASTER_PAGE
sta (OUTL),Y
iny
iny
pla
tax
cpy #48
bne setup_rasterbars_inner_loop
clc
lda #49
adc OUTL
sta OUTL
lda OUTH
adc #0
sta OUTH
lda RASTER_PAGE
eor #$04
sta RASTER_PAGE
inx
cpx #184
bne setup_rasterbars_outer_loop
rts
.endif
another_scanline:
.byte $2C,$54,$C0 ; bit PAGE0 ; 4
.byte $A2,$01 ;smc018: ldx #$01 ; 2
.byte $A9,$00 ; lda #$00 ; 2
.byte $9D,$00,$02 ; sta $c00,X ; 5
.byte $A9,$00 ; lda #$00 ; 2
.byte $9D,$00,$02 ; sta $c00,X ; 5
.byte $A9,$00 ; lda #$00 ; 2
.byte $9D,$00,$02 ; sta $c00,X ; 5
.byte $A9,$00 ; lda #$00 ; 2
.byte $9D,$00,$02 ; sta $c00,X ; 5
.byte $A9,$00 ; lda #$00 ; 2
.byte $9D,$00,$02 ; sta $c00,X ; 5
.byte $A9,$00 ; lda #$00 ; 2
.byte $9D,$00,$02 ; sta $c00,X ; 5
.byte $A9,$00 ; lda #$00 ; 2
.byte $9D,$00,$02 ; sta $c00,X ; 5
.byte $A2,$00 ; ldx #$00 ; 2
.byte $A5,$85 ; lda ZERO ; 3
.byte $9D,$00,$02 ; sta $c00,X ; 5
;========== ;===
; 47??? ; 65

View File

@ -133,7 +133,7 @@ frame_decode_loop:
; escape scene
;===========================
; jsr escape
jsr escape
;===========================
; book scene
@ -197,7 +197,7 @@ wait_until_keypressed:
.include "starbase.s"
; escape
;.include "escape.s"
.include "escape.s"
; book
.include "book.s"
@ -212,9 +212,13 @@ wait_until_keypressed:
.include "interrupt_handler.s"
.include "pt3_lib_play_frame.s"
.include "pt3_lib_write_frame.s"
.include "create_update_type1.s"
.include "create_update_type2.s"
; Pictures (no need to align)
.include "earth.inc"
.include "book_40_48d.inc"
.include "credits_bg.inc"

View File

@ -5,11 +5,6 @@
; by deater (Vince Weaver) <vince@deater.net>
; TODO:
; end level after a certain number of points
; track score properly
escape:
;===================
@ -59,6 +54,13 @@ escape:
sta ASTEROID_SPEED
sta XPOS
;==================
; setup graphics
jsr create_update_type2
; jsr setup_rasterbars
;=============================
; Load graphic page0
@ -107,8 +109,7 @@ escape:
jsr move_and_print
; ; GR part
; GR part
bit PAGE0
;==============================
@ -165,13 +166,15 @@ loopRR: dex ; 2
sprites_display_loop:
.include "sprites_screen.s"
jsr $9000
;.include "sprites_screen.s"
;======================================================
; We have 4550 cycles in the vblank, use them wisely
;======================================================
; 4550 -- VBLANK
; -12 -- call to graphics code
;-1835 -- draw ship (131*14)+1
; -829 -- erase ship (100*8)+(14*2)+1
; -167 -- erase fire
@ -883,7 +886,7 @@ done_sparkle:
pad_time:
pad_time2:
;============================
@ -1150,9 +1153,9 @@ keypress_done:
sprite_line:
sty TEMPY ; 3
lda y_lookup_l,Y ; 4
lda y_lookup2_l,Y ; 4
sta OUTL ; 3
lda y_lookup_h,Y ; 4
lda y_lookup2_h,Y ; 4
sta OUTH ; 3
;=======
; 17
@ -1224,9 +1227,9 @@ sprite_line:
erase_line:
sty TEMPY ; 3
lda y_lookup_l,Y ; 4
lda y_lookup2_l,Y ; 4
sta OUTL ; 3
lda y_lookup_h,Y ; 4
lda y_lookup2_h,Y ; 4
sta OUTH ; 3
;=======
; 17
@ -1274,9 +1277,9 @@ erase_line:
fire_line:
sty TEMPY ; 3
lda y_lookup_l,Y ; 4
lda y_lookup2_l,Y ; 4
sta OUTL ; 3
lda y_lookup_h,Y ; 4
lda y_lookup2_h,Y ; 4
sta OUTH ; 3
;=======
; 17
@ -1365,7 +1368,7 @@ erase_fire:
.align $100
random_values:
.incbin "random.data"
.include "sprites_table.s"
.include "offsets_table2.s"
.include "text_print.s"
.align $100
.include "gr_putsprite_fast.s"
@ -1373,8 +1376,6 @@ random_values:
;.assert >gr_offsets = >gr_offsets_done, error, "gr_offsets crosses page"
.assert >escape_wait_loop = >(escape_wait_loop_end-1), error, "escape_wait_loop crosses page"
.include "earth.inc"
.align $100
ship_sprite:

View File

@ -2,7 +2,7 @@ CC = gcc
CFLAGS = -Wall -O2
LFLAGS =
all: creator offsets
all: creator offsets offsets2
creator: creator.o
$(CC) -o creator creator.o $(LFLAGS)
@ -16,5 +16,11 @@ offsets: offsets.o
offsets.o: offsets.c
$(CC) $(CFLAGS) -c offsets.c
offsets2: offsets2.o
$(CC) -o offsets2 offsets2.o $(LFLAGS)
offsets2.o: offsets2.c
$(CC) $(CFLAGS) -c offsets2.c
clean:
rm -f *.o creator offsets
rm -f *.o creator offsets offsets2

View File

@ -0,0 +1,32 @@
#include <stdio.h>
#define NUMBER 128
#define START 32
//#define START 40
//#define START 48
int main(int argc, char **argv) {
int i;
printf("y_lookup2_h:\n");
for(i=0;i<NUMBER;i++) {
if (i%8==0) printf(".byte\t");
//printf(">(smc%3d+1)",i+START);
printf(">($%4X)",0x9000+(i+START)*47+4);
if (i%8!=7) printf(",");
else printf("\n");
}
printf("y_lookup2_l:\n");
for(i=0;i<NUMBER;i++) {
if (i%8==0) printf(".byte\t");
//printf("<(smc%3d+1)",i+START);
printf("<($%4X)",0x9000+(i+START)*47+4);
if (i%8!=7) printf(",");
else printf("\n");
}
return 0;
}