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


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

Re: Can anyone see a way to improve this ?

Newsgroups comp.sys.apple2.programmer
Date 2014-10-31 14:46 -0700
References (3 earlier) <727f6b36-eeed-4e07-b437-8b31fb58f041@googlegroups.com> <m2mrg5$c2$2@dont-email.me> <458a53bf-231c-437a-a49c-da0df9a64ea8@googlegroups.com> <593715696436289615.326117mjmahon-aol.com@news.giganews.com> <e80aa52e-8794-4f30-8f5e-c920a87de772@googlegroups.com>
Message-ID <2223ecd6-ff26-466c-9174-5ee723cbd99f@googlegroups.com> (permalink)
Subject Re: Can anyone see a way to improve this ?
From qkumba <peter.ferrie@gmail.com>

Show all headers | View raw


You have a bug that corrupts A in the event on an error in the even bits:
        LDA   #$01 
NEXTBIT  EOR   #$FF       ; Set and check complement first 
         STA   $2000,X 
         CMP   $2000,X 
         BNE   ERROR ;A is negated here
         ...
ERROR    JSR   FLAGERR 
CONT     ASL ;A still negated

If we combine Anton's and Vladmimir's suggestions, and fix the bug, we have this:

         LDX   #$00 
NEXTBYTE LDA   #$01 
NEXTBIT  EOR   #$FF       ; Set and check complement first 
         STA   $2000,X 
         CMP   $2000,X 
         BNE   FLAGERR1
         EOR   #$FF 
         STA   $2000,X 
         CMP   $2000,X 
         BNE   FLAGERR
CONT     ASL 
         BNE   NEXTBIT 
         INX 
         BNE   NEXTBYTE 
         RTS 
FLAGERR1 EOR   #$FF
FLAGERR  TAY  ; or PHA to free Y, but costs 1 more cycle
              ; Record this meaningfully in the future 
         TYA
         JMP   CONT

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


Thread

Can anyone see a way to improve this ? mdj <mdj.mdj@gmail.com> - 2014-10-27 05:04 -0700
  Re: Can anyone see a way to improve this ? "Anton Treuenfels" <teamtempest@yahoo.com> - 2014-10-27 08:38 -0500
  Re: Can anyone see a way to improve this ? Vladimir Ivanov <none@none.tld> - 2014-10-27 15:56 +0200
    Re: Can anyone see a way to improve this ? Michael J. Mahon <mjmahon@aol.com> - 2014-10-27 13:21 -0500
      Re: Can anyone see a way to improve this ? mdj <mdj.mdj@gmail.com> - 2014-10-27 17:48 -0700
        Re: Can anyone see a way to improve this ? Snertking <SNERTKING@GMAIL.COM> - 2014-10-27 21:28 -0400
          Re: Can anyone see a way to improve this ? mdj <mdj.mdj@gmail.com> - 2014-10-27 22:45 -0700
            Re: Can anyone see a way to improve this ? Michael J. Mahon <mjmahon@aol.com> - 2014-10-29 10:33 -0500
              Re: Can anyone see a way to improve this ? mdj <mdj.mdj@gmail.com> - 2014-10-29 22:54 -0700
                Re: Can anyone see a way to improve this ? qkumba <peter.ferrie@gmail.com> - 2014-10-31 14:46 -0700
      Re: Can anyone see a way to improve this ? Snertking <SNERTKING@GMAIL.COM> - 2014-10-27 21:25 -0400
      Re: Can anyone see a way to improve this ? michael.pohoreski@gmail.com - 2014-12-30 10:12 -0800
  Re: Can anyone see a way to improve this ? awanderin <awanderin@gmail.com> - 2014-10-27 21:35 -0600

csiph-web