Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #4751

Re: Efficient print of binary value

From awanderin <awanderin@gmail.com>
Newsgroups comp.sys.apple2.programmer
Subject Re: Efficient print of binary value
Date 2018-09-05 23:53 -0600
Organization A noiseless patient Spider
Message-ID <yubftynrx1v.fsf@gmail.com> (permalink)
References <pmokev$c9j$1@dont-email.me> <045a4a1c-c5b5-4701-b4fb-e7cd8055cd31@googlegroups.com> <pmoras$q2u$1@dont-email.me> <EuWdnZk5ntxaYBLGnZ2dnUU7-QHNnZ2d@giganews.com> <3e97b12c-8d58-43ea-b780-1ac58a313ac8@googlegroups.com>

Show all headers | View raw


qkumba <peter.ferrie@gmail.com> writes:

> Not even close to half-length, but not branching:
>
>          LDA   #%10000000 
>          STA   MASK 
>
> LAB1     LDA   MASK
>          AND   VALUE
>          CMP   #1
>          LDA   #"0
>          ADC   #0
>          JSR   COUT 
>          LSR   MASK 
>          BNE   LAB1 


How about this?

           sec         ; force all 8 bits to print
lab1       rol  value
           beq  :done
           lda  #$58   ; high-ascii "0" right-shifted one bit
           rol         ; now it's "0" or "1"
           jsr  cout
           clc         ; now shift in zeros until done
           bcc  lab1
:done

-- 
--
Jerry    awanderin at gmail dot com

Back to comp.sys.apple2.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Efficient print of binary value Jan Poulsen <jpo@tiggr.dk> - 2018-09-05 15:07 +0200
  Re: Efficient print of binary value Marco Verpelli <mverpelli@libero.it> - 2018-09-05 07:23 -0700
    Re: Efficient print of binary value Jan Poulsen <jpo@tiggr.dk> - 2018-09-05 17:05 +0200
      Re: Efficient print of binary value Michael J. Mahon <mjmahon@aol.com> - 2018-09-05 11:01 -0500
        Re: Efficient print of binary value qkumba <peter.ferrie@gmail.com> - 2018-09-05 11:13 -0700
          Re: Efficient print of binary value Michael J. Mahon <mjmahon@aol.com> - 2018-09-05 14:18 -0500
          Re: Efficient print of binary value Marco Verpelli <mverpelli@libero.it> - 2018-09-05 12:32 -0700
            Re: Efficient print of binary value Michael J. Mahon <mjmahon@aol.com> - 2018-09-05 22:21 -0500
          Re: Efficient print of binary value awanderin <awanderin@gmail.com> - 2018-09-05 23:53 -0600
            Re: Efficient print of binary value Jan Poulsen <jpo@tiggr.dk> - 2018-09-06 13:04 +0200
            Re: Efficient print of binary value Michael Barry <barrym95838@yahoo.com> - 2018-09-06 23:54 -0700
              Re: Efficient print of binary value awanderin <awanderin@gmail.com> - 2018-09-07 09:01 -0600

csiph-web