Decode Opcodes

From BeebWiki
Jump to: navigation, search


This program decodes Assembly Mnemonics from the BASIC 4 ROM.

   10 PRINT"NUM  MNE    OPCODE"'"---  ---    ------"
   20 FOR c%=0 TO &44
   30 b%=?(&8892+c%)
   40 b%=b% DIV 4
   50 b%=b% AND &1F
   60 b%=b% OR &40
   70 L1$=CHR$b%
   80 b%=?(&884D+c%)
   90 b%=b% DIV 32
  100 b%=b%+16*(ABS((?(&8892+c%) AND &02)=&02))
  110 b%=b%+8*(ABS((?(&8892+c%) AND &01)=&01))
  120 b%=b% AND &1F
  130 b%=b% OR &40
  140 L2$=CHR$b%
  150 b%=?(&884D+c%)
  160 b%=b% AND &1F
  170 b%=b% OR &40
  180 L3$=CHR$b%
  190 PRINT RIGHT$("0"+STR$~(c%),2);"   ";L1$;L2$;L3$;"    ";RIGHT$("0"+STR$~?(&88D7+c%),2);"  b1=";RIGHT$("0"+STR$~?(&884D+c%),2);"  b2=";~?(&8892+c%)
  200 NEXTc%