Closed utterances-bot closed 1 month ago
could you change FILL to: LDX #DISBUF-ENDBUF FILL: STAA ENDBUF,X INX BNE FILL ?
can you change FETCH this way: FETCH: LDX PPC ; POINT TO NEXT INSTR LDAB 0,X ; COPY TO PIR STAB PIR ANDB #$0F STAB ZHI JSR SKIP2 ; BUMP PRGM-CTR ?
can you move SKIP2 here: SKFEQ: CMPA VX BNE RETMON SKIP2: LDX PPC ; ADD 2 TO PPC INX INX STX PPC RTS ?
for RANDOM, why not: LDX #$C0 ; HIGH-ORDER BYTE OF RNDX = STX RNDX ; =MSB OF CHIP8 START ADRS ?
it looks like SHOW3 should move down by one line.
@peterferrie Thanks so much for your suggestions! Let me know if I misunderstood any of them.
could you change FILL to:
Huh. Very clever! Thank you! (Did you mean #ENDBUF-DISBUF
though?)
can you change FETCH this way:
Sadly, CHIP-8 instructions are two bytes long. So both PIR
and ZHI
need to point to both of those bytes (PIR+1
and ZLO
).
can you move SKIP2 here:
I put it where it is now so SKFNV
can fall through to SKIP2
– if I move it up so that SKFEQ
falls through to SKIP2
instead, I'll need to branch from SKFNV
instead. I could move SKIP2
within that whole segment, but all the routines there need to branch to it except one which can fall through. Right?
for RANDOM, why not:
Not sure I understand that one. Won't that set RNDX
to $C000
every time RANDOM
is called? That should be the initial seed, but the lower byte should increment between calls.
it looks like SHOW3 should move down by one line.
Good catch!! Definitely burning some unnecessary cycles there.
could you change FILL to:
Huh. Very clever! Thank you! (Did you mean
#ENDBUF-DISBUF
though?)
No, I meant DISBUF-ENDBUF so that X has a negative value and you increment until it reaches zero.
can you change FETCH this way:
Sadly, CHIP-8 instructions are two bytes long. So both
PIR
andZHI
need to point to both of those bytes (PIR+1
andZLO
).
Yes, I see it now.
can you move SKIP2 here:
I put it where it is now so
SKFNV
can fall through toSKIP2
SKFNV doesn't fall through to SKIP2 - it's gated by a BRA. That's why I thought that SKIP2 can move.
for RANDOM, why not:
Not sure I understand that one. Won't that set
RNDX
to$C000
every timeRANDOM
is called? That should be the initial seed, but the lower byte should increment between calls.
Yes, ignore that. It's my mistake again about X being 16-bit not 8-bit.
Comments for https://tobiasvl.github.io/blog/chipos-hacking/