| |
Testa Account closed
Registered: Oct 2004 Posts: 197 |
how reliable is illigal opcode: skip next byte.
i have a guestion, when you have fpp graphics you always stretch rc0 or rc7 to do the fpp trick.. this means that in the charsetbuffer only one of each 8 bytes is used..
is it possible to put code in the 7 byte area en skip the graphics byte with the skb opcde and continue the code
in the next 7 bytes?
i tested it with vice and it works, but how is it on real
hardware..
and maybe a 'stopid question' is it possible to do this
skb byte trick with a sidplayer.. or will the skb execution time of 2 cycles fuck up the sid..
i never have coded a sid routine so i really don't know this...
|
|
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
By SKB do you mean a 2 byte 3 cycle NOP, such as $04, $44, or $64? Then sure, you can interleave code as long as you can fit it in chunks of 6 bytes and don't mind NOP:ing 3 cycles. I have a hard time seeing when that would be an optimal solution though. |
| |
WVL
Registered: Mar 2002 Posts: 902 |
Ofcourse it works, but I guess you need either very repetitive code (and a code generator) OR some kind of special assembler for the job that inserts NOOP and NOOOP by itself.. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
you could also use a bit $graphicsbyte, zp or absolute. |
| |
WVL
Registered: Mar 2002 Posts: 902 |
No, because BIT sets N,V and Z flags. So it's not usable for generic code.
Oh! and you better be damn sure you dont have any tables inside that memory area! or anything else that you're trying to index. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
I didnt mean it for generic code. It's a nice problem tho. Coding such an assembler :) I have an idea which needs something similar, but the problem is way more simple. |
| |
Testa Account closed
Registered: Oct 2004 Posts: 197 |
i mean illigal opcode $80, $82, $c2 etc.. but now i think
about it a lda ($a9) will do the job too...
lda $1000 ;3 bytes ;$0a00
sta $2000 ;3 bytes ;$0a03
lda ;1 byte ;$0a06
.byte $?? ;the graphics byte ;$0a07 (rc7)
continue code here..
this will take 2 cycles too but it costs a register..
so SKB will be better. (but the flags must be untouched by the SKB opcode)
edit:WVL, why is a table with a index a problem
just use an extra index table for the x or y reg.
, but you already knew this.
infact you can store everything in al the free 7 bytes..
even packed or crunched data.. if you want you can
put the next cruched part of a spacabar demo in the free bytes..
|
| |
WVL
Registered: Mar 2002 Posts: 902 |
Ofcourse but you knew that too ;) But where are you going to put the _extra_ index table? ;)
x = index register
instead of
ldx #index
lda data,x
you would write :
ldx #index
ldy correctformissingbytes,x
lda data,y
but where in memory is the correctformissingbytes table? and how are you going to fix the indexing to this table? As you see, you've gained nothing and only used up the memory for the table twice, and lost extra lookup-cycles. -> don't put tables in this memory, except when they're <= 7 bytes long and aligned with the skipped bytes.
The only exception is when you're really starved for memory and have one fix-indexing-table outside the messed up memory area, and use that one for reading from all the tables inside the fpp-area. This does mean that you have to align all the tables in the fpp-area to the occupied bytes though. Another disadvantage : max table lenght is only 256-32 = 224 bytes.
NOP #imm and NOP $dead should be perfectly stable on real machines also (except on machines with scpu, but who cares about them). |