Groups | Search | Server Info | Login | Register
Groups > comp.sys.apple2.programmer > #6310
| From | Colin Leroy-Mira <colin@colino.net> |
|---|---|
| Newsgroups | comp.sys.apple2.programmer |
| Subject | Re: Help me with a crash theory? |
| Date | 2024-04-23 17:54 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <20240423175437.7787d420@laptop-sigfox> (permalink) |
| References | <20240423090459.6e9a34b4@laptop-sigfox> |
Hi,
>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.
Replying to myself: that theory is valid.
I tested it using a sender on the PC, doing
char buf[10000];
for (i = 0; i < 10000; i++)
buf[i] = (buf % 2) ? 0xf0 : 0x0f
while(1)
fwrite(buf, 1, 10000, tty);
On the Apple II, a basic cc65 program doing:
while (1) {
char r = read_stuff();
printf("unexpected %02x\n", r);
}
with read_stuff() being:
_read_stuff:
: lda $C0A9 ; Wait for first byte
and #$08
beq :-
; loop, reading data reg directly
duty_cycle:
lda $C0A8 ; 4 - get data byte
cmp #$F0 ; 6
beq ok_f0 ; 8/9
cmp #$0F ; 10
beq ok_0f ; 12/13
ldx #$00 ; We got something else. Return it.
rts
ok_f0: WASTE_63 ; 72 (9+63)
bra duty_cycle ; 75
ok_0f: WASTE_59 ; 72 (13+59)
bra duty_cycle ; 75
Mystery solved :)
--
Colin
https://www.colino.net/
Back to comp.sys.apple2.programmer | Previous | Next — Previous 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