Quantcast
Channel: Atari Systems Forums
Viewing all articles
Browse latest Browse all 22482

New 65C02 Instruction - OP CODE 80 - 7800 Only!

$
0
0
That's right fans, only on the 7800.

Have you ever noticed that all of the 6502 branch instructions end in a zero (0)?  There were extras that BRK, CPX, CPY, JSR, LDY, RTI, and RTS used up.  But one was missing.  Until now.  Finally exposed on atariage.com!!!

OPCODE $00 BRK Break - Force Interrupt, 1 byte, 7 cycles
OPCODE $10 BPL Branch if Positive, 2 bytes, 2 cycles
OPCODE $20 JSR   Jump to Subroutine, 3 bytes, 6 cycles
OPCODE $30 BMI Branch if Minus, 2 bytes, 2 cycles
OPCODE $40 RTI Return from Interrupt, 1 byte, 6 cycles
OPCODE $50 BVC Branch if Overflow Clear, 2 bytes, 2 cycles
OPCODE $60 RTS Return from Subroutine, 1 byte, 6 cycles
OPCODE $70 BVS Branch if Overflow Set, 2 bytes, 2 cycles

OPCODE $90 BCC Branch if Carry Clear, 2 bytes, 2 cycles
OPCODE $A0 LDY Load Y Register immediate, 2 bytes, 2 cycles
OPCODE $B0 BCS Branch if Carry Set, 2 bytes, 2 cycles
OPCODE $C0 CPY Compare Y Register immediate, 2 bytes, 2 cycles
OPCODE $D0 BNE Branch if Not Equal, 2 bytes, 2 cycles
OPCODE $E0 CPX Compare X Register immediate, 2 bytes, 2 cycles
OPCODE $F0 BEQ Branch if Equal, 2 bytes, 2 cycles

HERE'S THE ONE THAT'S MISSING…
OPCODE $80 BBQ Branch if Ready to Party, 2 bytes, infinite cycles (!)  This instruction runs until you stop it!

So what do you do with this new found instruction?  Anyone who has programmed a game on the 7800 knows there's always a possible brick wall to your coding right around any corner.  The former choices:  (1) sleep on it and try again another day, (2) punt and cancel the game, or (3) call TEP392 and have Perry deal with it, as the 7800 insiders call it TEP-perware support, ya know Tepperware - every household should have Tepperware.  Or now, we can use OP CODE 80.

How does OP CODE 80 work?  If you have code, any code that you can't get to work, simply add OP CODE 80 and it will automatically solve the problem.  You can have OP CODE 80 operate in a range, by entering $80$10 and it will diagnose and correct the 16 bytes following the BBQ (80) instruction.  Or the master trick is to enter $80$00 and it will diagnose problems forever, or until you halt the process.  This cutting edge technology is using the new 78XX Divide-By-Zero (DBZ) technology.  Here's an example of some code with OP CODE 80 implemented:

MOVEDOIT:
D516---B5-A2-----LDA BALLXPOS,X ;FIRST CHECK IF THE BALL IS OUTSIDE THE BOUNDARIES OF THE SCREEN
D518---C9-18-----CMP #LEFTSIDE
D51A---90-FA-----BCC MOVEDOIT
D51C---C9-88-----CMP #RGHTSIDE ;RIGHT SIDE MINUS WIDTH OF SPRITE
D51E---B0-13-----BCS MOVEFORCEL
D520---B5-A6-----LDA BALLYPOS,X
D522---C9-C8-----CMP #BOTSIDE
D524---B0-14-----BCS MOVEFORCEV
D526---80-00-----BBQ EVERYTHING ;SOLVE ALL MY 7800 CODING PROBLEMS
D528---C9-04-----CMP #TOPSIDE + 4
D52A---90-10-----BCC MOVEFORCEV
D52C---B0-56-----BCS MOVEBALLOK

When this code was executed, it found that "90 FA" was wrong, and it should have been "90 10."  Problem solved.  Programming the 7800 has never been so easy!!!

How do you read these branch instructions anyways?  Example "90 FA".  When the number is less than zero, eg-FA you count backwards to find where the branch is jumping to.  The first byte counted is FA which is count FF, the next byte backwards is 90=FE, and the next byte is 18=FD, and the next byte is C9=FC, and the next byte is A2=FB, and the final byte is B5=FA.  This is where 90 FA will branch to in this code.  For a positive count branch like B0 13, you count 19 (13 hex = 19 decimal) bytes beyond the B0 13.  Hence you start counting at B5=01, A6=02, C9=03, etc.


Are you RDY2PARTY?  Use BBQ OP CODE 80 today.


Could be Hollywood's next smash hit.  OP CODE 80

Viewing all articles
Browse latest Browse all 22482

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>