Optimized mul20 & mul40 and extracted to new library.
This commit is contained in:
committed by
Oliver Schmidt
parent
fbf302e6cd
commit
399250a105
@@ -7,7 +7,7 @@
|
||||
|
||||
.export _cputcxy, _cputc
|
||||
.export plot, cputdirect, putchar
|
||||
.import gotoxy, mul40
|
||||
.import gotoxy, _mul40
|
||||
.importzp tmp4,ptr4
|
||||
.import _revflag,setcursor
|
||||
|
||||
@@ -71,8 +71,7 @@ putchar:
|
||||
sta (OLDADR),y
|
||||
|
||||
lda ROWCRS
|
||||
jsr mul40 ; destroys tmp4
|
||||
clc
|
||||
jsr _mul40 ; destroys tmp4, carry is cleared
|
||||
adc SAVMSC ; add start of screen memory
|
||||
sta ptr4
|
||||
txa
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
.export _mouse_txt_callbacks
|
||||
.importzp tmp4
|
||||
.import mul40,loc_tmp
|
||||
.import _mul40
|
||||
.importzp mouse_txt_char ; screen code of mouse cursor
|
||||
|
||||
.include "atari.inc"
|
||||
@@ -104,22 +104,15 @@ movex:
|
||||
|
||||
; Move the mouse cursor y position to the value in A/X.
|
||||
movey:
|
||||
tax
|
||||
ldy tmp4 ; mul40 uses tmp4
|
||||
lda loc_tmp ; and this local variable
|
||||
pha
|
||||
txa ; get parameter back
|
||||
ldy tmp4 ; mul40 uses tmp4, save in Y
|
||||
lsr a ; convert y position to character line
|
||||
lsr a
|
||||
lsr a
|
||||
jsr mul40
|
||||
clc
|
||||
jsr _mul40 ; carry is cleared by _mul40
|
||||
adc SAVMSC
|
||||
sta scrptr
|
||||
txa
|
||||
adc SAVMSC+1
|
||||
sta scrptr+1
|
||||
pla
|
||||
sta loc_tmp
|
||||
sty tmp4
|
||||
sty tmp4 ; restore tmp4
|
||||
rts
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
;
|
||||
; Christian Groessler, June 2000
|
||||
;
|
||||
; mul40
|
||||
; multiplies A by 40 and returns result in AX
|
||||
; uses tmp4
|
||||
|
||||
.importzp tmp4
|
||||
.export mul40,loc_tmp
|
||||
|
||||
.proc mul40
|
||||
|
||||
ldx #0
|
||||
stx tmp4
|
||||
sta loc_tmp
|
||||
asl a
|
||||
rol tmp4
|
||||
asl a
|
||||
rol tmp4 ; val * 4
|
||||
adc loc_tmp
|
||||
bcc L1
|
||||
inc tmp4 ; val * 5
|
||||
L1: asl a
|
||||
rol tmp4 ; val * 10
|
||||
asl a
|
||||
rol tmp4
|
||||
asl a
|
||||
rol tmp4 ; val * 40
|
||||
ldx tmp4
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.bss
|
||||
loc_tmp:.res 1
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
.include "atari.inc"
|
||||
.importzp tmp1,tmp4,ptr1,ptr2
|
||||
.import mul40,_clrscr
|
||||
.import _mul40,_clrscr
|
||||
.export __scroll
|
||||
|
||||
.proc __scroll
|
||||
@@ -40,7 +40,7 @@ down_ok:lda SAVMSC
|
||||
sta ptr2+1
|
||||
|
||||
lda tmp1
|
||||
jsr mul40
|
||||
jsr _mul40
|
||||
sta tmp4
|
||||
lda ptr2
|
||||
sec
|
||||
@@ -103,8 +103,7 @@ up: sta tmp1 ; # of lines to scroll
|
||||
jmp _clrscr
|
||||
|
||||
;multiply by 40 (xsize)
|
||||
up_ok: jsr mul40
|
||||
clc
|
||||
up_ok: jsr _mul40 ; carry is cleared by _mul40
|
||||
adc SAVMSC ; add start of screen mem
|
||||
sta ptr2
|
||||
txa
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
; cursor handling, internal function
|
||||
|
||||
.include "atari.inc"
|
||||
.import cursor,mul40
|
||||
.import cursor,_mul40
|
||||
.export setcursor
|
||||
|
||||
.proc setcursor
|
||||
@@ -14,8 +14,7 @@
|
||||
sta (OLDADR),y
|
||||
|
||||
lda ROWCRS
|
||||
jsr mul40
|
||||
clc
|
||||
jsr _mul40 ; function leaves with carry clear!
|
||||
adc SAVMSC ; add start of screen memory
|
||||
sta OLDADR
|
||||
txa
|
||||
|
||||
Reference in New Issue
Block a user