Digital Research
This commit is contained in:
2020-11-06 18:50:37 +01:00
parent 621ed8ccaf
commit 31738079c4
8481 changed files with 1888323 additions and 0 deletions

View File

@@ -0,0 +1,225 @@
M4_LBL_SEG EQU 0FFFFH
M4_LBL_OFST EQU 05H
M4_PROM_VER EQU 03FFFH
M4_PROM_SEG EQU 0FC00H
; LSI-M4 & CAL-PC prom calls (relative to M4_PROM_SEG)
BOOT EQU 03000H
SIO_IN EQU 03005H
SIO_OUT EQU 0300AH
SIO_IN_STAT EQU 0300FH
SIO_OUT_STAT EQU 03014H
PRNTR_STAT EQU 03019H
PRNTR_OUT EQU 0301EH
FLOP_SET EQU 03023H
FLOP_ALL EQU 03028H
FLOP_START EQU 0302DH
FLOP_CONT EQU 03032H
FLOP_ABORT EQU 03037H
HDSK_ALL EQU 0303CH
HDSK_START EQU 03041H
HDSK_CONT EQU 03046H
HDSK_ABORT EQU 0304BH
HDSK_SIZE EQU 03050H
GET_SWITCH EQU 03055H
CPM EQU 0E0H
CODEMACRO CALL_PROM FUNC_CALL:DW
DB 09AH
DW FUNC_CALL
DW 0FC00H
ENDM
; LSI-M4 & CAL-PC I/O port definitions
; DMA controller (i8237-2) ports
DMAC_BADD0 EQU 00H ;Channel 0 - base & current address (write)
DMAC_CADD0 EQU 00H ; " " - current address (read)
DMAC_BCNT0 EQU 01H ; " " - base & current word count (write)
DMAC_CCNT0 EQU 01H ; " " - current word count (read)
DMAC_BADD1 EQU 02H ;Channel 1 - base & current address (write)
DMAC_CADD1 EQU 02H ; " " - current address (read)
DMAC_BCNT1 EQU 03H ; " " - base & current word count (write)
DMAC_CCNT1 EQU 03H ; " " - current word count (read)
DMAC_BADD2 EQU 04H ;Channel 2 - base & current address (write)
DMAC_CADD2 EQU 04H ; " " - current address (read)
DMAC_BCNT2 EQU 05H ; " " - base & current word count (write)
DMAC_CCNT2 EQU 05H ; " " - current word count (read)
DMAC_BADD3 EQU 06H ;Channel 3 - base & current address (write)
DMAC_CADD3 EQU 06H ; " " - current address (read)
DMAC_BCNT3 EQU 07H ; " " - base & current word count (write)
DMAC_CCNT3 EQU 07H ; " " - current word count (read)
DMAC_STAT EQU 08H ;Status register (read)
DMAC_CMD EQU 08H ;Command register (write)
DMAC_REQ EQU 09H ;Request register (write)
DMAC_MASK_SR EQU 0AH ;Single mask register bit (write)
DMAC_MODE EQU 0BH ;Mode register (write)
DMAC_FLOP EQU 0CH ;Clear byte pointer flip/flop (write)
DMAC_TEMP EQU 0DH ;Temporary register (read)
DMAC_CLR EQU 0DH ;Master clear (write)
DMAC_MASK EQU 0FH ;All mask register bits (write)
; programmable interrupt controller (i8259A) ports
PIC_STAT EQU 010H ;Interrupt request/serviced status
PIC_ICW EQU 010H ;Initialization control words
PIC_IMR EQU 011H ;Interrupt level masks
PIC_OCW EQU 011H ;Operational control words
; DIP switch and diagnostic LED display
DIP_SW EQU 020H ;DIP switch
LED_DSPY EQU 020H ;LED display
; Bank select registers
DMAC_BANK EQU 30H ;general - before seperate ones used
FDC_BANK EQU 31H ;Floppy bank
REFRESH_BANK EQU 30H ;Refresh bank
SIO_BANK EQU 32H ;SIO bank - for networking
WINCH_BANK EQU 33H ;Winchester bank
Z80_BANK EQU 30H ;Z80 bank
; CRT controller
CRT_ADDR EQU 040H ;Address/status register
CRT_STAT EQU 040H
CRT_DATA EQU 041H ;Register file
CRT_CHAR EQU 020H ;Character latch
; Floppy disk controller ports
AUC_CMD EQU 050H ;Floppy disk select/handshake
FDC_CMD EQU 060H ;Command port
FDC_STAT EQU 060H ;Status register
FDC_TRK EQU 061H ;Track register
FDC_SEC EQU 062H ;Sector register
FDC_DATA EQU 063H ;Data register
; Keyboard
KYBD_DATA EQU 051H ;Keyboard data
KYBD_STAT EQU 052H ;Keyboard status
KYBD_CNTL EQU 053H ;Mode control 8255
BUZZER EQU 050H ;Buzzer
; Hard disk registers
ADP_STAT EQU 071H
ADP_CMD EQU 071H
ADP_DIAG EQU 072H
ADP_DATA EQU 073H
; Programmable interval timer (i8253) ports
PIT0_CT0 EQU 080H ;PIT 0, counter 0
PIT0_CT1 EQU 081H ; " 0, " 1
PIT0_CT2 EQU 082H ; " 0, " 2
PIT0_CTL EQU 083H ; " 0, control
PIT1_CT0 EQU 090H ; " 1, counter 0
PIT1_CT1 EQU 091H ; " 1, " 1
PIT1_CT2 EQU 092H ; " 1, " 2
PIT1_CTL EQU 093H ; " 1, control
; Serial input/output (Z80-SIO) ports
SI00A_DATA EQU 0A0H ;SIO 0, channel A, data
SI00A_STAT EQU 0A1H ; " 0, " A, status
SI00A_CNTL EQU 0A1H ; " 0, " A, control
SI00B_DATA EQU 0A2H ;SIO 0, channel B, data
SI00B_STAT EQU 0A3H ; " 0, " B, status
SI00B_CNTL EQU 0A3H ; " 0, " B, control
SI01A_DATA EQU 0B0H ;SIO 1, channel A, data
SI01A_STAT EQU 0B1H ; " 1, " A, status
SI01A_CNTL EQU 0B1H ; " 1, " A, control
SI01B_DATA EQU 0B2H ;SIO 1, channel B, data
SI01B_STAT EQU 0B3H ; " 1, " B, status
SI01B_CNTL EQU 0B3H ; " 1, " B, control
SIO_INT_VEC EQU 0E0H ;Interrupt vector - SIO or DART
; Centronics compatible parallel printer ports
PRT_DATA EQU 0F0H ;Printer data out
PRT_STAT EQU 0F1H ; " status
PRT_CNTL EQU 0F2H ; " control
PRT_MODE EQU 0F3H ; " port mode control
PRT_FLAG EQU PRT_MODE
; LED display constants
led_0 equ 0c0h
led_1 equ 0f9h
led_2 equ 0a4h
led_3 equ 0b0h
led_4 equ 099h
led_5 equ 092h
led_6 equ 082h
led_7 equ 0f8h
led_8 equ 080h
led_9 equ 098h
led_0p equ 040h
led_1p equ 079h
led_2p equ 024h
led_3p equ 030h
led_4p equ 019h
led_5p equ 012h
led_6p equ 002h
led_7p equ 078h
led_8p equ 000h
led_9p equ 018h
; Others
LINE_LENGTH EQU 80 ;Length of CRT character line
CR EQU 13
LF EQU 10
BS EQU 08
ESC EQU 1BH
NULL EQU 0
BELL EQU 7
TAB EQU 9
SPACE EQU 20H
INT3 EQU 0CCH
CNTL_X EQU 'X'-'A'+1
CNTL_Q EQU 'Q'-'A'+1
CNTL_Z EQU 'Z'-'A'+1
CNTL_S EQU 'S'-'A'+1
TRUE EQU -1
FALSE EQU 0
RD_CMD EQU 20H ;Read command for FLOPALL
WR_CMD EQU 50H ;Write with verify
BIT0 EQU 00000001B
BIT1 EQU 00000010B
BIT2 EQU 00000100B
BIT3 EQU 00001000B
BIT4 EQU 00010000B
BIT5 EQU 00100000B
BIT6 EQU 01000000B
BIT7 EQU 10000000B
bit8 equ 0100h
bit9 equ 0200h
bit10 equ 0400h
bit11 equ 0800h
bit12 equ 1000h
bit13 equ 2000h
bit14 equ 4000h
bit15 equ 8000h
JC EQU JB
JNC EQU JNB
JNBE EQU JA
SBC EQU SBB
; End of CALIO.EQU


View File

@@ -0,0 +1,682 @@
FIRMWARE SPECIFICATION 1
The_Firmware_(PROM)_Primatives
All Prom routines are entered via a Far Call (CALLF)
instruction to the required entry point in the prom
jump table. The jump table is located at the start of
the prom at segment address FC00h, offset 3000h.
The disc related routines usually require large
amounts of stack space.
All registers not used for returning results, have
their entry value preserved.
The only re-entrant routines are the get switch
routine and the SIO input/output/status routines (when
called with different port numbers).
.PA
<EFBFBD>
FIRMWARE SPECIFICATION 2
The following is a list of all the PROM calls and
their entry point within the jump table:
Function Entry Action_Performed
BOOT FC00:3000 Bootstrap loader
SIO_IN FC00:3005 Serial Input
SIO_OUT FC00:300A Serial Output
SIO_IN_STAT FC00:300F Serial Input status
SIO_OUT_STAT FC00:3014 Serial Output status
PRNTR_ST FC00:3019 Printer status
PRNTR_OUT FC00:301E Printer output
FLOP_SET FC00:3023 Floppy initialisation
FLOP_ALL FC00:3028 Floppy perform activity
FLOP_START FC00:302D Floppy start activity
FLOP_CONT FC00:3032 Floppy continue activity
FLOP_ABORT FC00:3037 Floppy abort activity
HDSK_ALL FC00:303C Hard disc perform activity
HDSK_START FC00:3041 Hard disc start activity
HDSK_CONT FC00:3046 Hard disc continue activity
HDSK_ABORT FC00:304B Hard disc abort activity
HDSK_SIZE FC00:3050 Return size of hard disc
GET_SWITCH FC00:3055 Get system byte
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - INITIALISE 3
BOOT
Bootstrap_Loader
Entry Values : None
Exit Values : None
This is the Prom restart.
It performs a self test and initialises all the
hardware.
All interrupt vectors are set to a dummy routine which
clears the trap-flag and returns.
Sector zero is loaded from floppy or winchester into
memory at address FC00:BC00. If the six bytes from
offset BC02 match 'Lsi_M4' or 'Cal_PC' then a jump is
made to FC00:BC00. Failing that, a boot error message
is displayed, and once a key has been pressed the
process is repeated.
This routine does NOT return.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - SERIAL I/O 4
Serial_I/O_Routines
SIO_IN - Serial Input
SIO_OUT - Serial Output
SIO_IN_STAT - Serial Input status
SIO_OUT_STAT - Serial Output status
Definition_of_M-Four_Logical_Ports
0 = Keyboard and Monitor
1 = RS232 port 1 - DART Channel B
2 = RS232 port 2 - DART Channel A
3 = RS232 port 3 - SIO Channel B
4 = RS422 port - SIO Channel A
Definition_of_Cal-PC_Logical_Ports
0 = Keyboard and Monitor
1 = Keyboard and Monitor
2 = RS232 port 1 - DART Channel A
3 = RS232 port 2 - SIO Channel B
4 = RS422 port - SIO Channel A
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - SERIAL I/O 5
SIO_IN
Serial_Input
Entry Values: DL = logical port number
Exit Values: AL = character
All registers preserved.
This routine waits until a character is available.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - SERIAL I/O 6
SIO_OUT
Serial_Output
Entry Values: AL = character
DL = logical port number
Exit Values: Flags affected
Direction-flag reset if monitor
Escape sequences are handled if monitor port.
If not monitor port, the routine loops until
SIO_OUT_STAT returns ready status, before outputting
the character.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - SERIAL I/O 7
SIO_IN_STAT
Serial_Input_Status
Entry Values: DL = logical port number
Exit Values: NZ - character available
Z - character not available
All registers preserved.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - SERIAL I/O 8
SIO_OUT_STAT
Serial_Output_Status
Entry Values: DL = logical port number
Exit Values: NZ - ready
Z - not ready
All registers preserved.
Port 0 (the monitor) is always ready.
SIO ports are ready if the transmit buffer is not full
and the DSR and CTS inputs are active.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - CENTRONICS PRINTER 9
PRNTR_ST
Printer_Status
Entry Values: None
Exit Values: NZ - centronics port ready
Z - centronics port not ready
All registers preserved.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - CENTRONICS PRINTER 10
PRNTR_OUT
Printer_Output
Entry Values: AL = character to print
Exit Values: None
All registers preserved.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - FLOPPY ROUTINES 11
Floppy_Disc_Routines
FLOP_SET - Floppy initialisation
FLOP_ALL - Floppy perform activity
FLOP_START - Floppy start activity
FLOP_CONT - Floppy continue activity
FLOP_ABORT - Floppy abort activity
Definition_of_Floppy_Disc_Parameters
Floppy_Flag_Byte
Bit 0_-_reset 1_-_set
0 SINGLE SIDED DOUBLE SIDED
1 unused unused
2 unused unused
3 DOUBLE DENSITY SINGLE DENSITY
4 unused DD DISC IN QD DRIVE
5 unused unused
6 unused unused
7 unused unused
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - FLOPPY ROUTINES 12
Definition_of_Floppy_Disc_Parameters_-_continued
Floppy_Command_Byte
Bit Action
7 RECAL
6 WRITE
5 READ
4 VERIFY
3 unused
2 unused
1 unused
0 DRIVE
Valid_Command_Bit_Combinations
Bit 7 6 5 4
0 0 0 0 Status only
1 1 1 1 Uncommitted entry point
1 0 0 0 Recal only
x 0 0 1 Verify
x 0 1 0 Read
x 0 1 1 Unused
x 1 0 0 Write
x 1 0 1 Write + verify
x 1 1 0 Seek
x 1 1 1 NEVER to be used due to
Confusion with seek + recal
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - FLOPPY ROUTINES 13
Definition_of_Floppy_Disc_Parameters_-_continued
Prom_error_codes_returned_in_AL
10 Seek error
20 CRC error in ID
30 Write protected (from FDC)
38 No track zero
40 Record not found
50 Lost data (from FDC)
60 CRC error in data
70 DMA not reached terminal count
80 Prom busy
90 Sector out of range
A0 Bank crossing
B0 Write protected disc
Retry count returned in bits 0, 1, and 2
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - FLOPPY ROUTINES 14
Definition_of_Floppy_Disc_Parameters_-_continued
FD-1793_error_codes_returned_in_AH
Return codes for:
RESTORE, SEEK, STEP IN/OUT
BIT 7 - Drive is not ready
BIT 6 - Drive is write protected
BIT 5 - Head is loaded
BIT 4 - Seek error on desired track
BIT 3 - CRC error in sector ID field
BIT 2 - Read/write head is at track zero
BIT 1 - Index mark has been detected
BIT 0 - Command is in progress
Return codes for:
READ/WRITE SECTOR, READ ADDRESS, READ/WRITE TRACK
BIT 7 - Drive is not ready
BIT 6 - Drive is write protected
BIT 5 - On read record 1 = deleted data mark
0 = data mark
On any write 1 = write fault
BIT 4 - Desired track, sector or side not found
BIT 3 - If bit 4 = 1 - CRC error in ID field
If bit 4 = 0 - CRC error in data field
BIT 2 - Computer not taking data fast enough
BIT 1 - Date available on read operation or
- Data required during write operation
BIT 0 - Command is being executed
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - FLOPPY ROUTINES 15
FLOP_SET
Floppy_initialisation
Entry Values: AL = floppy flag byte
CL = retries (usually 10)
CH = sectors per track
SI = total sectors per disc
B<> <20> byte<74> pe<70> sector
Exit Values: None
All registers preserved.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - FLOPPY ROUTINES 16
FLOP_ALL
Floppy_complete_activity
Entry Values: AL = floppy command byte
CX = number of sectors
DX = logical sector number
BX = buffer address
DS = buffer segment
Exit Values: NZ - activity failed
Z - activity successful
AL = prom error code
AH = FD-1793 status
Perform a complete disc activity.
Register AX plus flags affected.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - FLOPPY ROUTINES 17
FLOP_START
Floppy_start_activity
Entry Values: AL = floppy command byte
CX = number of sectors
DX = logical sector number
BX = buffer address
DS = buffer segment
Exit Values: NZ - activity finished
Z - activity not finished
AL = prom error code
AH = FD-1793 status
Initiate floppy disc activity.
Register AX plus flags affected.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - FLOPPY ROUTINES 18
FLOP_CONT
Floppy_continue_activity
Entry Values: None
Exit Values: NZ - activity finished
Z - activity not finished
AL = prom error code
AH = FD-1793 status
Continue activity initiated by FLOP_START.
This routine may be called at any time after a call to
FLOP_START or FLOP_CONT returned NZ. However the call
is only useful if the controller is ready (i.e
interrupt pending)
Register AX plus flags affected.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - FLOPPY ROUTINES 19
FLOP_ABORT
Floppy_abort_activity
Entry Values: None
Exit Values: None
Aborts any pending floppy disc activity.
All registers preserved.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - HARD DISC ROUTINES 20
Hard_Disc_Routines
HDSK_ALL - Hard disc perform activity
HDSK_START - Hard disc start activity
HDSK_CONT - Hard disc continue activity
HDSK_ABORT - Hard disc abort activity
HDSK_SIZE - Return size of hard disc
Definition_of_Hard_Disc_Parameters
Hard_Disc_Command_Byte
Bit Action
7 RECAL
6 WRITE
5 READ
4 VERIFY
3 CONTROLLER NUMBER
2 CONTROLLER NUMBER
1 UNIT NUMBER
0 UNIT NUMBER
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - HARD DISC ROUTINES 21
Definition_of_Hard_Disc_Parameters_-_continued
Prom_error_codes_returned_in_AL
00-07 No error (or correctable if AH=98H)
08-0F Select error
10-17 Timeout sending command data block
18-1F Timeout waiting for Acknowledge
20-27 Wrong status after end-of-command int
28-2F No message byte
48-4F Error reading Xebec status
68-6F Command or RAM error
70-77 DMA not reached terminal count
78-7F Error successfully read
84 Prom controller busy
88 Controller bit busy
A0 Bank crossing error
Retry count returned in bits 0, 1, and 2.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - HARD DISC ROUTINES 22
Definition_of_Hard_Disc_Parameters_-_continued
Xebec_error_codes_returned_in_AH
00 No error detected
01 No index detected from disc drive
02 No seek complete from disc drive
03 Write fault from disc drive
04 Drive not ready after select
06 Track zero not found
10 ID field read error
11 Uncorrectable data error
12 Address Mark not found
14 Target sector not found
15 Seek error
18 Correctable data error
19 Bad track flag detected
1A Format error
1C Illegal access to alternate track
1D On format alternate track command, the
requested alternate track has already
been assigned as an alternate, or is
flagged a bad track
1E When controller attempted to access an
alternate track from the spared track,
the alternate track was not flagged as an
alternate
1F On a format alternate track command, the
bad track equalled the alternate track
20 Invalid command
21 Illegal disc address
30 Ram diagnostic failure
31 Program memory checksum error
32 ECC diagnostic failure
The above codes may be output with bit 7 set,
indicating the previous command used a logical block
address.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - HARD DISC ROUTINES 23
HDSK_ALL
Hard_disc_complete_activity
Entry Values: AL = command byte
CH:DX = start sector (absolute)
CL = number of sectors (1-256)
DS:BX = buffer start address
CH = bits 5,6,7 are control field
(normally 0, 111 for diag)
AH = user command if bits 7-4 of
AL are clear
DI = supplementary info if bits
7-4 of AL are clear.
bits 0-13 = length of DMA-1
bit 14 set = read cntrlr
bit 15 set = write cntrlr
bites 14/15 clear = no DMA
Exit Values: Z = Ok
NZ = error
AL = error code + retry count
AH = Xebec S1410 status
if error:
CH:DX = bad sector address
Perform a complete disc activity.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - HARD DISC ROUTINES 24
HDSK_START
Hard_disc_start_activity
Entry Values: AL = command byte
CH:DX = start sector (absolute)
CL = number of sectors (1-256)
DS:BX = buffer start address
CH = bits 5,6,7 are control field
(normally 0, 111 for diag)
AH = user command if bits 7-4 of
AL are clear
DI = supplementary info if bits
7-4 of AL are clear.
bits 0-13 = length of DMA-1
bit 14 set = read cntrlr
bit 15 set = write cntrlr
bites 14/15 clear = no DMA
Exit Values: Z = activity not finished
NZ = activity finished
AL = error code + retry count
AH = Xebec S1410 status
if error:
CL:DX = bad sector address
Initiate a hard disc activity.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - HARD DISC ROUTINES 25
HDSK_CONT
Hard_disc_continue_activity
Entry Values: None
Exit Values: Z = activity not finished
NZ = activity finished
AL = error code + retry count
AH = Xebec S1410 status
if error:
CL:DX = bad sector address
Continue hard disc activity.
This may be called any time after the preceding
HDSK_START or HDSK_CONT call gave a zero return.
However the call is only useful if a hard disc
interrupt is pending.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - HARD DISC ROUTINES 26
HDSK_ABORT
Hard_disc_continue_activity
Entry Values: None
Exit Values: None
Aborts any pending hard disc activity.
All registers preserved.
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - HARD DISC ROUTINES 27
HDSK_SIZE
Hard_disc:_return_size_of
Entry Values: None
Exit Values: BX = number of heads
CX = sectors per track
DX = number of cylinders
AX = total sectors on disc
.PA
<EFBFBD>
FIRMWARE SPECIFICATION - SYSTEM SWITCH BYTE 28
Definition_of_System_Switch_Byte
BIT 7 - Half height 5" floppy drives fitted