Compare commits

...

2 commits

Author SHA1 Message Date
f2a6af0995 Replace the not-enough-precision 32 bit to float impl
keep the proc though to encapsulate it but uses the older
logic of rounding down to 3.13 first
2025-07-03 18:43:10 -07:00
96e0356e57 WIP input handling for coords
experimental output via 32-bits mult, looses precision in conversion
2025-07-03 18:41:24 -07:00

View file

@ -126,6 +126,10 @@ KEY_7 = 51
KEY_8 = 53
KEY_9 = 48
KEY_0 = 50
KEY_PERIOD = 34
KEY_E = 42
KEY_X = 22
KEY_Y = 43
.struct float48
exponent .byte
@ -403,6 +407,13 @@ elapsed_work:
elapsed_digit:
.byte 0
input_col:
.byte 0
input_row:
.byte 0
input_max:
.byte 0
; 2 + 9 * byte cycles
.macro add bytes, dest, arg1, arg2
clc ; 2 cyc
@ -983,6 +994,17 @@ common:
.endproc
; rounds to 16-bit first!
; input in FR0, 32 bits signed 6.26 fixed
; output in FR0, Atari float
; clobbers a, x, y, FR0, FR1
.proc fixed6_26_to_float
shift_round_16 FR0, 3
copy16 FR0, FR0 + 2
jsr fixed3_13_to_float
rts
.endproc
; input in FR0, Atari float
; output in FR0, 16 bits signed 3.13 fixed
; clobbers a, x, y, FR0, FR1
@ -1603,7 +1625,7 @@ number_keys:
beq five
cpy #KEY_6
beq six
jmp skip_char
jmp letter_keys
one:
ldx #0
@ -1622,7 +1644,21 @@ five:
jmp load_key_viewport
six:
ldx #5
; fall through
jmp load_key_viewport
letter_keys:
cpy #KEY_X
bne not_x
jsr input_x
jmp load_key_viewport
not_x:
cpy #KEY_Y
bne not_y
jsr input_y
jmp load_key_viewport
not_y:
jmp skip_char
load_key_viewport:
jsr load_viewport
; fall through
@ -1632,6 +1668,23 @@ done:
.endproc
.proc input_x
ldx #col_x
ldy #1
jsr input_number
rts
.endproc
.proc input_y
rts
.endproc
.proc input_number
rts
.endproc
.proc clear_screen
; zero the range from framebuffer_top to display_list
lda #.lobyte(framebuffer_top)
@ -1679,9 +1732,7 @@ zero_byte_loop:
draw_string_const str_x
copy32 FR0, ox
shift_round_16 FR0, 3
copy16 FR0, FR0 + 2
jsr fixed3_13_to_float
jsr fixed6_26_to_float
jsr FASC
jsr draw_string
@ -1690,9 +1741,7 @@ zero_byte_loop:
draw_string_const str_y
copy32 FR0, oy
shift_round_16 FR0, 3
copy16 FR0, FR0 + 2
jsr fixed3_13_to_float
jsr fixed6_26_to_float
jsr FASC
jsr draw_string