Add modified calc with bugs #33, #34 fixed

This commit is contained in:
Joshua Bell 2017-09-20 19:54:19 -07:00
parent e94b6e7f2d
commit bc47645c5f
5 changed files with 1728 additions and 46 deletions

View File

@ -4,7 +4,7 @@ CAFLAGS = --target apple2enh --list-bytes 0
CCFLAGS = --config apple2-asm.cfg CCFLAGS = --config apple2-asm.cfg
# ProDOS file type is $F1 ($ is pesky) # ProDOS file type is $F1 ($ is pesky)
TARGETS = calculator.F1 show_text_file.F1 date.F1 puzzle.F1 show_image_file.F1 TARGETS = calculator.F1 show_text_file.F1 date.F1 puzzle.F1 show_image_file.F1 calc_fixed.F1
.PHONY: clean all .PHONY: clean all
all: $(TARGETS) all: $(TARGETS)

1710
desk.acc/calc_fixed.s Normal file

File diff suppressed because it is too large Load Diff

View File

@ -81,10 +81,8 @@ call_init:
;; redraws the window. ;; redraws the window.
.proc redraw_screen_and_window .proc redraw_screen_and_window
;; Redraw the desktop (by copying trampoline to ZP)
zp_stash := $20 zp_stash := $20
;; Copying trampoline routine to the ZP.
lda LCBANK1 lda LCBANK1
lda LCBANK1 lda LCBANK1
ldx #sizeof_routine ldx #sizeof_routine
@ -97,19 +95,19 @@ call_init:
;; Redraw window after drag ;; Redraw window after drag
lda ROMIN2 lda ROMIN2
lda #window_id lda #window_id
jsr draw_window jsr check_visibility_and_draw_window
;; ??? ;; ???
lda LCBANK1 lda LCBANK1
lda LCBANK1 lda LCBANK1
bit redraw_flag ; BUG: https://github.com/inexorabletash/a2d/issues/33 bit offscreen_flag ; BUG: https://github.com/inexorabletash/a2d/issues/33
bmi skip bmi skip
DESKTOP_CALL DESKTOP_REDRAW_ICONS DESKTOP_CALL DESKTOP_REDRAW_ICONS
;; ??? ;; ???
skip: lda #0 skip: lda #0
sta redraw_flag sta offscreen_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
@ -129,17 +127,20 @@ skip: lda #0
;;; ================================================== ;;; ==================================================
redraw_flag: .byte 0 ; ??? ;; Set when the client area is offscreen and
;; should not be painted.
offscreen_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)
.proc draw_window .proc check_visibility_and_draw_window
sta query_state_params_id sta query_state_params_id
lda create_window_params_top lda create_window_params_top
cmp #screen_height - 1 cmp #screen_height - 1
bcc :+ bcc :+
lda #$80 lda #$80
sta redraw_flag sta offscreen_flag
rts rts
;; Is skipping this responsible for display redraw bug? ;; Is skipping this responsible for display redraw bug?
@ -804,7 +805,7 @@ init: sta ALTZPON
lda ROMIN2 lda ROMIN2
jsr reset_buffer2 jsr reset_buffer2
lda #window_id lda #window_id
jsr draw_window jsr check_visibility_and_draw_window
jsr reset_buffers_and_display jsr reset_buffers_and_display
lda #'=' ; last operation lda #'=' ; last operation
@ -819,7 +820,7 @@ init: sta ALTZPON
sta calc_l sta calc_l
.proc copy_to_b1 .proc copy_to_b1
ldx #(end_adjust_txtptr_copied - adjust_txtptr_copied + 4) ; should be just + 1 ? ldx #sizeof_adjust_txtptr_copied + 4 ; should be just + 1 ?
loop: lda adjust_txtptr_copied-1,x loop: lda adjust_txtptr_copied-1,x
sta adjust_txtptr-1,x sta adjust_txtptr-1,x
dex dex
@ -1699,6 +1700,6 @@ loop: inc TXTPTR
sbc #$D0 ; carry set if successful sbc #$D0 ; carry set if successful
end: rts end: rts
.endproc .endproc
end_adjust_txtptr_copied := * sizeof_adjust_txtptr_copied := * - adjust_txtptr_copied
da_end := * da_end := *

View File

@ -18,8 +18,6 @@ function stats {
echo "$1: "$(res/stats.pl < "$1") echo "$1: "$(res/stats.pl < "$1")
} }
#do_make clean #do_make clean
do_make all do_make all
@ -37,4 +35,7 @@ stats "date.s"
stats "puzzle.s" stats "puzzle.s"
cat show_image_file.F1 > mount/SHOW.IMAGE.FILE.\$F1 \ cat show_image_file.F1 > mount/SHOW.IMAGE.FILE.\$F1 \
&& echo "Updated mountable file" && echo "Updated mountable file (SIF)"
cat calc_fixed.F1 > mount/TEST.\$F1 \
&& echo "Updated mountable file (Test)"

View File

@ -7,10 +7,6 @@
.include "../inc/auxmem.inc" .include "../inc/auxmem.inc"
.include "a2d.inc" .include "a2d.inc"
;; Big questions:
;; * How can we hide/show the cursor on demand?
;; * Can we trigger menu redraw? (if not, need to preserve for fullscreen)
start: jmp copy2aux start: jmp copy2aux
save_stack:.byte 0 save_stack:.byte 0
@ -34,32 +30,6 @@ dst: sta start,y ; self-modified
bne src bne src
.endproc .endproc
call_main_trampoline := $20 ; installed on ZP, turns off auxmem and calls...
call_main_addr := call_main_trampoline+7 ; address patched in here
;;; Copy the following "call_main_template" routine to $20
.scope
sta RAMWRTON
sta RAMRDON
ldx #sizeof_routine
loop: lda routine,x
sta call_main_trampoline,x
dex
bpl loop
jmp call_init
.endscope
.proc routine
sta RAMRDOFF
sta RAMWRTOFF
jsr $1000 ; overwritten (in zp version)
sta RAMRDON
sta RAMWRTON
rts
.endproc
sizeof_routine := * - routine ; can't .sizeof(proc) before declaration
;; https://github.com/cc65/cc65/issues/478
.proc call_init .proc call_init
;; run the DA ;; run the DA
jsr init jsr init