c65 OpCodes, Draft1 =====================================================}94/02/06/04:43p{==== This text file brought to you courtesy of TPUG via CRSo. by Jim Butterfield and myself, }>ug Rodger. Additions From: Simon Laule (c900cade@w255zrz.zrz.tu-berlin.de) 5 Feb 1994 13:17:58 GMT System: c65 v0.9.910111 CBDOS v1.0, 1084 RGBa {roundy} and 1581 {device 10}. FileName Text . Binary TPUG Disk: c65.opz1,s : c65dump,p c65.1 Purpose: define all the csg65ce02 OpCodez. -rough draft so far.. ====} Ledgend {=========================================================== ++ -LONG Branches! 2 byte operand and Relative Adressing! ?? -Unclear as yet, possibly hardwired to another chip. ** -Unclear, within in easy reach though. !! -Surprisingly useful bonus! word -Seem to be 2_byte/word related. ..after working through these so long the OpCodez relating to Z register are starting to look normal! BTW; I originaly suspected no ZeroPage adressing for Z Register ..{honk!} I wuz quite wrong, there are a few. {stz zp : stz zp,x : cpz zp} No ldz zp!! }>ug.. ====} OpCodez {=========================================================== BYTES 00 brk 01 00 ora ($00,x) 02 cle ?? Clear Emulation ??? 03 see ?? Set Emulation ??? 04 00 tsb $00 ** 05 00 ora $00 06 00 asl $00 07 00 rmb0 $00 ** 08 php 09 00 ora #00 0a asl 0b tsy 0c 01 00 tsb $0001 ** 0d 01 00 ora $0001 0e 01 00 asl $0001 0f 01 00 bbr0 $01,$310e ** branch on bit reset (0.bit) bbr0-bbr7 ( also bbs0-7: branch on bit set) 10 00 bpl $3020 11 00 ora ($00),y 12 00 ora ($00),z 13 00 00 bpl $3008 ++ 3 (just like 65c02) 14 00 trb $00 ?? 15 00 ora $00,x 16 00 asl $00,x 17 0a rmb1 $0a ** 18 clc 19 01 00 ora $0001,y 1a inc 1b inz Increment Z-Register 1c 01 00 trb $0001 ?? 1d 01 00 ora $0001,x 1e 01 00 asl $0001,x 1f 01 00 bbr1 $01,$3020 ** 20 01 00 jsr $0001 21 00 and ($00,x) 22 01 00 jsr ($0001) new: JSR x-indiziert 23 01 00 jsr ($0001,x) !! 24 00 bit $00 25 00 and $00 26 00 rol $00 27 00 rmb2 $00 ** Reset bit 2, ZP 28 plp 29 00 and #$00 2a rol 2b tys 2c 00 00 bit $0000 2d 00 00 and $0000 2e 00 00 rol $0000 2f 00 00 bbr2 $00,$3047 ** 30 00 bmi $3049 31 00 and ($00),y 32 00 and ($00),z 33 01 00 bmi $3050 ++ 34 00 bit $00,x 35 00 and $00,x 36 00 rol $00,x 37 00 rmb3 $00 ** 38 sec 39 01 00 and $0001,y 3a dec a 3b dez 3c 01 00 bit $0001,x 3d 01 00 and $0001,x 3e 01 00 rol $0001,x 3f 01 00 bbr3 $01,$306a ** 40 rti 41 00 eor ($00,x) 42 neg ?? negate akku??? 43 asr a 44 00 asr $00 45 00 eor $00 46 00 lsr $00 47 00 rmb4 $00 ** 48 pha 49 00 eor #$00 4a lsr a 4b taz transfer akku -> z-register 4c 01 00 jmp $0001 4d 01 00 eor $0001 4e 01 00 lsr $0001 4f 01 00 bbr4 $01,$3088 ** 50 00 bvc $308a 51 00 eor ($00),y 52 00 eor ($00),z 53 01 00 bvc $3091 ++ 54 00 asr $00,x 55 00 eor $00,x 56 00 lsr $00,x 57 00 rmb5 $00 ** 58 cli 59 01 00 eor $0001,y 5a phy 5b tab !!! 5c map !!! 5d 01 00 eor $0001,x 5e 01 00 lsr $0001,x 5f 01 00 bbr5 $01,$30a9 ** 60 rts 61 00 adc ($00,x) 62 00 rts #$00 63 01 00 bsr $30b1 ++ 64 00 stz $00 65 00 adc $00 66 00 ror $00 67 00 rmb6 $00 ** 68 pla 69 00 adc #$00 6a ror 6b tza transfer z-reg -> akku 6c 01 00 jmp ($0001) 6d 01 00 adc $0001 6e 01 00 ror $0001 6f 01 00 bbr6 $01,$30ca ** 70 00 bvc $30cc 71 00 adc ($00),y 72 00 adc ($00),z 73 01 00 bvs $30d3 ++ 74 00 stz $00,x 75 00 adc $00,x 76 00 ror $00,x 77 00 rmb7 $00 ** 78 sei 79 01 00 adc $0001,y 7a ply pull from stack in y-register 7b tba !!!... 7c 01 00 jmp ($0001,x) !!!... 7d 01 00 adc $0001,x 7e 01 00 ror $0001,x 7f 01 00 bbr7 $01,$30ed ** 80 00 bra $30ff ++ branch always (relativ) 81 00 sta ($00,x) 82 00 sta ($00,sp),y !!!! SP - StackPointer, like 65c816 83 01 00 bra $30f6 ++!! branch always ( direkt or relativ long) 84 00 sty $00 85 00 sta $00 86 00 stx $00 87 00 smb0 $00 ** set bit 0, ZP 88 dey 89 00 bit #$00 8a txa 8b 01 00 sty $0001,x 8c 01 00 sty $0001 8d 01 00 sta $0001 8e 01 01 stx $0001 8f 00 00 bbs0 $00,$3111 ** 90 00 bcc $3113 91 00 sta ($00),y 92 00 sta ($00),z 93 01 00 bcc $311a ++ 94 00 sty $00,x 95 00 sta $00,x 96 00 stx $00,y 97 00 smb1 $00 ** 98 tya 99 01 00 sta $0000,y 9a txs 9b 01 00 stx $0001,y 9c 01 00 stz $0001 9d 01 00 sta $0001,x 9e 01 00 stz $0001,x 9f 01 00 bbs1 $01,$3136 ** a0 00 ldy #$00 a1 00 lda ($00,x) a2 00 ldx #$00 a3 00 ldz #$00 a4 00 ldy $00 a5 00 lda $00 a6 00 ldx $00 a7 00 smb2 $00 ** a8 tay a9 00 lda #$00 aa tax ab 01 00 ldz $0001 ac 01 00 ldy $0001 ad 01 00 lda $0001 ae 01 00 ldx $0001 af 01 00 bbs2 $01,$3159 ** b0 00 bcs $315b b1 00 lda ($00),y b2 00 lda ($00),z b3 01 00 bcs $3162 ++ b4 00 ldy $00,x b5 00 lda $00,x b6 00 ldx $00,y b7 00 smb3 $00 ** b8 clv b9 01 00 lda $0001,y ba tsx bb 01 00 ldz $0001,x bc 01 00 ldy $0001,x bd 01 00 lda $0001,x be 01 00 ldx $0001,y bf 01 00 bbs3 $01,$317e ** c0 00 cpy #$00 c1 00 cmp ($00,x) c2 00 cpz #$00 c3 00 dew $00 ??word c4 00 cpy $00 c5 00 cmp $00 c6 00 dec $00 c7 00 smb4 $00 ** c8 iny c9 00 cmp #$00 ca dex cb 01 00 asw $0001 ??word cc 01 00 cpy $0001 cd 01 00 cmp $0001 ce 01 00 dec $0001 cf 01 00 bbs4 $01,$31a1 ** d0 00 bne $31a3 d1 00 cmp ($00),y d2 00 cmp ($00),z d3 00 00 bne $31aa +++ d4 00 cpz $00 d5 00 cmp $00,x d6 00 dec $00,x d7 00 smb5 $00 ** d8 cld d9 01 00 cmp $0001,y da phx db phz dc 01 00 cpz $0001 dd 01 00 cmp $0001,x de 01 00 dec $0001,x df 01 00 bbs5 $01,$31c4 ** e0 00 cpx #$00 e1 00 sbc ($00,x) e2 00 lda ($00,sp),y !!! e3 00 inw $00 ??word e4 00 cpx $00 e5 00 sbc $00 e6 00 inc $00 e7 00 smb6 $00 ** e8 inx e9 00 sbc #$00 ea nop eb 01 00 row $0001 ??word ec 01 00 cpx $0001 ed 01 00 sbc $0001 ee 01 00 inc $0001 ef 01 00 bbs6 $00,$31e7 ** f0 00 beq $31e9 f1 00 sbc ($00),y f2 00 sbc ($00),z f3 01 00 beq $31f0 ++ f4 01 00 phw #$0001 !!word, immediate!! f5 00 sbc $00,x f6 99 inc $00,x f7 00 smb7 $00 f8 sed f9 01 00 sbc $0001,y fa plx fb plz fc 01 00 phw $0001 !!word fd 01 00 sbc $0001,x fe 01 00 inc $0001,x ff 01 00 bbs7 $01,$320b ** ========================================================================== Welp, there ya have it. A good rough draft start. As mentioned in the header there is a binary file of this exact dump availible. So far though the TPUG c65 disk is a myth and will be until it is _full_ but the files for it will be avalible on the BBS's listed below. Otherz will be there also, like a wee ML thing that showz all the text charz and colour_code/atributez availible and MultiColour mode. In the next couple of dayz we'll have at the WORD OpCodes and see whatz what. Our first attemp went for not! PHW #$bb77 : RTS ..and we couldn't find it *anywhere*!! }>ug.. Last minute Newz! The WORD opz generaly relate to the Stack and the _EXTENDED_STACK_. ES is in at $1100, heavely used by the system. Simply amazing! Kind of remindz one of UNIX type systemz. System/User Stack.. oh boy. ========================================================================== }-{ighlander BBS, 416+588+0922, 3/12/24oo, C=/ascii/ansi, NISSA/Image Net. }>ug.. @ CBM (Node28) :NISSA TPUG SYSOP :CRSo TPUG SYSOP 1:229/15.0 :Fido tpug.sysop@canrem.com Ok, I know all those z-Register commands, but there are some I dont know, like BBS0-BBS7. Also there are the W commands (DEW, ROW, ...). Looks like they are WORD (16 bit) commands, working on stack and/or zeropage,. Another question is the PC, is it true 24 Bit or not?? Could be the B commands (TRB,..) working directly on the bank register.?? I'm still looking forward for an answer by Fred Bowen, posting the 4510 data-sheet.... Please post any changes, suggestions to this list directly to me... I will correct and post it again. Any test programs, for bank switching are welcome... Bye, Simon. Some stuff for the c65 [sixty-FIVE] crowd, Newz and more Questionz! [Suggest adding to FAQ] Lets start with the Monitor; pc sr ac xr yr ZR sp ; 000000 00 00 00 00 00 00 A new register, and opcodez to match! LDZ $0000 : LDZ $0000,x ..etc. The whole family is there with it, all the branches, comparez, transferz ..etc. [inz, dez] What is missing for this one is Zero page stuff! No; LDZ $aa : STZ $aa ..etc. Assembling this in the Monitor nets the Absolute version; LDZ $00aa. -------------- Also notice that the ProgramCounter has 3 bytez/6 digitz! Disassembling will WRAP to next BANK! df0fffe .f0fffe b1 fa lda ($fa),y .f10000 ff ff 02 bbs7 $ff,$0005 ;gadzookx, what's this code..?! -------------- Next are some OpCodez we *alwayz* wanted! PHA : PLA PHX : PLX PHY : PLY PHZ : PHZ BRA ;BRanch Alwayz! TYS ;Tranzfer y to Stack TSY ; Stack to y TSX ; Stack to x TXS ; x to Stack There are quite a few more. -------------- There are many in the Gadzookx category! The most baffling one I have seen is MAP! Usualy preceeded with a loading of a, x, y and z. Then MAP. Could this be connected directly to the frankenstein MMU? Might be nice! ..oh, possibly the DAT [Direct Adress Tranzlator]? How about TRB, TSB, NEG, SEE, DEW, ROW, ASW, CLE, PHW, CLV, BBS7 $00,0000 BBR7 $00,0000 SMB2 $00 RMB5 $00 ^ This value ranges from 0 to 7, proll'y branching on bitz ON/OFF. Going to need Fred for this stuff!