                   Important 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   DEC           COMMENTS
---------------------------------------------------------------
3C00 15360 This is the beginning of video ram or VIDRAM. It
           ends at 3FFFH or 16383.
4000 16384 RST 08 Compare value pointed to by HL to that
           immediately following RST instruction.
4003 16387 RST 10 Examine next symbol pointed to by HL.
4006 16390 RST 18 Compare DE and HL.
4009 16393 RST 20 Test the type of current varible.
400C 16396 RST 28 3 byte break key vector (cass. Basic & TRSDOS
           1.3) and normal Dos function call.
400F 16399 RST 30 Reserved for Dos; normally for invoking Debug
4012 16402 RST 38 Maskable interupt vector.
4015 16405 Beggining of Keyboard DCB. One byte device type. = 1
4016 16406 Two byte keyboard driver vector.
4018 16408 Right SHIFT toggle.
4019 16409 Caps lock switch (Not 0 = Caps only)
401A 16410 Cursor blink count
401B 16411 Cursor blink status. (0=blinks)
401C 16412 Cursor blink switch (0 = blink)
401D 16413 Beggining of Video DCB. One byte device type. = 7.
401E 16414 Two byte video driver vector.
4020 16416 Two byte cursor position.
4022 16418 0 = Cursor on, Not 0 = character replaced by cursor.
4023 16419 Cursor Character (in ascii).
4024 16420 FLAG: 0=Space compression; Not 0=special character.
4025 16421 Beggining of Printer DCB. One byte device type. = 6.
4026 16422 Two byte printer driver vector.
4028 16424 Maximum lines printed per page plus one. Default=67.
4029 16425 Number of lines printed plus one.
402A 16426 Character counter + 1.
402B 16427 Line printer maximum line length less two.
402C 16428 "R"
402D 16429 Return to Dos exit. (Disk systems only).
4030 16432 For all doses except TRSDOS, is abnormal return to
           DOS ready.
4036 16438 Keyboard buffer (7 bytes).
403D 16445 Cassette port and print size flag (bit 3) copy (For
           Model 3, see 4210). L3: location of routine to add
           task to interupt chain.
403E 16446 For Model I DOSPLUS, hold DOS version in DCB format.
4040 16448 For L1 & M1, 25 ms heartbeat counter. For L3, used
           to remove task from interrupt chain.
4041 16449 Beginning of Time and Date bytes. (seconds, min.,
           hours, year, day, month) Ends at 4046H or 16454. L1,
           D1, and M1
4043 16451 L3, change address of interupt task.
4044 16452 L1, D1, & M1. Contains date in binary format.
4046 16454 L3. Remove task from interupt chain.
4047 16455 L1. Current day in coded form.
4049 16457 For the Model III disk is non maskable interupt
           vector, for Model I disk is highest available memory
           location (Model III = 4411H)
404B 16459 L1. Contains image of interrupt latch.
408E 16526 Address of USR routine (two bytes)
4099 16537 INKEY$ storage. Most recent keyboard character.
409A 16538 Error code is at this address (for BASIC only)
409C 16540 OUTSEL. On Model I, is a 1-byte output device flag.
           -1 (or 129) for cass, 0 for video, 1 for printer.
40A0 16544 Clear address pointer. Beggining of CLEARed area for
           string variable storage
40A2 16546 Last executed line number.
40A4 16548 Pointer to beggining of Basic program.
40A6 16550 Cursor's current column number.
40A7 16551 Input buffer pointer.
40A9 16553 ???.
40AA 16554 3 byte random seed number.
40AB 16555 This byte is changed by RANDOM.
40AF 16559 SAFLAG. Contains typeflag of software accumulator.
40B1 16561 Two byte MEMTOP (for BASIC).
40D3 16585 Saves length ASCII representation of binary integer.
40D4 16586 Two byte address. Points to buffer where ASCII
           decimal representation written.
40D6 16598 String pointer. Keeps track within CLEARed area as
           to where last string data was put.
40D8 16600 Two byte location of where Basic is currently
           reading program.
40DF 16607 Default entry point for SYSTEM tapes.
40E1 16609 Auto flag.
40E2 16610 Current auto line number.
40E4 16612 Auto increment.
40E6 16614 Pointer to terminator (end of line 00H byte or ":")
           of last executed Basic statement is at this address.
40E8 16616 Beggining of Basic's stack.
40EA 16618 Two byte address. Contains line number with error.
40EC 16621 Two byte address. "." line number.
40EE 16622 Pointer to I/O buffer.
40F0 16624 Pointer to line of BASIC error handling.
40F2 16626 Error flag.
40F5 16629 Current line number.
40F9 16633 End of BASIC program/ start of simple variable list
           pointer.
40FB 16635 Start of arrays variables pointer.
40FD 16637 End of arrays variables/ start of free memory
           pointer.
40FF 16639 Two byte address. Current location of Basic's DATA
           pointer.
4101 16641 Beginning of variable type table.
411A 16666 End of variable type table.
411B 16667 Trace flag.
411D 16669 First byte of SA.
4124 16673 Last byte of SA.
4127 16679 First byte of SA1.
412E 16686 Last byte of SA1.
4152 16722 CVI        3 byte vector.
4155 16725 FN               "
4158 16728 CVS              "
415B 16731 DEF              "
415E 16734 CVD              "
4161 16737 EOF              "
4164 16740 LOC              "
4167 16743 LOF              "
416A 16746 MKI$             "
416D 16749 MKS$             "
4170 16752 MKD$             "
4173 16755 CMD              "
4179 16761 OPEN             "
417C 16764 FIELD            "
417F 16767 GET              "
4182 16770 PUT              "
4185 16773 CLOSE            "
4188 16776 LOAD             "
418B 16779 MERGE            "
418E 16782 NAME             "
4191 16785 KILL             "
4194 16788 & function       "
4197 16791 LSET             "
419A 16794 RSET             "
419D 16797 INSTR            "
41A0 16800 SAVE             "
41A3 16803 LINE             "
41A6 16806 ERROR Error processing jumps to this 3-byte vector.
           In cassette BASIC it contains RET instruction; in
           Disk BASIC, contains a jump (through RST) to long
           error message
41A9 16809 USR        3 byter vector.
41AC 16812 Ready prompt
41AF 16815 Called from 0368H to input line from keyboard to I/O
           buffer.
41B2 16818 Called from 1AA1H immediately after BASIC line is
           tokenized. HL points to tokenized line.
41B5 16821 Called 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
41BB 16827 Called from 1B8CH and 1DB0H during NEW and END
           processing to allow Disk Basic to close open files.
41BE 16830 PRINT# processing called from 2174H
41C1 16833 Byte output to any device. Called from 032CH so
           output to disk can be handled as to other devices.
41C4 16836 ROM KB scan (0358H) calls this exit. BASIC processes
           INKEY$ here and also after each command when system
           searches for break or shift @.
41C7 16839 Called from 1EA6H when RUN is followed by filename
           or line number
41CA 16842 Related to 41BEH above. Called at beggining of print
           processing from 206FH to check for possible disk
           output.
41CD 16845 Called from 20C6H. Call made during print processing
           after number is in ASCII and just before printing.
           Could be used for Hex and Binary printing.
41D0 16848 Called from 2103H (from PRINT routine after code
           that send CR.) Could be used for screen wrap-around.
41D3 16851 Called 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.
41D6 16854 INPUT# processing. Called from 219EH to check for
           INPUT# command and to provide input from disk.
41D9 16857 Left side of MID$ processing. Only DOS exit BASIC
           jumps to instead of calls. Used to allow MID$ on
           left side of equals sign.
41DC 16860 Variables assignment. During processing of READ &
           INPUT statements, after computer recieves value and
           before assigned to variable, BASIC calls this exit
           from 222DH.
41DF 16863 Called 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.
41E2 16866 SYSTEM 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.
41E8 16872 $RSRCV input buffer (1 byte)
41F0 16880 $RSTX output buffer (1 byte)
41F8 16888 $RSINIT baud rate code. TX code = most sig. nibble,
           RCV code = least sig. nib.
41F9 16889 $RSINIT parity/word/length stop-bit code
41FA 16890 $RSINIT wait switch (0 = wait, Not 0 = wait)
4209 16905 L3. Checks for drive and mounted disk.
4210 16912 Various controls: See port EC
4211 16913 Cass baud rate switch (0=500 baud, Not 0=1500 baud)
4214 16916 Video display scroll protect (range = 0 - 7)
4217 16919 Model 3 time. Contains time in binary format.
421A 16922 Model 3 date. Contains date in binary format.
4220 16928 $ROUTE destination device (two bytes)
4222 16930 $ROUTE source device (two bytes)
4225 16933 T3, L3, D3. Dos command buffer.
4288 17032 L3. 33.33 ms heartbeat counter.
428A 17034 L3. Send message to Job Log and CRT.
428D 17037 T3, D3. Find drive and file number for open file.
           L3, send message to Job Log.
4290 17040 T3, L3, D3. Copy directory to RAM buffer.
4293 17043 Get file name from directory.
4296 17046 L3. Execute Dos command and return to DOS ready.
4299 17049 T3. Do DOS command and return to DOS ready.
           L3: returns to caller is @EXIT and @ABORT vectors
           change to jump to return address.
429C 17052 T3. Do DOS command and return to caller.
42AD 17069 D3. Contains address of break key routine.
4312 17170 D1. Contains address of break key routine.
4318 17176 T1, L1, D1. DOS command buffer.
4396 17302 L1. Read directory into memory.
4400 17408 L1, D1, D3, N1, N3, M1, M3. Same as 402D.
4402 17410 Send text to file or device.
4405 17413 L1, D1, D3, N1, N3, M1, M3. Do DOS command and
           return to DOS ready.
4409 17417 Display error message on CRT.
440D 17421 L1, L3, D1, D3, N1, N3, M1, M3. Enter Debug.
4410 17424 L1, D1, N1, M1. Add task to interrupt chain.
4411 17425 Address of highest available memory location (Mod 3
           disk only - Mod 1 disk = 4049H)
4413 17427 L1, D1, N1, N3, M1. Remove task from interrupt
           chain.
           D3, add task to interrup chain.
4415 17429 T3 (undocumented) Second copy of high memory
           address. Copied to 4411H in case of I/O error during
           DO processing.
4416 17430 L1, M1. Change entry address of task in interrupt
           chain.
           D3: Remove task from interrupt chain.
           N1, N3: Keep rotating and reselect current drive.
4417 17431 L3. Contains current day in coded format.
4419 17433 T3, L3. Write disk directory to screen or buffer.
           N1, N3: Execute DOS command and return to caller.
441C 17436 T3, L1, L3, D1, D3, N1, N3, M1, M3. Move filespec to
           FCB.
4420 17440 All. Open or create a file.
4424 17444 All. Open existing file.
4428 17448 All. Close a file.
442C 17452 All. Remove file from directory.
4430 17456 All. (undocumented in T1) Load file (m.l. program)
           into memory.
4433 17459 All. (undocumented in T1) Load and run m.l. program.
4436 17462 All. Read logical record into memory.
4439 17465 All. Write logical record to disk.
443C 17468 All. Write record and verify.
443F 17471 T3, L1, L3, D1, D3, N1, N3, M1, M3. Point to first
           record in file.
4442 17474 All. Position file to specified record.
4445 17477 T3, L1, L3, D1, D3, N1, N3, M1, M3. Backspace file
           one record.
4448 17480 T3, L1, L3, D1, D3, N1, N3, M1, M3. Position to EOF.
444B 17483 T3, 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.
444E 17486 T3, L3, D3. Multiply 16 bit by 8 bit integer.
           L1: Update directory with current record as EOF.
           D1: Divide 16 bit by 8 bit integer.
           N1, N3: Position file to specified byte record.
4451 17489 T3, 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.
4454 17492 L1 Read current sector.
           L3, D3, M3: Parse parameters in command line.
           D1: Find drive and file number of a file.
4457 17495 L1 Rewrite current sector.
           D3: Check for end of file.
           D1: Read directory to user buffer.
4458 17496 L3. Check for end of file.
445A 17498 L1. Calculate current logical record number.
           D1, D3: Display directory on CRT.
445B 17499 L3. Update directory with current record as EOF.
           N1, N3: Select and power up specified drive.
445D 17501 L1. Calculate EOF record number.
445E 17502 L3. Reread current sector.
           N1, N3: Test drive and disk.
4460 17504 L1. Skip next logical record.
4461 17505 L3. Rewrite current sector. N1, N3: Add user routine
           to DOS library chain.
4462 17506 D1, D3. Send text to printer.
4463 17507 L1. Read directory to buffer or CRT.
4464 17508 L3. Skip next logical record. N1, N3: Remove user
           routine from DOS library chain.
4467 17511 L1, L3, D1, D3, N1, N3, M1, M3. Display text on CRT.
446A 17514 L1, L3, N1, N3, M1, M3. Send text to printer.
446D 17517 T1, L1, D1, D3, N1, N3, M1. Get time in ASCII
           format. L3: Calculate current logical record number.
4470 17520 L3. Calculate end of file record number.
4473 17523 L3. Holds image of interrupt latch. T1, L1, D1, D3,
           N1, N3, M1, M3: Add default extension to filespec in
           FCB. (See also 444BH)
4476 17526 L1, D1, M1, M3: Parse parameters in command line.
4779 17529 L1. Send text to file or device. D1, D3: Scan and
           evaluate command line.
447B 17531 L1. Send text to job log and CRT. N3: Add task
           interrupt chain.
447C 17532 D1, D3. Compare filespec to wildcard mask.
447E 17534 L1. Send text to joblog.
447F 17535 D1, D3. Get device number for file or I/O device.
4482 17538 D1, D3. Sort block of memory.
4485 17541 D1. 10 disk I/O functions depending on value in A.
4488 17544 D3. 10 disk I/O functions depending on value in A.
           D1: Locate device control block for any device.
448B 17547 D1. Locate drive control table for any drive.
44A0 17568 D3. Locate device control block for any device.
44A3 17571 D3. Locate drive control table for any drive.
44B8 17592 L1. Check drive and disk.
44BB 17595 L1. Get file name from directory.
44C1 17601 L1. Multiply 16 bit by 8 bit integer.
44C4 17604 L1. Divide 16 bit by 8 bit integer.
44D2 17618 M3. Add task to interrupt chain.
44D5 17621 M3. Remove task from interrupt chain.
44D8 17624 M3. Change execution address of task in interrupt
           chain.
44DB 17627 M3. Set task pointer to default of RET.
44DE 17630 M1, M3. Verify a sector without reading to RAM.
44E1 17633 M1, M3. Read sector.
44E4 17636 M1, M3. Write sector.
44E8 17640 M1, M3. Read directory sector.
44EB 17643 M1, M3. Write directory sector.
44EE 17646 M1, M3. Read director.
44F1 17649 M1, M3. Write directory.
44F4 17652 M1, M3. User function.
44F7 17655 M1, M3. Get directory track number.
46DD 18141 RDSECT. On Model I, allows reading a disk sector.
           Register C contains the drive selcted; D, the track;
           E, the sector number; HL points at data buffer. On
           return, Z is set if successful; else A= error code.
46E6 18150 WTSECT. On Model I, allows you to write a disk
           sector. Same conditions as RDSECT at 46DDH.
4754 18260 L1, L3. Select drive.
4759 18265 L1, L3. Continually reselect drive until it's ready.
475E 18270 L1, L3. Seek specified cylinder (track).
4763 18275 L1, L3. Write sector to disk.
4768 18280 L1, L3. Write system (directory) sector.
476D 18285 L1, L3. Write track to disk (used for formatting).
4772 18290 L1, L3. Verify sector without transfering data to
           memory.
4777 18295 L1, L3. Read sector to buffer.
478F 18319 L1, L3. Get address of DCT for specifed drive.
479C 18332 L1, L3. Get byte field from drive code table.
4B10 19216 L1, L3. Read DIR sector with specified entry code.
4B1F 19231 L1, L3. Write system buffer to specified DIR sector.
4B45 19269 L1, L3. Read directory sector to user buffer.
4B64 19300 L3. Get cylinder (track) number of directory.
4B65 19301 L1. Get cylinder (track) number of directory.
4B6B 19307 L3. Multiply 8 bit by 8 bit integers.
4B6C 19308 L1. Multiply 8 bit by 8 bit integers.
4B7A 19322 L3. Divide 8 bit by 8 bit integers.
4B7B 19323 L1. Divide 8 bit by 8 bit integers.


                       Model III/IV Ports

80H Input: Reserved. Output: Graphics board register.
81H Input: Graphics board RAM read. Output: Graphics board RAM
    write.
82H Input: Reserved. Output: Graphics board Y register.
83H Input: Reserved. Output: Graphics board X register.
84H Mod 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 x 16 mode) 0=page 0, 1=page 1.
85H - 87H. Same as 84H.
88H CRT controller control register.
89H CRT controller control register.
8AH CRT controller control register.
8BH CRT controller data register.
8CH - 8FH. Graphics board select 2.
Z0H Model 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.
C0H Input: Hard disk write protect. Output: Reserved.
C1H Hard disk control register.
C2H - C3H. Input: HD device ID register. Output: Reserved
C4H Hard disk CTC channel 0.
C5H Hard disk CTC channel 1.
C6H Hard disk CTC channel 2.
C7H Hard disk CTC channel 3.
C8H Hard disk data register.
C9H Hard disk error register.
E0H Maskable interupt
E4H Select NMI options/read NMI status
E8H --
E9H ------ RS-232
EAH ------ ports
EBH --
ECH Write = 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) **
F0H Read 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
F1H FDC track register
F2H FDC sector register
F3H FDC data register
F4H Select drive and options
F8H Line printer addres port
    80H  Busy.
    40H  Out of paper
    20H  Unit select
    10H  Fault
FFH Cassette port

-FDC commands via port F0- (Model III only)
00H restore
80H read sector
A0H write normal sector
A1H write read protect sector
C0H read address
D0H reset; puts FDC in mode 1
E0H read track
F0H write track

Table 1:
    Bits   Model III       Video and
    1 0    ROMs Enabled.   Keyboard status.

    0 0    Yes             Model III.
    0 1    No              Model III.
    1 0    No              Model 4. (In)
    1 1    No              Model 4. (Out)


Table 2:
    Bits   Lower 32k       Upper 32K
    6 5 4  RAM             RAM

    0 0 0  Bank 0          Bank 1
    0 1 0  Bank 0          Bank 2
    0 1 1  Bank 0          Bank 3
    1 1 0  Bank 2          Bank 1
    1 1 1  Bank 3          Bank 1


