;
-; Ullrich von Bassewitz, 06.08.1998
+; Piotr Fusik, 24.10.2003
+; originally by Ullrich von Bassewitz
;
; CC65 runtime: Scale the primary register by 8
;
.importzp tmp1
asrax3: stx tmp1
- cpx #$80 ; Put bit 7 into carry
- ror tmp1
- ror a
+ cpx #$80 ; Put bit 7 into carry
+ ror tmp1
+ ror a
+ cpx #$80
+ ror tmp1
+ ror a
+ cpx #$80
+ ror tmp1
+ ror a
ldx tmp1
- cpx #$80
- ror tmp1
- ror a
- ldx tmp1
- cpx #$80
- ror tmp1
- ror a
- ldx tmp1
- rts
+ rts
;
-; Ullrich von Bassewitz, 25.07.2001
+; Piotr Fusik, 24.10.2003
+; originally by Ullrich von Bassewitz
;
; CC65 runtime: Scale the primary register by 16
;
- .export asrax4
- .importzp tmp1
+ .export asrax4
+ .importzp tmp1
asrax4: stx tmp1
- cpx #$80 ; Put bit 7 into carry
- ror tmp1
- ror a
+ cpx #$80 ; Put bit 7 into carry
+ ror tmp1
+ ror a
+ cpx #$80
+ ror tmp1
+ ror a
+ cpx #$80
+ ror tmp1
+ ror a
+ cpx #$80
+ ror tmp1
+ ror a
ldx tmp1
- cpx #$80
- ror tmp1
- ror a
- ldx tmp1
- cpx #$80
- ror tmp1
- ror a
- ldx tmp1
- cpx #$80
- ror tmp1
- ror a
- ldx tmp1
- rts
+ rts
;
-; Ullrich von Bassewitz, 04.10.2001
+; Piotr Fusik, 24.10.2003
+; originally by Ullrich von Bassewitz
;
-; CC65 runtime: Multiply the primary register
+; CC65 runtime: Multiply the primary register by 10
;
- .export mulax10
+ .export mulax10
.importzp ptr1
.proc mulax10
- sta ptr1
+ sta ptr1
stx ptr1+1
asl a
rol ptr1+1
rol ptr1+1
clc
adc ptr1
- pha
+ sta ptr1
txa
adc ptr1+1
- sta ptr1+1
- pla
- asl a
- rol ptr1+1
- ldx ptr1+1
+ asl ptr1
+ rol a
+ tax
+ lda ptr1
rts
.endproc
;
-; Ullrich von Bassewitz, 16.03.2002
+; Piotr Fusik, 24.10.2003
+; originally by Ullrich von Bassewitz
;
-; CC65 runtime: Multiply the primary register
+; CC65 runtime: Multiply the primary register by 6
;
- .export mulax6
- .importzp ptr1
+ .export mulax6
+ .importzp ptr1
.proc mulax6
- sta ptr1
+ sta ptr1
stx ptr1+1
asl a
rol ptr1+1
clc
adc ptr1
- pha
+ sta ptr1
txa
adc ptr1+1
- sta ptr1+1
- pla
- asl a
- rol ptr1+1
- ldx ptr1+1
+ asl ptr1
+ rol a
+ tax
+ lda ptr1
rts
.endproc
;
-; Ullrich von Bassewitz, 16.03.2002
+; Piotr Fusik, 24.10.2003
+; originally by Ullrich von Bassewitz
;
-; CC65 runtime: Multiply the primary register
+; CC65 runtime: Multiply the primary register by 7
;
- .export mulax7
- .importzp ptr1, tmp1
+ .export mulax7
+ .importzp ptr1
.proc mulax7
sta ptr1
stx ptr1+1
- stx tmp1
- asl a
- rol tmp1 ; * 2
asl a
- rol tmp1 ; * 4
+ rol ptr1+1 ; * 2
asl a
- rol tmp1 ; * 8
+ rol ptr1+1 ; * 4
+ asl a
+ rol ptr1+1 ; * 8
sec
sbc ptr1
pha
- lda tmp1
- sbc ptr1+1 ; * (8 - 1)
+ txa
+ eor #$ff
+ adc ptr1+1 ; * (8 - 1)
tax
pla
rts
;
-; Ullrich von Bassewitz, 16.03.2002
+; Piotr Fusik, 24.10.2003
+; originally by Ullrich von Bassewitz
;
-; CC65 runtime: Multiply the primary register
+; CC65 runtime: Multiply the primary register by 9
;
- .export mulax9
- .importzp ptr1, tmp1
+ .export mulax9
+ .importzp ptr1
.proc mulax9
- sta ptr1
- stx ptr1+1
- stx tmp1
- asl a
- rol tmp1 ; * 2
- asl a
- rol tmp1 ; * 4
- asl a
- rol tmp1 ; * 8
+ sta ptr1
+ stx ptr1+1
+ asl a
+ rol ptr1+1 ; * 2
+ asl a
+ rol ptr1+1 ; * 4
+ asl a
+ rol ptr1+1 ; * 8
clc
- adc ptr1 ; * (8+1)
+ adc ptr1 ; * (8+1)
pha
- lda tmp1
+ txa
adc ptr1+1
tax
pla
;
-; Ullrich von Bassewitz, 25.10.2000
+; Piotr Fusik, 24.10.2003
+; originally by Ullrich von Bassewitz
;
; CC65 runtime: Decrement the stackpointer by value in y
;
- .export subysp
- .importzp sp, tmp1
+ .export subysp
+ .importzp sp
.proc subysp
- sty tmp1 ; Save the value
- lda sp ; Get lo byte
+ tya
+ eor #$ff
sec
- sbc tmp1 ; Subtract y value
- sta sp ; Put result back
+ adc sp
+ sta sp
bcs @L1
dec sp+1
-@L1: rts ; Done
+@L1: rts
.endproc
-
-
-