]> git.sur5r.net Git - cc65/commitdiff
multiply by 40 routine
authorcpg <cpg@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 23 Jun 2000 22:06:37 +0000 (22:06 +0000)
committercpg <cpg@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 23 Jun 2000 22:06:37 +0000 (22:06 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@118 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/atari/mul40.s [new file with mode: 0644]

diff --git a/libsrc/atari/mul40.s b/libsrc/atari/mul40.s
new file mode 100644 (file)
index 0000000..b14d960
--- /dev/null
@@ -0,0 +1,35 @@
+;
+; Christian Groessler, June 2000
+;
+; mul40
+; multiplies A by 40 and returns result in AX
+; uses tmp4
+
+       .importzp       tmp4
+       .export         mul40
+
+.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