1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2025-02-10 08:30:38 +00:00

Fix jmp (vector) syntax. Filename extension is .60p.

--HG--
rename : eg/cinv.60pical => eg/cinv.60p
rename : eg/demo.60pical => eg/demo.60p
rename : eg/hi.60pical => eg/hi.60p
rename : eg/screen.60pical => eg/screen1.60p
rename : eg/screen2.60pical => eg/screen2.60p
rename : eg/screen3.60pical => eg/screen3.60p
This commit is contained in:
Cat's Eye Technologies 2014-04-03 18:52:58 +01:00
parent 55a5ee85e3
commit 571b3d403b
15 changed files with 18 additions and 200 deletions

View File

@ -180,4 +180,6 @@ TODO
* Character tables ("strings" to everybody else)
* Work out the analyses again and document them
* Addressing modes; rename instructions to match
* fix jmp (vector) syntax
* `jsr (vector)`
* `jmp routine`
* insist on EOL after each instruction. need spacesWOEOL production

View File

@ -142,27 +142,27 @@ No duplicate routine names, including externals.
| }
? duplicate routine name
We can jump to a vector.
We can jump indirectly through a vector.
| reserve vector blah
| routine main {
| jmp blah
| jmp (blah)
| }
= True
We can't jump to a word.
We can't jump indirectly through a word.
| reserve word blah
| routine main {
| jmp blah
| jmp (blah)
| }
? jmp to non-vector
We can't jump to a byte.
We can't jump indirectly through a byte.
| assign byte screen 1024
| routine main {
| jmp screen
| jmp (screen)
| }
? jmp to non-vector

View File

@ -111,7 +111,7 @@ Installing an interrupt handler (at the Kernal level, i.e. with CINV)
|
| routine our_cinv {
| inc screen
| jmp save_cinv
| jmp (save_cinv)
| }
= main:
= sei

View File

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

View File

@ -11,5 +11,5 @@ routine main {
routine our_cinv {
inc screen
jmp save_cinv
jmp (save_cinv)
}

View File

@ -1,24 +0,0 @@
reserve byte m_high
reserve byte m_low
reserve byte n_high
reserve byte n_low
routine compare_16_bit {
lda m_high
cmp n_high
if beq {
lda m_low
cmp n_low
} else {
}
}
routine compare_16_bit {
lda >m
cmp >n
if beq {
lda <m
cmp <n
} else {
}
}

View File

@ -54,7 +54,7 @@ routine our_cinv {
jsr reset_position
} else {
}
jmp save_cinv
jmp (save_cinv)
}
routine increment_pos {

View File

@ -66,7 +66,7 @@ routine our_cinv {
jsr reset_position
} else { }
}
jmp save_cinv
jmp (save_cinv)
}
routine reset_position {

View File

@ -1,160 +0,0 @@
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

View File

@ -15,7 +15,7 @@ import SixtyPical.Emitter (emitProgram)
-- -- -- -- driver -- -- -- --
usage = do
putStrLn "Usage: sixtypical (parse|check|analyze|emit) filename.60pical"
putStrLn "Usage: sixtypical (parse|check|analyze|emit) filename.60p"
exitWith $ ExitFailure 1
main = do

View File

@ -490,7 +490,11 @@ jmp :: Parser Instruction
jmp = do
string "jmp"
spaces
string "("
spaces
l <- locationName
string ")"
spaces
return $ JMPVECTOR (NamedLocation Nothing l)
jsr :: Parser Instruction