Menu

ROM / RAM / PORTS / CALLS / TOKENS (The inside stuff)
     
  • ROM Addresses
  • ROM Calls
  • ROM RST Vectors
  • Memory Mapped I/O Devices
  • ROM Routines (I/O & Misc.)
  • ROM Routines (Integer Math)
  • DOS Routines
  • Level II/DOS RAM Map
  • Useful PEEKs & POKEs
  • Disk Basic Command Vectors
  • TRS-80 Keybaord PEEK Table
  • Disk Speed-Up Chart
  • System Tape Format
  • EDAS Tape Format
  • BASIC Tape Format
  • RAM Addresses
  • Z-80 Instruction Set
  • Port Addresses (Model III/IV)
  • Model III RS-232 Ports
  • Model III WD1793 Disk Controller Ports
  • Radio Shack 5/15 Meg HD Port Assignments
  • UART Bits
  • Tokenized BASIC
  • Pokes and Peeks
  • DOS Tips & Tricks
         
  • Using a Single Hard Drive with 2 Operating Systems
  • Using LDOS as a Host (Communications)
  • Increasing The Number of Drives in LDOS
  • Booting NewDos/80 v2.0 on a Model 4P
  • NewDos/80 v2.0 /SYS File Guide
  • Initializing Hard Drives under Model IV DOS's
  • Passwords
  • Model III Self-Booting Disk using NEWDOS/80
  • Setting HIMEM from NEWDOS/80 v2.0 BASIC
  • System functions that can be accomplished in BASIC
  • Creating /CMD Files from LDOS LIB Commands
  • Changing The Minimum Cluster Size on Radio Shack Hard Drives
  • Guided Tour Through The Model III TRSDOS Directory
  • Formatting A Double-Sided Diskette Under TRSDOS 6.x
  • Booting A Double-Sided Diskette Under LDOS 5.1.x and 6.x
  • Program Modifications and Patches
         
  • Easter Eggs
  • Patches (Software Changes)
  • Putting and Running RESCUE AT RIGEL under Disk BASIC
  • Copying Copy-Protected VISICALC and SCRIPSIT
  • Copying Copy-Protected SUPER UTILITY PLUS to a CMD file
  • Converting Superscripsit to LDOS
  • Hardware Modifications and Patches
         
  • Converting Model I Screen to Inverse Video
  • Conversion and Installation of a Model III Hires Board into a Model IV
  • Making a Hardware Clock and Hard Drive Play Nice Together
  • Quick Model 4 Speed-Up Modification
  • Adding External Drives to a Model 4P
  • Convert 5" Drive Cable to 8" Drive Cable
  • Model 4P Video "Shake"
  • Making the USRobotics Courier 2400 Modem Work With A Model IV
  • Connecting an ATARI 400 to a Model III
  • How to Bolster the Power Supply for the Model IV
  • TRS-80 Model I 48K RAM expansion
  • TRS-80 Hard Drive Bubble Repair Information
  • Upgrading a Model III to a Model 4



  • RAM Addresses

    This section contains a list of important RAM Addresses

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    The following keys for DOSes apply:
          T1 - Model 1 TRSDOS T3 - Model 3 TRSDOS
          N1 - Model 1 NEWDOS N3 - Model 3 NEWDOS
          L1 - Model 1 LDOS L3 - Model 3 LDOS
          M1 - Model 1 MULTIDOS M3 - Model 3 MULTIDOS
          D1 - Model 1 DOSPLUS D3 - Model 3 DOSPLUS
          All - All DOSes, Model I and Model III.
    Hex     Decimal   Description
    3C0015360This is the beginning of video ram or VIDRAM. It ends at 3FFFH or 16383.
    16333-16334End of BASIC Program Pointer (LSB,MSB)
    400016384RST 08 Compare value pointed to by HL to that immediately following RST instruction.
    400316387RST 10 Examine next symbol pointed to by HL.
    400616390RST 18 Compare DE and HL.
    400916393RST 20 Test the type of current varible.
    400C16396RST 28 3 byte break key vector (cass. Basic & TRSDOS 1.3) and normal Dos function call.
    400F16399RST 30 Reserved for Dos - normally for invoking Debug.
    401216402RST 38 Maskable interupt vector.
    401516405Beggining of Keyboard DCB. One byte device type. = 1
    4016-401716406-16407Two byte keyboard driver vector.
    To Disable The Keyboard:
    N1=PEEK(16406)            (MOD 1)
    N2=PEEK(16407)
    POKE16406,154
    POKE16407, 10
         THESE FOUR STEPS DISABLE THE
         KEYBOARD. TO RE-ENABLE IT:
         POKE 16406,N1
         POKE 16407,N2
    
    401816408Right SHIFT toggle.
    401916409Caps lock switch (Not 0 = Caps only)
    401A16410Cursor blink count
    401B16411Cursor blink status. (0=blinks)
    401C16412Cursor blink switch (0 = blink)
    401D16413Beggining of Video DCB. One byte device type. = 7.
    401E16414Two byte video driver vector.
    402016416Two byte cursor position.
    4022164180 = Cursor on, Not 0 = character replaced by cursor.
    402316419Cursor Character (in ascii).
    402416420FLAG : 0 = Space compression; Not 0 = special character.
    402516421Beggining of Printer DCB. One byte device type. = 6.
    402616422Two byte printer driver vector.
    402816424Maximum lines printed per page +1. Default = 67.
    402916425Number of lines printed +1.
    402A16426Character counter + 1.
    402B16427Line printer maximum line length less two.
    402C16428"R"
    402D16429Return to Dos exit. (Disk systems only).
    403016432For all doses except TRSDOS, is abnormal return to DOS ready.
    403616438Keyboard buffer (7 bytes).
    403D16445Cassette port and print size flag (bit 3) copy (For Model 3, see 4210). L3: location of routine to add task to interupt chain.
    403E16446For Model I DOSPLUS, hold DOS version in DCB format.
    404016448For L1 & M1, 25 ms heartbeat counter. For L3, used to remove task from interrupt chain.
    404116449Beginning of Time and Date bytes. (seconds, min., hours, year, day, month) Ends at 4046H or 16454. L1, D1, and M1
    404316451L3, change address of interupt task.
    404416452L1, D1, & M1. Contains date in binary format.
    404616454L3. Remove task from interupt chain.
    404716455L1. Current day in coded form.
    404916457For the Model III disk is non maskable interupt vector, for Model I disk is highest available memory location (Model III = 4411H)
    404B16459L1. Contains image of interrupt latch.
    408E16526Address of USR routine (two bytes)
    409916537INKEY$ storage. Most recent keyboard character.
    409A16538Error code is at this address (for BASIC only)
    409C16540OUTSEL. On Model I, is a one byte output device flag. -1 (or 129) for cass, 0 for video, 1 for printer.
    40A016544Clear address pointer. Beggining of CLEARed area for string variable storage
    40A016544LSB of Lower Limit for String Variable Storage Space
    40A116545MSB of Lower Limit for String Variable Storage Space
    40A2-40A316546-16547Last executed line number/Program Line Counter (LSB-MSB).
    40A4-40A516548-16549Pointer to beggining of Basic program (LSB-MSB).
    40A616550Cursor's current column number.
    40A716551Input buffer pointer.
    40A916553???.
    40AA165543 byte random seed number.
    40AB16555This byte is changed by RANDOM.
    40AF16559SAFLAG. Contains typeflag of software accumulator.
    40B1-40B216561-16562Two byte End (Upper Limit) of String Storage - LSB & MSB.
    40B1-40B216561-16562Two byte MEMTOP (for BASIC) - LSB & MSB.
    40D316585Saves length ASCII representation of binary integer.
    40D416586Two byte address. Points to buffer where ASCII decimal representation written.
    40D616598String pointer. Keeps track within CLEARed area as to where last string data was put.
    40D816600-16601Two byte location of where Basic is currently reading program/Present BYTE Counter (LSB & MSB).
    40DF16607-16608Default entry point for SYSTEM tapes (LSB & MSB).
    40E116609Auto flag.
    40E216610Current auto line number.
    40E416612Auto increment.
    40E616614Pointer to terminator (end of line 00H byte or ":") of the last executed Basic statement is at this address.
    40E816616Beggining of Basic's stack.
    40EA16618Two byte address. Contains line number with error.
    40EC16621Two byte address. "." line number.
    40EE16622Pointer to I/O buffer.
    40F016624Pointer to line of BASIC error handling.
    40F216626Error flag.
    40F516629Current line number.
    40F916633End of basic program/ start of simple variable list pointer.
    40FB16635Start of arrays variables pointer.
    40FD16637-16638End of arrays variables/ start of free memory pointer (LSB,MSB).
    40FF16639-16640Two byte address. Current location of Basic's DATA pointer (LSB,MSB).
    410116641Beginning of variable type table.
    411A16666End of variable type table.
    411B16667Trace flag.
    411D16669First byte of SA.
    412416673Last byte of SA.
    412716679First byte of SA1.
    412E16686Last byte of SA1.
    415216722CVI 3 byte vector.
    415516725FN 3 byte vector.
    415816728CVS 3 byte vector.
    415B16731DEF 3 byte vector.
    415E16734CVD 3 byte vector.
    416116737EOF 3 byte vector.
    416416740LOC 3 byte vector.
    416716743LOF 3 byte vector.
    416A16746MKI$ 3 byte vector.
    416D16749MKS$ 3 byte vector.
    417016752MKD$ 3 byte vector.
    417316755CMD 3 byte vector.
    417916761OPEN 3 byte vector.
    417C16764FIELD 3 byte vector.
    417F16767GET 3 byte vector.
    418216770PUT 3 byte vector.
    418516773CLOSE 3 byte vector.
    418816776LOAD 3 byte vector.
    418B16779MERGE 3 byte vector.
    418E16782NAME 3 byte vector.
    419116785KILL 3 byte vector.
    419416788& function 3 byte vector.
    419716791LSET 3 byte vector.
    419A16794RSET 3 byte vector.
    419D16797INSTR 3 byte vector.
    41A016800SAVE 3 byte vector.
    41A316803LINE 3 byte vector.
    41A616806ERROR Error processing jumps to this three byte vector. In cassette Basic it contains RET instruction, in Disk Basic, contains a jump (through RST) to long error message
    41A916809USR 3 byter vector.
    41AC16812Ready prompt
    41AF16815Called from 0368H to input line from keyboard to I/O buffer.
    41B216818Called from 1AA1H immediately after BASIC line is tokenized. HL points to tokenized line.
    41B516821Called from 1AECH immediately after BASIC's table of prg lines are updated. After call to 41B5H, BASIC calls CLEAR routine at 1B5DH then calls this dos exit from 1AF2H
    41BB16827Called from 1B8CH and 1DB0H during NEW and END processing to allow Disk Basic to close any open files.
    41BE16830PRINT# processing called from 2174H
    41C116833Byte output to any device. Called from 032CH so output to disk can be handled as to other devices.
    41C416836ROM KB scan (0358H) calls this exit. BASIC processes INKEY$ here and also after each command when system searches for break or shift @.
    41C716839Called from 1EA6H when RUN is followed by filename or line number
    41CA16842Related to 41BEH above. Called at beggining of print processing from 206FH to check for possible disk output.
    41CD16845Called from 20C6H. Call is made during print processing after number is in ASCII and just before printing. Could be used for Hex and Binary printing.
    41D016848Called from 2103H (from PRINT routine after code that send CR.) Could be used for screen wrap-around.
    41D316851Called from 2108H and 2141H. First is for printing with comma tabs, second is for printing with TAB statement. Could be used to increase length of original tabs from 63 or 127 up to 255.
    41D616854INPUT# processing. Called from 219EH to check for INPUT# command and to provide input from disk.
    41D916857Left side of MID$ processing. Only DOS exit BASIC jumps to instead of calls. Used to allow MID$ on left side of equals sign.
    41DC16860Variables assignment. During processing of READ & INPUT statements, after computer recieves value and before assigned to variable, BASIC calls this exit from 222DH.
    41DF16863Called twice from BASIC: From 2278H after BASIC assigns input value to variable and just before BASIC searches for extra data that will generate "Extra ignored" message, and from 2B44H from the midst of list processing. Could be used to alter list command.
    41E216866SYSTEM command processing. Called from 02B2 just before "*?" prompt. A system tape will automatically start if a jump to its starting address is placed here. Keep in mind this is a 3 byte location. The first byte should be C3H which is the code for "JP" and should be followed by the starting address of your program.
    41E816872$RSRCV input buffer (1 byte)
    41F016880$RSTX output buffer (1 byte)
    41F816888$RSINIT baud rate code. TX code = most sig. nibble, RCV code = least sig. nib.
    41F916889$RSINIT parity/word/length stop-bit code
    41FA16890$RSINIT wait switch (0 = wait, Not 0 = wait)
    420916905L3. Checks for drive and mounted disk.
    421016912Various controls: See port EC
    421116913Cassette baud rate switch (0 = 500 baud, Not 0 = 1500 baud)
    421416916Video display scroll protect (range = 0 - 7)
    421716919Model 3 time. Contains time in binary format.
    421A16922Model 3 date. Contains date in binary format.
    422016928$ROUTE destination device (two bytes)
    422216930$ROUTE source device (two bytes)
    422516933T3, L3, D3. Dos command buffer.
    428817032L3. 33.33 ms heartbeat counter.
    428A17034L3. Send message to Job Log and CRT.
    428D17037T3, D3. Find drive and file number for open file. For L3, send message to Job Log.
    429017040T3, L3, D3. Copy directory to RAM buffer.
    429317043Get file name from directory.
    429617046L3. Execute Dos command and return to DOS ready.
    429917049T3. Do DOS command and return to DOS ready. L3: returns to caller is @EXIT and @ABORT vectors change to jump to return address.
    429C17052T3. Do DOS command and return to caller.
    42AD17069D3. Contains address of break key routine.
    431217170D1. Contains address of break key routine (195=Off, 201=On).
    431817176T1, L1, D1. DOS command buffer.
    439617302L1. Read directory into memory.
    440017408L1, D1, D3, N1, N3, M1, M3. Same as 402D: return to DOS ready.
    440217410Send text to file or device.
    440517413L1, D1, D3, N1, N3, M1, M3. Do DOS command and return to DOS ready.
    440917417Display error message on CRT.
    440D17421L1, L3, D1, D3, N1, N3, M1, M3. Enter Debug.
    441017424L1, D1, N1, M1. Add task to interrupt chain.
    441117425Address of highest available memory location (Mod III disk only - Mod 1 disk = 4049H)
    441317427L1, D1, N1, N3, M1. Remove task from interrupt chain. For D3, add task to interrup chain.
    441517429T3 (undocumented) Second copy of high memory address. Copied to 4411H in case of I/O error during DO processing.
    441617430L1, M1. Change entry address of task in interrupt chain. D3: Remove task from interrupt chain. N1, N3: Keep drives rotating and reselect current drive.
    441717431L3. Contains current day in coded format.
    441917433T3, L3. Write disk directory to screen or buffer. N1, N3: Execute DOS command and return to caller.
    441C17436T3, L1, L3, D1, D3, N1, N3, M1, M3. Move filespec to FCB.
    442017440All. Open or create a file.
    442417444All. Open existing file.
    442817448All. Close a file.
    442C17452All. Remove file from directory.
    443017456All. (undocumented in T1) Load file (m.l. program) into memory.
    443317459All. (undocumented in T1) Load and run m.l. program.
    443617462All. Read logical record into memory.
    443917465All. Write logical record to disk.
    443C17468All. Write record and verify.
    443F17471T3, L1, L3, D1, D3, N1, N3, M1, M3. Point to first record in file.
    444217474All. Position file to specified record.
    444517477T3, L1, L3, D1, D3, N1, N3, M1, M3. Backspace file one record.
    444817480T3, L1, L3, D1, D3, N1, N3, M1, M3. Position to end of file.
    444B17483T3, L3, D3, M3. Add extension to filespec in FCB (see also 4473). L1: Check for end of file. D1: Multiply 16 bit by 8 bit integer. N1, N3: Allocate disk space to file.
    444E17486T3, L3, D3. Multiply 16 bit by 8 bit integer. L1: Update directory with current record as end of file. D1: Divide 16 bit by 8 bit integer. N1, N3: Position file to specified byte record.
    445117489T3, L3, D3. Divide 16 bit by 8 bit integer. D1: Check for end of file. N1, N3: Update directory with record as end of file.
    445417492L1 Read current sector. L3, D3, M3: Parse parameters in command line. D1: Find drive and file number of a file.
    445717495L1 Rewrite current sector. D3: Check for end of file. D1: Read directory to user buffer.
    445817496L3. Check for end of file.
    445A17498L1. Calculate current logical record number. D1, D3: Display directory on CRT.
    445B17499L3. Update directory with current record as end of file. N1, N3: Select and power up specified drive.
    445D17501L1. Calculate EOF record number.
    445E17502L3. Reread current sector. N1, N3: Test drive and disk.
    446017504L1. Skip next logical record.
    446117505L3. Rewrite current sector. N1, N3: Add user routine to DOS library chain.
    446217506D1, D3. Send text to printer.
    446317507L1. Read directory to buffer or CRT.
    446417508L3. Skip next logical record. N1, N3: Remove user routine from DOS library chain.
    446717511L1, L3, D1, D3, N1, N3, M1, M3. Display text on CRT.
    446A17514L1, L3, N1, N3, M1, M3. Send text to printer.
    446D17517T1, L1, D1, D3, N1, N3, M1. Get time in ASCII format. L3: Calculate current logical record number.
    447017520L3. Calculate end of file record number.
    447317523L3. Holds image of interrupt latch. T1, L1, D1, D3, N1, N3, M1, M3: Add default extension to filespec in FCB. (See also 444BH)
    447617526L1, D1, M1, M3: Parse parameters in command line.
    447817528NewDOS/80 v2.0 for Model 3 Break Vector (195=Off, 201=On).
    477917529L1. Send text to file or device. D1, D3: Scan and evaluate command line.
    447B17531L1. Send text to job log and CRT. N3: Add task interrupt chain.
    447C17532D1, D3. Compare filespec to wildcard mask.
    447E17534L1. Send text to joblog.
    447F17535D1, D3. Get device number for file or I/O device.
    448217538D1, D3. Sort block of memory.
    448517541D1. 10 disk I/O functions depending on value in A.
    448817544D3. 10 disk I/O functions depending on value in A. D1: Locate device control block for any device.
    448B17547D1. Locate drive control table for any drive.
    44A017568D3. Locate device control block for any device.
    44A317571D3. Locate drive control table for any drive.
    44B817592L1. Check drive and disk.
    44BB17595L1. Get file name from directory.
    44C117601L1. Multiply 16 bit by 8 bit integer.
    44C417604L1. Divide 16 bit by 8 bit integer.
    44D217618M3. Add task to interrupt chain.
    44D517621M3. Remove task from interrupt chain.
    44D817624M3. Change execution address of task in interrupt chain.
    44DB17627M3. Set task pointer to default of RET.
    44DE17630M1, M3. Verify a sector without reading to RAM.
    44E117633M1, M3. Read sector.
    44E417636M1, M3. Write sector.
    44E817640M1, M3. Read directory sector.
    44EB17643M1, M3. Write directory sector.
    44EE17646M1, M3. Read director.
    44F117649M1, M3. Write directory.
    44F417652M1, M3. User function.
    44F717655M1, M3. Get directory track number.
    46DD18141RDSECT. On Model I, allows you to read a disk sector. Register C contains the drive selcted, D contains the track, E contains the sector number, HL points at data buffer. On return, Z is set if successful; otherwise A contains error code.
    46E618150WTSECT. On Model I, allows you to write a disk sector. Same conditions as RDSECT at 46DDH.
    475418260L1, L3. Select drive.
    475918265L1, L3. Continually reselect drive until it is ready.
    475E18270L1, L3. Seek specified cylinder (track).
    476318275L1, L3. Write sector to disk.
    476818280L1, L3. Write system (directory) sector.
    476D18285L1, L3. Write track to disk (used for formatting).
    477218290L1, L3. Verify sector without transfering data to memory.
    477718295L1, L3. Read sector to buffer.
    478F18319L1, L3. Get address of drive code table for specifed drive.
    479C18332L1, L3. Get byte field from drive code table.
    4B1019216L1, L3. Read directory sector with specified entry code.
    4B1F19231L1, L3. Write system buffer to specified directory sector.
    4B4519269L1, L3. Read directory sector to user buffer.
    4B6419300L3. Get cylinder (track) number of directory.
    4B6519301L1. Get cylinder (track) number of directory.
    4B6B19307L3. Multiply 8 bit by 8 bit integers.
    4B6C19308L1. Multiply 8 bit by 8 bit integers.
    4B7A19322L3. Divide 8 bit by 8 bit integers.
    4B7B19323L1. Divide 8 bit by 8 bit integers.

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu




    Model III RS-232 Ports

    Luis M. Garcia-Barrio


    This section contains a list of Model III RS-232 Ports

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    PORT E8H (232) Master Reset/MODEM Status Register
    Any output to this port resets the Controller.
    On input: Bit 4 -- Ring Indicator
    Bit 5 -- Carrier Detect
    Bit 6 -- Data Set Ready
    Bit 7 -- Clear To Send
    PORT E9H (233) Config. DIP switches/Baud rate select
    On input: Bits 0-2 Baud rate from 50 to 1200 (5=300; 7=1200)
    Bit 3 -- 0=Parity On; 1=Parity Off
    Bit 4 -- 0=1 Stop Bit; 1=2 Stop Bits
    Bit 5-6 Word length (00=5, 01=6, 10=7, 11=8)
    Bit 7 -- 0=Parity Odd; 1=Parity Even
    On output: Bits 0-3 Receive Baud Rate (50-19200)
    Bits 4-7 Transmit Baud Rate (50-19200)
    PORT EAH (234) Status and Control Register
    On input: Bit 3 -- 1=Parity Error
    Bit 4 -- 1=Framing Error
    Bit 5 -- 1=Overrun Error
    Bit 6 -- 1=Data Sent
    Bit 7 -- 1=Data Ready
    On output: Bit 0 -- Data Terminal Ready
    Bit 1 -- Request To Send
    Bit 2 -- Break
    Bit 3 -- Parity enable
    Bit 4 -- Stop bits
    Bits 5-6 Word length select
    Bit 7 -- Parity
    PORT EBH (235) Data Register
    On input: Received Data
    On output: Transmit Data

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu




    Model III/IV Ports

    This section contains a list of Model III/IV Ports

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    PortDescription
    80HInput: Reserved. Output: Graphics board register.
    81HInput: Graphics board RAM read. Output: Graphics board RAM write.
    82HInput: Reserved. Output: Graphics board Y register.
    83HInput: Reserved. Output: Graphics board X register.
    84HMod IV - various controls. 80 micro, March 84, p. 122. Input is reserved. Output:
    Bit 0: Video memory, keyboard memory, and Model III ROM. (See Table 1)
    Bit 1: Same as bit 0. (See Table 1)
    Bit 2: Video display mode. 0 = 64 by 16, 1 = 80 by 24.
    Bit 3: Reverse Video.
    Bit 4: Ram bank select. (See Table 2)
    Bit 5: Ram bank select. (See Table 2)
    Bit 6: Ram bank select. (See Table 2)
    Bit 7: Video page select (64 by 16 mode) 0 = page 0, 1 = page 1.
    85H - 87H.Same as 84H.
    88HCRT controller control register.
    89HCRT controller control register.
    8AHCRT controller control register.
    8BHCRT controller data register.
    8CH - 8FH.Graphics board select 2.
    90HModel IV sound port. Any of the sound routines used on the Model I and Model III that uses port FFH can be changed to this and then the Model IV's built in speaker can be used!
    91H - 93H.Same as 90H.
    94H - BFH.Reserved.
    C0HInput: Hard disk write protect. Output: Reserved.
    C1HHard disk control register.
    C2H - C3H.Input: Hard disk device ID register. Output: Reserved.
    C4HHard disk CTC channel 0.
    C5HHard disk CTC channel 1.
    C6HHard disk CTC channel 2.
    C7HHard disk CTC channel 3.
    C8HHard disk data register.
    C9HHard disk error register.
    E0HMaskable interupt
    E4HSelect NMI options/read NMI status
    E8H--
    E9H------ RS-232
    EAH------ ports
    EBH--
    ECHWrite = various controls/ read = reset clock
    Bit 7 not used
    Bit 6 CPU clock speed [0 = 2 mhz, 1 = 4 mhz (Mod IV only)]
    Bit 5 Video waits [0 = disable, 1 = enable]
    Bit 4 I/O bus [0 = disable, 1 = enable]
    Bit 3 Alt. char. [0 = disable, 1 = enable]
    Bit 2 Double width [0 = normal, 1 = double]
    Bit 1 Cass motor [0 = on, 1 = off]
    Bit 0 not used
    ** NOTE : Ports F0H through F4H are for Model III/IV disk I/O (not Model I) **
    F0HRead FDC status/issue FDC command
    Read status
    80H Not ready
    40H Write protect
    20H Record type/Write fault/Head loaded
    10H Seek error/Record not found
    08H CRC error
    04H Track 0/lost data
    02H Index/DRQ
    01H Busy
    F1HFDC track register
    F2HFDC sector register
    F3HFDC data register
    F4HSelect drive and options
    F8HLine printer addres port
    80H Busy.
    40H Out of paper
    20H Unit select
    10H Fault
    FFHCassette port
    FDC commands via port F0 (Model III only)
    00Hrestore
    80Hread sector
    A0Hwrite normal sector
    A1Hwrite read protect sector
    C0Hread address
    D0Hreset; puts FDC in mode 1
    E0Hread track
    F0Hwrite track
    Table 1
         Bits
    1 0
    Model III
    ROMs Enabled
    Video and
    Keyboard Status.
         00Yes Model III.
         01No Model III.
         10No Model 4. (In)
         11No Model 4. (Out)
    Table 2
         Bits
    6 5 4     
    Lower 32k     
    RAM
    Upper 32K
    RAM
         0 0 0Bank 0Bank 1
         0 1 0Bank 0Bank 2
         0 1 1Bank 0Bank 3
         1 1 0Bank 2Bank 1
         1 1 1Bank 3Bank 1

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu




    ROM Addresses

    This section contains a list of ROM Addresses

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    The following Z80 registers and register pairs apply: A,F,B,C,D,E,H,L,AF,BC,DE,HL,IX,IY. Any of these proceeded by a "'" refers to the alternate set.
    Miscellaneous:
         SA - Software accumulator
         SA1 - Alternate software accumulator
         RA - Register accumulator (E,D,C,B).
    HexDecLabelTypeDescription
    00000DOSCLDJp"In cassette systems, reset computer; in disk systems, cold boot of DOS. Could also be done via RST 00H."
    00088SYNTAXRSTChecks for syntax. HL points to byte to be checked and proper byte follows RST 08H instruction.
    000B11WHERECall"Vector used to resolve relocation address of calling routine. On exit, HL points to address following Call instruction."
    001319GETCallThis routine gets a byte from a logical device or a file that is open. Entry: DE points at FCB. Exit: A = byte.
    001824CP16RstCompare DE and HL as 16 bit unsigned intergers.
    001B27PUTCallOutputs a byte to a logical device or FCB. DE = FCB and A = byte. Don't confuse with CTL at 0023.
    002335CTLCallOutputs a control byte to a logical device or FCB. DE = FCB and A = control byte.
    002840RstPressing Break key RST's here and then jumps to location 400CH. Also normal DOS function vector.
    002B43KBDSCNCallScan keyboard and return with accumulator containing result. DE is used.
    003351VDCHARCallDisplays a character at current cursor location.
    003B59PRCHARCall"Waits until printer is ready then prints charatcter. A = ASCII character. If BREAK is pressed, a return to caller is made."
    004064KBLINECallCall Input a line from the keyboard. B = max length of line. HL points at buffer. Buffer should be the length of B plus 1. To terminate, hit BREAK or ENTER. On exit, HL points at buffer and B = number of characters entered. Carry will be set if BREAK was pressed.
    004973KBWAITCall"Scans the keyboard until a key is pressed. If BREAK is pressed, it is returned like other keys."
    005080RSRCVCall"Recieve a character from RS-232. No entry conditions. On exit, memory location 16872 contains character recieved. DE is altered. This routine honors wait status."
    005585RSTXCall"Transmit character to RS-232. On entry, Accumulator or memory location 16880 contains character. On exit, 16880 = 0 if no character sent. Wait status honored."
    005A90RSINITCallCall Initialize RS-232 interface. On entry, memory location 16888 = send/recieve baud rate code, location 16890 = wait/don't wait switch, location 16889 = RS-232 characteristics switch. On exit, DE is altered. For more detail, consult Model 3 reference manual.
    006096DELAYCall"Load BC with how many times to loop, then call."
    0069105INITIOCall"Initialize all I/O drivers to their ROM routines. No entry conditions. On exit, all registers changed."
    006C108ROUTECall"On entry, location 4222H = two byte source device ASCII abbreviation and location 4220H = two byte destination ASCII abbreviation. On exit, DE is altered."
    0072114An alternative for entering Basic. See also 1A19H.
    00B1177Type in SYSTEM (even from DISK BASIC) and reply to the "*?" prompt with /177. The computer will then ask you for memory size. Upon return, you'll still be in DISK BASIC, but your program will be gone. Also, it doesn't get along with any high memory routines present.
    00FA250Call this routine from BASIC and your computer will brag about it having Level II or Model III BASIC.
    0132306POINTBasic's POINT routine.
    0135309SETBasic's SET routine.
    0138312RESETBasic's RESET routine.
    0150336GRAPHJpThis is the routine that is Basic's SET, RESET, and POINT functions. Here's how to use it. Load HL with return address and push. Load register A with one of the following: 00H = POINT, 01H = RESET, and 80H = SET. Push AF onto stack. Load A with X coordinate and push onto stack. Load A with Y coordianate and JP GRAPH.
    018C396Call"Checks for syntax of "")"" via RST 08H."
    01C9457CLSCallClear screen.
    01D3467RANDOMCallRandomize.
    01F8504CSOFFCallThis routine turns off the cassette drive.
    0212530DEFCASCallA register contains a 0 or 1 which is the cassette number. This routine defines cassette number and turns on cassette. Model I only.
    022C556?????????
    0235565CSINCallInputs data one byte at a time from cassette after you use CSHIN. A = the data byte.
    0264612CSOUTCallOutputs data one byte at a time to cassette after you use CSHWR. A = the output byte.
    0287647CSHWRCallTurns on the cassette and writes the header.
    0296662CSHINCallFinds the cassette header info at the beggining of cassette file.
    02B2690SYSTEMBasic's SYSTEM routine.
    0314788?????????
    032A810OUTCHRCallOuput character in register A; OUTSEL (409CH) selects device. See OUTSEL for device values.
    033A826DISPACallDisplays character in A on screen at next print position. Uses AF.
    0358856Calls keyboard scan routine.
    035B859CallSame as 002BH.
    0361865KIBUFFCallReads keyboard into buffer until a carriage return is entered. 40A7H contains the address of the buffer.
    03C2962Line printer driver for Model I.
    03E3995Keyboard driver for Model I. Model III = 3024H.
    04581112Video driver for Model I.
    04731139Video driver for Model III.
    05061286CURCON"Start of cursor control table. Model I. 80 Microcomputing, Sept. 1980, p. 187."
    05401344End of cursor control table.
    058D1421Line printer driver for Model I.
    05D91497KLINECallSame as KBLINE. See 0040.
    06CC1740An alternative for entering Basic. See also 1A19H.
    06D21746Start of Model 1 interrupts relocated to RAM on boot up.
    06E61766End of Model 1 interrupts relocated to RAM on boot up.
    06E71767Start of Model 1 keyboard DCB.
    06EE1774End of Model 1 keyboard DCB.
    06EF1775Start of Model 1 Video DCB.
    06F61782End of Model 1 Video DCB.
    06F71783Start of Model 1 Printer DCB.
    06FE1790End of Model 1 Printer DCB.
    07131811SUBSPCallSubtract SA from RA; result in SA.
    07161814ADDSPCallAdd RA and SA; result in SA.
    07781912RSETSACall"If SA contains a 00H, RND generates a number between 0 and 1. Use this call to place a 00H in SA."
    08092057LOGCallBasic's LOG function.
    08472119MLTSPCallMultiply RA and SA; result in SA.
    08A22210DIVSPCallDivide RA by SA; result in SA.
    09772423ABSCallBasic's ABS function.
    09822434MVVARCallMove number of bytes shown by typeflag from area pointed to by DE to area pointed to by HL.
    098A2442SGNCallBasic's SGN function.
    09A42468LDSTSACallLoad SA into stack.
    09B12481LDSAHLCallLoad single precision number pointed to by HL into SA.
    09B42484LDSARACallLoad RA into SA.
    09BF2495LDRASACallLoad SA into RA.
    09C22498LDRAHLCallLoad single precision number pointed to by HL into RA.
    09CB2507LDHLSACallLoad SA into area pointed to by HL.
    09D22514LDDEHLCallLoad single precision number pointed to by HL into area pointed to by DE; needs FLAGSP.
    09D32515LDHLDECallLoad single precision number pointed to by DE into area pointed to by HL; needs FLAGSP.
    09D62518MOVEACall"Move data; DE = source, HL = destination, A = how much to move."
    09D72519MOVEBCall"Same as above, except B contains the count."
    09F72551MVSAHLCallMove number pointed to by HL into SA; needs FLAGDP.
    09FC2556MVALTCallMove SA into SA1.
    0A0C2572CPSPCallCompare RA and SA1.
    0A392617CPINTCallCompare DE and HL.
    0A782680CPDPCallCompare SA and SA1.
    0A7F2687GETPARCallLoad parameter in USR(x) into HL; this must be first instruction of USR call. Also used for CINT function.
    0A9A2714BSCPARJpReturn to Basic program with parameter.
    0A9D2717FLAGINCallSet typeflag of SA to interger.
    0AB12737CSASPCallConvert SA to single precision. Also Basic's CSNG routine.
    0ACC2764CHGISCallValue in workspace/accumulator is changed from integer to single precision.
    0ADB2779CSADPCallConvert SA to double precision. Also Basic's CDBL routine.
    0AEC2796FLAGDPCallSet typeflag for SA to double precision.
    0AEF2799FLAGSPCallSet typeflag for SA to single presision.
    0B262854FIXCallBasic's FIX function.
    0B372871INTCallBasic's INT function.
    0BC73015SUBINTCallSubtract HL from DE; result in HL and SA if no overflow (flag = 2); result in SA only if overflow (flag = 4).
    0BD23026ADDINTCallAdd DE and HL; result in HL and in SA if no overflow.
    0BF23058MLTINTCall"Multiply DE and HL; result in HL and SA if no overflow (flag=2), result in SA only if overflow (flag=4)"
    0C703184SUBDPCallSubtract SA1 from SA; result in SA.
    0C773191ADDDPCallAdd SA and SA1; result in SA.
    0DA13489MLTDPCallMultiply SA and SA1; result in SA.
    0DE53557DIVDPCallDivided SA by SA1; result in SA.
    0FAF4015Display integer number in HL in ASCII decimal. The ASCII number will also be in memory at 4131H - 4135H.
    0FBD4029CSAASCCallConvert SA (set typeflag) to ASCII. Result (in dec) is placed in buffer starting at 4130H and terminated by a 00H byte and HL = 4130H.
    13E75095SQRCallBasic's SQR function.
    13F75111POWERCallRaise RA to the power SA; result in SA.
    14395177EXPCallBasic's EXP function.
    14C95321RNDCallBasic's RND function.
    14CC5324???
    15415441COSCallBasic's COSine function.
    15475447SINCallBasic's SIN function.
    15A85544TANCallBasic's TAN function.
    15BD5565ATNCallBasic's ATN function
    16085640"Beginning of jump table for Basic's functions. For Basic's jump statement table, see 1822H."
    164F5711End of jump table for Basic's functions.
    16505712Beginning of table of names of Basic's reserved words.
    181F6175End of table of names of Basic's reserved words.
    18226178"Beginning of jump table for Basic's statements. For Basic's jump funtion table, see 1608H."
    18996297End of jump table for Basic's statements.
    18C96345"Start of BASIC error messages. Ie: NF, OM, etc."
    18F66390End of BASIC error messages.
    196C6508Check for enough RAM for stack operation.
    19976551SN ERROR routine.
    19A26562ERROR routine.
    1A196681BASICJp"Return to Basic and display Basic READY prompt (if you have difficulty with 1A19, try 06CCH or 0072H instead)"
    1AF86904Writes line pointers beginning from start of Basic program.
    1AFC6908Writes line pointers beginning with line pointed to by DE.
    1B2C6956FNDLIN"To use: Load DE with line number, call and this location. Upon exit, BC will contain location. 80 Micro, Feb. 1981, p. 148."
    1B496985NEWBasic's NEW routine.
    1B4D6989"Reset Basic pointers? 80 Microcomputing, Nov 81, p. 386."
    1B5D6705Basic initialization routines (RUN).
    1BC07104TOKENBasic's tokenizing routine. Point register pair HL to the start of the string to be tokenized terminated by a 0 byte and call 1BC0H. Upon exit, HL will point to one byte below the tokenized string which will be terminated by a 0 byte.
    1CA17329FORBasic's FOR routine.
    1D1E7454RUNSTMJp"HL points at "":"" or 00H terminating a Basic statement or line; execution will proceed from next statement."
    1D917569RESTOREBasic's RESTORE routine.
    1D9B7579Scan for shift @ and BREAK.
    1DA97593STOPBasic's STOP routine.
    1DAE7598ENDBasic's END routine.
    1DE47652CONTBasic's CONT routine.
    1DF77671TRONBasic's TRON routine.
    1DF87672TROFFBasic's TROFF routine.
    1E007680DEFSTRBasic's DEFSTR routine.
    1E037683DEFINTBasic's DEFINT routine.
    1E067686DEFSNGBasic's DEFSNG routine.
    1E097689DEFDBLBasic's DEFDBL routine.
    1E4A7754FCERRCall"Prints ""FC Error""."
    1E5A7770VALCall"Convert a string representing a decimal number and terminated by a 00H byte to a binary number. HL points at first character, DE contains result after call."
    1E7A7802CLEARBasic's CLEAR routine.
    1EA37843RUNBasic's RUN routine.
    1EB17857GOSUBBasic's GOSUB routine.
    1EC27874GOTOBasic's GOTO routine.
    1EDE7902RETURNBasic's RETURN routine.
    1F057941DATABasic's DATA routine.
    1F077943REM/ELSEBasic's REM and/or ELSE routine.
    1F217969EVALUCallCall Evaluate expression. Useful for doing complicated math functions in machine language. HL must point to a portion of memory that is in tokenized BASIC and terminated by a 00H byte or a ":" byte. Also known as Basic's LET routine.
    1F6C8044ONBasic's ON routine.
    1FAF8111RESUMEBasic's RESUME routine.
    1FF48180ERRORBasic's ERROR routine.
    20088200AUTOBasic's AUTO routine.
    20398249IFBasic's IF routine.
    20678295LPRINTBasic's LPRINT routine.
    206F8303PRINTBasic's PRINT routine.
    219A8602INPUTBasic's INPUT routine.
    21E38675MVSTRCallMove string into space; HL points at first byte of buffer and BC points at variable name.
    21EF8687READBasic's READ routine.
    22B68886NEXTBasic's NEXT routine.
    23379015"Gets a general (string, integer, single, or double precision) parameter in the accumulator and sets the type flag (40AFH) accordingly."
    24909360DIVINTCallCall Divide DE by HL; result in SA in single precision format. 2540 9536 LDVAWS Call Loads value of variable into workspace/ accumulator. On entry, HL points to first character of variable name. On exit, HL points to first character following variable name.
    25A19633CPSTRCall"Compare two strings. HL and BC point at strings, D and E contain lengths."
    26089736DIMBasic's DIM statement.
    260D9741VARPTRCall"Get variable address in DE, HL points at variable name."
    27D410196FREBasic's FRE routine.
    27F510229POSBasic's POS routine.
    283610294STR$Basic's STR$ routine.
    28A710407OUTSTRCall"Output string terminated by a 00H byte or 22H ("") byte.; HL points at first character, OUTSEL (409CH) selects device. See OUTSEL for device numbers."
    2A0310755LENBasic's LEN routine.
    2A0F10767ASCBasic's ASC routine.
    2A1F10783CHR$Basic's CHR$ routine.
    2A6110849LEFT$Basic's LEFT$ routine.
    2A9110897RIGHT$Basic's RIGHT$ routine.
    2A9A10906MID$Basic's MID$ routine.
    2AEF10991INPBasic's INP routine.
    2A2F10799STRING$Basic's STRING$ routine.
    2AC510949VALBasic's VAL routine.
    2AFB11003OUTBasic's OUT routine.
    2B0211010Gets a two byte integer in DE.
    2B1711031"Evaluate expression? 80 Microcomputing, Nov 81, p. 386"
    2B1C11036Gets a one byte integer in A.
    2B2911049LLISTBasic's LLIST routine.
    2B2E11054LISTBasic's LIST routine.
    2B7511125OSTRCall"Output string to current device. On entry, HL points to first character in string which ends in a 00 byte."
    2B7E11134"Write line of Basic in buffer, change tokens to words."
    2BC611206DELETEBasic's DELETE routine.
    2BF511253CSAVEBasic's CSAVE routine.
    2C1F11295CLOADBasic's CLOAD routine.
    2C7711383"Initialize for Basic. 80 Micro, Sep. 1980, p. 72."
    2CAA11434PEEKBasic's PEEK routine.
    2CB111441POKEBasic's POKE routine.
    2E6011872EDITBasic's EDIT routine.
    2E6611878EDITOR"Load HL with line number to edit and use this routine. 80 Micro, Feb. 1981, p. 148."
    302412324Video driver for Model III.
    303312339GETDATCall"Get date in ASCII format. Mod III TRSDOS, LDOS, & MULTIDOS."
    303612342GETTIMCall"Get time in ASCII format. Mod III TRSDOS, LDOS, & MULTIDOS."
    304212354?????????
    37E014304Port"Model I interrupt address port. Bit 7 set for clock, bit 6 set for disk."
    37E114305PortModel I disk drive select.
    37E414308PortModel I cassette 1 or 2 select (0 or 1).
    37E814312PortLineprinter address port.
    37EC14316PortModel I disk command/status.
    37ED14317PortModel I disk track select.
    37EE14318PortModel I disk sector select.
    37EF14319PortModel I disk data.
    380014336PortsBeginning of model I & III keyboard address ports.
    38401440PortsEnd of model I & III keyboard address ports.

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu




    Radio Shack 5/15 Meg HD Port Assignments

    Bob Haynes, [73075,77], 10/15/87

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    This chart provides reference on the Western Digital Hard Disk Controller board WD1000-TB1, based on the WD1010 controller chip and WD1100 support chip. This board is used in later (white) versions of the Radio Shack 15 Meg Hard Disk (26-4155).
    Earlier versions of the 15M, the 5M, and 12M hard disk systems all use a larger controller board based on the 8X300 controller chip. I've heard the R/S 8M hard disk also uses the 8X300 board, but that's unconfirmed.
    I have little information on the 8X300 board, but since both 15 and 5 Meg systems are known to work with the same driver/format software from at least three sources (Tandy/MISOSYS/PowerSOFT), it is assumed most of this chart also applies to the earlier 8X300 board. (one difference is noted above)
    Although Radio Shack has mapped the HD access ports from C0-CFH as a standard configuration, both boards can re-map the ports to 50-5FH, 60-6FH, or 70-7FH simply by changing some jumpers. (If interested, drop a line for details.)
    Special thanks to Adam Rubin, who reviewed the information to help confirm its accuracy. Comments, corrections and updates are welcome!
                     Radio Shack 5/15 Meg HD Port Assignments
    .--------------------------------------------------------------------------.
    |PORT C0H - READ ONLY                |PORT C1H - R/W - HD Control Register |
    |Bits 2-3 unused                     |Bits 0-2, 5-7 unused (see note 4)    |
    |     0-INTRQ-Interrupt request      |     3    If set, enables controller |
    |     1-HWPL-If set, at least one HD |     4    If set, resets controller  |
    |            is write protected      |-------------------------------------|
    |     4-WPD4-drive 4 write protected |PORT C2-C3H - READ - HD Dev. ID Reg. |
    |     5-WPD3-drive 3 write protected |     C4-C7H - HD CTC Channels 0-3    |
    |     6-WPD2-drive 2 write protected |     See note 1                      |
    |     7-WPD1-drive 1 write protected |-------------------------------------|
    |------------------------------------|PORT C8H - R/W - HD Data Register    |
    |PORT C9H - READ - Error Register    |-------------------------------------|
    |Bits 3,5 all reserved (zero)        |PORT C9H - WRITE - Wrt Pre-Comp Cyl. |
    |     0-DAM not found (see note 2)   |The value stored here multiplied x4  |
    |     1-Track 0 Error (restore cmnd) |is the RWC start cylinder number.    |
    |     2-Aborted Command              |-------------------------------------|
    |     4-ID Not Found Error           |PORT CAH - R/W - Sector Count        |
    |     6-CRC Data Field Error         |Used only for multiple sector access |
    |     7-Bad Block Detected           |don't care w/ single sector commands,|
    |------------------------------------|internally decrements when used.     |
    |PORT CBH - R/W - Sector number      |-------------------------------------|
    |------------------------------------| PORT CDH - R/W - Cylinder MSB       |
    |PORT CCH - R/W - Cylinder LSB       |   (bits 0-1 only; max cyls = 1024)  |
    |--------------------------------------------------------------------------|
    |PORT CEH - R/W - SDH - Sector size/Drive #/Head #                         |
    |Bits 0-2  Head number  (0-7)                                              |
    |     3-4  Drive number (00-11 reference DSEL1-DSEL4 respectively)         |
    |     5-6  Sector size  (00=256, 01=512, 10=1024, 11=128)                  |
    |     7    EXTension:   if set, ECC (Error Checking and Correction) codes  |
    |                       are in use, R/W data (sector length+7 bytes) do    |
    |                       not check/generate CRC.                            |
    |--------------------------------------------------------------------------|
    |PORT CFH - READ - Error Status Register                                   |
    |Bit 0  Error (OR of bits 1-7)       Bit 4  Seek complete                  |
    |    1  Command in progress              5  Write fault                    |
    |    2  Reserved (0)                     6  Drive ready                    |
    |    3  Data request                     7  Busy                           |
    |--------------------------------------------------------------------------|
    |PORT CFH - WRITE - Command Register Instruction Set - see note 3          |
    |          Bits: 7 6 5 4 3 2 1 0    |            Bits: 7 6 5 4 3 2 1 0     |
    |  Restore     | 0 0 0 1 d c b a    |  Read Sector   | 0 0 1 0 i m 0 0     |
    |  Seek        | 0 1 1 1 d c b a    |  Write Sector  | 0 0 1 1 0 m 0 0     |
    |  Scan ID     | 0 1 0 0 0 0 0 0    |  Write Format  | 0 1 0 1 0 0 0 0     |
    |                                   |                                      |
    | "dcba" defines step rate field:   | "i" defines interrupt enable status: |
    |      0000 =  35 us.               |   0 = interrupt when data request    |
    | 0001-1111 =  0.5-7.5 ms in        |       line (DRQ*) is enabled         |
    |               0.5 ms steps        |   1 = interrupt at end of command    |
    |                                                                          |
    | "m" defines multiple sector flag: 0 = one sector, 1 = multiple sectors   |
    `--------------------------------------------------------------------------'
    
    Notes:
    1.  Ports C2-C7 are applicable to the Model II configuration with interface
        board and 8X300 controller board only.  (no further information was
        available, sorry!)
    
    2.  Port C9, bit 0, READ: R/S 15M HD Service Manual indicates this bit is
        reserved (forced zero), but WD1010-00 spec sheet indicates it is used to
        indicate a "DAM not found" error.
    
    3.  Port CF, WRITE: The 4P ROM is known to send three commands to this port:
        16H-restore, 20H-read one sector, 70H-seek. Draw your own conclusions re
        the step rate and interrupt values.
    
    4.  Although there is no formal documentation of this, according to the
        schematics, port C1H bit 2 seems to be used to enable wait state support
        on the 8X300 controller board.  I cannot absolutely confirm this, neither
        can I say whether the later WD-1000-TB1 board implements this function.
    

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu




    Tokenized BASIC

    Leonard Erickson (aka Shadow)

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    Each "line" starts with the 2-byte address of the start of the *next* line. Then there's the line number. Both are binary integers in LSB MSB format. This is followed by the text of the line, with BASIC keywords replaced by one byte tokens. All tokens have bit 8 set.

    129     FOR             170     KILL            211     OR
    130     RESET           171     LSET            212     >
    131     SET             172     RSET            213     =
    132     CLS             173     SAVE            214     <
    133     CMD             174     SYSTEM          215     SGN
    134     RANDOM          175     LPRINT          216     INT
    135     NEXT            176     DEF             217     ABS
    136     DATA            177     POKE            218     FRE
    137     INPUT           178     PRINT           219     INP
    138     DIM             179     CONT            220     POS
    139     READ            180     LIST            221     SQR
    140     LET             181     LLIST           222     RND
    141     GOTO            182     DELETE          223     LOG
    142     RUN             183     AUTO            224     EXP
    143     IF              184     CLEAR           225     COS
    144     RESTORE         185     CLOAD           226     SIN
    145     GOSUB           186     CSAVE           227     TAN
    146     RETURN          187     NEW             228     ATN
    147     REM             188     TAB             229     PEEK
    148     STOP            189     TO              230     CVI
    149     ELSE            190     FN              231     CVS
    150     TRON            191     USING           232     CVD
    151     TROFF           192     VARPTR          233     EOF
    152     DEFSTR          193     USR             234     LOC
    153     DEFINT          194     ERL             235     LOF
    154     DEFSNG          195     ERR             236     MKI$
    155     DEFDBL          196     STRING$         237     MKS$
    156     LINE            197     INSTR           238     MKD$
    157     EDIT            198     POINT           239     CINT
    158     ERROR           199     TIME$           240     CSNG
    159     RESUME          200     MEM             241     CDBL
    160     OUT             201     INKEY$          242     FIX
    161     ON              202     THEN            243     LEN
    162     OPEN            203     NOT             244     STR$
    163     FIELD           204     STEP            245     VAL
    164     GET             205     +               246     ASC
    165     PUT             206     -               247     CHR$
    166     CLOSE           207     *               248     LEFT$
    167     LOAD            208     /               249     RIGHT$
    168     MERGE           209     ^               250     MID$
    169     NAME            210     AND
    

    Here are the single byte model 4 codes:
    128                     171     AUTO            214     NOT
    129     END             172     RENUM           215     ERL
    130     FOR             173     DEFSTR          216     ERR
    131     NEXT            174     DEFINT          217
    132                     175     DEFSNG          218     USING
    133     INPUT           176     DEFDBL          219     INSTR
    134     DIM             177     LINE            220     '
    135     READ            178                     221     VARPTR
    136     LET             179                     222
    137     GOTO            180     WHILE           223     ERRS$
    138     RUN             181     WEND            224     INKEY$
    139     IF              182     CALL            225     MEM
    140     RESTORE         183     WRITE           226     TIME$
    141     GOSUB           184     COMMON          227
    142     RETURN          185     CHAIN           228
    143     REM             186     OPTION          229
    144     STOP            187     RANDOM          230
    145     PRINT           188                     231
    146     CLEAR           189     SYSTEM          232
    147     LIST            190                     233
    148     NEW             191     OPEN            234
    149     ON              192     FIELD           235
    150     WAIT            193     GET             236
    151     DEF             194     PUT             237
    152     POKE            195     CLOSE           238
    153     CONT            196     LOAD            239
    154                     197                     240     >
    155                     198                     241     =
    156     OUT             199     NAME            242     <
    157     LPRINT          200     KILL            243     +
    158     LLIST           201     LSET            244     -
    159     CLS             202     RSET            245     *
    160                     203     SAVE            246     /
    161                     204                     247     ^
    162     ELSE            205     SOUND           248     AND
    163     TRON            206                     249     OR
    164     TROFF           207     TO              250     XOR
    165     SWAP            208     THEN            251     EQV
    166     ERASE           209     TAB             252     IMP
    167     EDIT            210     STEP            253     MOD
    168     ERROR           211     USR             254     \
    169     RESUME          212     FN              255
    170     DELETE          213     SPC
    

    The 2 byte codes all start with a 255 byte (FFh), the second byte is listed below:

    128
    129     LEFT$
    130     RIGHT$
    131     MID$
    132     SGN
    133     INT
    134     ABS
    135     SQR
    136     RND
    137     SIN
    138     LOG
    139     EXP
    140     COS
    141     TAN
    142     ATN
    143     FRE
    144     INP
    145     POS
    146     LEN
    147     STR$
    148     VAL
    149     ASC
    150     CHR$
    151     PEEK
    152     SPACE$
    153     OCT$
    154     HEX$
    155     LPOS
    156     CINT
    157     CSNG
    158     CDBL
    159     FIX
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170     CVI
    171     CVS
    172     CVD
    173     EOF
    174     LOC
    175     LOF
    176     MKI$
    177     MKS$
    178     MKD$
    179     ROW
    

    Pete Cervasio continues with

    REM is 143. The three byte sequence is :, 143, 251 and in the program below I decode 251 as the single quote.

    I've converted this one and my Model 4 converter to Turbo Pascal recently, and they allow things like having the keywords come out in upper/lower/mixed case, and other fun stuff like that. I'll put them up on the web when I get them finished up a little more.

    One weird thing: Model 1/3 basic stores literal numbers as the ASCII representation of those numbers. Model 4 basic stores them in the binary representation.

    ' Model 1/3 compresed BASIC to ASCII format converter thingie
    ' Copyright (c) 1998, Peter Cervasio (cervasio@airmail.net)
    ' Permission to distribute freely is granted to all.
    DEFINT A-Z
    
    DIM KeyWord$(256)
    
    false = 0
    true = NOT false
    
    READ First%, Last%
    
    FOR i = First% TO Last%
            READ KeyWord$(i)
    NEXT
    
    PRINT "MOD1BAS - Model 1/3 BASIC to ASCII Conversion Program"
    PRINT "Copyright (c) 1997, Pete Cervasio"
    PRINT "Distribute freely"
    PRINT
    PRINT "Model 1/3 BASIC file to convert: ";
    LINE INPUT TheFile$
    IF TheFile$ = "" THEN END
    
    
    PRINT "Enter output filename: ";
    LINE INPUT OutFile$
    IF OutFile$ = "" THEN
      IF INSTR(TheFile$, ".") = 0 THEN
        OutFile$ = TheFile$ + ".qbx"
      ELSE
        OutFile$ = LEFT$(TheFile$, INSTR(TheFile$, ".")) + "qbx"
      END IF
    END IF
    
    
    OPEN TheFile$ FOR BINARY AS 1
    
    
    A$ = " "
    GET 1, , A$
    
    
    IF A$ = CHR$(255) THEN
      PRINT TheFile$; " -> "; OutFile$
      OPEN OutFile$ FOR OUTPUT AS 2
      WHILE NOT EOF(1)
        GET 1, , i%
        IF i% = 0 THEN END
        GET 1, , i%
        IF i% > 0 THEN
          PRINT #2, LTRIM$(RTRIM$(STR$(i%))); " ";
        ELSE
          PRINT #2, LTRIM$(RTRIM$(STR$(65536! + i%))); " ";
        END IF
        linedone = false
        WHILE NOT linedone
          GET 1, , A$
          IF A$ = CHR$(0) THEN
            linedone = true
          ELSE
            j = ASC(A$)
            IF (j >= First%) AND (j <= Last%) THEN
              PRINT #2, KeyWord$(j);
            ELSE
              PRINT #2, A$;
            END IF
          END IF
        WEND
        PRINT #2, ""
      WEND
    ELSE
      PRINT "Could not recognize "; TheFile$; " - 1st byte not 0xFF"
    END IF
    CLOSE
    
    
    END
    
    
    DATA 128, 251
    DATA END, FOR, RESET, SET, CLS, CMD, RANDOM, NEXT, DATA, INPUT, DIM
    DATA READ, LET, GOTO, RUN, IF, RESTORE, GOSUB, RETURN, REM, STOP
    DATA ELSE, TRON, TROFF, DEFSTR, DEFINT, DEFSNG, DEFDBL, LINE, EDIT
    DATA ERROR, RESUME, OUT, ON, OPEN, FIELD, GET, PUT, CLOSE, LOAD
    DATA MERGE, NAME, KILL, LSET, RSET, SAVE, SYSTEM, LPRINT, DEF, POKE
    DATA PRINT, CONT, LIST, LLIST, DELETE, AUTO, CLEAR, CLOAD, CSAVE
    DATA NEW, "TAB(", TO, FN, USING, VARPTR, USR, ERL, ERR, STRING$, INSTR
    DATA POINT, TIME$, MEM, INKEY$, THEN, NOT, STEP, "+", "-", "*", "/"
    DATA "^", AND, OR, ">", "=", "<", SGN, INT, ABS, FRE, INP, POS, SQR
    DATA RND, LOG, EXP, COS, SIN, TAN, ATN, PEEK, CVI, CVS, CVD, EOF, LOC
    DATA LOF, MKI$, MKS$, MKD$, CINT, CSNG, CDBL, FIX, LEN, STR$, VAL, ASC
    DATA CHR$, LEFT$, RIGHT$, MID$, "'"
    

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu




    Pokes and Peeks

    Valley TRS-80 Hackers Group (A Levinson and E Bagai)


    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    MODELADDRESSESFUNCTION



    30 TO 14335ROM - LOW MEMORY - BASIC INTERPRETER
    30 (0000H)$RESET SOFTWARE SYSTEM RESET
    343 (002BH)$KBCHAR SCAN KEYBOARD FOR A CHARACTER
    351 (0033H)$VDCHAR DISPLAY A CHARACTER ON THE SCREEN
    359 (003BH)$PRCHAR PRINT A CHARACTER ON THE PRINTER
    364 (0040H)$KBLINE GET A LINE FROM THE KEYBOARD
    373 (0049H)$KBWAIT WAIT FOR A KEYBOARD CHARACTER
    380 (0050H)$RSRCV RECEIVE A CHARACTER FROM RS-232-C
    1/384UNOFFICIAL PEEK POINT (SEE 293) 1=M1 ELSE=M3
    385 (0055H)$RSTX SEND A CHARACTER TO RS-232-C
    390 (005AH)$RSINIT INITIALIZE THE RS-232-C
    396 (0060H)$DELAY DELAY FOR A SPECIFIED TIME
    3105 (0069H)$INITIO INITIALIZE I/O DRIVERS
    3108 (006CH)$ROUTE ROUTE I/O DEVICES
    1/3293OFFICIAL RADIO SHACK PEEK POINT 73=M3 ELSE=M1
    3457 (01C9H)$VDCLS CLEAR THE SCREEN
    3473 (01D9H)$PRSCN PRINT THE SCREEN ON THE PRINTER
    3504 (01F8H)$CSOFF TURN OFF THE CASSETTE
    3539 (021BH)$VDLINE DISPLAY A LINE TO THE SCREEN
    3565 (0235H)$CSIN INPUT A BYTE FROM THE CASSETTE
    3612 (0264H)$CSOUT OUTPUT A BYTE TO THE CASSETTE
    3647 (0287H)$CSHWR WRITE THE CASSETTE HEADER
    3653 (028DH)$KBBRK QUICK SCAN FOR BREAK KEY ONLY
    3662 (0296H)$CSHIN SEARCH FOR HEADER ON CASSETTE
    3664 (0298H)$CLKON TURN ON THE CLOCK DISPLAY
    3673 (02A1H)$CLKOFF TURN OFF THE CLOCK DISPLAY
    36681 (1A19H)$READY BASIC READY ENTRY ADDRESS
    312339 (3033H)$DATE GET THE SYSTEM DATE
    312342 (3036H)$TIME GET THE SYSTEM TIME
    312354 (3042H)$SETCAS SELECT CASSETTE BAUD RATE
    114305DISK DRIVE SELECT
    114308Values: 0-1
    SELECT TAPE DRIVE: 0=#1 1=#2
    314312 (37E8H)$PRSTAT PRINTER STATUS BYTE
    1/314312PRINTER ON=63 OFF=143 (NOT DEPENDABLE)
    114316DISK COMMAND/STATUS --
    114317DISK TRACK SELECT
    114318DISK SECTOR SELECT
    114319DISK DATA
    1/314336 TO 14400KEYBOARD ADDRESS MATRIX
    1/314337SEE 15105
    1/314338SEE 15106
    1/314340SEE 15108
    1/314352SEE 15120
    1/314368SEE 15136
    1/314400SEE 15168
    1/314464SEE 15232
    MEM.   1   2   4   8  16  32  64  128
     ......................................
    14337= `   A   B   C   D   E   F   G
    14338= H   I   J   K   L   M   N   O
    14340= P   Q   R   S   T   U   V   W
    14344= X   Y   Z
    14352= 0   1   2   3   4   5   6   7
    14368= 8   9   :   ;   ,   -   .   /
    14400=ENT CLR BRK UP  DN   LT  RT SPC
    14464=SHF SHF CTL CAP F1   F2  F3
    
    MODEL I IS MAPPED FOR DECIMAL 1 IN THE
    POSITION 14464 FOR EITHER SHIFT KEY. IN
    THE MODEL III AND 4, THE LOCATION 14464
    WOULD BE DECIMAL 1 FOR THE LEFT SHIFT KEY
    AND DECIMAL 2 FOR THE RIGHT SHIFT KEY.
    
    FOR EXAMPLE, IF PEEK(14340)=16,
    THEN THE "T" KEY IS BEING PRESSED.
    OR IF PEEK(14400)=1, THEN THE
    ENTER KEY IS BEING PRESSED.
    THIS DOES NOT USE THE INKEY$
    ROUTINE, AND THEREFORE YOU CAN
    HOLD A KEY DOWN INSTEAD OF HITTING
    IT REPEATINGLY. (USEFUL FOR ACTION
    GAMES) ALSO, IF TWO KEYS THAT HAVE
    THE SAME KEYBOARD ADDRESS ARE
    PRESSED AT THE SAME TIME, THE
    VALUE WILL BE THE SUM OF THE TWO
    KEYS. EX: If ENTER and CLEAR are
    pressed at the same time, location
    14400 will equal 3. (UP =Up Arrow
    DN=Down Arrow, LT=Left Arrow, and
    RT=Right Arrow)
    
    1/315105Values: 1,2,4,...128
    PEEK KEYBOARD RESPECTIVELY: A,B,C,D,E,F,G
    1/315106Values: 1,2,4,...128
    PEEK KEYBOARD RESPECTIVELY: H,I,J,K,L,M,N,O
    1/315108Values: 1,2,4,...128
    PEEK KEYBOARD RESPECTIVELY: P,Q,R,S,T,U,V,W
    1/315112Values: 1,2,4
    PEEK KEYBOARD RESPECTIVELY: X,Y,Z
    1/315120Values: 1,2,4,...128
    PEEK KEYBOARD RESPECTIVELY: 0,1,2,3,4,5,6,7
    1/315136Values: 1,2,4,...128
    PEEK KEYBOARD RESPECTIVELY: 8 9 : ; , - . /
    1/315168Values: 1,2,4,...128
    PEEK: ENTER, CLR,BREAK,UP-ARW,DN-ARW,L-ARW,R-ARW,SPACE
    1/315232PEEK KEYBD RT/LT SHIFT
    115360Value: 1/65
    1:RADIO SHACK LC MOD 65=NOT RS MOD OR L/C DRIVER INSTALLED
    1/315360 TO 16383RAM - VIDEO DISPLAY (BEGINS UPPER RIGHT CORNER)
    316383 (3FFFH)END OF VIDEO MEMORY
    1/316387 TO 16389RST 10H TRANSFER ADDRESS
    1/316396Value: 201
    RE-ENABLE BREAK KEY
    116396Value: 23/221
    IN LEVEL II: 23=DISABLES BREAK 221=ENABLES BREAK
    316396Value: 175
    1ST OF TWO TO DISABLE BREAK (RS RECOMMENDS)
    316396 (400CH)BREAK KEY JUMP VECTOR
    316396Value: 195
    1ST OF 3 COMBINED TO DISABLE BREAK
    316397Value: 154
    2ND OF 3 COMBINED TO DISABLE BREAK
    316397Value: 201
    2ND OF TWO TO DISABLE BREAK (RS RECOMMENDS)
    316398Value: 10
    3RD OF 3 COMBINED TO DISABLE BREAK
    1/316402 TO 16405RST 38H TRANSFER ADDRESS
    1/316405 TO 16412KEYBOARD CONTROL BLOCK
    316409Value: 0/1
    0=INPUT LEFT U/L CASE 1=INPUT CONVERTED TO U CASE (UNLESS FOREIGN DRIVER - DOS+)
    1/316412Value: 0/1
    CURSOR BLINK=0 NO BLINK=1
    1/316413 TO 16420VIDEO CONTROL BLOCK
    1/316414Value: 141/194
    1ST OF 2 TO SEND PRINT TO LPRINT (M1=141 M3=194)
    1/316415Value: 5/6
    2ND OF 2 TO SEND PRINT TO LPRINT (M1=5 M3=3)
    1/316414Value: 88/115
    1ST OF 2 TO RESTORE PRINT (VIDEO) (M1=88 M3=115)
    1/316415Value: 4
    2ND OF 2 TO RESTORE PRINT (VIDEO) (M1 & M3)
    1/316416 & 16417CURSOR ADDRESS 2 BYTES LSB/MSB
    1/316418 or 16419Value: 32-255
    CURSOR CHARACTER IN ASCII (NORMAL CURSOR=171)
    316420CHARACTER SET: 1=ALTERNATE 0=REG
    1/316421 TO 16428PRINTER CONTROL BLOCK
    1/316422Value: 88/15
    1ST OF 2 TO SEND LPRINT TO VIDEO (M1=88 M3=115)
    1/316423Value: 4
    2ND OF 2 TO SEND LPRINT TO VIDEO (M1 & M3)
    1/316422Value: 141/194
    1ST OF 2 TO RESTORE LPRINT (PRINTER) (M1=141 M3=194)
    1/316423Value: 5/3
    2ND OF 2 TO RESTORE LPRINT (PRINTER) (M1=5 M3=3)
    1/316424 (4028H)MAX PRINTER LINES PER PAGE PLUS 1
    1/316425Value: 1
    RESETS LINE COUNT
    1/316425Value: 1 TO ?
    PEEKS # LINES PRINTED+1 -- POKE N,1: RESETS LINE COUNT
    1/316427MAX CHAR PER LPRINT LINE LESS 2 (255=NO MAX)
    116445CASSETTE PORT AND PRINT-SIZE FLAG (BIT 3) COPY
    116445Value: 0/8
    0=CHR$(28):64 CHAR LINE. 8=CHR$(23):32 CHAR LINE
    116449 TO 16454TIME/DATE (SEC,MIN,HRS,YR,DA,MO) (SEE 16919/924)
    116457 & 16458DOS MEMORY SIZE
    116526 & 16527POINTER TO USR ROUTINE - LEVEL II ONLY
    316526NUMBER CHAR PRINTED PER LINE PLUS 1
    1/316537INKEY$ STORAGE (IN ASCII)
    1/316538ERROR CODE
    1/316539e.g.:LPRINT STRING$(N-PEEK(16539),32) . . .
    1/316539TO LPRINT TAB(N) WHEN N>63 (SEE NOTE)
    1/316540OUTPUT FLAG (-1=KBD 0=VIDEO 1=PRINTER)
    1/316544 & 16545STRING SPACE START ADDRESS
    1/316546 & 16547CURRENT LINE NUMBER IN BASIC PROGRAM
    1/316548 & 16549POINTER TO BEGIN BASIC PROGRAM (SEE NOTE)
    1/316548TO APPEND: POKE 16548,PEEK(16633)-2:POKE16549,PEEK(16634)
    1/316548TO CLOAD: POKE16548,233:POKE16549,66
    1/316551 & 16552WHEN IN BASIC - POINTS TO ADDR OF BASIC KBD BUFFER
    116553Value: 255
    FOR OLD M1'S -POKE AFTER "INPUT#" FOR A "READ" TO FUNCTION
    1/316554 TO 16556SEED FOR RND
    1/316555THIS BYTE CHANGED BY 'RANDOM'
    1/316559VARIABLE-TYPE FLAG FOR THE SOFTWARE ACCUMULATOR
    1/316561 & 16562LAST BYTE OF MEMORY AVAILABLE FOR BASIC
    1/316598 & 16599NEXT USABLE BYTE IN STRING SPACE
    1/316607 & 16608ENTRY POINT OF SYSTEM TAPE
    1/316614 & 16615POINTS AT TERMINATOR OF THE LAST EXECUTED BASIC STATEMENT
    1/316618 & 16619LINE # WITH ERROR (IF 65535 : COMMAND MODE)
    116633 & 16634POINTER TO END OF BASIC PROG - SEE 16548
    1/316633 & 16634STARTING ADDRESS OF SIMPLE VARIABLE TABLE
    1/316635 & 16636STARTING ADDRESS OF ARRAY VARIABLE TABLE
    1/316637 & 166381ST BYTE OF FREE MEMORY AFTER ARRAY TABLE
    1/316639 & 16640'DATA' POINTER - TELLS YOU WHERE YOU'RE GOING TO RECORD
    1/316641 TO 16666VARIABLE-TYPE TABLE
    1/316669 TO 16676SOFTWARE ACCUMULATOR (SA)
    1/316679 TO 16686ALTERNATE SOFTWARE ACCUMULATOR (SA)
    1/316722 TO 16815DISK BASIC INTERFACE
    1/316806 TO 16868DOS INTERFACE AREA
    1/316872 (41E8H)$RSRCV INPUT BUFFER
    416875, 16876 & 16883M4 IN M3 MODE: ASCII VALUES OF F1,2,3 KEYS
    1/316880 (41F0H)$RSTX OUTPUT BUFFER
    1/316884 (41F4H)Value 103
    1st of 2 to Change LINE keyword to act as LPRINT
    1/316885 (41F5H)Value 32
    2nd of 2 to Change LINE keyword to act as LPRINT
    1/316888 (41F8H)$RSINIT BAUD RATE CODE
    1/316889 (41F9H)$RSINIT PARITY/WD LEN/STOP CODE
    1/316890 (41FAH)$RSINIT WAIT SWITCH (0=DON'T WAIT)
    316912Value: 0/8
    0=CHR$(28):64 CHAR LINE. 8=CHR$(23):32 CHAR LINE
    4/316912Value: 64,0
    SPEEDUP IN III MODE, 0=RETURN TO 2MHZ
    316913CASSETTE BAUD RATE: 0=500 NON-0=1500
    316916Value: 0-7
    VIDEO DISPLAY SCROLL PROTECT 1-7 LINES
    316919Value: 00-59
    SECONDS
    316920Value: 00-59
    MINUTES
    316921Value: 00-23
    HOURS
    316922Value: 00-99
    YEARS
    316923Value: 01-31
    DAYS
    316924Value: 01-12
    MONTHS
    1/316928 (4220H)$ROUTE DESTINATION (1ST) BYTE
    1/316929 (4221H)$ROUTE DESTINATION (2ND) BYTE
    1/316930 (4222H)$ROUTE SOURCE (1ST) BYTE
    117129BEGINNING OF BASIC PROGRAMS IN LEVEL II BASIC
    117170MODEL 1 NEWDOS/80 V2.0 BREAK VECTOR
    195=OFF, 201=ON
    317385 TO --RAM - BASIC PROGRAM IN A CASSETTE SYSTEM
    317425 & 17426MEMORY SIZE M3 DISK BASIC
    117528MODEL 3 NEWDOS/80 V2.0 BREAK VECTOR
    195=OFF, 201=ON
    1/319631 (4223H)$ROUTE SOURCE (2ND) BYTE
    326841 TO --RAM - BASIC PROGRAM IN TRS-DOS 1.3
    1/332767 (7FFFH)16K SYSTEM TOP OF PHYSICAL MEMORY
    349151 (BFFFH)TOP OF MEMORY 32K SYSTEM
    365535 (FFFFH)TOP OF MEMORY 48K SYSTEM
    A few more ...
    PEEK 14312      If the line printer status port is >63 then the printer is
                    not on or ready to print.  Power off =255; print inhibit
                    switch (off line) enabled =233 or 223; print buffer full
                    =191; ready to accept data =63 (normal).
    
    PEEK 14316      The disk status register =255 when there is no expansion
                    interface conncected or powered on.
    
    POKE 14308,0    Latches cassette #1
         14308,1    Latches cassette #2
    
    POKE 16396,23   Disable the BREAK key (Level II)
         16396,199  Causes BASIC to reinitialize when the BREAK key is hit
                    (Level II)
    
    POKE 16405,0    Locks up the keyboard, but lets your program keep running
    
    PEEK 16549      If <66 then this is not Disk BASIC
    
    POKE 17170,175  Disable the BREAK key
    POKE 17171,201  both of these POKEs are necessary
    
    POKE 23461,0    Disable the BREAK key (NEWDOS 2.1)
    
    POKE 23886,0    Disable the BREAK key (TRSDOS 2.3)
    

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu




    Model III WD1793 Disk Controller Ports

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    The Model III talks to its WD1793 disk controller through the following ports:
    0E4H
    Bit


    7
    6
    5
    Write


    0/1: dis/enable INTRQ intrpt
    dis/enable DRQ interpt
    N/A
    Read


    0/1: INTRQ status: true/false
    0/1: DRQ status = true/false
    0/1: Reset status = true/false
    0F0H
    Bit


    7
    6
    5
    4
    3
    2
    1
    0
    Disk Command Register

    Disk Status Register


    Not Ready
    Write Protect
    Read: Record Type; Write: Write Fault
    Record Not Found
    CRC Error
    Data Lost
    DRQ
    Busy
    0F1H (Read/Write) - Disk Track Register
    Byte


    N/A
    Write


    Track Number
    Read


    Track Number
    0F2H (Read/Write) - Disk Sector Register
    Byte


    N/A
    Write


    Sector Number
    Read


    Sector Number
    0F3H (Read/Write) - Disk Data Register
    Byte


    N/A
    Write


    Data byte to be written to disk      
    Read


    Data byte read from disk
    0F4H
    Bit


    7

    6

    5

    4

    3
    2
    1
    0
    Write Only


    0 Selects FM Mode (Single Density)
    1 Selects MFM Mode (Double Density)
    0 disable wait state generation
    1 enable
    0 disable write precompensation
    1 enables
    0 select side 0
    1 select side 1
    0/1: deselect/select drive 3
    0/1: deselect/select drive 2
    0/1: deselect/select drive 1
    0/1: deselect/select drive 0

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu




    UART Bits

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    Port Add.! D7  ! D6  ! D5  ! D4  ! D3  ! D2  ! D1  ! D0  !
    =========!=====!=====!=====!=====!=====!=====!=====!=====!
    E8 Write ! <---- UART  RESET & INITIALISATION ONLY ----->!
             !           NO  DATA  BITS  REQUIRED            !  T
    ---------!-----!-----!-----!-----!-----!-----!-----!-----!
    E8 Read  ! cts ! dsr ! cd  ! ri  !  -  !  -  ! rec !  -  !
             !     !     !     !     !     !     ! i/p !     !  R
    =========!=====!=====!=====!=====!=====!=====!=====!=====!
    E9 Write !   Software Baud rate settings  (see manual)   !
             !     !     !     !     !     !     !     !     !  S
    ---------!-----!-----!-----!-----!-----!-----!-----!-----!
    E9 Read  !Parit! w/l ! w/l ! stop!Parit! Baud! Baud! Baud!
    switches !ev/od!slct1!slct2! 1or2!en/di!  1  !  2  !  3  !
    =========!=====!=====!=====!=====!=====!=====!=====!=====!  I
    EA Write !Parit! w/l ! w/l ! stop!Parit! TX  ! DTR ! RTS !
    control  !ev/od!slct1!slct2! 1or2!en/di!en/di!     !     !
    ---------!-----!-----!-----!-----!-----!-----!-----!-----!
    EA Read  ! DAV ! TBMT!o/run!frame!Parit!  -  !  -  !  -  !  8
     Uart    !     !     !error!error!error!     !     !     !
    =========!=====!=====!=====!=====!=====!=====!=====!=====!
    EB Write ! <---------- 8 BIT DATA  to  UART -----------> !  0
    EB Read  ! <---------- 8 BIT DATA from UART -----------> !
    ========='====='====='====='====='====='====='====='====='---
               D7    D6    D5    D4    D3    D2    D1    D0
    =========v=====v=====v=====v=====v=====v=====v=====v=====v---
    F8 Write !  -  !  -  !  -  !  -  !  -  !Uart ! DTR ! RTS !  S
             !     !     !     !     !     !Reset!     !     !
    ---------!-----!-----!-----!-----!-----!-----!-----!-----!  Y
    F8 Read  ! <---------- 8 BIT DATA from UART -----------> !
             !     !     !     !     !     !     !     !     !  S
    =========!=====!=====!=====!=====!=====!=====!=====!=====!
    F9 Write ! <---------- 8 BIT DATA  to  UART -----------> !
             !     !     !     !     !     !     !     !     !  8
    ---------!-----!-----!-----!-----!-----!-----!-----!-----!
    F9 Read  !TMBT ! CTS ! DSR ! CD  ! PE  ! FE  ! OR  ! DAV !  0
             !     !     !     !     !     !     !     !     !
    ========='====='====='====='====='====='====='====='====='
    

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu




    Z-80 Instruction Set

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

                                 Table I
                   Z-80 Instructions from 00 through 3F
    
               HEX OCT  OP   AD            HEX OCT  OP    AD
                00 000  NOP                 01 001  LD    BC,nn
              * 08 010  EX   AF,AF'         09 011  ADD   HL,BC
              * 10 020  DJNZ n              11 021  LD    DE,nn
              * 18 030  JR   n              19 031  ADD   HL,DE
                20 040  JR   NZ,n           21 041  LD    HL,nn
              * 28 050  JR   Z,n            29 051  ADD   HL,HL
                30 060  JR   NC,n           31 061  LD    SP,nn
              * 38 070  JR   C,n            39 071  ADD   HL,SP
    
                02 002  LD   (BC),A         03 003  INC   BC
                0A 012  LD   A,(BC)         0B 013  DEC   BC
                12 022  LD   (DE),A         13 023  INC   DE
                1A 032  LD   A,(DE)         1B 033  DEC   DE
                22 042  LD   (nn),HL        23 043  INC   HL
                2A 052  LD   HL,(nn)        2B 053  DEC   HL
                32 062  LD   (nn),A         33 063  INC   SP
                3A 072  LD   A,(nn)         3B 073  DEC   SP
    
                04 004  INC  B              05 005  DEC   B
                0C 014  INC  C              0D 015  DEC   C
                14 024  INC  D              15 025  DEC   D
                1C 034  INC  E              1D 035  DEC   E
                24 0D4  INC  H              25 045  DEC   H
                2C 054  INC  L              2D 055  DEC   L
                34 064  INC  (HL)           35 065  DEC   (HL)
                3C 074  INC  A              3D 075  DEC   A
    
                06 006  LD   B,n            07 007  RLCA
                0E 016  LD   C,n            0F 017  RRCA
                16 026  LD   D,n            17 027  RLA
                1E 036  LD   E,n            1F 037  RRA
                26 046  LD   H,n            27 047  DAA
                2E 056  LD   L,n            2F 057  CPL
                36 066  LD   (HL),n         37 067  SCF
                3E 076  LD   A,n            3F 077  CCF
    
    
    
                                Table II
                    Z-80 Instructions from 40 through 7F
                        8-Bit Interregister Transfers
    
    General form:
           OCT          OP    AD
           1(r1)(r2)    LD    REG(r1),REG(r2)
    Source is REG(r2), destination is REG(r1), where r1 and r2 are 8-bit registers
    (see Table VI).
    
               HEX OCT  OP   AD            HEX OCT  OP    AD
                40 100  LD   B,B            41 101  LD    B,C
                48 110  LD   C,B            49 111  LD    C,C
                50 120  LD   D,B            51 121  LD    D,C
                58 130  LD   E,B            59 131  LD    E,C
                60 140  LD   H,B            61 141  LD    H,C
                68 150  LD   L,B            69 151  LD    L,C
                70 160  LD   (HL),B         71 161  LD    (HL),C
                78 170  LD   A,B            79 171  ADD   A,C
    
                42 102  LD   B,D            43 103  LD    B,E
                4A 112  LD   C,D            4B 113  LD    C,E
                52 122  LD   D,D            53 123  LD    D,E
                5A 132  LD   E,D            5B 133  LD    E,E
                62 142  LD   H,D            63 143  LD    H,E
                6A 152  LD   L,D            6B 153  LD    L,E
                72 162  LD   (HL),D         73 163  LD    (HL),E
                7A 172  LD   A,D            7B 173  LD    A,E
    
                44 104  LD   B,H            45 105  LD    B,L
                4C 114  LD   C,H            4D 115  LD    C,L
                54 124  LD   D,H            55 125  LD    D,L
                5C 134  LD   E,H            5D 135  LD    E,L
                64 144  LD   H,H            65 145  LD    H,L
                6C 154  LD   L,H            6D 155  LD    L,L
                74 164  LD   (HL),H         75 165  LD    (HL),L
                7C 174  LD   A,H            7D 175  LD    A,L
    
                46 106  LD   B,(HL)         47 107  LD    B,A
                4E 116  LD   C,(HL)         4F 117  LD    C,A
                56 126  LD   D,(HL)         57 127  LD    D,A
                5E 136  LD   E,(HL)         5F 137  LD    E,A
                66 146  LD   H,(HL)         67 147  LD    H,A
                6E 156  LD   L,(HL)         6F 157  LD    L,A
                76 166  HALT                77 167  LD    (HL),A
                7E 176  LD   A,(HL)         7F 177  LD    A,A
    
    
    
                                Table III
                   Z-80 Instructions from 80 through BF
                       8-Bit Arithmetic and Logic
    
    General form:
           OCT        OP       AD
           2(op3)(r)  OP(op3) [A,]REG(r)
    The [A,] field is used with ADD, ADC and SBC to avoid ambiguity with other
    instructions.  For the operation codes OP(op3) and the 8-bit register codes
    see Table VI.
    
               HEX OCT  OP   AD            HEX OCT  OP    AD
                80 200  ADD  A,B            81 201  ADD   A,C
                88 210  ADC  A,B            89 211  ADC   A,C
                90 220  SUB  B              91 221  SUB   C
                98 230  SBC  A,B            99 231  SBC   A,C
                A0 240  AND  B              A1 241  AND   C
                A8 250  XOR  B              A9 251  XOR   C
                B0 260  OR   B              B1 261  OR    C
                B8 270  CP   B              B9 271  CP    C
    
                82 202  ADD  A,D            83 203  ADD   A,E
                8A 212  ADC  A,D            8B 213  ADC   A,E
                92 222  SUB  D              93 223  SUB   E
                9A 232  SBC  A,D            9B 233  SBC   A,E
                A2 242  AND  D              A3 243  AND   E
                AA 252  XOR  D              AB 253  XOR   E
                B2 262  OR   D              B3 263  OR    E
                BA 272  CP   D              BB 273  CP    E
    
                84 204  ADD  A,H            85 205  ADD   A,L
                8C 214  ADC  A,H            8D 215  ADC   A,L
                94 224  SUB  H              95 225  SUB   L
                9C 234  SBC  A,H            9D 235  SBC   A,L
                A4 244  AND  H              A5 245  AND   L
                AC 254  XOR  H              AD 255  XOR   L
                B4 264  OR   H              B5 265  OR    L
                BC 274  CP   H              BD 275  CP    L
    
                86 206  ADD  A,(HL)         87 207  ADD   A,A
                8E 216  ADC  A,(HL)         8F 217  ADC   A,A
                96 226  SUB  (HL)           97 227  SUB   A
                9E 236  SBC  A,(HL)         9F 237  SBC   A,A
                A6 246  AND  (HL)           A7 247  AND   A
                AE 256  XOR  (HL)           AF 257  XOR   A
                B6 266  OR   (HL)           B7 267  OR    A
                BE 276  CP   (HL)           BF 277  CP    A
    
    
    
                                Table IV
                    Z-80 Instructions from C0 through FF
    
               HEX OCT  OP   AD            HEX OCT  OP    AD
                C0 300  RET  NZ             C1 301  POP   BC
                C8 310  RET  Z              C9 311  RET
                D0 320  RET  NC             D1 321  POP   DE
                D8 330  RET  C            * D9 331  EXX
                E0 340  RET  PO             E1 341  POP   HL
                E8 350  RET  PE             E9 351  JP    (HL)
                F0 360  RET  P              F1 361  POP   AF
                F8 370  RET  M              F9 371  LD    SP,HL
    
                C2 302  JP   NZ,nn          C3 303  JP    nn
                CA 312  JP   Z,nn         * CB 313  (See notes)
                D2 322  JP   NC,nn          D3 323  OUT   n,A
                DA 332  JP   C,nn           DB 333  IN    A,n
                E2 342  JP   PO,nn          E3 343  EX    (SP),HL
                EA 352  JP   PE,nn          EB 353  EX    DE,HL
                F2 362  JP   P,nn           F3 363  DI
                FA 372  JP   M,nn           FB 373  EI
    
                C4 304  CALL NZ,nn          C5 305  PUSH  BC
                CC 314  CALL Z,nn           CD 315  CALL  nn
                D4 324  CALL NC,nn          D5 325  PUSH  DE
                DC 334  CALL C,nn         * DD 335  (See notes)
                E4 344  CALL PO,nn          E5 345  PUSH  HL
                EC 354  CALL PE,nn        * ED 355  (See notes)
                F4 364  CALL P,nn           F5 365  PUSH  AF
                FC 374  CALL M,nn         * FD 375  (See notes)
    
                C6 306  ADD  A,n            C7 307  RST   00H
                CE 316  ADC  A,n            CF 317  RST   08H
                D6 326  SUB  n              D7 327  RST   10H
                DE 336  SBC  A,n            DF 337  RST   18H
                E6 346  AND  n              E7 347  RST   20H
                EE 356  XOR  n              EF 357  RST   28H
                F6 366  OR   n              F7 367  RST   30H
                FE 376  CP   n              FF 377  RST   38H
    
    
    
                                Table V
               Extended Z-80 Instructions Prefixed by ED
                        Listed by Second Byte
    
               HEX OCT  OP   AD            HEX OCT  OP    AD
    
                40 100  IN   B,(C)          41 101  OUT   (C),B
                48 110  IN   C,(C)          49 111  OUT   (C),C
                50 120  IN   D,(C)          51 121  OUT   (C),D
                58 130  IN   E,(C)          59 131  OUT   (C),E
                60 140  IN   H,(C)          61 141  OUT   (C),H
                68 150  IN   L,(C)          69 151  OUT   (C),L
                70 160  (NONE)              71 161  (NONE)
                78 170  IN   A,(C)          79 171  OUT   (C),A
    
                42 102  SBC  HL,BC          43 103  LD    (nn),BC
                4A 112  ADC  HL,BC          4B 113  LD    BC,(nn)
                52 122  SBC  HL,DE          53 123  LD    (nn),DE
                5A 132  ADC  HL,DE          5B 133  LD    DE,(nn)
                62 142  SBC  HL,HL          63 143  (NONE, see 22H)
                6A 152  ADC  HL,HL          6B 153  (NONE, see 2AH)
                72 162  SBC  HL,SP          73 163  LD    (nn),SP
                7A 172  ADC  HL,SP          7B 173  LD    SP,(nn)
    
                44 104  NEG                 45 105  RETN
                4C 114  (NONE)              4D 115  RETI
    
                46 106  IM   0              47 107  LD    I,A
                4E 116  (NONE)              4F 117  LD    R,A
                56 126  IM   1              57 127  LD    A,I
                5E 136  IM   2              5F 137  LD    A,R
                66 146  (NONE)              67 147  RRD
                6E 156  (NONE)              6F 157  RLD
    
                A0 240  LDI                 A1 241  CPI
                A8 250  LDD                 A9 251  CPD
                B0 260  LDIR                B1 261  CPIR
                B8 270  LDDR                B9 271  CPDR
    
                A2 242  INI                 A3 243  OUTI
                AA 252  IND                 AB 253  OUTD
                B2 262  INIR                B3 263  OTIR
                BA 272  INDR                BB 273  OTDR
    
    
    
                                 Table VI
                  Extended Z-80 Instructions Prefixed by CB
                           Listed by Second Byte
    
           OCT          OP    AD            p  OP(p)
           0(p)(r)      OP(p) REG(r)        0  RLC
           1(n)(r)      BIT   n,REG(r)      1  RRC
           2(n)(r)      RES   n,REG(r)      2  RL
           3(n)(r)      SET   n,REG(r)      3  RR
                                            4  SLA
                                            5  SRA
                                            6  SLO (See notes)
                                            7  SRL
    
    Other octal fields common in Z80 instructions
    
    8-Bit Registers:
      r      0   1   2   3   4   5   6    7
    REG(r)   B   C   D   E   H   L  (HL)  A
    
    16 Bit Registers:
      R     0   1   2   3
    REG(R) BC  DE  HL  SP
    
    Operations (see Table I):
     op1     0    1      2     3      4    5    6    7
    OP(op1) JR  LD/ADD  LD  INC/DEC  INC  DEC  LD   rotate
    OP(1) and OP(3) are 16-bit instructions, OP(6) are the immediate loads.
    OP(2) is 4 8-bit indexed memory, 2 16-bit and 2 8-bit memeory loads.
    OP(7) includes 4 rotates of A, DAA, CPL, SCF and CCF.
    
    Operations (see Table III):
     op3     0    1    2    3    4    5    6    7
    OP(op3) ADD  ADC  SUB  SBC  AND  XOR   OR   CP
    
    Operations (see Table IV):
     op4     0         1        2         3        4          5     6    7
    OP(op4) RET CN(c) ---  JP CN(c),nn   ---  CALL CN(c),nn  PUSH  op3  RST
    OP(5) includes the unconditional CALL plus the prefixes DD, FD, and ED
    OP(6) is the immediate 8-bit arithmetic and logical operations ADD A,n etc.
    
    Conditions for JR, JP, CALL, RET
     c     0   1   2   3   4   5   6   7
    CN(c) NZ   Z  NC   C  PO  PE   P   M
    JR implements only the first four
    
    
    
    
    Notes:
    
    (1)  Instructions in the Z80 but not in the 8080 instruction set are marked
         with an asterisk preceeding the hex instruction in Tables I through IV.
         None of the instructions in Tables V and VI are in the 8080 instruction
         set.  None of the instructions involving the auxiliary index registers
         IX and IY are in the 8080 instruction set.
    
    (2)  The byte CB indicates the first byte of the extended Z80 instructions
         given in Table V.
    
    (3)  The bytes DD and FD are used to prefix instructions using the
         auxiliary index registers IX and IY.  In single-byte instructions,
         using memory location (HL), the memory location pointed to m, where
         m is (IX+d) or (IY+d), may be substituted for (HL) by prefixing the
         instruction by DD or FD, respectively, and spcifying (HL) as the
         source or destination in the instruction format.  The instruction is
         followed by d when this is done and the resulting instruction is
         3 bytes long.
    
    (4)  The byte ED indicates the first byte of the extended Z80 instructions
         given in Table VI.
    
    (5)  Prefixing single-byte 8-bit instructions involving registers H and L
         by DD (for IX) or FD (for IY) results in use of XH, XL, YH or YL
         instead.  This usage is undocumented and works only on Zilog Z80's
         and second-sources which use Zilog masks.  XH, XL, YH and YL refer to
         the high-order bytes of IX and IY, respectively.  ALDS supports these
         instructions.
    
    (6)  The SLO operation in Table V is undocumented and is not well defined.
    
    (7)  All the instructions in Table V can be extended to undocumented Zilog
         Z80 instructions:  These instructions, which use (IX+d) and (IY+d) as
         the source and destination as well as load the result in r, result
         when the (IX+d) or (IY+d) format is used and registers other than
         (HL) are specified.  The resulting instrucions are 4 bytes long.  ALDS
         supports these instructions using the format [OP]LD r,m where m is
         (IX+d) or (IY+d).  The timing is the same as [OP] m.
    

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu




    ROM Calls

    Bob Alger (10/27/83)


    ROMCALLS is a quick reference to the more common ROM & DOS subroutines, excluding cassette I/O and floating point math. These routines have been assembled from many other publications. Also note that all addresses are in hex except the PEEK/POKE section which is in decimal.
    ROM RST VECTORS:
    RST     Jump    Contents Purpose
    0       none    Re-boot- power on or RESET
    8       4000    JP 1C96  If (HL) = ((SP))- do RST10H logic, else print SN error
    10      4003    JP 1D78  Find next non-blank character in a string
    18      4006    JP 1C90  DE compared to HL.  Z set if DE = HL, C set if DE > HL
    20      4009    JP 25D9  Test NTF flag at 40AF.  Z flag set if string, M if
                    integer, P&C if single, P&NC if double, A=NTF - 3.
    28      400C    RET      BREAK key vector.  you can put your own 3 byte
                    instruction here to jump to your own routine.
                    NOP
                    NOP
    30      400F    RET      Used by DOS
                    NOP
                    NOP
    38      4012    EI       Used by DOS
                    RET
                    NOP
    

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    MEMORY MAPPED I/O DEVICES:
    Address
    3000-37DD
    37E0
    27E4
    37E8
    37E8
    37EC
    37EC
    37ED
    37EE
    37EF
    3801-3880
    3C00-3FFF
    Use
    NO MEMORY here at all
    Disk drive select latch
    Cassette drive latch
    Line printer data port when storing
    Line printer status port when loading
    Disk command register when storing
    Disk status register when loading
    Disk track register
    Disk sector register
    Disk data register
    Keyboard memory
    Video display memory

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    ROM ROUTINES (I/O & MISC.):
    Address         Use
    0013            Inputs a byte from an input device.
                    call:   LD      DE,nnnn ;address of DCB
                            CALL    0013H   ;get byte
                            JP      NZ,NRDY ;input dev not ready
    
    001B            Outputs a byte to an output device.
                    call:   LD      DE,nnnn ;address of DCB
                            CALL    001BH   ;put byte
                            JP      NZ,NRDY ;output dev not ready
    
    002B            INKEY subroutine- scans keyboard.  The data is not echoed on
                    your screen.  Note that calling 0358H instead will eliminate
                    need to save DE.
    
                    call:   PUSH    DE      ;save
                            CALL    002BH   ;scan keyboard
                            POP     DE      ;restore
                            JP      Z,NOKEY ;no key pressed
                            ;key is now in A
    
    0033            DISPLAY subroutine- prints character in A at current cursor
                   position on video display.  Cursor position is stored at
                   4020-4021.  Note that calling 033AH instead will eliminate
                   need to save DE.
    
                   call:    PUSH    DE        ;save
                            LD      HL,nnnn   ;* optionally position cursor
                            LD      (4020H),HL;*   before displaying byte
                            CALL    0033H     ;dislay character
                            POP     DE        ;restore
    
    003B           LPRINT subroutine- prints character in A on line printer.
                   Note that calling 039CH instead will eliminate need to save DE.
                   call:   PUSH    DE      ;save
                           CALL    003BH   ;print character
                           PNP     DE      ;restore
                           JP      NZ,NRDY ;printer not ready
    
    0049           INPUT subroutine- scans keyboard and waits for key to be
                   pressed.  Note that calling 0384H instead will eliminate need
                   to save DE.
    
                   call:   PUSH    DE      ;save
                           CALL    0049H   ;wait for key
                           POP     DE      ;restore
                           ;key is now in A
    
    0060           Delay loop in 14.66 microsecond increments.  A value of 0 will
                   be equal to .96 seconds.
    
                   call:   PUSH    AF      ;save
                           LD      BC,nnnn ;number of delays
                           CALL    0060H   ;delay a little
                           POP     AF      ;restore
    
    0066           NMI vector.  Jumps here on non-maskable interrupt (ie.
                   HALT or press of RESET button). Note- see 41BE.
    
    0150           SET, RESET, POINT graphics functions.  You must make sure
                   that the coordinates are within legal range.
                   call:   LD      B,nn    ;x coordinate (0-127)
                           LD      A,nn    ;y coordinate (0-47)
                           LD      H,nn    ;POINT=00, RET=80H, RESET=01
                           CALL    GRAPH   ;B, A, & HL will be destroyed
                           LD     A,(4121H);*if POINT was done
                           NR      A       ;*
                           JP      Z,OFF   ;* the point was off
                           JP      ON      ;* the point was on
                           .
                           .
                           .
                   GRAPH   PUSH    HL      ;push indicator
                           PUSH    BC      ;push x coordinate
                           LD      HL,DUMMY;fake out BASIC's RST8
                           JP      0150H   ;go do the selected function
                   DUMMY   DEFM    ');'    ;make believe this is a BASIC program
    
    01C9           CLS subroutine- homes cursor and clears screen.
                   call:   PUSH    AF      ;save
                           CALL    01C9H   ;cls
                           POP     AF      ;restore
    
    02B2           SYSTEM command- prints "*?" and waits for entry.  When
                   using the SYSTEM command, if your program machine language
                   program has an ORG for 41BEH with a 3 byte instruction
                   following, then that 3 byte instruction will be automaticly
                   executed after your tape is finished loading.  For example-
    
                           ORG     41BEH
                           JP      7000H
                           ORG     7000H
                   START   .               ;first instruction of your program
                           .
                           .
                           END     START
    
    05D9           LINE INPUT subroutine- accepts a line of keyboard input
                   terminated by ENTER or BREAK.  Echoes characters typed
                   and recognizes control functions (backspace, shift-backspace,
                   etc.).  None of these special characters ever get put into
                   your buffer.
    
                   call:   PUSH    DE      ;save
                           LD      B,nn    ;maximum characters allowed to input
                           LD      HL,nnnn ;address of buffer to store characters
                   in
                           CALL    05D9H   ;get a line of input
                           POP     DE      ;restore
                           JP      C,BRK   ;BREAK was hit
                           ;B= number of characters typed including
                   terminator
                           ;C= original contents of B
    
    06CC           Ref 1A19.
    
    0A7F           Used to pass a 06-bit value to a machine language
                   program.
                   call:   CALL    0A7FH   ;get value from BASIC
                           ;value now in HL
    
    0A9A           Used to pass a 16-bit value back to BASIC.
                   call:   LD      HL,nnnn ;get value to give BASIC
                           JP      0A9AH
                           ;at this point you are back in BASIC with the value.
    
    1A19           Normal entry point for a READY in Level II or Disk BASIC.
                   Note that it is better to jump to 06CCH because it does
                   not cause an OM error on the first command that follows.
    
    1BB2           Prints "?", inputs up to 241 characters from the keyboard
                   and echoes characters typed.  Data goes into BASIC's input
                   buffer.  0361H is the same as 1BB3H, less the prompt.
                   call:   PUSH    AF      ;save
                           PUSH    DE
                           CALL    1BB3H   ;get input
                           POP     DE      ;restore
                           POP     AF
                           ;HL= points to 1st character minus 1
    
    1D78           (RST10H) Finds next non-blank character in a sting.  It
                   increments through string, ignoring spaces and control
                   characters 9 & 10 (enters) and returns when the next
                   non-blank character is encountered.
    
                   call:    LD      HL,nnnn ;starting address of string minus 1
                            CALL    1D78H   ;search string
                            ;A= non-blank character found
                            JP      Z,END   ;encountered a 00 byte (end of line)
                   or ":" (end of statement)
                            JP      C,NBR   ;got an ASCII numeric digit
                            JP      ALPHA   ;not a numeric digit
    
    1E5A           ASCII integer decimal to HEX converter.
                   call:    LD      HL,nnnn ;address of ASCII decimal number
                            CALL    1E5AH   ;translate to HEX
                            ;DE= HEX result
                            ;HL= points to first non-decimal character
    
    260D           Point to the VARPTR of a variable.  If the variable
                   doesn't exist then create it first.
                   call:    LD      HL,nnnn ;point to ASCII variable name
                            CALL    260DH   ;look for/create it
                            ;DE= points to VARPTR of the variable
    
    28A7           PRINT subroutine- prints a string of text on the video
                   display, terminated by ENTER (13) or NULL (00), at current
                   cursor position.
    
                   call:    PUSH    DE      ;save
                            PUSH    IY
                            LD      HL,nnnn ;address of text
                            CALL    28A7H   ;display text
                            POP     IY      ;restore
                            POP     DE
    

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    ROM ROUTINES (INTEGER MATH):
                   The following integer math routines make use ACC to contain
                   the result of the operation.  ACC is 2 locations in
                   memory at 4121 & 4122 (LSB,MSB).  The number type flag (NTF)
                   at 40AF must also be set to 02 to indicate integer.
    
    Address        Use
    0BD2           Add     - ACC < DE + HL
    0BC7           Subtract- ACC = DE - HL
    0BF2           Multiply- ACC = DE * HL
    2490           Divide  - @BC = DE / HL
    
                   Note that on integer overflow +, -, & * return a single
                   precision floating point number in ACC at 4121-4124
                   (LSB,LSB,MSB,EXPonent).  Also, / always returns a single
                   precision floating point number.  In all cases you should
                   check NTF for the type of the result (single= 4).
    
                   Integers are stored in two's compliment form.  Single
                   precision floating point numbers are stored as a normalized
                   binary fraction, with an assumed decimal point before the most
                   significant bit.  Since the msb is always a 1, the most
                   significant bit also doubles as the sign bit by making it a 0
                   for positive and 1 for negative.  The binary exponent is
                   stored in excess 128 form; that is, 128 is added to the
                   actual binary exponent needed.  The number 0 is stored as a
                   zero mantissa and exponent.  A couple of examples are
                   shown below:
    
    Decimal         4121    4122    4123    4124
    -------         ----    ----    ----    ----
       0.5          00      00      00      80
       1.0          00      00      00      81
      -1.0          00      00      80      81
     129.0          00      00      01      88
    -129.0          00      00      81      88
     257.0          00      80      00      89
    
    
    ----- Arithmetic Accumulator (411D-4124) -----
            Integer         Single          Double
    411D                                    LSB
    411E                                    LSB
    411F                                    LSB
    4120                                    LSB
    4121    LSB             LSB             LSB
    4122    MSB             LSB             LSB
    4123                    MSB             MSB
    4124                    EXP             EXP
    
    
    --- Hex Arithmetic Accululator (4127-412E) ---
            Integer         Single          Double
    4127    LSB             LSB             LSB
    4128    MSB             LSB             LSB
    4129                    MSB             LSB
    412A                    EXP             LSB
    412B                                    LSB
    412C                                    LSB
    412D                                    MSB
    412E                                    EXP
    

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    DOS ROUTINES:
    Address        Use
    402D           EXIT is the normal program exit back to DOS.
                   call:    JP      402DH
    
    4030           ABORT is the exit back to DOS after an unsuccessful
                   program exit.
                   call:    JP      4030H
    
    4400           CMD is a routine that accepts a new command to be evaluated.
                   call:    CALL    4400H
    
    4405           CMNDI is the entry into the command interpreter.
                   call:    ;the following 3 lines are necessary only if this is
                   called at the  end  of ` BASIC program
                            LD      HL,402D   ;DOS return address
                            LD      (41FAH),HL
                            LD      SP,41FAH  ;reset stack pointer for DOS use
    
                            ;your ASCII DOS command should be in the command buffer
                            terminated by a carriage return
                            LD      HL,4318H  ;DOS command buffer
                            JP      4405H     ;if from BASIC
                            CALL    4405H     ;else this way
    
    440D           DEBUG is the entry into the debugging package
                   call:    JP      440DH
    
    441C           FSPEC fetches a file specification in TRSDOS standard format.
                   call:    CALL    441CH
    
    4420           INIT creates a new file in the directory and opens the DCB
                   for this file.  If the filespec name is found then the file
                   is simply opened for use, else a new file is created first.
                   call:    LD      HL,BUFFER
                            LD      DE,DCB
                            LD      B,LRL
                            CALL    4420H
                            JP      Z,OK      ;no error
                            JP      C,NEWFIL  ;no error, but new file was created
                            ;A= TRSDOS error code
    
    4424           OPEN opens the DCB of an existing file.
                   call:    LD      HL,BUFFER
                            LD      DE,DCB
                            LD      B,LRL
                            CALL    4424H
                            JP      Z,OK      ;no error
                            JP      NZ,NOFILE ;file does not exist
                            ;A= TRSDOS error code
    
    4428           CLOSE updates the directory and then closes the file from any
                   more processing.
                   call:    LD      DE,DCB
                            CALL    4428H
                            JP      Z,OK     ;no error
                            ;A= TRSDOS error code
    
    442C           KILL deletes the directory for an open file and then closes the
                   DCB.
                   call:    LD      DE,DCB
                            CALL    442CH
                            JP      Z,OK     ;no error
                            ;A= TRSDOS error code
    
    4430           LOAD loads a program file.
                   call:    CALL    4430H
    
    4433           RUN loads and executes a program file.
                   call:    JP      4433H
    
    4436           READ transfers one logical or physical disk record to
                   memory.  See TRSDOS Technical Infromation for complete
                   definition.
                   call:    LD      HL,UREC
                            LD      DE,DCB
                            CALL    4436H
                            JP      Z,OK      ;no error
                            A= TRSDOS error code (EOF=1CH or 1DH)
    
    4439           WRITE transfers one logical or physical disk record from
                   memory.  See TRSDOS Technical Information for complete
                   definition.
                   call:    LD      HL,UREC
                            LD      DE,DCB
                            CALL    4439H
                            JP      Z,OK      ;no error
                            A= TRSDOS error code
    
    443C           VERF is the same as WRITE except that it vdrifies what
                   was written to disk.
                   call:    LD      HL,UREC
                            LD      DE,DCB
                            CALL    443C
                            BP      Z,OK      ;no error
                            A= TRSDOS error code
    
    4442           POSN positions a file to READ or WRITE a randomly
                   selected logical record.
                   call:    LD      DE,DCB
                            LD      BC,nnnn   ;logical record # to position for
                            CALL    4442H
                            JP      Z,OK      ;no error
                            ;A= TRSDOS errnr code
    
    446D           TIME will return the current time in ASCII.
                   call:    LD      HL,nnnn   ;address of 8 byte buffer
                            CALL    446DH     ;put time in buffer
    
    4470           DATE will return the current date in ASCII.
                   call:    LD      HL,nnnn   ;address of 8 byte buffer
                            CALL    4470H     ;put date in buffer
    
    4AC1           This routine will read sectors 2 - 9 of the disk directory
                   track (11H) into your designated buffer.  It is just like the
                   DOS routine at 5CC8 which is overlayed by BASIC/CMD.
                   ( not for Newdos 80)
                   call:    LD      B,0
                            LD      DE,BUFFER ;256*8 bytds
                   READ     CALL    4AC1H     ;read sector
                            LD      L,0
                            PUSH    BC
                            LD      BB,256
                            LDIR
                            POP     BC
                            INC     B
                            LD      A,B
                            CP      8
                            JR      NZ,READ
                            RET
    

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    LEVEL II/DOS RAM MAP:
    4001-4014      Jump vectors for RST 8 - RST 56
    4015-401C      Keyboard Device Control Block (DCB)
    401D-4024      Video display DCB
    4025-402C      Line printer DCB
    4036-403C      Work area for keyboard input routine
    403D           Print size flag: 0=64 char., 8=32 char.
    403E           OSVER$- DOS version #
    4040           25 millisecond clock count
    4041-4043      TIME$, time of day: seconds, minutes, hours
    4044-4046      DATE$- day of year: year, day, month
    4049-404A      HIFH$- highest unused RAM address (DOS)
    408E-408F      (L2 only) Entry point to USR routines
    4093-4098      Input and output port routines
    4099           INKEY$ storage of key pressed
    409A           Error code for RESUME
    409B           Printer carriage position
    409C           Device type flag: -1=tape, 0=video,  1=line printer
    409D           Used by PRINT#
    40A0-40A1      Pointer to lowest address available for string storage
    40A2-40A3      program line number counter (current line # being
                   processed)
    40A4-40A5      Start of BASIC program pointer.  Normal values for: (L2)=42E9;
                   (Disk BASIC)=varies with version of  DOS/BASIC.
    40A6           Line cursor position, used for TAB
    40A7-40A8      Input buffer pointer
    40AA-40AC      Seed for RND
    40AF           Number type flag (NTF): 2=int, 3=stng, 4=sngl, 8=dbl
    40B1-40B2      Pointer to highest address available for string storage
                   (set by MEMORY SIZE).  Protected memory, if any, follows.
    40B3-40B4      String work area pointer
    40B5-40D5      String work area
    40D6-40D7      Pointer to next byte of string storage
    40D8-40D9      Present byte count pointer
    40DA-40DB      Last DATA,READ line #
    40DC           Used by DIM
    40DE           Used by PRINT USING
    40DF-40E0      Entry point storage for SYSTEM tapes (accessed by "/"
                   command)
    40E1           AUTO flag (0=off)
    40E2-40E3      Current line #
    40E4           AUTO increment size
    40E6-40E7      Encoded statement pointer
    40E8-40E9      Stack pointer pointer
    40EA           Used during RESUME
    40EC-40ED      EDIT line #
    40EE           Used during RESUME
    40F0-40F1      ON ERROR location for ON ERROR GOTO
    40F5-40F6      Last line # executed prior to a BREAK
    40F7-40F8      Last statement byte counter for CONTINUE retrieval
    40F9-40FA      Start simple variables pointer (top of BASIC program plus
                   1)
    40FB-40FC      Start of arrays pointer (end of simple variables)
    40FD-40FE      Start of free space pointer (end of arrays)
    40FF-4100      DATA pointer
    4101-411B      Variable type declaration table for each letter: 2=int,
                   3=stng, 4=sngl, 8=dbl
    411B           TRON flag: 0=off (TROFF), 175=on (TRON)
    411D-4124      Arithmetic accumulator
    4127-412E      Hex arithmetic accumulator
    4130-4131      Line # work area pointer
    4152-41A6      DOS entry points
    41BE-41C0      (L2 only( Jumps here on RESET button hit.  You can put your
                   own 3 byte instrtction here to jump to your own routine.
    41E8-42E8      Input buffer area
                   (stack pointer for system is at 4288)
    4200-51FF      TRSDOS
    42E9           Start of user RAM for program storage
    4318-4357      DOS command buffer- Last DOS command entered (64 chars.).
    4500-4517      DOS interrupt table contains address pairs for interrupt
                   routines (ie. CLOCK, TRACE, etc.).  You can place your own
                   routine addresses in this table.  An example is below:
                            DI                ;disable interrupts
                            LD      HL,4510H  ;address of table link
                            LD      (HL),MYROUT ;address of my interrupt
                   routine
                            EI                ;enable interrupts
    5200-6FFF      Disk BASIC or DOS utilities when loaded, or user memory
    57F0           61 character ASCII copyright notice (DOS)
    

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    DISK BASIC COMMAND VECTORS:
    AddressCommand
    4152CVI
    4155FN*
    4158CVS
    415BDEF
    415ECVD
    4161EOF
    4164LOC
    4167LOF
    416AMKI$
    416DMKS$
    4170MKD$
    4173CMD
    4176TIME$*
    4179OPEN
    417CFIELD
    417FGET
    4182PUT
    4185CLOSE
    4188LOAD
    418BMERGE
    418ENAME
    4191KILL
    4194&*
    4197LSET
    419ARSET
    419DINSTR*
    41A0SAVE
    41A3LINE
    * Items marked with an asterisk are called during expression evaluation.

    Top of Page / Top of Menu / ROM / RAM / PORTS / CALLS / TOKENS Menu

    TRS-80 KEYBOARD PEEK TABLE
                          ----- Decimal Contents ----,
    Address   1     2     4     8     16     32     64     128    Hex Address
    ------- ----- ---,- ----- ----- -----  -----  -----   -----   -----------
    14337     @     A     B     C      D      E      F      G        3801       1
    14338     H     I     J     K      L      M      N      O        3802       2
    14340     P     Q     R     S      T      U      V      W        3804       4
    14344     X     Y     Z     ,      -      -      -      -        3808       8
    14352     0     1     2     3      4      5      6      7        3810      16
    14368     8     9    *:    +;     <,     =-     >.     ?/        3820      32
    14400  enter  clear break  up    down   left  right  space       3840      64
    14464  shift    -     -     -  control    -      -      -        3880     128
    ---,--- ----- ----- ----- ----- -----  -----  -----   -----           ------,--
              0     2      4    8     10     20     40      80             14336
                          -----   Hex Contents   -----
    
    
    Notes on the table:
    
    1.  Blank areas ("-") of the table are not used on the standard TRS-80.
    2.  The control key at location 14464 is used by the ELECTRIC PENCIL.
    3.  The break key can not be used in BASIC programs, but can be checked in
    machine language programs.
    4.  In BASIC use  -  variable = PEEK(address)
          ie:    IF PEEK(14400)=8 THEN SET(X+1,Y)  ' up arrow key was pressed
    5.  In machine language you can use- LD A,(3840H) ;08H = up arrow
    6.  If two or more keys are pressed at the same time you will get the sum of
    the keys.
    7.  You can also combine more than one address.  Note the right-hand column
    of numbers.  If you total this number with other row numbers you want to
    address, and add 14436, you will get the final decimal address to PEEK.
    8   In BASIC a better way to use this table, than described in 4 above, might
    be to
        PEEK(address) AND (value to check)  -  This will recognize a key as being
    pressed
        even when other keys are being held down.
    
    
    
    Try running this small program and hold down more than one ARROW key at the
    same time.
    
    
                     5 DEFINT A
                    10 A = PEEK(14400)
                    20 IF (A AND 8) THEN PRINT "UP ":
                    30 IF (A AND 16) THEN PRINT "DOWN ";
                    40 IF (A AND 32) THEN PRINT "LEFT ";
                    50 IF (A AND 64) THEN PRINT "RIGHT ";
                    60 IF (A AND 255)THEN PRINT
                    70 GOTO 10
    
    DISK SPEEDUP CHART:
    ----------I-------------------------------
              I       Delay in miliseconds
    Command   I     40      20      10      05
    ----------I-----------------,,------------
    RESTORE   I     0B      0A      09      08
    ----------I-------------------------------
    SEEK      I     1B      1A      19      08
    ----------I-------------------------------
    
    
    
    Program   I     DOS     Trk. Sec.  Byte  Org.  Ndw   Command
    ----------I-------------------------------------------,-----
    BOOT/SYS  I     ALL*    0    0     B9    361B  3618  SEEK    (except NEWDOS 80)
              I     NEWDOS  0    0     6A    361B  3618  SEEK    (only   NEWDOS 80)
              I     80.1    0    0     A5    360B  3608  RESTORE  "       "     "
    ------,--------------------------------------------,--------
              I     TRSDOS  0    7     51    3E1B  3E18  SEEK
              I     (ALL)   0    7     C4    3E0B  3E08  RESTORE
              I     ----------,---------------------------------
              I     NEWDOS  0    7     0E    3E0B  3E08  RESTORE
    SYS0/SYS  I      2.1    0    9     0E    3E1B  3E18  SEEK
              H     -------------------------------------,------
              I     NEWDOS  0    8     CC    3E0B  3E08  RESTORE
              I     80.1    0    8     FD    3E1B  3E18  SEEK
              I     --,-----------------------------------------
              I     VTOS    0    7     15    3E1B  3E18  SEEK
              I      3.0    0    7     90    3E0B  3E08  RESTORE
    ----------I----------------------------------,---------,----
    
    Note:   The values under the "new" column are for 5 milisecond operation.
            For 20 ms. change 18 to 1A, 08 to 0A.
    
            - older Shugarts & some newer ones use 40 ms.
            - some newer Shugarts can use 40 or 20 ms.
            - Micropolis uses 40 ms.
            - Pertecs can use 40 or 20 ms.
            - MPIs and Siemens can use 40, 20, 10, or 5 ms.
    
    SYSTEM TAPE FORMAT:
    TAPE LEADER             256 zeroes followed by a A5 (sync byte)
    55                      header byte indicating system format
    xx xx xx xx xx xx       6 character file name in ASCII
    
            3C              data header
            xx              length of data 01-FFH, 00=256 bytes
            lsb,msb         load address
            xx ... xx       data (your program)
            xx              checksum of your data & load address
    
            .               repeat from 3C through checksum
            .
            .
    78                      end of file marker
    lsb,msb                 entry point address
    
    EDITOR/ASSEMBLER SOURCE TAPE FORMAT:
    TAPE LEADER             256 zeroes followed by a A5 (sync byte)
    D3                      header byte indicating source format
    xx xx xx xx xx xx       6 character file name in ASCII
    
            xx xx xx xx xx  line # in ASCII with bit 7 set in each byte
            20              data header
            xx ... xx       source line (128 byte maximum)
            0D              end of line marker
    
            .
            .
            .
    
    1A                      end of file marker
    
    BASIC TAPE FORMAT:
    LEADER                  256 zeroes followed by an A5 (sync byte)
    D3 D3 D3                BASIC header bytes
    xx                      1 character file name in ASCII
    
            lsb,msb         address pointer to next line
            lsb,msb         line #
            xx ... xx       BASIC line (compressed)
            00              end of line marker
    
            .
            .
            .
    
    00 00                   end of file markers