>Z80TAIL 6 End of Z80BASIC Rom with Z80 & 8085 disassembler " By J.G.Harston, (C)1991-2000 ( 70 Camm Street 2 SHEFFIELD < S6 3TR. F Public Domain P: Z=&7000:Assem d"*SAVE Z80R2 7000 "+~O% n"KEY0 *LOAD Z80R1 3000|M*LOAD Z80BAS 3100|M*LOAD Z80R2 "+~(start-&5000)+"|M*SAVE Z80ROM 3000 "+~(P%-&5000)+" FFFF0000 FFFBBC00|M*FX18|M" x *FX225,1 *FX138,0,128 *BASIC : @ݤs(A$):$O%=A$:P%=P%+$O%:O%=O%+$O%:O%?-1=O%?-1 &80:=P*3+4 Assem *LOAD Z80R1 7000 BasicName=&800D @OSBYTE=&FFF4:OSNEWL=&FFE7:OSWRCH=&FFEE:OSASCI=&FFE3:ProgID=9 GTXA:A #&80:STA &24B :\ *BASIC passed to , with my rom num HBMI ServQuitRestoreY R: \.LanguageOff f9LDA &2A1,X: #&BF:STA &2A1,X:\ Remove my language bit p.ServQuitRestoreY z PLA:TAY  PLA:RTS :  .Serv0F =LDA &DF0,X:A &28D:A #&40 :\ Save Break type in my flag 5STA &DF0,X:LDA #2:STA &28D :\ Set 'Hard Break'  PLA:RTS : 6.Serv06:\ Check for 'This is not a language' error  TYA:PHA 3LDY #0:LDA (&FD),Y:BNE ServQuitRestoreY :\ <>0 ELDA &DF0,X:CMP #&40:BCC Serv06MoveError :\ Get rid of =0 problem TYA  .Serv06Lp =ADC (&FD),Y:INY:CPY #23:BNE Serv06Lp:\ Hash up the string 8CMP #&EB:BNE ServQuitRestoreY :\ Not the error .Serv06Enter $3LDA #142:LDX &F4:JMP OSBYTE :\ Enter me .E:]:TubeAddr=P%-2:[OPT P*3+4:EQUW 0 :\ Address of OSBYTE in copro 8.Serv06MoveError BCINY:LDA (&FD),Y:STA &101,Y :\ Copy error block to &100 LBNE Serv06MoveError V?LDA #1:STA &FD:STA &FE :\ Adjust error pointer `7LDA #&FF:STA &101:BNE ServQuitRestoreY:\ Make =255 j: t .Serv07 ~;LDA &EF:CMP #90:BNE Serv07Quit :\ Not *FX90,x,x - quit >LDA &F0:BEQ Serv07Help :\ *FX90,0 - Display names .Serv07Display :\ A<>0, X=0 at this point ZLDX #MsgServ07-MsgBase d:JSR PrMessage :\ Print ProgID prefix n: xPLA  .PrName PHA  .PrName2 =LDX #0:LDY #3 :\ Terminate at 2nd space  .PrNameLp /LDA &8009,X:BNE P%+4:LDA #32 :\ &00 -> CMP #32:BNE PrNameChar DEY:BEQ PrNameEnd .PrNameChar JSR OSWRCH:INX:BNE PrNameLp .PrNameEnd JSR OSNEWL .Serv07Quit  PLA:RTS :  .Serv09 "&LDA (&F2),Y:CMP #13:BEQ serv9simpl ,!CMP #".":BEQ serv9all: #&DF 6CMP #"Z":BNE serv9exit @ .serv9all:JSR serv9simplPush J&LDX #MsgHelp-MsgBase:JSR PrMessage T.serv9exit:PLA:RTS ^.serv9simplPush:PHA h.serv9simpl rJSR OSNEWL:JMP PrName2 |:  .Serv04 TYA:PHA:LDX #0:.serv4lp LDA (&F2),Y:INY:CMP #"." BEQ serv4ok  #&DF:CMP BasicName,X BNE serv4not INX:LDA BasicName,X BNE serv4lp LDA (&F2),Y:CMP #33 BCS serv4not  .serv4ok LDA (&F2),Y:INY:CMP #32 BEQ serv4ok CMP #"-":BNE serv4select .serv4skip LDA (&F2),Y:INY &CMP #33:BCS serv4skip 0BCC serv4ok :.serv4select DCMP #13:BEQ serv4enter NDEY:LDX #0:.serv4sel_lp XLDA (&F2),Y:STA &781,X b#INX:INY:CMP #13:BNE serv4sel_lp l STX &780 vLDA &DC6:STA &779 LDA &DC7:STA &77A LDA &DC8:STA &77B LDA #newGBPB 255:STA &DC6 LDA #newGBPB 256:STA &DC7 LDA &F4:STA &DC8 .serv4enter JMP Serv06Enter  .serv4not PLA:TAY:LDX &F4:PLA:RTS  .newGBPB CMP #&80:BEQ do_newGBPB &PHA:JSR restore_GBPB:PLA:JMP &FFD1 .do_newGBPB STX &A8:STY &A9:LDY #4  .newGBPBlp1 LDA (&A8),Y:STA &77B,Y  DEY:BNE newGBPBlp1 *.newGBPBclaim 4JSR TubeClaim >LDX #&7C:LDY #7:LDA #1 H JSR &406 RLDX #0:LDY &780 \.newGBPBloop fLDA &780,X:STA &FEE5 pTXA:LDX #9:.newGBPBwait zDEX:BNE newGBPBwait:TAX INX:DEY:BPL newGBPBloop $JSR TubeRelease:JSR restore_GBPB LDX &A8:LDY &A9:LDA #0:RTS .restore_GBPB LDA &779:STA &DC6 LDA &77A:STA &DC7 LDA &77B:STA &DC8:RTS : .TubeClaim LDA #&C0+16+ProgID JSR &406:BCC TubeClaim:RTS : .TubeRelease LDA #&80+16+ProgID:JMP &406 :  .Serv08 $&PLA:LDA &EF:CMP #190:BNE Serv8Exit .LDY #0:LDA (&F0),Y:TAX 8)INY:LDA (&F0),Y:CMP #16:BCC Serv8Exit BINY:LDA (&F0),Y LCMP #80:BEQ Serv8Mine V1CMP #85:BNE Serv8Exit :\ Not Z80 or 8080/8085 `.Serv8Mine jCPX #4:BNE DisWhich tCMP #85:BEQ FindName ~ LDX #0 .FindName LDY #4 .FindNameLp #LDA Names,X:STA (&F0),Y:INX:INY CMP #13:BNE FindNameLp LDA #0:RTS : .Serv8Exit LDA #8:RTS : .Names EQUS "Z80":EQUB 13 EQUS "8080/8085":EQUB 13 :  .DisWhich CPX #12:BCC Serv8Exit (LDY #11:PHA 2.DisDataLp <LDA (ptr),Y:STA data-8,Y FDEY:CPY #7:BNE DisDataLp PLDX #0:STX indexP:PLA ZCMP #80:BEQ DisZ80 d: n;\ Now attach Dis8085 and DisZ80 from DisAssem rom here: x: .Dis85:.Dis8085 LDA data:PHA:JSR DisZ80 .dissChkErr ELDY #2:LDA (ptr),Y: #&BF:BEQ dis85ok:\ If any z80 done, not 8085 .dissIsErr PLA:PHA:STA data:JSR do_defb .dis85ok PLA:LDA #0:RTS : .Dis80:.DisZ80 .diss_try INX #LDY #table2-table3:LDA data-1,X CMP #&ED:BNE notED 6LDA indexP:A #2:STA indexP:\ ED codes not on 8085 JMP search_go " .notED ,CMP #&DD:BEQ indexes 6CMP #&FD:BEQ indexes @CMP #&CB:BNE notCB J=LDA indexP: #&F7:A #2:STA indexP:\ CB codes not on 8085 T#LDY #0:BIT indexP:BPL search_go ^LDA data+3 hSTA opcode:JMP search_loopX r .indexes |CPX #1:BEQ index_ok .do_defb KLDA #2:PHA:LDA #&36:JMP diss_cont:\ Too many indexes, do 'B' (was A=0) .index_ok J #&4F:STA indexP:JMP diss_try:\ Set Index,~End,X/Y,Unf---Not85,~UnDoc .notCB LDY #table1-table3 DEX:CMP #&D9:BNE search_go 1LDA indexP:A #2:STA indexP:\ EXX not on 8085 \ search table .search_go LDA data,X:STA opcode .search_loopX STX Dptr .search_loop PHA: table3,Y:INY !CMP table3,Y:BEQ search_found &%INY:LDA table3,Y:BPL search_2:INY 0 .search_2 :PLA DINY:BNE search_loop NPHA:\ should never get here X.search_found b INY:PLA lLDA table3,Y:\ index v\ BMI diss_mode CMP #&40:BCS diss_index PHA  #&F:CMP #&F:BNE diss_comp PLA:LDA opcode: #3:A #&18 JSR get_mn_text LDA opcode:LSR A:LSR A:LSR A ADC #8:JSR get_mn_text2 JMP diss_done \Separate index and mode .diss_comp #PLA:PHA:CMP #&10:BCC diss_comp2 CMP #&20:BCS diss_comp2 /LDA opcode: #&F8:CMP #&30:\ Is it CB-SLS? BNE diss_comp2 4LDA indexP:A #1:STA indexP:\ SLS not documented .diss_comp2 * LDA opcode:LSR A:LSR A:LSR A 4 #7:STA data >PLA:PHA:LSR A: #&18 HA data:STA data RPLA: #&F:PHA \"LDA data:CMP #&4:BCS diss_cont fPLA:A #&70:PHA pLDA data:BPL diss_cont z.diss_index SEC:SBC #32:STA data LDA #0:PHA:\ mode LDA data:BPL diss_cont : $.diss_mode:\ Table byte has b7=1 /CMP #&E6:BNE diss_mode_2:\ Is it 'RETI/N' ? 5PHA:LDA indexP:A #64:STA indexP:PLA:.diss_mode_2 : TAX:LDA table3+1,Y:\ mode PHA:TXA: #127 CMP #&40:BCC diss_cont 2PHA:LDA opcode:LSR A:LSR A:LSR A: #1:STA data PLA:A data: #63 .diss_cont CCMP #&36:BNE diss_cont2:\ If unrecognised, reset input pointer 3LDX #0:STX Dptr:LDX data:STX data+1:.diss_cont2 $PHA:LDY #4 .)LDA (ptr),Y:CLC:ADC #2:STA data-1:INY 8#LDA (ptr),Y:ADC #0:STA data:PLA B0\ data-1,data holds PC+2 for JR instructions LJSR get_mn_text VPLA:BEQ diss_done ` PHA:LDA #32:.diss_do_mode_lp jSTA (ptr),Y:INY tCPY #9:BCC diss_do_mode_lp ~ LDY #9 PLA:\ mode PHA: #&F0:BEQ do_second LSR A:LSR A:LSR A:LSR A  #&0F:JSR opernd1 PLA: #&0F:BEQ diss_done !PHA:LDA #",":STA (ptr),Y:INY .do_second PLA:JSR opernd2 .diss_done LDA indexP:BPL diss_finish . #&10:BEQ diss_finish:\ Incomplete index? +\LDA #&36:\JSR get_mn_text:\ ********** 7LDA indexP: #&FD:A #&DD:STA data:\ Restore opcode  *LDX #0:STX Dptr:STX indexP:JMP do_defb .diss_finish LDA #13:STA (ptr),Y:CLC:PHP (?LDA indexP:BMI diss_fin_index:\ index only JP (hxy) checked 21 #2:BNE diss_fin_unkn:\ EDxx already checked <.LDA opcode:CMP #&C9:BEQ diss_fin_end:\ RET F"CMP #&C3:BEQ diss_fin_end:\ JP P.diss_fin_index Z4LDA opcode:CMP #&E9:BNE diss_fin_unkn:\ JP (hxy) d.diss_fin_end n2LDA indexP:A #64:STA indexP:BNE diss_fin_unkn x.diss_fin_unkn (LDY #7:LDA (ptr),Y:CMP #"B":\ 'B'? BNE diss_finish2 -LDA #0:STA Dptr:PLP:SEC:PHP:.diss_finish2 8LDY #3:LDX Dptr:INX:TXA:STA (ptr),Y:\ Bytes occupied 4LDA indexP:ROL A:PLP:ROR A:\ Put Unknown flag in " #&C3:DEY:STA (ptr),Y:\ Flags "LDA #0:RTS:\ Claim and return : \ Table format: 0\ mask match mode1 [ mode2 if mode1b7=1 ] \ mode1=mnemomic+32 ??? \ \ .table3:\ CB bytes %EQUB &C0:EQUB &00:EQUB &16:\ rots -EQUB &C0:EQUB &40:EQUB &91:EQUB &36:\ BIT "-EQUB &C0:EQUB &80:EQUB &92:EQUB &36:\ RES ,-EQUB &C0:EQUB &C0:EQUB &93:EQUB &36:\ SET 6.table2:\ ED bytes @&EQUB &E4:EQUB &A0:EQUB &0F:\ BLOCK J$EQUB &FF:EQUB &44:EQUB &41:\ NEG T.EQUB &FF:EQUB &46:EQUB &B3:EQUB &40:\ IM 0 ^0EQUB &F7:EQUB &56:EQUB &B3:EQUB &40:\ IM 1/2 h0EQUB &CF:EQUB &42:EQUB &83:EQUB &FD:\ SBC HL r0EQUB &CF:EQUB &4A:EQUB &81:EQUB &FD:\ ADC HL |1EQUB &F7:EQUB &67:EQUB &E8:EQUB &00:\ RRD/RLD 3EQUB &F7:EQUB &45:EQUB &E6:EQUB &00:\ RETN/RETI 4EQUB &CF:EQUB &4B:EQUB &98:EQUB &DA:\ LD dd,(nn) 4EQUB &CF:EQUB &43:EQUB &98:EQUB &AD:\ LD (nn),dd ,EQUB &C7:EQUB &40:EQUB &9A:EQUB &B8:\ IN -EQUB &C7:EQUB &41:EQUB &B2:EQUB &8B:\ OUT 2EQUB &F7:EQUB &57:EQUB &98:EQUB &7C:\ LD A,I/R 2EQUB &F7:EQUB &47:EQUB &98:EQUB &C7:\ LD I/R,A 8EQUB &00:EQUB &00:EQUB &B6:EQUB &02:\ was &56:\ *NOP .table1:\ plain bytes $EQUB &FF:EQUB &00:EQUB &40:\ NOP %EQUB &FF:EQUB &76:EQUB &42:\ HALT $EQUB &FF:EQUB &D9:EQUB &43:\ EXX 2EQUB &FF:EQUB &08:EQUB &90:EQUB &04:\ EX af,af $EQUB &C0:EQUB &80:EQUB &06:\ alu %EQUB &C7:EQUB &C6:EQUB &02:\ alu# 0EQUB &C7:EQUB &06:EQUB &98:EQUB &B2:\ LD r,n &'EQUB &E7:EQUB &27:EQUB &20:\ DAAetc 0(EQUB &E7:EQUB &07:EQUB &17:\ RLCAetc :0EQUB &C0:EQUB &40:EQUB &98:EQUB &B6:\ ld r,r D: N/EQUB &F7:EQUB &F3:EQUB &E4:EQUB &00:\ DI/EI X1EQUB &F7:EQUB &10:EQUB &EC:EQUB &01:\ DJNZ/JR b1EQUB &C7:EQUB &03:EQUB &EA:EQUB &D0:\ INC/DEC l4EQUB &CF:EQUB &01:EQUB &98:EQUB &D3:\ LD dr,nnnn v3EQUB &EF:EQUB &02:EQUB &98:EQUB &E7:\ LD (dr),A 3EQUB &EF:EQUB &0A:EQUB &98:EQUB &7E:\ LD A,(dr) /EQUB &C7:EQUB &04:EQUB &AA:EQUB &0B:\ INC r /EQUB &C7:EQUB &05:EQUB &AB:EQUB &0B:\ DEC r 3EQUB &CF:EQUB &09:EQUB &80:EQUB &FD:\ ADD HL,dr 3EQUB &E7:EQUB &20:EQUB &AD:EQUB &21:\ JR cc,dis 4EQUB &FF:EQUB &22:EQUB &98:EQUB &AF:\ LD (nn),hl 4EQUB &FF:EQUB &2A:EQUB &98:EQUB &FA:\ LD hl,(nn) 3EQUB &FF:EQUB &32:EQUB &98:EQUB &A7:\ LD (nn),A 3EQUB &FF:EQUB &3A:EQUB &98:EQUB &7A:\ LD A,(nn) 0EQUB &C7:EQUB &C0:EQUB &AF:EQUB &20:\ RET cc 3EQUB &C7:EQUB &C4:EQUB &AE:EQUB &23:\ cc,addr -EQUB &FF:EQUB &C9:EQUB &AF:EQUB &00:\ RET 0EQUB &FF:EQUB &CD:EQUB &AE:EQUB &03:\ addr 4EQUB &C7:EQUB &C2:EQUB &B4:EQUB &23:\ JP cc,addr  1EQUB &FF:EQUB &C3:EQUB &B4:EQUB &03:\ JP addr 1EQUB &FF:EQUB &E9:EQUB &B4:EQUB &0E:\ JP (hl)  0EQUB &CF:EQUB &C1:EQUB &B0:EQUB &60:\ pop dr *1EQUB &CF:EQUB &C5:EQUB &B1:EQUB &60:\ push dr 4/EQUB &C7:EQUB &C7:EQUB &B5:EQUB &10:\ rst x >3EQUB &FF:EQUB &D3:EQUB &B2:EQUB &97:\ OUT A,(n) H2EQUB &FF:EQUB &DB:EQUB &9A:EQUB &79:\ IN A,(n) R4EQUB &FF:EQUB &E3:EQUB &90:EQUB &5F:\ EX (SP),HL \2EQUB &FF:EQUB &EB:EQUB &90:EQUB &05:\ EX DE,HL f2EQUB &FF:EQUB &F9:EQUB &98:EQUB &DF:\ LD SP,HL p8EQUB &00:EQUB &00:EQUB &B6:EQUB &02:\ was &56:\ *NOP z .d_text  EQUB &80 OPT s("ADD"):OPT s("ADC") OPT s("SUB"):OPT s("SBC") OPT s("AND"):OPT s("XOR") OPT s("OR"):OPT s("CP") OPT s("RLC"):OPT s("RRC") OPT s("RL"):OPT s("RR") OPT s("SLA"):OPT s("SRA") OPT s("SLS"):OPT s("SRL") OPT s("EX"):OPT s("BIT") OPT s("RES"):OPT s("SET") OPT s("DAA"):OPT s("CPL") OPT s("SCF"):OPT s("CCF") OPT s("LD"):OPT s("CP") OPT s("IN"):OPT s("OT") OPT s("I"):OPT s("D") $OPT s("IR"):OPT s("DR") .OPT s("NOP"):OPT s("NEG") 8 OPT s("HALT"):OPT s("EXX") BOPT s("DI"):OPT s("EI") L!OPT s("RETN"):OPT s("RETI") VOPT s("RRD"):OPT s("RLD") `OPT s("INC"):OPT s("DEC") jOPT s("DJNZ"):OPT s("JR") t OPT s("CALL"):OPT s("RET") ~ OPT s("POP"):OPT s("PUSH") OPT s("OUT"):OPT s("IM") OPT s("JP"):OPT s("RST") OPT s("DEFB"):\ Was ???? OPT s("BC"):OPT s("DE") OPT s("AF"):OPT s("SP") OPT s("HL"):OPT s("(SP)") OPT s("IX"):OPT s("IY") $OPT s("AF,AF'"):OPT s("DE,HL") OPT s("NZ"):OPT s("Z") OPT s("NC"):OPT s("C") OPT s("PO"):OPT s("PE") OPT s("P"):OPT s("M") OPT s("B"):OPT s("C")  OPT s("D"):OPT s("E") OPT s("H"):OPT s("L") OPT s("(C)"):OPT s("A") (OPT s("I"):OPT s("R") 2: <.get_mn_text:LDY #4 F.get_mn_text2 PTAX:TYA:PHA:TXA ZLDX #0:TAY d.get_mn_text_lp n)INX:LDA d_text-1,X:BPL get_mn_text_lp xDEY:BPL get_mn_text_lp  PLA:TAY .get_mn_text_lp1 LDA d_text,X:PHA  #&7F:STA (ptr),Y #INY:INX:PLA:BPL get_mn_text_lp1 LDX Dptr:RTS %\ Returns Y=next char, X=data ptr \ !\ 0-7 -> nothing, &nn, ??, ??  .opernd1 TAX:LDA opcode DEX:BNE condit  #&38:JMP out_hex : !\ 0-7 -> nothing, ??, ??, ??,  .opernd2 "TAX:LDA opcode ,DEX:BNE dat8 6\ @/.outRelAddr:\ Also called by 65x02 routines JJSR fetch:BMI pc_neg TCLC:ADC data-1:PHA ^LDA #0:ADC data:JMP pc_pos h .pc_neg rCLC:ADC data-1:PHA |LDA #&FF:ADC data  .pc_pos JSR out_hex ALDA indexP:A #2:STA indexP:\ Relative addr, so not 8080/8085 %LDA opcode:CMP #&18:BNE pc_pos_jr 8LDA indexP:A #64:STA indexP:\ JR is code end marker .pc_pos_jr PLA:JMP da  .condit LSR A:LSR A:LSR A DEX:BNE bitnum PHA: #&10:BNE abs PLA: #3:PHA:.abs !PLA: #7:CLC:ADC #&41:BPL ps1  .dat8 DEX:BNE dat16 .d8 &JSR fetch:JMP out_hex 0 .bitnum :DEX:BNE intmod D# #7:A #48:STA (ptr),Y:INY:RTS N .dat16 XDEX:BNE exaf b.d16 lJSR fetch:\ Get lo byte vPHA:JSR fetch:\ Do hi byte JSR out_hex:PLA .da PHA:LSR A:LSR A:LSR A:LSR A JSR dnyb:PLA:.dnyb  #15:CMP #10:BCC dnyb2 ADC #6:.dnyb2 ADC #48:STA (ptr),Y:INY:RTS .ps1:JMP ps2  .intmod DEX:BNE stktop  #3:CMP #2:BCS intmod2 LDA #1:.intmod2 #CLC:ADC #47:STA (ptr),Y:INY:RTS  .stktop  DEX:BNE reg16p LDA #60:JMP ps2  .reg16p:\ reg pair *DEX:BNE comm_jmp 4 LSR A: #3:CMP #3:BNE rx_jmp >LDA #2:JMP rnx H.rx_jmp:JMP rx R.comm_jmp:JMP common \ .exaf fDEX:BNE exde p7LDA indexP:A #2:STA indexP:\ EX AF,AF' not on 8085 zLDA #&3F:JMP ps2  .exde DEX:BNE reg8s LDA #&40:JMP ps2  .reg8s DEX:BNE accum .r8  #7:CMP #6:BEQ r8hl BIT indexP:BPL ps3jmp CMP #4:BEQ r8xh CMP #5:BNE ps3jmp  .r8xh PHA:LDA opcode: #&F7 CMP #&66:BEQ r8xl LDA opcode: #&FE:CMP #&74  BEQ r8xl FLDA indexP:A #1:STA indexP:\ Using 8bit index regs not documented $ #&10:BNE r8xy .INC Dptr:.r8xy 8)JSR regx:.r8xl:PLA:\ drop thru to ps3 B.ps3jmp:JMP ps3 L .r8hl VJSR lp:\ '(' `JSR regx:\ HL/IX/IY jBIT indexP:BPL rp_jmp t INC Dptr ~"LDA data+1:CMP #&36:BNE r8next DEY:DEY:DEY:DEY:DEY JSR lp:JSR regx  .r8next LDA #"+":STA (ptr),Y LDA data+2:BPL pos LDA #"-":STA (ptr),Y  LDA data+2: #255:CLC:ADC #1  .pos:INY JSR out_hex !\ change this so it's decimal  .rp_jmp  JMP rp  .accum  LSR A:LSR A:LSR A  .common DEX:BNE portC (LDA opcode: #&E7:CMP #&07 2BNE accum2 <DEY:DEY:DEY:LDA (ptr),Y FCMP #" ":BEQ accum2 PINY:.accum2 ZLDA #&50:BNE ps2 d .portC nDEX:BNE idat8 x LDA #&4F %.ps2:\ A=text entry no. to output JMP get_mn_text2 .ps3:\ A+'B'=entry no. CLC:ADC #&49:BNE ps2  .idat8 DEX:BNE idat16 JSR lp:\ '(' JSR d8:CLC:BCC rp  .idat16 DEX:BNE reg8 JSR lp:\ '(' JSR d16:CLC:BCC rp  .reg8 DEX:BEQ r8_jmp  .iparef DEX:BNE reg16 "" #9:BNE ps3:\ jump to do regs ,.r8_jmp:JMP r8 6 .reg16 @LSR A:DEX:BNE ireg16 J.r16 T #3 ^.rx hCMP #2:BEQ regx r.rnx |CLC:ADC #&37  BNE ps2  .ireg16 DEX:BNE regx  JSR lp  JSR r16 .rp LDA #")":STA (ptr),Y:INY RTS .regx:\ HL or IX/IY  \ indexes HLDA indexP:ROL A:PHP:ROL A:PLP:ROL A:ROL A:\ Convert indexP to 0/2/3 0 #3:CMP #2:BCC regx2:\ 0=HL, so not indexed 6PHA:LDA indexP: #&EF:STA indexP:\ Index completed PLA:.regx2 CLC:ADC #&3B:BNE ps2 .lp &!PHA:LDA #"(":STA (ptr),Y:INY 0 PLA:RTS : .out_amp D!PHA:LDA #"&":STA (ptr),Y:INY N PLA:RTS X .out_hex bJSR out_amp:JMP da l .fetch v(LDX Dptr:INX:LDA data,X:STX Dptr:RTS .Rol4:ROL A .Rol3:ROL A:ROL A:ROL A:RTS : ]