1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2025-01-10 17:31:18 +00:00

Add some demos, one of which works.

This commit is contained in:
Cat's Eye Technologies 2014-04-02 14:24:43 +01:00
parent 61378f5a88
commit 765073f94e
3 changed files with 218 additions and 0 deletions

4
eg/char_actor_demo.60p Normal file
View File

@ -0,0 +1,4 @@
assign byte table screen 1024
assign byte table actor_x 49152
assign byte table actor_x 49152

54
eg/demo.60pical Normal file
View File

@ -0,0 +1,54 @@
assign byte table screen 1024
assign byte table screen2 1274
assign byte table screen3 1524
assign byte table screen4 1774
assign byte table colormap 55296
assign byte table colormap2 55546
assign byte table colormap3 55796
assign byte table colormap4 56046
assign byte vic_border 53280
assign byte table vic_bg 53281
assign vector cinv 788
reserve vector save_cinv
routine main {
lda #5
sta vic_border
lda #0
sta vic_bg
jsr clear_screen
sei {
copy vector cinv to save_cinv
copy routine our_cinv to cinv
}
clc
repeat bcc { }
}
routine our_cinv {
inc screen
jmp save_cinv
}
routine clear_screen {
ldy #0
repeat bne {
lda #1
sta colormap, y
sta colormap2, y
sta colormap3, y
sta colormap4, y
lda #32
sta screen, y
sta screen2, y
sta screen3, y
sta screen4, y
iny
cpy #250
}
}

View File

@ -0,0 +1,160 @@
assign byte table actor_0_sprite_x 60
assign byte table actor_0_sprite_y 68
assign byte table vic_sprite_0_x 53281
assign byte table vic_sprite_0_y 53289
reserve byte actor_msb
reserve byte msb_counter
reserve vector logic_vector
assign byte vic_sprite_x_msb 55555
routine main {
jsr display_actors
}
routine display_actors {
ldy #0
ldx #0
repeat bne {
lda actor_0_sprite_x, y
sta vic_sprite_0_x, x
lda actor_0_sprite_y, y
sta vic_sprite_0_y, x
iny
inx
inx
cpy #8
}
lda actor_msb
sta vic_sprite_x_msb
}
routine update_actors {
lda #1
sta msb_counter
lda #0
sta actor_msb
ldy #0
repeat ... {
lda actor_0_logic_high, y
if bne {
sta logic_vector+1
lda actor_0_logic_low, y
sta logic_vector
save y
jsr logic_vector
restore y
}
// update_xvel
clc
lda actor_0_xvel, y
adc actor_0_xacc, y
cmp #max_vel
bcc xvel_within_limit ; branch if accumulator is less
cmp #min_vel
bcs xvel_within_limit ; branch if accumulator is greater or equal
jmp update_xpos
xvel_within_limit:
sta actor_0_xvel, y
update_xpos:
clc
lda actor_0_xpos_low, y
adc actor_0_xvel, y
sta actor_0_xpos_low, y
lda #0
sta sign_extend
lda actor_0_xvel, y
and #$80
beq carry_x
dec sign_extend
carry_x:
lda actor_0_xpos_high, y
adc sign_extend ; $00, or $ff if xvel < 0
sta actor_0_xpos_high, y
update_yvel:
clc
lda actor_0_yvel, y
adc actor_0_yacc, y
cmp #max_vel
bcc yvel_within_limit ; branch if accumulator is less
cmp #min_vel
bcs yvel_within_limit ; branch if accumulator is greater or equal
jmp update_ypos
yvel_within_limit:
sta actor_0_yvel, y
update_ypos:
clc
lda actor_0_ypos_low, y
adc actor_0_yvel, y
sta actor_0_ypos_low, y
lda #0
sta sign_extend
lda actor_0_yvel, y
and #$80
beq carry_y
dec sign_extend
carry_y:
lda actor_0_ypos_high, y
adc sign_extend
sta actor_0_ypos_high, y
precompute_sprite_position:
lda actor_0_xpos_low, y
sta temp_low
lda actor_0_xpos_high, y
sta temp_high
jsr shift_temp
jsr shift_temp
jsr shift_temp
sta actor_0_sprite_x, y
lda temp_high ; calculate the sprite's msb
beq advance_msb_counter
lda actor_msb
ora msb_counter
sta actor_msb
advance_msb_counter:
asl msb_counter
set_sprite_y:
lda actor_0_ypos_low, y
sta temp_low
lda actor_0_ypos_high, y
sta temp_high
jsr shift_temp
jsr shift_temp
jsr shift_temp
sta actor_0_sprite_y, y
next_actor:
cpy #$07
beq exit_actor_loop
iny
jmp update_actor_loop
exit_actor_loop:
rts