Menu
Cassette
System Tape Format
EDAS Tape Format
BASIC Tape Format
Cassette Volume Settings
 
 
 
I/O
Port Addresses (Model I)
Port Addresses (Model III)
Memory Mapped I/O Devices
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
Model 1/3 TRS-80 Keyboard PEEK Table
Model 4P Modem Controls
 
Other
DOS Routines
Level II/DOS RAM Map
Disk Basic Command Vectors
Disk Speed-Up Chart
RAM Addresses
Tokenized BASIC
Pokes and Peeks
Vidtex Escape Sequences
Model 4P Boot Mode Select

RAM Addresses
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-40A5  16548-16549 Pointer to beggining of Basic program (LSB-MSB).
40A616550Cursor’s current column number.
40A716551Input buffer pointer.
40A916553Used by INPUT command routine, contains zero byte if (and only if) input is from cassette. A bug in the first release of the Model I Level II BASIC ROM required that this location be POKEd with a non-zero value prior to reading program DATA statements. This bug was corrected soon after Level II BASIC was released, so that this POKE is required only for older TRS-80 Model I machines..
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.

Model III RS-232 Ports – Luis M. Garcia-Barrio
This section contains a list of Model III RS-232 Ports
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

Model III/IV Ports
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


Radio Shack 5/15 Meg HD Port Assignments – Bob Haynes, 10/15/87
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.
						

Tokenized BASIC – Dick Straw
HOW THE LEVEL II INTERPRETER SEES IT
Dick Straw
Down at the end of appendix C12 in your Level II BASIC Reference Manual you will discover the information that ASCII codes 129 through 191 are graphics codes, and ASCII 192 through 255 are tab codes. And they are. If you run something like
     PRINT CHR$(200); CHR$(140)
					
You will get a graphic block set spaced appropriately eight spaces from the left margin of your screen. Actually, 128 is a graphics code too — it just doesn’t have any of the six segments of the graphics matrix set, so it comes out blank.
But that only tells part of the story, because those same 128 code values are used by the interpreter as spacesaving symbols equivalent to that list of reserved words on page A115 of the appendix in the manual. Here’s how it works –and how to see it for yourself.
When you start typing a line on your keyboard in the usual fashion, each keystroke is duly recorded in the 110 buffer as its ASCII code equivalent. When you push ENTER at the end of the line, the line you just typed is interpreted right on the spot — in the buffer. Each of the command or instruction words is converted to a single byte equivalent, with values between 128 and 255, inclusive. If there was no number at the beginning of the line, the instructions you just entered will be acted upon at once. If there was a line number, the whole line is transferred to the text memory location and put into its proper place.
Both of those locations can be examined using the PEEK command. The 110 buffer occupies 256 locations beginning at 16870, while the text memory starts at 17129 if you have no disk BASIC entered . I don’t have a printer or a disc, so it takes a lot of staring at the screen, but no big hazards.
Try this: write a short program, say, three lines or so. For example:
     10 DEFINTA,L: DIM A(9)
     20 FOR L = 0 TO 9: A(L) = 5 * L + 2
     30 PRINTA (L);:NEXTL
					
Then run it. You get the line of ten numbers you expected. Now, in command mode, enter
     FOR Z = 0 TO 200 : ?PEEK(17129 + Z);: NEXTZ
					
I got a string of numbers like the following you should too, if you used the same spacing I did. I will mark some places as I type this, in order to refer to them later, so remember that the underlining and the letters don’t come with the output.
Most of the numbers here are simply the ASCII codes for the individual letters and numbers used in the program — and the punctuation, too, of course. If you look them up in appendix C, you will find, for example, that 32 is a space and 58 a a colon.
First of all, remember that the program had three lines, numbered 10, 20, and 30. We can see those line numbers in the parts of the text marked B. It is easy to see them if you use line numbers below 256, because the numbers are entered in the usual manner for recording integers, with the least significant byte(LSB) first and the most significant byte (MSB) next, in two bytes. For low numbers, the MSB is zero and the LSB comes out as its real number. For higher numbers, you need to multiply the MSB by 256 and add the LSB to see what you have.
The two numbers ahead of the line numbers are marked B. These, In the same integer format, are the pointers to the next line of the program in the text memory. For example, 252 66 translates to 17148. Since the location of the first number, 252, Is 17129, we count over until we reach 17148 and find a 24, the first byte of the pointer to the third line. The pointer at the beginning of the third line points to a pair of zeroes, marked with an M – this means there is no next line, so the line we were in, in this case line 30, is the last in the program. Since every line of the program ends with a zero (marked E, above) you can locate not only the end of each line but the end of the program as well.
All those other big numbers in the program itself are the function codes I referred to earlier, and you can translate them either by comparison with the program itself or by looking them up in the table of function codes listed there. The first, for example, is 153, the equivalent of DEFINT.
Following the program itself you will find all the variables that were assigned values in the program (that Is why it was worth while to run it .before the PEEK). You need to know that every variable has a three-byte “name” that precedes each value itself. The first byte is a digit that both defines the type of variable and tells how many value-bytes there are. For example, the sequence 2 0 76, marked “L”, is the name of the integer variable L used as an index. The 2 tells you it is stored In two bytes. The next byte is the second symbol In the name, here a zero because we didn’t use a second symbol. It would be 49, the ASCII value of 1 if we had called the variable L1. The MSB of the name is 76, which is ASCII “L”.
The next one is something of a surprise at first. It starts out 4 0 90 — 4 is a single precision variable that needs four bytes for the value, and the name is Z – the variable used in the command line to print out the peek was put in here, shoving the other variables aside. If a double precision variable were used, its indicator would be an 8. After the Z valuer (the value it had when the printing command passed it up), we find the array, A. Its name is that of an integer, but the next values are descriptions of the array – two bytes for the length of the storage string (after the MSB of its value), one byte for the number of dimensions (here 1), and two bytes for the number of locations in each dimension. There is only one dimension here, with ten locations (0 to 9). Then come the ten values, two bytes each.
String arrays have a header beginning with 3, meaning three bytes are in storage. Those three bytes are not its value, obviously, but indicate the length of the string in the first byte (thus a limit of 256 characters), and the integer-format location of the first character in the string. If you assign the string value in the program, as in a print statement, the location pointed to will be in the program text. If it is a string whose value is assigned as a variable, it will be found at the end of the RAM memory.
So there is your whole program, laid out in the memory of your processor for the interpreter to read. And you can read it too. I have included the Hex values for the function codes in the table so that those who get a Hex dump say, from the RSM-1S monitor, can translate it also. Those masochists will also need to translate the ASCII values of letters and numbers from and into Hex, of course!
It is also interesting to look at the I/O buffer. If you type in a long command string, such as the PEEK routine we used to look at the text memory, you will discover that the little program is still there. The first parts of it will be written over as the line is shortened by conversion of the functions to their one-byte codes, and will end with three zeroes, but after that you can find the key-by-key entries you put in when typing.
You can also try this: with your program in residence and after a PEEK, as we did before, en-ter NEW, then run the PEEK on the same area again. You will find that the first two numbers are zeroes — meaning, sorry, no program. You will also find the variable you used to PEEK written in there too. But after that, the rest of the program will be in its original form. You can POKE the original numbers back into locations 17129 and 17130 and list the program again, with only the loss of the first line (if it was long enough not to be overwritten in your playing around).
You can figure out what most of the numbers between 128 and 255 mean by PEEKing at them just as described. But a lot of those numbers don’t mean-anything unless you have disc basic. You can still see what they mean if you try the following:
Entera short program, say, two lines, like this:
     10 A = 10
     20 PRINT A
					
You know that the text will be located beginning at location 17129, with the first four bytes devoted to the pointer and line number. So POKE into 17133 (the first byte of the program itself) and maybe a couple of others — but be sure not to get past the end of the line, and then LIST the program. Line 10 will be there, and so will the meanings of the numbers you POKEd in. Most of them won’t run, of course, unless you have disc running, but the listing will still do the translating for you.

Tokenized BASIC – Leonard Erickson (a/k/a Shadow)
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.

128     END
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             251     (REM QUOTE)
					

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
						

Tokens - Pete Cervasio
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$, "'"
						

Pokes and Peeks - Valley TRS-80 Hackers Group (A Levinson and E Bagai)
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)
					

Model III WD1793 Disk Controller Ports
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

UART Bits
One of the minor incompatibilities between the MODEL-I and the MODEL-III lie in the way in which serial (RS-232-C) I/O is handled. they are almost, but not quite the same. This article will discuss the differences, provide patches for SCRIPSIT/LC'S serial printer driver and give some general guidelines for adapting MODEL-I serial I/O code for use on the MODEL-III.
Both the MODEL-I and the MODEL-III use four Z-80 I/O ports for the RS-232-C interface: E8H, E9H, EAH and EBH. The ports are used as follows:
E8HOutputting any byte to this port resets the uart. This is usually done only when initializing the interface. Inputting a byte from this port places the contents of the modem status register in the a register. see the manual for Radio Shack's RS-232-C Interface (Catalog #26-1145) for details. MODEL-I and MODEL-III use this port in exactly the same way.
E9HWriting a byte to this port programs the baud rate generator (BRG). The high-order nybble sets the transmit baud rate and the low-order nybble sets the receive baud rate. This is the same for both MODEL-I and MODEL-III. In the MODEL-I, reading this port transfers the settings of the configuration sense switches (the eight dip switches on the RS-232 card) to the a register. these values can then be used for setting the interface to default parameters. the read function for this port is not used in the MODEL-III.
EAHWriting to this port sets up the UART control parameters and the handshake latch. reading this port transfers the contents of the uart status register to the a register. same for both MODEL-I and MODEL-III.
EBHWriting to this port loads the transmit data register with the contents of the a register. reading this port transfers the contents of the received data register to the a register. same for both MODEL-I AND MODEL-III.
From this we can see that the only difference between the two machines is that the MODEL-III has no dip switches to read and thus does not have to input from port E9H. A MODEL-III with the RS-232-C interface installed will automatically set up the interface for 300 baud, 8 bit word, 1 stop bit and no parity, when the system boots up. The disk version uses the SETCOM command to change these values as desired. In the MODEL-I, the RS-232-C Interface is not set up by the operating system and must be configured by the user program which will be using the interface. Some simple drivers merely read the dip switches and set the interface accordingly. programs like ST80 can also do this and additionally allow the user to over-ride these default settings with different values. In converting MODEL-I software to run on the MODEL-III, All code relating to the reading of port E9H and setting the interface accordingly must be removed.

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
         !     !     !     !     !     !     !     !     !
========='====='====='====='====='====='====='====='====='
					

Z-80 Instruction Set
                             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.
						

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

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
						

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)
						

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.

TRS-80 MODEL 1/3 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
						

VIDTEX ESCAPE SEQUENCES - Neil Morrison
VIDTEX lets the host computer perform screen control functions through escape sequences. Remember that these are remote functions executed by the host and cannot be performed from the keyboard. The following table summarizes the screen control sequences and the functions they perform. Note the difference between lower and uppercase.
Escape Control Sequence Summary:
Sequence          Function
{ESC}{ESC}OOpen RAM buffer
{ESC}{ESC}CClose RAM buffer
{ESC}{ESC}ZZero RAM buffer
{ESC}ACursor up
{ESC}BCursor down
{ESC}CCursor right
(ESC)DCursor left
{ESC}G4Semi-graphics 4 mode
{ESC}GNText mode
{ESC}HHome cursor
{ESC}JClear to end of page
{ESC}KClear to end of line
{ESC}Y line colPosition cursor
{ESC}bLock keyboard
{ESC}cUnlock keyboard
(ESC}eDisable display
{ESC}fEnable display
{ESC}gRestart VIDTEX
{ESC}jClear Page
{ESC}lNormal character width
{ESC}mWide character width
{DC1}XON
{DC2}Printer on
{DC3}XOFF
{DC4}Printer off
Graphics Mode:
An {ESC}G4 is used by the host to specify semi-graphics 2 x 2 mode. These codes are used internally by the Videotex Plus software and cannot be generated from the keyboard. In this mode the parity bit is used to distinguish between graphic and ASCII characters. If the parity bit is zero, the character is a standard ASCII character. If the parity bit is one, the character is a graphics character.
Model II Videotex Plus does not support graphics or color. When graphics mode is required by the host. similar Model II graphics characters are substituted for the graphics codes. These are not true representations of Videotex’s standard graphics.

Cassette Recorder Levels - Neil Morrison
Recorder Model User-Generated Tapes Pre-Recorded
Radio Shack Tapes
Model I Model III Model I Model III
Level I Level II Level I Level II
CTR-40 Yellow Line Red Line Yellow Line Red Line
CTR-41 6-8 4-6 6.5-8.5 5-7
CTR-80 4.5-6.5 3-5 5-7 5.5-7.5 2.5-5 4-6
CTR-80A 4.5-6.5 3-5 5-7 5.5-7.5 2.5-5 4-6
CTR-81 4.5-6.5 3-5 5-7 5.5-7.5 2.5-5 4-6

Model 4P boot mode key selection
Model 4P boot mode key selection (hold key till completed):
no keys pressed - boots in III mode if MODELA/III on disk 0
F1      pressed - boots from hard disk
F2      pressed - boots from floppy disk
F3      pressed - boots in III mode if MODELA/III on disk
L       pressed - re-load ROM image (in case of damage)
N       pressed - boots TRSDOS 6.x (not III's 1.3)
P       pressed - prompts to switch disks after loading III ROM
        (press  to run III Basic or  to load & run a DOS
V       pressed - prints ROM version on screen
.       pressed - performs dynamic RAM test until  is presed
  - boots from RS232. Acts like Network III Boot ROM
						

Model 4P Modem Commands
Commands:
     *Opens modem for programming.
     ASwitches modem to the answer mode.
     @Stand by to receive a new Abort code.
     CClears (resets) modem memory.
     DClears current telephone number from memory. Must precede any new telephone number.
     EToggle the Echo enable switch.
     FFast Rotary or Tone dialing (20 pps.)
     GToggle forced carrier detect switch.
     LTransmits (displays) current contents of modem memory to the computer (terminal).
     MToggles the Manual/Automatic switch.
     OSwitches the modem to the Originate mode.
     PInserts a 3 second pause in dialing sequence.
     QPuts modem into LOCal Test Mode.
     RRotary dialing (default value).
     SSlow Rotary or Tone dialing (10 pps.) (default value).
     TTone dialing (10 digits per second).
     XExecutes current program (dials phone number in memory, goes into Self-Test mode, waits for telephone to ring while in answer mode).
     BKSP  Erase the last code entered when programming dialing information.
     ,Insert a user space when programming dialing information.
Examples
      To see the menu (or list) of the modem you type: *L in the terminal program such as COMM/CMD, XT4/CMD, etc.
To program it in order to call 555-3595, you would do the following on one line:
**C**MOGFDR652-3595;
     C clears modem
     M changes to automatic
     O is for originate
     G disables forced carrier detect
     F is for Fast dialing
     D is for dialing
     R is for Rotary
Now if you typed the modem will respond with:
     MODE=A
     TYPE=O
     F CD=N
     TEST=N
     NUMB=R652-3595
     RATE=F
     EXIT=14
then you would type to execute the above commands and dial the number.

Ports (Model I)
EBH:  Serial Port
     IN                            OUT
     (Input Data)                  (Output Data)
B7:  Data-7                        Data-7
B6:  Data-6                        Data-6
B5:  Data-5                        Data-5
B4:  Data-4                        Data-4
B3:  Data-3                        Data-3
B2:  Data-2                        Data-2
B1:  Data-1                        Data-1
B0:  Data-0                        Data-0


EAH:  Serial Port
     IN                            OUT
     (Uart Status bits)            (Uart parameters set)
B7:  1=Data Available              1=Even Parity
B6:  0=Data sent (TBMT)            WD Lngth 00=5 01=7
B5:  1=Overrun Error               WD Lngth 10=6 11=8
B4:  1=Framing Error               0=1-Stop bit
B3:  1=Parity Error                1=No Parity
B2:  unused                        1=Transmit Enable
B1:  unused                        0=DTR on
B0:  unused                        0=RTS on


E9H:  Serial Port
     IN                            OUT
     (DIP Switches??)              (Set speeds)
B7:  Parity 0=Odd                   Set Baud rate (all bits)
B6:  Wd Length 00=5 01=7            110 = 22H   150 = 44H
B5:            10=6 11=8            300 = 55H   600 = 66H
B4:  Stop bits 0=1 1=2             1200 = 77H  2400 = AAH
B3:  Parity 0=enable               4800 = 66H  9600 = EEH
B2:  unused                        Bits 0-3 = Receive Speed
B1:  unused                        Bits 4-7 = Transmit Speed
B0:  unused


E8H:  Serial Port
     IN                            OUT
     (Signals Input)               (Reset Uart)
B7:  CTS                           Any value will reset the
B6:  DSR                           Uart
B5:  0=Carrier Detected
B4:  1?=Ring Indicate
B3:  unused
B2:  unused
B1:  unused
B0:  Serial data input
						

Ports (Model III)
FF: Cassette unit.       I/O
F8: Printer.             I/O


F4H: Disk Drive register port.
     IN                            OUT
B7:
B6:
B5:
B4:
B3:
B2:
B1:
B0:


F3: Disk Controller DATA register.
     Same specs as for WD1791 DDEN Disk Controller.
F2: Disk SECTOR register.
     For WD1791.
F1: Disk TRACK  register.
     For WD1791.
F0: Disk COMMAND/STATUS register.
     For WD1791.



C8-CF: Hard disk controller port addresses.
   Ports C8 to CF correspond to Winchester Disk controller
chip WD1010 registers 0 through 7. Port C8 in particular
is the port used to read/write data.
   See Western Digital manual for specs.

C1: ??
C0: ??


EC: ?                    I/O

EBH:  RS-232 data in/out port
     IN                            OUT
     (Data read from line)         (Data sent to line)
B7:  Data-7                        Data-7
B6:  Data-6                        Data-6
B5:  Data-5                        Data-5
B4:  Data-4                        Data-4
B3:  Data-3                        Data-3
B2:  Data-2                        Data-2
B1:  Data-1                        Data-1
B0:  Data-0                        Data-0


EAH: RS-232 status/control
     IN                            OUT
     (Uart Status & signals)       (Set UART parameters)
B7:  1=Data Available (input)      1=Even Parity, 0=Odd
B6:  1=Data Sent (output)          : Word length 00=5 01=7
B5:  1=Overrun Error               : Word length 10=6 11=8
B4:  1=Framing Error               0=1-Stop bit, 1=2.
B3:  1=Parity Error                0=Enable parity, 1=Disable
B2:  unused                        1?=Send BREAK signal
B1:  unused                        1=DTR off
B0:  unused                        1=RTS off


E9: RS-232 software switches and speed select
     IN                            OUT
     (DIP Switches)                (Baud rate select)
B7:  Parity 0=odd 1=even           ) Xmit baud rate B4-B7
B6:  Word length 00=5 01=7         )
B5:  Word length 10=6 11=8         )
B4:  Stop bits 0=1 1=2             )
B3:  Parity 0=enable 1=disable     ) Recv baud rate B0-B3
B2:  Baud rate select #2           )
B1:  Baud rate select #1           )
B0:  Baud rate select #0           )


E8: RS-232 Signals and reset
     IN                            OUT
     (Input signals)               (Reset)
B7:  CTS                           Any value will reset the
B6:  DSR                           interface.
B5:  Carrier Detect
B4:  Ring Indicate
B3:  unused
B2:  unused
B1:  Copy of serial input pin UART
B0:    (May be bit 0 instead)

E4: ?                    I/O
E0: ?                    I/O
9C: ? (4p only?)         O
						

Undocumented Z-80 Opcodes - Developed from the article by Daniel Lunsford in TAS, V1. N6. pp53-55
In these opcodes, HX and LX represent the high- and low-order bytes of the IX register. HY and LY are analogous for the IY register. The timing for these new IX and IY instructions is 4 T-states longer than the equivalent H and L instructions..
Also, SLS means Shift Left and Set. This shifts the register left just as an SLA would, and then the LSB is set. The MSB goes into the Carry flag, and sign and parity are adjusted as expected.
New Opcode      Hex             Assembler Realization


SLS   A         CB 37           DEFW    37CBH
SLS   B         CB 30           DEFW    30CBH
SLS   C         CB 31           DEFW    31CBH
SLS   D         CB 32           DEFW    32CBH
SLS   E         CB 33           DEFW    33CBH
SLS   H         CB 34           DEFW    34CBH
SLS   L         CB 35           DEFW    35CBH
SLS   (HL)      CB 36           DEFW    36CBH

SLS   (IX+d)    DD CB dd 36     RLC (IX+d)
                                ORG $-1
                                DEFB 36H

SLS   (IY+d)    FD CB dd 36     RLC (IY+d)
                                ORG $-1
                                DEFB 36H

ADC   A,HX      DD 8C           DEFW    8CDDH
ADC   A,LX      DD 8D           DEFW    8DDDH
ADC   A,HY      FD 8C           DEFW    8CFDH
ADC   A,LY      FD 8D           DEFW    8DFDH

ADD   A,HX      DD 84           DEFW    84DDH
ADD   A,LX      DD 85           DEFW    85DDH
ADD   A,HY      FD 84           DEFW    84FDH
ADD   A,LY      FD 85           DEFW    85FDH

AND   HX        DD A4           DEFW    0A4DDH
AND   LX        DD A5           DEFW    0A5DDH
AND   HY        FD A4           DEFW    0A4FDH
AND   LY        FD A5           DEFW    0A5FDH

CP    HX        DD BC           DEFW    0BCDDH
CP    LX        DD BD           DEFW    0BDDDH
CP    HY        FD BC           DEFW    0BCFDH
CP    LY        FD BD           DEFW    0BDFDH

DEC   HX        DD 25           DEFW    25DDH
DEC   LX        DD 2D           DEFW    2DDDH
DEC   HY        FD 25           DEFW    25FDH
DEC   LY        FD 2D           DEFW    2DFDH

INC   HX        DD 24           DEFW    24DDH
INC   LX        DD 2C           DEFW    2CDDH
INC   HY        FD 24           DEFW    24FDH
INC   LY        FD 2C           DEFW    2CFDH

OR    HX        DD B4           DEFW    0B4DDH
OR    LX        DD B5           DEFW    0B5DDH
OR    HY        FD B4           DEFW    0B4FDH
OR    LY        FD B5           DEFW    0B5FDH

SBC   A,HX      DD 9C           DEFW    9CDDH
SBC   A,LX      DD 9D           DEFW    9DDDH
SBC   A,HY      FD 9C           DEFW    9CFDH
SBC   A,LY      FD 9D           DEFW    9DFDH

SUB   HX        DD 94           DEFW    94DDH
SUB   LX        DD 95           DEFW    95DDH
SUB   HY        FD 94           DEFW    94FDH
SUB   LY        FD 95           DEFW    95FDH

XOR   HX        DD AC           DEFW    0ACDDH
XOR   LX        DD AD           DEFW    0ADDDH
XOR   HY        FD AC           DEFW    0ACFDH
XOR   LY        FD AD           DEFW    0ADFDH

LD   HX,A       DD 67           DEFW    67DDH
LD   LX,A       DD 6F           DEFW    6FDDH
LD   HY,A       FD 67           DEFW    67FDH
LD   LY,A       FD 6F           DEFW    6FFDH

LD   HX,B       DD 60           DEFW    60DDH
LD   LX,B       DD 68           DEFW    68DDH
LD   HY,B       FD 60           DEFW    60FDH
LD   LY,B       FD 68           DEFW    68FDH

LD   HX,C       DD 61           DEFW    61DDH
LD   LX,C       DD 69           DEFW    69DDH
LD   HY,C       FD 61           DEFW    61FDH
LD   LY,C       FD 69           DEFW    69FDH

LD   HX,D       DD 62           DEFW    62DDH
LD   LX,D       DD 6A           DEFW    6ADDH
LD   HY,D       FD 62           DEFW    62FDH
LD   LY,D       FD 6A           DEFW    6AFDH

LD   HX,E       DD 63           DEFW    63DDH
LD   LX,E       DD 6B           DEFW    6BDDH
LD   HY,E       FD 63           DEFW    63FDH
LD   LY,E       FD 6B           DEFW    6BFDH

LD   HX,n       DD 26 n         DEFB    0DDH,26H,n
                             or DEFB    221,38,n

LD   LX,n       DD 2E n         DEFB    0DDH,2EH,n
                             or DEFB    221,46,n

LD   HY,n       FD 26 n         DEFB    0FDH,26H,n
                             or DEFB    253,38,n

LD   LY,n       FD 2E n         DEFB    0FDH,2EH,n
                             or DEFB    253,46,n

LD   HX,LX      DD 65           DEFW    65DDH
LD   LX,HX      DD 6C           DEFW    6CDDH
LD   HY,LY      FD 65           DEFW    65FDH
LD   LY,HY      FD 6C           DEFW    6CFDH

LD   A,HX       DD 7C           DEFW    7CDDH
LD   A,LX       DD 7D           DEFW    7DDDH
LD   A,HY       FD 7C           DEFW    7CFDH
LD   A,LY       FD 7D           DEFW    7DFDH

LD   B,HX       DD 44           DEFW    44DDH
LD   B,LX       DD 45           DEFW    45DDH
LD   B,HY       FD 44           DEFW    44FDH
LD   B,LY       FD 45           DEFW    45FDH

LD   C,HX       DD 4C           DEFW    4CDDH
LD   C,LX       DD 4D           DEFW    4DDDH
LD   C,HY       FD 4C           DEFW    4CFDH
LD   C,LY       FD 4D           DEFW    4DFDH

LD   D,HX       DD 54           DEFW    54DDH
LD   D,LX       DD 55           DEFW    55DDH
LD   D,HY       FD 54           DEFW    54FDH
LD   D,LY       FD 55           DEFW    55FDH

LD   E,HX       DD 5C           DEFW    5CDDH
LD   E,LX       DD 5D           DEFW    5DDDH
LD   E,HY       FD 5C           DEFW    5CFDH
LD   E,LY       FD 5D           DEFW    5DFDH