10REM Read byte from TMS6100         
   20*FX159,0,255
   30REM Reset speech processor
   40MODE7:PRINT"PHROM dumper":PRINT:INP
UT"Enter PHROM£ to dump (15=PHROMA):"P%:
PRINT:PRINT"Data is:":PRINT
   50REM P%=phrom to dump now
   60H%=(P% AND 12)/4:REM high 2 bits
   70L%=(P% AND 3)*4:REM low 2 bits
   80O%=0:REM offset to start at
  100Y%=(O% AND &F)DIV&1:PROCwrite
  110Y%=(O% AND &F0)DIV&10:PROCwrite
  120Y%=(O% AND &F00)DIV&100:PROCwrite
  130Y%=L%+(O% AND &F000)DIV&1000:PROCwr
ite
  140Y%=H%:PROCwrite
  141FORO%=0 TO 16384
  150PROCread:PROCdisplay:NEXT
  160REM Address is sent xcccaaaa
  170REM where x=don't care
  180REM       c=command (see below)
  190REM       a=address
  200END
  210REM Five address calls are reqd:
  220REM Call 1: xccc A3 A2 A1 A0
  230REM Call 2: xccc A7 A6 A5 A4
  240REM Call 3: xccc AB AA A9 A8
  250REM Call 4: xccc C1 C0 AD AC
  260REM Call 5: xccc  x  x C3 C2
  270REM Hence A13 to A0 are sent
  280REM ie.14 bit addr = 16384 long
  290REM Chip select C0 to C3 too
  300END
  310REM Commands used here:
  320REM ccc=%100=64 (load address)
  330REM ccc=%001=16 (read byte)
  340END
  350REM Send address to TMS5220
  360DEFPROCwrite
  370  A%=&9F:Y%=Y%+64:CALL&FFF4
  380ENDPROC
  390REM Do a read byte...
  400DEFPROCread
  410  *FX159,0,16
  420  A%=&9E:D%=((USR&FFF4)AND &FF0000)
DIV&10000:REM Mask out Y which contains
the answer
  430ENDPROC
  440REM Filter out control chr$
  450DEFPROCdisplay
  460  IFD%>31 AND D%<127 THENPRINTCHR$(
D%); ELSEPRINT".";
  470ENDPROC