SIF DA: Optimize main>aux copy, use more macros

This commit is contained in:
Joshua Bell 2018-12-19 18:52:33 -08:00
parent be8f64864f
commit 13dfdf786c

View File

@ -236,14 +236,12 @@ nextwinfo: .addr 0
lda LCBANK1 lda LCBANK1
lda LCBANK1 lda LCBANK1
lda #0 copy #0, mode
sta mode
;; Get filename by checking DeskTop selected window/icon ;; Get filename by checking DeskTop selected window/icon
;; Check that an icon is selected ;; Check that an icon is selected
lda #0 copy #0, pathbuff::length
sta pathbuff::length
lda selected_file_count lda selected_file_count
beq abort ; some file properties? beq abort ; some file properties?
lda path_index ; prefix index in table lda path_index ; prefix index in table
@ -426,12 +424,15 @@ close: jsr close_file
;; TODO: Load directly into Aux if RamWorks is not present. ;; TODO: Load directly into Aux if RamWorks is not present.
;; Copy MAIN to AUX ;; Copy MAIN to AUX
sta CLR80COL ; read main, write aux
sta RAMRDOFF
sta RAMWRTON
copy16 #hires, ptr copy16 #hires, ptr
ldx #>hires_size ; number of pages to copy ldx #>hires_size ; number of pages to copy
ldy #0 ldy #0
: sta PAGE2OFF ; from main : lda (ptr),y
lda (ptr),y
sta PAGE2ON ; to aux
sta (ptr),y sta (ptr),y
iny iny
bne :- bne :-
@ -439,13 +440,15 @@ close: jsr close_file
dex dex
bne :- bne :-
sta RAMWRTON ; read aux, write aux
sta RAMRDON
sta SET80COL
;; MAIN memory half ;; MAIN memory half
sta PAGE2OFF sta PAGE2OFF
jsr read_file jsr read_file
jsr close_file jsr close_file
;; TODO: Restore PAGE2 state?
rts rts
.endproc .endproc
@ -464,15 +467,12 @@ close: jsr close_file
lda #0 ; row lda #0 ; row
rloop: pha rloop: pha
tax tax
lda hires_table_lo,x copy hires_table_lo,x, ptr
sta ptr copy hires_table_hi,x, ptr+1
lda hires_table_hi,x
sta ptr+1
ldy #cols-1 ; col ldy #cols-1 ; col
lda #0 copy #0, spill ; spill-over
sta spill ; spill-over
cloop: lda (ptr),y cloop: lda (ptr),y
tax tax
@ -504,8 +504,7 @@ hibitset:
sta PAGE2OFF sta PAGE2OFF
sta (ptr),y sta (ptr),y
lda #0 ; no spill bit copy #0, spill ; no spill bit
sta spill
next: next:
dey dey
bpl cloop bpl cloop
@ -546,10 +545,8 @@ inner:
lda #0 ; row # lda #0 ; row #
rloop: pha rloop: pha
tax tax
lda hires_table_lo,x copy hires_table_lo,x, src
sta src copy hires_table_hi,x, src+1
lda hires_table_hi,x
sta src+1
ldy #cols-1 ldy #cols-1
cloop: lda (src),y cloop: lda (src),y
sta (dst),y sta (dst),y
@ -579,10 +576,8 @@ inner:
lda #0 ; row # lda #0 ; row #
rloop: pha rloop: pha
tax tax
lda hires_table_lo,x copy hires_table_lo,x, dst
sta dst copy hires_table_hi,x, dst+1
lda hires_table_hi,x
sta dst+1
ldy #cols-1 ldy #cols-1
cloop: lda (src),y cloop: lda (src),y
sta (dst),y sta (dst),y
@ -612,8 +607,7 @@ mode: .byte 0 ; 0 = B&W, $80 = color
.proc set_color_mode .proc set_color_mode
lda mode lda mode
bne done bne done
lda #$80 copy #$80, mode
sta mode
;; AppleColor Card - Mode 2 (Color 140x192) ;; AppleColor Card - Mode 2 (Color 140x192)
sta SET80VID sta SET80VID