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


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

Resolved!, was Re: Uthernet receive error: bytes swapped

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From D Finnigan <dog_cow@macgui.com>
Newsgroups comp.sys.apple2.programmer
Subject Resolved!, was Re: Uthernet receive error: bytes swapped
Date Mon, 2 Mar 2015 20:47:29 +0000 (UTC)
Organization Mac GUI
Lines 47
Message-ID <dog_cow-1425329291@macgui.com> (permalink)
References <dog_cow-1425155060@macgui.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Injection-Date Mon, 2 Mar 2015 20:47:29 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="ac9e0e4d7dd3957fb97803ee6801bab8"; logging-data="8057"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+vrwamdu/amKMNajQmKFfL"
User-Agent Mac GUI Usenet
In-Reply-To <dog_cow-1425155060@macgui.com>
Cancel-Lock sha1:u9Bs72t1QSsJGYj3uknw+e942Gk=
Xref csiph.com comp.sys.apple2.programmer:1546

Show key headers only | View raw


First off, thanks to everyone for giving me a chance to talk about this
problem. I'm pretty sure it led me to the solution faster than if I hadn't
discussed it.

Wireshark has been a good friend of mine, and here's a screenshot detailing
what was happening:
http://macgui.com/gallery/showphoto.php?pic_id=3495

Click the image to get the full-size version. That's pretty well documented
in the picture, so I won't talk about it any more.

Both problems were caused by programmer error. As far as I can tell, there
was nothing wrong with the hardware.

The checksum error was caused by a loop that was running twice as long as it
should have. I am using an optimized checksum routine set for 20 byte IP
headers. I unrolled the loop using Merlin's LUP command. But instead of
doing LUP 10, because I'm accessing two bytes per iteration, I did LUP 20.
You can see where my thinking was mixed up there.

What's incredible is how the checksum routine still managed to give correct
results in so many cases. That's definitely one of those tricky bugs.


Ok, now on to the real issue of this thread: the doubled byte, followed by
the swapped bytes. My explanation of "missing a beat" is exactly what
happened. There was a condition in my receive loop where it was possible
that the same RXTX data register would be accessed twice in a row. This
caused the double byte, then on each successive iteration, the accesses to
the CS8900A were out of order, thus producing the swapped bytes. The cause
in my code was due to not properly updating the zero-page base address used
with indirect indexed Y addressing.

Again, this was an interesting bug because in most cases, the code worked
correctly, making it tricky to distinguish a hardware error from a software
error.

These bugs were getting me pretty upset, so I'm really glad to get them both
nailed. I'll be posting more details on my project later this month.
Obviously, it's a TCP/IP stack... ;-)

-- 
]DF$
Apple II Book: http://macgui.com/newa2guide/
Usenet: http://macgui.com/usenet/  <-- get posts by email!
Apple II Web & Blog hosting: http://a2hq.com/

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


Thread

Uthernet receive error: bytes swapped D Finnigan <dog_cow@macgui.com> - 2015-02-28 20:23 +0000
  Re: Uthernet receive error: bytes swapped David Schmenk <dschmenk@gmail.com> - 2015-02-28 12:58 -0800
  Re: Uthernet receive error: bytes swapped a2retrosystems@gmail.com - 2015-02-28 16:20 -0800
    Re: Uthernet receive error: bytes swapped D Finnigan <dog_cow@macgui.com> - 2015-03-01 00:34 +0000
      Re: Uthernet receive error: bytes swapped a2retrosystems@gmail.com - 2015-02-28 17:17 -0800
      Re: Uthernet receive error: bytes swapped David Schmidt <schmidtd@my-deja.com> - 2015-02-28 21:58 -0500
  Re: Uthernet receive error: bytes swapped ol.sc@web.de (Oliver Schmidt) - 2015-03-01 14:33 +0000
    Re: Uthernet receive error: bytes swapped David Schmenk <dschmenk@gmail.com> - 2015-03-01 12:15 -0800
  Resolved!, was Re: Uthernet receive error: bytes swapped D Finnigan <dog_cow@macgui.com> - 2015-03-02 20:47 +0000
    Re: Resolved!, was Re: Uthernet receive error: bytes swapped gids.rs@sasktel.net - 2015-03-02 16:14 -0800
      Re: Resolved!, was Re: Uthernet receive error: bytes swapped D Finnigan <dog_cow@macgui.com> - 2015-03-06 00:30 +0000
        Re: Resolved!, was Re: Uthernet receive error: bytes swapped David Schmidt <schmidtd@my-deja.com> - 2015-03-05 20:53 -0500
          Re: Resolved!, was Re: Uthernet receive error: bytes swapped D Finnigan <dog_cow@macgui.com> - 2015-03-07 17:37 +0000
        Re: Resolved!, was Re: Uthernet receive error: bytes swapped David Schmenk <dschmenk@gmail.com> - 2015-03-06 07:21 -0800
          Re: Resolved!, was Re: Uthernet receive error: bytes swapped D Finnigan <dog_cow@macgui.com> - 2015-03-07 17:31 +0000

csiph-web