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


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

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-07 09:01 -0600
Organization A noiseless patient Spider
Message-ID <yubbm99s66n.fsf@gmail.com> (permalink)
References (2 earlier) <pmoras$q2u$1@dont-email.me> <EuWdnZk5ntxaYBLGnZ2dnUU7-QHNnZ2d@giganews.com> <3e97b12c-8d58-43ea-b780-1ac58a313ac8@googlegroups.com> <yubftynrx1v.fsf@gmail.com> <056fd503-9d49-4a25-b70a-bd77faadb46b@googlegroups.com>

Show all headers | View raw


Michael Barry <barrym95838@yahoo.com> writes:

> On Wednesday, September 5, 2018 at 10:53:49 PM UTC-7, awanderin wrote:
>> 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
>
> I like it, Jerry!  If we know we're always going to jsr to it, we
>  could shave one more byte like so, right?
>
> lab1:
>       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
>       .db   $b0         ; bcs op-code
> prbin:
>       sec               ; force all 8 bits to print
>       rol   value
>       bne   lab1
>       rts

Sure, that works.  Nice!


--
Jerry    awanderin at gmail dot com

Back to comp.sys.apple2.programmer | Previous | Next — Previous 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