Comments on making Tiny BASIC work with UT4/IDIOT monitor
Herb Johnson Aug 4 2017

My version of Tiny BASIC, is based on binary code from the RCA 18S020
manual which has a TB hex dump (but not a dump of the ROM monitor). I have
images of the hex dump; and the TB source was "fixed" to match that hex dump.

Reading the Tiny BASIC source, it looks like it expects ROM at 0000H
and RAM at 800H. It's only Tiny BASIC code, here's where it talks to a ROM moinitor:

PAGE:    EQU  0800H    ; WORKSPACE BEGINNING
KEYV:    EQU  PAGE+06H    ; KEY-INPUT ROUTINE VECTOR
TYPEV:    EQU  PAGE+09H    ; TYPE-OUTPUT ROUTINE VECTOR
BREAKV: EQU  PAGE+0CH    ; BREAK-DETECTION ROUTINE VECTOR

These addresses get wired into those vectors:

KEYBD: LBR  TTYRED    ; JUMP TO KEY-INPUT ROUTINE
TYPED: LBR  TYPE    ; JUMP TO KEY-OUTPUT ROUTINE
TBRK:    LBR  TSTBR    ; JUMP TO BREAK-DETECTION ROUTINE

and here's those calls-to-monitor routines in Tiny:

; TEST FOR BREAK (TO ABORT LONG LISTINGS)
;
TSTBR:    ADI  0        ; SET DF=0
    B4   $+6    ; IF BREAK (EF4=0, SO EF4 PIN HIGH),
    SMI  0        ;   THEN SET DF=1
    BN4  $        ;   WAIT FOR EF4 PIN TO RETURN LOW
    SEP R5 ;EXIT        ; EXIT

; MONITOR, should be 066FH- RCA disassembled code HRJ

TTYRED: SEP R7    ;monitor
    INC R1       
    GLO RD
    STXD           
    LBR 8440H    <---actually should be "LBR 8140" see below

TYPE:    SEP R7   
    INC R2
    BZ  TT
    SEP RC       
    INC R7
    DEC RD
    STR RD
TT:    LBR 81A4H
;

That's the RCA development system ROM monitor, probably UT4, at 8000H. 
Or for Lee Hart, the IDIOT MOnitor. 

Looking at the IDIOT code, there's "TYPE" and "TTYRED" procedures. TYPE
 in IDIOT starts at X1A4, TTYRED starts at X140. That value for TTYRED
caused me to look at the hex dump image again - and sure enough, the proper
address is 8140, not 8440. 

 Tiny BASIC, only uses the monitor's serial in and out routines, 
not anything else from IDIOT. You'd have to jump to the IDIOT monitor
 cold-start, to use IDIOT facilities: and it likely wipes out Tiny BASIC.

Keep in mind: old UT4 and old IDIOT, used /EF4 for serial in. Lee Hart's M/S card
uses /EF3f for serial in. Some people use /EF4 or /EF2 as a "break" input, with 
a pushbutton. 

Herb JOhnson
