Calc: symbols

This commit is contained in:
Joshua Bell 2017-09-15 00:53:45 -07:00
parent 87aff9debc
commit a2c64de108

View File

@ -103,7 +103,7 @@ call_init:
;; ??? ;; ???
lda LCBANK1 lda LCBANK1
lda LCBANK1 lda LCBANK1
bit L089D bit redraw_flag
bmi skip bmi skip
jsr UNKNOWN_CALL jsr UNKNOWN_CALL
@ -112,7 +112,7 @@ call_init:
;; ??? ;; ???
skip: lda #0 skip: lda #0
sta L089D sta redraw_flag
lda ROMIN2 lda ROMIN2
A2D_CALL A2D_QUERY_STATE, query_state_params A2D_CALL A2D_QUERY_STATE, query_state_params
A2D_CALL A2D_SET_STATE, state_params A2D_CALL A2D_SET_STATE, state_params
@ -132,7 +132,7 @@ skip: lda #0
;;; ================================================== ;;; ==================================================
L089D: .byte 0 redraw_flag: .byte 0 ; ???
;; Called after window drag is complete ;; Called after window drag is complete
;; (called with window_id in A) ;; (called with window_id in A)
@ -142,7 +142,7 @@ L089D: .byte 0
cmp #screen_height - 1 cmp #screen_height - 1
bcc :+ bcc :+
lda #$80 lda #$80
sta L089D sta redraw_flag
rts rts
: A2D_CALL A2D_QUERY_STATE, query_state_params : A2D_CALL A2D_QUERY_STATE, query_state_params
@ -545,12 +545,12 @@ tall_button_bitmap: ; bitmap for '+' button
saved_stack: saved_stack:
.byte $00 ; restored after error .byte $00 ; restored after error
L0BC5: .byte $00 ; high bit set if pending op? calc_p: .byte $00 ; high bit set if pending op?
calc_op:.byte $00 calc_op:.byte $00
calc_d: .byte $00 ; '.' if decimal present, 0 otherwise calc_d: .byte $00 ; '.' if decimal present, 0 otherwise
calc_e: .byte $00 ; exponential? calc_e: .byte $00 ; exponential?
calc_n: .byte $00 ; negative? calc_n: .byte $00 ; negative?
L0BCA: .byte $00 ; related to = key calc_g: .byte $00 ; high bit set if last input digit
calc_l: .byte $00 ; input length calc_l: .byte $00 ; input length
;;; ================================================== ;;; ==================================================
@ -575,7 +575,7 @@ white_pattern:
.res 8, $FF .res 8, $FF
.byte $00 .byte $00
;; ??? ;; arg for $0C call ???
L0BEF: .byte $7F L0BEF: .byte $7F
display_left := 10 display_left := 10
@ -792,11 +792,11 @@ init: sta ALTZPON
sta calc_op sta calc_op
lda #0 ; clear registers lda #0 ; clear registers
sta L0BC5 sta calc_p
sta calc_d sta calc_d
sta calc_e sta calc_e
sta calc_n sta calc_n
sta L0BCA sta calc_g
sta calc_l sta calc_l
.proc copy_to_b1 .proc copy_to_b1
@ -937,7 +937,7 @@ loop: lda routine,x
lda input_state_params::key lda input_state_params::key
cmp #KEY_ESCAPE cmp #KEY_ESCAPE
bne trydel bne trydel
lda L0BC5 lda calc_p
bne clear ; empty state? bne clear ; empty state?
lda calc_l lda calc_l
beq exit ; if so, exit DA beq exit ; if so, exit DA
@ -1109,7 +1109,7 @@ miss: clc
lda #'=' lda #'='
sta calc_op sta calc_op
lda #0 lda #0
sta L0BC5 sta calc_p
sta calc_l sta calc_l
sta calc_d sta calc_d
sta calc_e sta calc_e
@ -1117,13 +1117,13 @@ miss: clc
jmp reset_buffers_and_display jmp reset_buffers_and_display
: cmp #'E' ; Exponential? : cmp #'E' ; Exponential?
bne L0FC7 bne try_eq
ldx #<btn_e::box ldx #<btn_e::box
ldy #>btn_e::box ldy #>btn_e::box
lda #'e' lda #'e'
jsr depress_button jsr depress_button
ldy calc_e ldy calc_e
bne L0FC6 bne rts1
ldy calc_l ldy calc_l
bne :+ bne :+
inc calc_l inc calc_l
@ -1132,11 +1132,11 @@ miss: clc
sta text_buffer2 + text_buffer_size sta text_buffer2 + text_buffer_size
: lda #'E' : lda #'E'
sta calc_e sta calc_e
jmp L1107 jmp update
L0FC6: rts rts1: rts
L0FC7: cmp #'=' ; Equals? try_eq: cmp #'=' ; Equals?
bne :+ bne :+
pha pha
ldx #<btn_eq::box ldx #<btn_eq::box
@ -1163,7 +1163,7 @@ L0FC7: cmp #'=' ; Equals?
inc calc_l inc calc_l
: lda #'.' : lda #'.'
sta calc_d sta calc_d
jmp L1107 jmp update
rts2: rts rts2: rts
@ -1308,77 +1308,78 @@ end: rts
do_digit_click: do_digit_click:
jsr depress_button jsr depress_button
bne L1106 bne :+
pla pla
rts rts
L1106: pla : pla
L1107: sec update: sec
ror L0BCA ror calc_g
ldy calc_l ldy calc_l
bne L111C bne :+
pha pha
jsr reset_buffer2 jsr reset_buffer2
pla pla
cmp #$30 cmp #'0'
bne L111C bne :+
jmp display_buffer1 jmp display_buffer1
L111C: sec : sec
ror L0BC5 ror calc_p
cpy #$0A cpy #$0A
bcs L114B bcs rts3
pha pha
ldy calc_l ldy calc_l
beq L113E beq empty
lda #$0F lda #$0F
sec sec
sbc calc_l sbc calc_l
tax tax
L1131: lda text_buffer1,x : lda text_buffer1,x
sta text_buffer1-1,x sta text_buffer1-1,x
sta text_buffer2-1,x sta text_buffer2-1,x
inx inx
dey dey
bne L1131 bne :-
L113E: inc calc_l empty: inc calc_l
pla pla
sta text_buffer1 + text_buffer_size sta text_buffer1 + text_buffer_size
sta text_buffer2 + text_buffer_size sta text_buffer2 + text_buffer_size
jmp display_buffer1 jmp display_buffer1
L114B: rts rts3: rts
do_op_click: .proc do_op_click
jsr depress_button jsr depress_button
bne L1153 bne :+
pla pla
rts rts
L1153: lda calc_op : lda calc_op
cmp #'=' cmp #'='
bne :+ bne :+
lda L0BCA lda calc_g
bne L1173 bne reparse
lda #$00 lda #$00
jsr FLOAT jsr FLOAT
jmp L1181 jmp do_op
: lda L0BCA : lda calc_g
bne L1173 bne reparse
pla pla
sta calc_op sta calc_op
jmp reset_buffer1_and_state jmp reset_buffer1_and_state
L1173: lda #<text_buffer1 reparse:lda #<text_buffer1
sta TXTPTR sta TXTPTR
lda #>text_buffer1 lda #>text_buffer1
sta TXTPTR+1 sta TXTPTR+1
jsr adjust_txtptr jsr adjust_txtptr
jsr FIN jsr FIN
L1181: pla
do_op: pla
ldx calc_op ldx calc_op
sta calc_op ; Operation sta calc_op
lda #<farg lda #<farg
ldy #>farg ldy #>farg
@ -1404,9 +1405,10 @@ L1181: pla
: cpx #'=' : cpx #'='
bne post_op bne post_op
ldy L0BCA ldy calc_g
bne post_op bne post_op
jmp reset_buffer1_and_state jmp reset_buffer1_and_state
.endproc
.proc post_op .proc post_op
ldx #<farg ; after the FP operation is done ldx #<farg ; after the FP operation is done
@ -1445,7 +1447,7 @@ end: jsr display_buffer1
sta calc_d sta calc_d
sta calc_e sta calc_e
sta calc_n sta calc_n
sta L0BCA sta calc_g
rts rts
.endproc .endproc