Groups | Search | Server Info | Login | Register
Groups > comp.sys.apple2.programmer > #6309
| Path | csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Colin Leroy-Mira <colin@colino.net> |
| Newsgroups | comp.sys.apple2.programmer |
| Subject | Help me with a crash theory? |
| Date | Tue, 23 Apr 2024 09:04:59 +0200 |
| Organization | A noiseless patient Spider |
| Lines | 57 |
| Message-ID | <20240423090459.6e9a34b4@laptop-sigfox> (permalink) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Tue, 23 Apr 2024 09:05:02 +0200 (CEST) |
| Injection-Info | dont-email.me; posting-host="6f48bc08933f1ed7594ac86d2b3c7c06"; logging-data="1575461"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/n0dHb2yJPgxumFhm8ZE43FCKsiHfElUw=" |
| Cancel-Lock | sha1:vvAn23EKTGjlrly8nz4Njlnhm1k= |
| X-Newsreader | Claws Mail 3.19.1git30 (GTK+ 2.24.33; x86_64-pc-linux-gnu) |
| Xref | csiph.com comp.sys.apple2.programmer:6309 |
Show key headers only | View raw
Hi all, I have a low-level ACIA serial question for you. Context: I'm working on my Wozamp thingy, specificaly the audio+video streaming part. It works similar to A2stream for the audio, except it reads from the ACIA instead of an Uthernet card to redirect execution to the next duty cycle. I have started investigating a new, weird bug yesterday evening. I had relocated my duty cycle code, which consists of 32 different duty cycles functions, all aligned on pages so I can jump from one to another by updating just the high byte of the jmp pointer. My duty cycle functions started at $6000, $6100, etc to $7F00 and everything worked fine. Yesterday I relocated that to $6400 to $8300. Emulation still works good, but it crashes on real hardware. The only theory I have right now is that it's due to my savage way of reading the next destination byte from the ACIA DATA register: I don't have enough cycles to check the STATUS register, so I just read the DATA one. At worst, I thought, I'll re-read the same byte, and that's not a problem. (and it was not a problem with my functions from $6000 to $7F00). But in fact, I'm wondering, can I read a byte from the DATA register in the middle of the ACIA writing it? This would explain the bug: $60 = 01100000 $7F = 01111111 But: $64 = 01100100 $83 = 10000011 If I indeed read a byte right when it's written, the first solution is no problem, because the high bit is always 0, and then the ACIA can update bits in the order it wants, I have a handler at any 011xxxxx location. But the second solution would be problematic: what if the ACIA updates the data register from $7E (01111110), to $81 (10000001) ? If the high bit is the first one updated, I could read 11111110 ($FE), and jump to $FE00 which would be bad. Or, if I go from $83 (10000011) to $64 (01100100) ? Reading in the middle of this write could result in 00000011 ($03, bad) if bits are written high to low, or 1000100 ($84, also bad) if they are written low to high. In both cases, reading the DATA register without a care for the STATUS register telling me a byte is ready just happens to work safely with numbers from $60 to $7F, but can wreak havoc with numbers from $64 to $83. Does this theory sound plausible to you folks? -- Colin https://www.colino.net/
Back to comp.sys.apple2.programmer | Previous | Next — Next in thread | Find similar
Help me with a crash theory? Colin Leroy-Mira <colin@colino.net> - 2024-04-23 09:04 +0200 Re: Help me with a crash theory? Colin Leroy-Mira <colin@colino.net> - 2024-04-23 17:54 +0200
csiph-web