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


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

Re: Efficient print of binary value

Path csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From awanderin <awanderin@gmail.com>
Newsgroups comp.sys.apple2.programmer
Subject Re: Efficient print of binary value
Date Fri, 07 Sep 2018 09:01:04 -0600
Organization A noiseless patient Spider
Lines 39
Message-ID <yubbm99s66n.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> <yubftynrx1v.fsf@gmail.com> <056fd503-9d49-4a25-b70a-bd77faadb46b@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain
Injection-Info h2725194.stratoserver.net; posting-host="3c69a4fa9902a9b174503d66124abd70"; logging-data="8032"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/GmOOMekAM8BXptVSLUImAC+q7eQTqWSM="
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)
Cancel-Lock sha1:lYPojxKCtroQvlK8P/bFIJMYMMk= sha1:eOayV6oPQrjpG3XQQZFSx+GNM+o=
Xref csiph.com comp.sys.apple2.programmer:4758

Show key headers only | 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