please dont rip this site

SX Microcontroller Radix Math Method

Binary to ASCII, 16 bit to 5 digits (1 at a time) no temp register (!)

by Nikolai Golovchenko

;Thanks Scott, your code is very instructive.
;Total execution time:
;worst case: 59 + 80 + 66 + 46 = 251 cycles

;Code size: 73

        clr     temp
sub30k
        mov     W, #3
        add     temp, W
        mov     W, #30000 & $FF
        sub     Lo, W

        mov     W, #30000 >> 8
        sb      C
        mov     W, #(30000 >> 8) + 1
        sub     Hi, W
        snb     C
        jmp     sub30k

add10k
        dec     temp
        mov     W, #10000 & $FF
        add     Lo, W

        mov     W, #(10000 >> 8)
        snb     C
        mov     W, #(10000 >> 8) + 1
        add     Hi, W
        sb      C
        jmp     add10k
;       Output(temp)         ;output temp = TenK
;worst case: 12 * 3 + 11 * 3 - 1 = 59

        clr     temp
sub3k
        mov     W, #3
        add     temp, W
        mov     W, #3000 & $FF
        sub     Lo, W

        mov     W, #(3000 >> 8)
        sb      C
        mov     W, #(3000 >> 8) + 1
        sub     Hi, W
        snb     C
        jmp     sub3k
add1k
        dec     temp
        mov     W, #1000 & $FF
        add     Lo, W

        mov     W, #(1000 >> 8)
        snb     C
        mov     W, #(1000 >> 8) + 1
        add     Hi, W
        sb      C
        jmp     add1k
;       Output(temp)         ;output temp = Thou
;worst case: 12 * 4 + 11 * 3 - 1 = 80

        clr     temp
sub300
        mov     W, #3
        add     temp, W
        mov     W, #300 & $FF
        sub     Lo, W

        mov     W, #(300 >> 8)
        sb      C
        mov     W, #(300 >> 8) + 1
        sub     Hi, W
        snb     C
        jmp     sub300

        mov     W, #100
add100
        dec     temp
        add     Lo, W
        sb      C
        jmp     add100
        inc     Hi
        snb     Hi.7
        jmp     add100
;       Output(temp)         ;output temp = Hund
;worst case: 11 * 4 + 6 * 3 + 3 = 66

        clr     temp
        mov     W, #30
sub30
        inc     temp
        sub     Lo, W
        snb     C
        jmp     sub30
        mov     W, temp
        rl      temp
        add     temp, W
        mov     W, #10
add10
        dec     temp
        add     Lo, W
        sb      C
        jmp     add10
;       Output(temp)         ;output temp = Tens
;worst case: 6 * 4 + 6 * 3 + 4 = 46

;       Output(Lo)         ;output temp = Ones



file: /Techref/scenix/lib/math/radix/b2a-16b4a-ng_sx.htm, 2KB, , updated: 2004/6/10 14:40, local time: 2024/3/29 05:19,
TOP NEW HELP FIND: 
18.206.238.189:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.org/Techref/scenix/lib/math/radix/b2a-16b4a-ng_sx.htm"> SX Microcontroller Radix Math Method - Binary to ASCII, 16 bit to 5 digits (1 at a time) no temp register</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .