by boomlinde · 11y ago · 0 comments
.pc=$7c
loop:
lda $d012 ; content of $d012 into accumulator
lsr ; shift accumulator right, moving lsbit into carry
lda #$cd ; value of diagonal line into accumulator
adc #0 ; add 0 + carry. if carry, accumulator will hold $ce, opposite diagonal line
jsr $ffd2 ; call CHROUT in rom; outputs character in accumulator on device
bcc loop ; branch to loop if carry is cleared; an effective branch-always which saves 1 byte from a jump
I'm sure it can be golfed further with the illegal opcodes that I am not familiar with.EDIT: Shed one byte, added comments, moved the origin to $7c which means that adding 2 bytes of header will make it a runnable C64 PRG.
I'm sure it can be golfed further with the illegal opcodes that I am not familiar with.
Possible. But not necessarily. Long time ago I reviewed the many illegal opcodes of the 6502. Many are simply doing nothing and most of them are not useful at all. The few that are useful give little benefits, because they can be used in very very few situations. I finally did not use them, since I don't wanted to break compatibility with 6502 successors (which where very few, finally).Yes, there are some interesting opcodes too, but I found their usage so limited, that it was not worthwhile to drop compatibility. Of course, with a fixed setting, where you need every byte .... but I must say, that for me today it is just academic, since I also do no embedded programming today. With computers of today, I still think, that optimizing is worthwhile, but not to that degree, that breaking compatibility makes sense.