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,411 @@
;---------------------------------------------------------------------
; ADLER-P2.A86 version 2.1 for LSI M-FOUR and CAL-PC computers
; 30-NOV-87
; Stephen Hunt
;---------------------------------------------------------------------
;
;
; configure drive C, D or E to Triumph Adler P2 ss dd format.
;
; Will be of no use if 8" floppy drives are fitted.
;
;
;---------------------------------------------------------------------
; prom related equates
label_seg equ 0ffffh ; label segment
label_ofst equ 05h ; label offset
prom_seg equ 0fc00h ; prom segment
get_switch equ 03055h ; get switch function (prom call)
; character equates
cr equ 0dh ; carriage return
lf equ 0ah ; line feed
eof equ 01ah ; end of file
esc equ 01bh ; escape
bit0 equ 00000001b
bit1 equ 00000010b
bit2 equ 00000100b
bit3 equ 00001000b
bit4 equ 00010000b
bit5 equ 00100000b
bit6 equ 01000000b
bit7 equ 10000000b
cpm equ 0e0h
; macro to CALLF to prom (asm86 does not understand 'CALLF SEG:OFST')
codemacro call_prom func_call:dw
db 09ah
dw func_call
dw 0fc00h
endm
;---------------------------------------------------------------------
; CODE SEGMENT
;---------------------------------------------------------------------
cseg
org 0000h
;---------------------------------------------------------------------
; jump past my copywrite message
;---------------------------------------------------------------------
start:
;
jmp check_os
vers db '(C) STEPHEN HUNT 30-NOV-87, Disk Patch Version 2.1',eof
;---------------------------------------------------------------------
; check that the operating system is BDOS version 2.x
;---------------------------------------------------------------------
check_os:
;
mov cl,0ch ; get o/s version number
int cpm
and al,0f0h ; mask of lower nybble
cmp al,020h ; check version 2.x
jz get_machine_type; if ok jump forward
;---------------------------------------------------------------------
; incorrect BDOS version, so print error & terminate
;---------------------------------------------------------------------
wrong_bdos_version:
;
mov dx,offset wrong_version
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; check that the machine is a CAL-PC or LSI-M4
;---------------------------------------------------------------------
get_machine_type:
;
mov ax,label_seg
mov es,ax
mov si,offset m4_label
mov di,label_ofst
mov cx,06h
cld
rep cmpsb
mov bl,00h ; 0 = LSI-M4
jz set_mc_type
mov si,offset cal_label
mov di,label_ofst
mov cx,06h
rep cmpsb
mov bl,01h ; 1 = CAL-PC
jz set_mc_type
mov bl,02h ; 2 = UNKNOWN
;---------------------------------------------------------------------
; print machine type, and exit if not CAL-PC or LSI-M4
;---------------------------------------------------------------------
set_mc_type:
;
mov mc_type,bl
xor bh,bh
add bx,bx
add bx,offset machines
mov dx,[bx]
call print_string
cmp mc_type,02h
jb valid_hware
jmp reset
;---------------------------------------------------------------------
; print signon message
;---------------------------------------------------------------------
valid_hware:
;
mov dx,offset signon
call print_string
;---------------------------------------------------------------------
; get system dip switch setting
;---------------------------------------------------------------------
; settings returned in AL as follows:
;
; bit 0 - double sided drives
; bit 1 - quad density drives
; bit 2 - 8 inch drives
; bit 3 - hard disk present
; bit 4 - 2 floppy drives present (else only 1)
; bit 5 & 6 - hard disk type:
; 0 0 - 5 Mb ST-412 (M4) or Rodime RO201 (CAL)
; 0 1 - 10 Mb Rodime RO202
; 1 0 - 15 Mb Rodime RO203
; 1 1 - 20 Mb Rodime RO204
; bit 7 - half height 5 inch floppy drives fitted
;---------------------------------------------------------------------
get_system_type_switch:
;
call_prom get_switch
mov dip_sw,al
;---------------------------------------------------------------------
; if 8 inch floppy drives fitted print message & exit
;---------------------------------------------------------------------
test_drive_size:
;
test al,bit2 ; test for 8" drives
jz test_number_drives
mov dx,offset eight_inch ; error message
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; test if 1 or 2 floppies, if only 1 drive test also for hard disk
; if 2 drives set drive C, right hand drive
;---------------------------------------------------------------------
test_number_drives:
;
test al,bit4 ; test for 1 or 2 floppy drives
jz test_winchester ; if 1 drive, test for winchester
mov drive,02h ; set initially to drive C:
mov drvpos,01h ; set to right hand drive
jmp test_number_sides
;---------------------------------------------------------------------
; test for hard disk, if no hard disk print message & exit
;---------------------------------------------------------------------
test_winchester:
;
test al,bit3 ; test for winchester
jnz winchester_exists ; if there is a winchester jump forward
mov dx,offset one_drive
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; hard disk present so set to drive D, left hand drive
;---------------------------------------------------------------------
winchester_exists:
;
mov drive,03h ; set initially to drive D:
mov drvpos,0h ; set to left hand drive
;---------------------------------------------------------------------
; if single sided floppy drives, abort with error (see below)
;---------------------------------------------------------------------
; NOTE: There should never be single sided 5.25" drives on the CAL-PC
; or LSI-M4. If the machine is booted from a single sided disk
; with the appropriate dip switch set to single sided drives the
; operating system always display the message:
;
; System not recognised
;
; The machine then halts and has to be reset.
;
; I have encountered the above when using the following versions
; of CP/M :
;
; CP/M-86/80 level 17
; " level 21
; " level 22
; Concurrent CP/M-86/80 vers 2.0 level 1
;
; The program will therefore stop with an error message, simply
; because I don't know how single sided drives are configured.
;---------------------------------------------------------------------
test_number_sides:
test al,bit0 ; test for single or double sided
jnz test_density ; if double sided jump forward
mov dx,offset single_sided
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; if quad density floppy drive, increment the drive reference letter
;---------------------------------------------------------------------
; NOTE: If the disk drive is quad density, the disk is treated as read
; only by the BIOS.
;---------------------------------------------------------------------
;
test_density:
;
test al,bit2 ; test for double or quad density drives
jz select_drive ; if double, jump forward
inc drive ; quad density, so change patch drive
;---------------------------------------------------------------------
; select required drive via a direct bios call,
; returns the following in this configuration:
; ax = dpb offset
; bx = dpe offset
; es = segment address
;---------------------------------------------------------------------
select_drive:
;
mov dx,offset bios_code
mov cl,032h
int cpm
;---------------------------------------------------------------------
; if invalid drive (dpb or dpe = 0), print message and exit
;---------------------------------------------------------------------
test_valid_dpb:
;
test ax,ax
jz drive_select_error
test bx,bx
jnz set_new_format
drive_select_error:
;
mov dx,offset select_error
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; overwrite the old disk parameters with the new parameters
;---------------------------------------------------------------------
set_new_format:
;
mov si,offset new_dpb
mov di,ax
mov cx,24
cld
rep movsb
;---------------------------------------------------------------------
; get & display the drive that has been patched, and to what format
; before terminating
;---------------------------------------------------------------------
finished_message:
;
mov ax,drive
add al,'A'
mov drv_letter,al
mov dx,offset complete
;jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; print message at DX, reset all drives, and exit back to CP/M-86
;---------------------------------------------------------------------
exit_msg:
;
call print_string
reset: ; reset drives even if errors occur
;
mov cl,0dh
int cpm
exit:
;
xor cl,cl
xor dl,dl
int cpm
;---------------------------------------------------------------------
; subroutine: print string at offset DX
;---------------------------------------------------------------------
print_string:
;
mov cl,09h
int cpm
ret
;---------------------------------------------------------------------
; END OF CODE SEGMENT
;---------------------------------------------------------------------
;---------------------------------------------------------------------
; DATA SEGMENT
;---------------------------------------------------------------------
dseg
org 0100h
signon db ' Disk Patch Version 2.1 (C) S.Hunt 30-Nov-87',cr,lf,'$'
complete db cr,lf,'Drive '
drv_letter db 'X'
db ': set to Triumph Adler P2 SS DD format',cr,lf,'$'
machines dw offset m_four
dw offset cal_pc
dw offset unknown
m_four db cr,lf,'LSI M-FOUR$'
cal_pc db cr,lf,'CAL-PC$'
unknown db cr,lf,'Disk Patch only runs on the LSI M-FOUR or CAL-PC$'
wrong_version db cr,lf,'Disk Patch Requires CP/M-86 version 2.x$'
eight_inch db cr,lf,'Aborting - not configured for 8" drives$'
one_drive db cr,lf,'Aborting - not configured for single drive machine$'
single_sided db cr,lf,'Aborting - configuration not known for single sided drives$'
select_error db cr,lf,'Aborting - Unable to access disk parameters$'
dip_sw db 00h ; dip switch setting
mc_type db 02h ; machine type
m4_label db 'Lsi_M4' ; machine label in prom at FFFF:0005
cal_label db 'Cal_PC' ; " " " " " " "
bios_code db 09h ; select drive function
drive dw 00h ; drive code [CX]
dw 00h ; " " [DX]
;---------------------------------------------------------------------
; parameters for Triumph Adler P2 single sided double density format
;---------------------------------------------------------------------
new_dpb dw 32 ; spt
db 3 ; bsh
db 7 ; blm
db 0 ; exm
dw 151 ; dsm
dw 63 ; drm
db 0c0h ; al0
db 0 ; al1
dw 16 ; cks
dw 2 ; off
;---------------------------------------------------------------------
; parameters used by the firmware when accessing the disk controller.
; MUST follow on directly after the Disk Parameter Block.
;---------------------------------------------------------------------
flags db 00h ; parameter flags (initially SS DD)
db 0ah ; number of retries
db 010h ; physical sectors per track
drvpos db 01h ; right hand drive
db 00h ; ? don't know ?
dw 0280h ; total sectors per disk
dw 0100h ; bytes per sector
db 0 ; just padding !!
;---------------------------------------------------------------------
; END OF DATA SEGMENT
;---------------------------------------------------------------------
end
;---------------------------------------------------------------------
; end of Disk Patch v2.10
;---------------------------------------------------------------------


View File

@@ -0,0 +1,419 @@
;---------------------------------------------------------------------
; IBMCPM.A86 version 2.1 for LSI M-FOUR and CAL-PC computers
; 23-MAR-88
; Stephen Hunt
;---------------------------------------------------------------------
;
;
; configure drive C, D or E to IBM CP/M ss dd format.
;
; Will be of no use if 8" floppy drives are fitted.
;
;
;---------------------------------------------------------------------
; prom related equates
label_seg equ 0ffffh ; label segment
label_ofst equ 05h ; label offset
prom_seg equ 0fc00h ; prom segment
get_switch equ 03055h ; get switch function (prom call)
; character equates
cr equ 0dh ; carriage return
lf equ 0ah ; line feed
eof equ 01ah ; end of file
esc equ 01bh ; escape
bit0 equ 00000001b
bit1 equ 00000010b
bit2 equ 00000100b
bit3 equ 00001000b
bit4 equ 00010000b
bit5 equ 00100000b
bit6 equ 01000000b
bit7 equ 10000000b
cpm equ 0e0h
; macro to CALLF to prom (asm86 does not understand 'CALLF SEG:OFST')
codemacro call_prom func_call:dw
db 09ah
dw func_call
dw 0fc00h
endm
;---------------------------------------------------------------------
; CODE SEGMENT
;---------------------------------------------------------------------
cseg
org 0000h
;---------------------------------------------------------------------
; jump past my copywrite message
;---------------------------------------------------------------------
start:
;
jmp check_os
vers db '(C) STEPHEN HUNT 23-MAR-88, Disk Patch Version 2.1',eof
;---------------------------------------------------------------------
; check that the operating system is BDOS version 2.x
;---------------------------------------------------------------------
check_os:
;
mov cl,0ch ; get o/s version number
int cpm
and al,0f0h ; mask of lower nybble
cmp al,020h ; check version 2.x
jz get_machine_type; if ok jump forward
;---------------------------------------------------------------------
; incorrect BDOS version, so print error & terminate
;---------------------------------------------------------------------
wrong_bdos_version:
;
mov dx,offset wrong_version
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; check that the machine is a CAL-PC or LSI-M4
;---------------------------------------------------------------------
get_machine_type:
;
mov ax,label_seg
mov es,ax
mov si,offset m4_label
mov di,label_ofst
mov cx,06h
cld
rep cmpsb
mov bl,00h ; 0 = LSI-M4
jz set_mc_type
mov si,offset cal_label
mov di,label_ofst
mov cx,06h
rep cmpsb
mov bl,01h ; 1 = CAL-PC
jz set_mc_type
mov bl,02h ; 2 = UNKNOWN
;---------------------------------------------------------------------
; print machine type, and exit if not CAL-PC or LSI-M4
;---------------------------------------------------------------------
set_mc_type:
;
mov mc_type,bl
xor bh,bh
add bx,bx
add bx,offset machines
mov dx,[bx]
call print_string
cmp mc_type,02h
jb valid_hware
jmp reset
;---------------------------------------------------------------------
; print signon message
;---------------------------------------------------------------------
valid_hware:
;
mov dx,offset signon
call print_string
;---------------------------------------------------------------------
; get system dip switch setting
;---------------------------------------------------------------------
; settings returned in AL as follows:
;
; bit 0 - double sided drives
; bit 1 - quad density drives
; bit 2 - 8 inch drives
; bit 3 - hard disk present
; bit 4 - 2 floppy drives present (else only 1)
; bit 5 & 6 - hard disk type:
; 0 0 - 5 Mb ST-412 (M4) or Rodime RO201 (CAL)
; 0 1 - 10 Mb Rodime RO202
; 1 0 - 15 Mb Rodime RO203
; 1 1 - 20 Mb Rodime RO204
; bit 7 - half height 5 inch floppy drives fitted
;---------------------------------------------------------------------
get_system_type_switch:
;
call_prom get_switch
mov dip_sw,al
;---------------------------------------------------------------------
; if 8 inch floppy drives fitted print message & exit
;---------------------------------------------------------------------
test_drive_size:
;
test al,bit2 ; test for 8" drives
jz test_number_drives
mov dx,offset eight_inch ; error message
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; test if 1 or 2 floppies, if only 1 drive test also for hard disk
; if 2 drives set drive C, right hand drive
;---------------------------------------------------------------------
test_number_drives:
;
test al,bit4 ; test for 1 or 2 floppy drives
jz test_winchester ; if 1 drive, test for winchester
mov drive,02h ; set initially to drive C:
mov drvpos,01h ; set to right hand drive
jmp test_number_sides
;---------------------------------------------------------------------
; test for hard disk, if no hard disk print message & exit
;---------------------------------------------------------------------
test_winchester:
;
test al,bit3 ; test for winchester
jnz winchester_exists ; if there is a winchester jump forward
mov dx,offset one_drive
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; hard disk present so set to drive D, left hand drive
;---------------------------------------------------------------------
winchester_exists:
;
mov drive,03h ; set initially to drive D:
mov drvpos,0h ; set to left hand drive
;---------------------------------------------------------------------
; if single sided floppy drives, abort with error (see below)
;---------------------------------------------------------------------
; NOTE: There should never be single sided 5.25" drives on the CAL-PC
; or LSI-M4. If the machine is booted from a single sided disk
; with the appropriate dip switch set to single sided drives the
; operating system always display the message:
;
; System not recognised
;
; The machine then halts and has to be reset.
;
; I have encountered the above when using the following versions
; of CP/M :
;
; CP/M-86/80 level 17
; " level 21
; " level 22
; Concurrent CP/M-86/80 vers 2.0 level 1
;
; The program will therefore stop with an error message, simply
; because I don't know how single sided drives are configured.
;
; 23-03-88 only single sided 8" drives may exists on this system !
;
;---------------------------------------------------------------------
test_number_sides:
test al,bit0 ; test for single or double sided
jnz test_density ; if double sided jump forward
mov dx,offset single_sided
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; if quad density floppy drive, increment the drive reference letter
;---------------------------------------------------------------------
; NOTE: If the disk drive is quad density, the disk is treated as read
; only by the BIOS.
;---------------------------------------------------------------------
;
test_density:
;
test al,bit2 ; test for double or quad density drives
jz select_drive ; if double, jump forward
inc drive ; quad density, so change patch drive
;---------------------------------------------------------------------
; select required drive via a direct bios call,
; returns the following in this configuration:
; ax = dpb offset
; bx = dpe offset
; es = segment address
;---------------------------------------------------------------------
select_drive:
;
mov dx,offset bios_code
mov cl,032h
int cpm
;---------------------------------------------------------------------
; if invalid drive (dpb or dpe = 0), print message and exit
;---------------------------------------------------------------------
test_valid_dpb:
;
test ax,ax
jz drive_select_error
test bx,bx
jnz set_new_format
drive_select_error:
;
mov dx,offset select_error
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; overwrite the old disk parameters with the new parameters
;---------------------------------------------------------------------
set_new_format:
;
mov si,offset new_dpb
mov di,ax
mov cx,24
cld
rep movsb
;---------------------------------------------------------------------
; get & display the drive that has been patched, and to what format
; before terminating
;---------------------------------------------------------------------
finished_message:
;
mov ax,drive
add al,'A'
mov drv_letter,al
mov dx,offset complete
;jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; print message at DX, reset all drives, and exit back to CP/M-86
;---------------------------------------------------------------------
exit_msg:
;
call print_string
reset: ; reset drives even if errors occur
;
mov cl,0dh
int cpm
exit:
;
xor cl,cl
xor dl,dl
int cpm
;---------------------------------------------------------------------
; subroutine: print string at offset DX
;---------------------------------------------------------------------
print_string:
;
mov cl,09h
int cpm
ret
;---------------------------------------------------------------------
; END OF CODE SEGMENT
;---------------------------------------------------------------------
;---------------------------------------------------------------------
; DATA SEGMENT
;---------------------------------------------------------------------
dseg
org 0100h
signon db ' Disk Patch Version 2.1 (C) S.Hunt 23-Mar-88',cr,lf,'$'
complete db cr,lf,'Drive '
drv_letter db 'X'
db ': set to IBM CP/M SS DD format',cr,lf,'$'
machines dw offset m_four
dw offset cal_pc
dw offset unknown
m_four db cr,lf,'LSI M-FOUR$'
cal_pc db cr,lf,'CAL-PC$'
unknown db cr,lf,'Disk Patch only runs on the LSI M-FOUR or CAL-PC$'
wrong_version db cr,lf,'Disk Patch Requires CP/M-86 version 2.x$'
eight_inch db cr,lf,'Aborting - not configured for 8" drives$'
one_drive db cr,lf,'Aborting - not configured for single drive machine$'
single_sided db cr,lf,'Aborting - configuration not known for single sided drives$'
select_error db cr,lf,'Aborting - Unable to access disk parameters$'
dip_sw db 00h ; dip switch setting
mc_type db 02h ; machine type
m4_label db 'Lsi_M4' ; machine label in prom at FFFF:0005
cal_label db 'Cal_PC' ; " " " " " " "
bios_code db 09h ; select drive function
drive dw 00h ; drive code [CX]
dw 00h ; " " [DX]
;---------------------------------------------------------------------
; parameters for IBM CP/M single sided double density format.
;
; NOTE: each track has 8 x 512 byte sectors. However, this system
; expects each sector to be 128 bytes long. So as far as this system
; is concerned, each track has 32 x 128 byte sectors per track.
; (i.e 8 x 512 = 32 x 128)
;---------------------------------------------------------------------
new_dpb dw 020h ; spt
db 03h ; bsh
db 07h ; blm
db 0h ; exm
dw 09bh ; dsm
dw 03fh ; drm
db 0c0h ; al0
db 0h ; al1
dw 010h ; cks
dw 01h ; off
;---------------------------------------------------------------------
; parameters used by the firmware when accessing the disk controller.
; MUST follow on directly after the Disk Parameter Block.
;---------------------------------------------------------------------
flags db 00h ; parameter flags (initially SS DD)
db 0ah ; number of retries
db 08h ; physical sectors per track
drvpos db 01h ; right hand drive
db 00h ; ? don't know ?
dw 320 ; total sectors per disk
dw 512 ; bytes per sector
db 0 ; just padding !!
;---------------------------------------------------------------------
; END OF DATA SEGMENT
;---------------------------------------------------------------------
end
;---------------------------------------------------------------------
; end of Disk Patch v2.10
;---------------------------------------------------------------------


View File

@@ -0,0 +1,237 @@
;---------------------------------------------------------------------
; LOADCPM.ASM (FOR CAL-PC MSDOS 2.11 - ASSEMBLE USING A86.COM)
; 28-10-88
; STEPHEN HUNT
;---------------------------------------------------------------------
; 28-12-89
; Modified to attempt to open the CPM.SYS file in the root directory
; if it could not be found in the current directory
;---------------------------------------------------------------------
;
cr equ 0dh ; carriage return
lf equ 0ah ; line feed
eof equ 01ah ; end of file marker
;
dos equ 21h
;
;---------------------------------------------------------------------
; jump to start of code
;---------------------------------------------------------------------
;
loadcpm:
;
jmp start
;
db 'LOADCPM version 1.1 Copyright (C) Stephen Hunt'
db eof
;
;---------------------------------------------------------------------
; tell 'em what were up to
;---------------------------------------------------------------------
;
start:
;
mov dx,offset loading
call print_string
;
;---------------------------------------------------------------------
; open the CPM.SYS file
;---------------------------------------------------------------------
;
mov dx,offset cpm_sys+1 ; assume 'CPM.SYS'
call open_cpm ; open file
jnc read_cpm_sys ; ok - continue
;
mov dx,offset cpm_sys ; assume '\CPM.SYS'
call open_cpm ; open file
jnc read_cpm_sys ; ok - continue
;
mov dx,offset err_open ; 'cannot find CPM.SYS'
jmp error_exit ; exit with error
;---------------------------------------------------------------------
; read the CPM.SYS file (upto 32k bytes, usually only 16k bytes)
;---------------------------------------------------------------------
;
read_cpm_sys:
;
mov bx,word ptr cpm_hnd
mov dx,offset cpm_buf
mov cx,32768
mov ah,03fh
int dos ; read 32768 bytes of CPM.SYS
;
mov word ptr cpm_siz,ax ; store number of bytes read
;
pushf ; save read error status
call closecpm ; close CPM.SYS file
popf ; restore read error status
;
jnc check_header ; continue if read successful
;
mov dx,offset err_read ; 'error reading CPM.SYS'
jmp error_exit ; exit with error
;---------------------------------------------------------------------
; check that the CPM.SYS header record is valid
;---------------------------------------------------------------------
;
check_header:
;
cmp word ptr cpm_siz,0 ; q. was anything read ?
jz check_header_err ; no - error
;
mov si,offset cpm_buf
cmp byte ptr 0[si],1 ; q. code segment group type present ?
jnz check_header_err ; no - error
;
mov ax,word ptr 1[si] ; get group length in paragraphs
mov dx,010h
mul dx ; convert to length in bytes
mov word ptr cpm_len,ax ; and store it
;
mov bx,word ptr cpm_siz
cmp bx,ax ; q. file size greater than code length ?
jb check_header_err ; no - error
;
sub bx,080h ; subtract length of header record
sub bx,ax ; then the code length
cmp bx,080h ; q. (file size less header) more than
; ; 128 bytes larger than code length ?
jae check_header_err ; yes - error
;
cmp word ptr 3[si],0 ; q. base segment defined ?
jz check_header_err ; no - error
;
mov ax,word ptr 1[si]
cmp ax,word ptr 5[si] ; q. code length equal minimum length ?
jnz check_header_err ; no - error
;
cmp word ptr 7[si],0 ; q. maximum length defined ?
jnz check_header_err ; yes - error
;
add si,9 ; point to next group descriptor
mov cx,128 -9
cld
;
check_header_loop:
;
cmp byte ptr 0[si],0 ; q. any more descriptors defined ?
jnz check_header_err ; yes - error
loop check_header_loop ; loop until finished
;
jmp reset_int3 ; reset int 3 vector
;
check_header_err:
;
mov dx,offset err_head ; 'invalid CPM.SYS header'
jmp error_exit ; exit with error
;---------------------------------------------------------------------
; reset interrupt 3 to use the prom interrupt 3 routine (FC00:32BE).
;---------------------------------------------------------------------
;
reset_int3:
;
push ds
mov dx,0fc00h ; segment FC00h
mov ds,dx
mov dx,032beh ; offset 32BEh
mov al,3
mov ah,025h
int dos ; reset int 3
pop ds
;---------------------------------------------------------------------
; relocate cpm image, set segment registers and jump to it.
;---------------------------------------------------------------------
;
move_cpm:
;
mov ax,word ptr cpm_buf +3
mov es,ax ; es points to cpm segment
;
mov si,offset cpm_buf +080h
xor di,di ; set source + destination pointers
;
mov cx,word ptr cpm_len ; set length of code to move
;
cld ; clear the direction flag
cli ; plus the interrupt flag
;
rep movsb ; move it !!!!
;
mov ds,ax
push ax ; push cpm segment address on stack
mov ax,02500h
push ax ; push bios cold boot address on stack
;
retf ; return far to CPM-86 !!!
;---------------------------------------------------------------------
; Subroutines
;---------------------------------------------------------------------
; Open CPM.SYS file
;---------------------------------------------------------------------
;
open_cpm:
;
xor al,al
mov ah,03dh
int dos ; open CPM.SYS file
mov word ptr cpm_hnd,ax ; save file handle
;
ret
;---------------------------------------------------------------------
; Close CPM.SYS file
;---------------------------------------------------------------------
;
close_cpm:
;
mov bx,word ptr cpm_hnd
mov ah,03eh
int dos ; close CPM.SYS file
;
ret
;---------------------------------------------------------------------
; print string at offset dx
;---------------------------------------------------------------------
;
print_string:
;
mov ah,09h
int dos ; print string
;
ret
;---------------------------------------------------------------------
; print string and exit
;---------------------------------------------------------------------
;
error_exit:
;
call print_string
mov ah,04ch
xor al,al
int dos ; return to dos
;
;---------------------------------------------------------------------
; data
;---------------------------------------------------------------------
;
loading db cr,lf,'Loading CP/M-86 $'
;
err_open db cr,lf,lf,'Unable to open CPM.SYS',cr,lf,'$'
err_read db cr,lf,lf,'Error reading CPM.SYS',cr,lf,'$'
err_head db cr,lf,lf,'Invalid CPM.SYS header',cr,lf,'$'
;
cpm_sys db '\CPM.SYS',0 ; asciiz file name
cpm_hnd dw 0 ; file handle
cpm_siz dw 0 ; file size
cpm_len dw 0 ; code length
;
cpm_buf db 32768 dup (0) ; cpm.sys load buffer
;
db 0 ; spare
;
;---------------------------------------------------------------------
;
;---------------------------------------------------------------------
;
end


View File

@@ -0,0 +1,381 @@
;---------------------------------------------------------------------
; PCW8256.A86 version 2.0 for LSI M-FOUR and CAL-PC computers
; 13-NOV-87
; Stephen Hunt
;---------------------------------------------------------------------
;
;
; configure drive B, C or D to Amstrad PCW8256 ss dd format.
;
; Will only be of use if a 3" drive is fitted as the right
; hand drive on dual floppies machines, or the left hand
; drive drive on hard disk machines.
;
;
;---------------------------------------------------------------------
; prom related equates
label_seg equ 0ffffh ; label segment
label_ofst equ 05h ; label offset
prom_seg equ 0fc00h ; prom segment
get_switch equ 03055h ; get switch function (prom call)
; character equates
cr equ 0dh ; carriage return
lf equ 0ah ; line feed
eof equ 01ah ; end of file
esc equ 01bh ; escape
bit0 equ 00000001b
bit1 equ 00000010b
bit2 equ 00000100b
bit3 equ 00001000b
bit4 equ 00010000b
bit5 equ 00100000b
bit6 equ 01000000b
bit7 equ 10000000b
cpm equ 0e0h
; macro to CALLF to prom (asm86 does not understand 'CALLF SEG:OFST')
codemacro call_prom func_call:dw
db 09ah
dw func_call
dw 0fc00h
endm
;---------------------------------------------------------------------
; CODE SEGMENT
;---------------------------------------------------------------------
cseg
org 0000h
;---------------------------------------------------------------------
; jump past my copywrite message
;---------------------------------------------------------------------
start:
;
jmp check_os
vers db '(C) STEPHEN HUNT 13-NOV-87, Disk Patch Version 2.0',eof
;---------------------------------------------------------------------
; check that the operating system is BDOS version 2.x
;---------------------------------------------------------------------
check_os:
;
mov cl,0ch ; get o/s version number
int cpm
and al,0f0h ; mask of lower nyble
cmp al,020h ; check version 2.x
jz get_machine_type; if ok jump forward
;---------------------------------------------------------------------
; incorrect BDOS version, so print error & terminate
;---------------------------------------------------------------------
wrong_bdos_version:
;
mov dx,offset wrong_version
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; check that the machine is a CAL-PC or LSI-M4
;---------------------------------------------------------------------
get_machine_type:
;
mov ax,label_seg
mov es,ax
mov si,offset m4_label
mov di,label_ofst
mov cx,06h
cld
rep cmpsb
mov bl,00h ; 0 = LSI-M4
jz set_mc_type
mov si,offset cal_label
mov di,label_ofst
mov cx,06h
rep cmpsb
mov bl,01h ; 1 = CAL-PC
jz set_mc_type
mov bl,02h ; 2 = UNKNOWN
;---------------------------------------------------------------------
; print machine type, and exit if not CAL-PC or LSI-M4
;---------------------------------------------------------------------
set_mc_type:
;
mov mc_type,bl
xor bh,bh
add bx,bx
add bx,offset machines
mov dx,[bx]
call print_string
cmp mc_type,02h
jb valid_hware
jmp reset
;---------------------------------------------------------------------
; print signon message
;---------------------------------------------------------------------
valid_hware:
;
mov dx,offset signon
call print_string
;---------------------------------------------------------------------
; get system dip switch setting
;---------------------------------------------------------------------
; settings returnend in AL as follows:
;
; bit 0 - double sided drives
; bit 1 - quad density drives
; bit 2 - 8 inch drives
; bit 3 - hard disk present
; bit 4 - 2 floppy drives present (else only 1)
; bit 5 & 6 - hard disk type:
; 0 0 - 5 Mb ST-412 (M4) or Rodime RO201 (CAL)
; 0 1 - 10 Mb Rodime RO202
; 1 0 - 15 Mb Rodime RO203
; 1 1 - 20 Mb Rodime RO204
; bit 7 - half height 5 inch floppy drives fitted
;---------------------------------------------------------------------
get_system_type_switch:
;
call_prom get_switch
mov dip_sw,al
;---------------------------------------------------------------------
; if 8 inch floppy drives fitted print message & exit
;---------------------------------------------------------------------
test_drive_size:
;
test al,bit2 ; test for 8" drives
jz test_number_drives
mov dx,offset eight_inch ; error message
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; test if 1 or 2 floppies, if only 1 drive test also for hard disk
; if 2 drives set drive C, right hand drive
;---------------------------------------------------------------------
test_number_drives:
;
test al,bit4 ; test for 1 or 2 floppy drives
jz test_winchester ; if 1 drive, test for winchester
mov drive,02h ; set initialy to drive C:
mov drvpos,01h ; set to right hand drive
jmp test_number_sides
;---------------------------------------------------------------------
; test for hard disk, if no hard disk print message & exit
;---------------------------------------------------------------------
test_winchester:
;
test al,bit3 ; test for winchester
jnz winchester_exists ; if there is a winchester jump forward
mov dx,offset one_drive
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; hard disk present so set to drive D, left hand drive
;---------------------------------------------------------------------
winchester_exists:
;
mov drive,03h ; set initialy to drive D:
mov drvpos,0h ; set to left hand drive
;---------------------------------------------------------------------
; if single sided flopy drives, decrement the drive reference letter
;---------------------------------------------------------------------
test_number_sides:
;
test al,bit0 ; test for single or double sided
jnz test_density ; if double sided jump forward
dec drive ; single sided, so change patch drive
;---------------------------------------------------------------------
; if quad density floppy drive, set flag in disk controller parameters
;---------------------------------------------------------------------
test_density:
;
test al,bit2 ; test for double or quad density drives
jz select_drive ; if double, jump forward
or flags,bit4 ; set quad density flag
;---------------------------------------------------------------------
; select required drive via a direct bios call,
; returns the following in this configuration:
; ax = dpb offset
; bx = dpe offset
; es = segment address
;---------------------------------------------------------------------
select_drive:
;
mov dx,offset bios_code
mov cl,032h
int cpm
;---------------------------------------------------------------------
; if invalid drive (dpb or dpe = 0), print message and exit
;---------------------------------------------------------------------
test_valid_dpb:
;
test ax,ax
jz drive_select_error
test bx,bx
jnz set_new_format
drive_select_error:
;
mov dx,offset select_error
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; overwrite the old disk parameters with the new parameters
;---------------------------------------------------------------------
set_new_format:
;
mov si,offset new_dpb
mov di,ax
mov cx,24
cld
rep movsb
;---------------------------------------------------------------------
; get & display the drive that has been patched, and to what format
; before terminating
;---------------------------------------------------------------------
finished_message:
;
mov ax,drive
add al,'A'
mov drv_letter,al
mov dx,offset complete
;jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; print message at DX, reset all drives, and exit back to CP/M-86
;---------------------------------------------------------------------
exit_msg:
;
call print_string
reset: ; reset drives even if errors occur
;
mov cl,0dh
int cpm
exit:
;
xor cl,cl
xor dl,dl
int cpm
;---------------------------------------------------------------------
; subroutine: print string at offset DX
;---------------------------------------------------------------------
print_string:
;
mov cl,09h
int cpm
ret
;---------------------------------------------------------------------
; END OF CODE SEGMENT
;---------------------------------------------------------------------
;---------------------------------------------------------------------
; DATA SEGMENT
;---------------------------------------------------------------------
dseg
org 0100h
signon db ' Disk Patch Version 2.0 (C) S.Hunt 13-Nov-87',cr,lf,'$'
complete db cr,lf
db 'Drive '
drv_letter db 'X'
db ': set to Amstrad PCW SS DD format',cr,lf,'$'
machines dw offset m_four
dw offset cal_pc
dw offset unknown
m_four db cr,lf,'LSI M-FOUR$'
cal_pc db cr,lf,'CAL-PC$'
unknown db cr,lf,'Disk Patch only runs on the LSI M-FOUR or CAL-PC$'
wrong_version db cr,lf,'Disk Patch Requires CP/M-86 version 2.x$'
eight_inch db cr,lf,'Aborting - not configured for 8" drives$'
one_drive db cr,lf,'Aborting - not configured for single drive machine'
select_error db cr,lf,'Aborting - Unable to access disk parameters$'
mc_type db 02h ; machine type
dip_sw db 00h ; dip switch setting
bios_code db 09h ; select drive function
drive dw 00h ; drive code [CX]
dw 00h ; " " [DX]
m4_label db 'Lsi_M4'
cal_label db 'Cal_PC'
; parameters for Amstrad PCW 8256/8512 SS DD drive
new_dpb dw 024h ; spt
db 03h ; bsh
db 07h ; blm
db 0h ; exm
dw 0aeh ; dsm
dw 03fh ; drm
db 0c0h ; al0
db 0 ; al1
dw 010h ; cks
dw 01h ; off
flags db 00h ; parameter flags (initialy SS DD)
db 0ah ; retries
db 09h ; physical sectors / track
drvpos db 01h ; initialy right hand drive
db 00h ; ?
dw 0168h ; total sectors / disk
dw 0200h ; bytes / sector
db 0 ;this byte is of no real use !
;---------------------------------------------------------------------
; END OF DATA SEGMENT
;---------------------------------------------------------------------
end
;---------------------------------------------------------------------
; end of Disk Patch v2.00
;---------------------------------------------------------------------


View File

@@ -0,0 +1,398 @@
;---------------------------------------------------------------------
; SV328.A86 version 2.2 for LSI M-FOUR and CAL-PC computers
; 06-APR-88
; Stephen Hunt
;---------------------------------------------------------------------
;
;
; configure drive C, D or E to Spectravideo SV328 ss sd format.
;
; Will be of no use if 8" floppy drives are fitted.
;
;
;---------------------------------------------------------------------
; prom related equates
label_seg equ 0ffffh ; label segment
label_ofst equ 05h ; label offset
prom_seg equ 0fc00h ; prom segment
get_switch equ 03055h ; get switch function (prom call)
; character equates
cr equ 0dh ; carriage return
lf equ 0ah ; line feed
eof equ 01ah ; end of file
esc equ 01bh ; escape
bit0 equ 00000001b
bit1 equ 00000010b
bit2 equ 00000100b
bit3 equ 00001000b
bit4 equ 00010000b
bit5 equ 00100000b
bit6 equ 01000000b
bit7 equ 10000000b
cpm equ 0e0h
; macro to CALLF to prom (asm86 does not understand 'CALLF SEG:OFST')
codemacro call_prom func_call:dw
db 09ah
dw func_call
dw 0fc00h
endm
;---------------------------------------------------------------------
; CODE SEGMENT
;---------------------------------------------------------------------
cseg
org 0000h
;---------------------------------------------------------------------
; jump past my copywrite message
;---------------------------------------------------------------------
start:
;
jmp check_os
vers db '(C) STEPHEN HUNT 06-APR-88, Disk Patch Version 2.2'
db eof
;---------------------------------------------------------------------
; check that the operating system is BDOS version 2.x
;---------------------------------------------------------------------
check_os:
;
mov cl,0ch ; get o/s version number
int cpm
and al,0f0h ; mask of lower nybble
cmp al,020h ; check version 2.x
jz get_machine_type; if ok jump forward
;---------------------------------------------------------------------
; incorrect BDOS version, so print error & terminate
;---------------------------------------------------------------------
wrong_bdos_version:
;
mov dx,offset wrong_version
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; check that the machine is a CAL-PC or LSI-M4
;---------------------------------------------------------------------
get_machine_type:
;
mov ax,label_seg
mov es,ax
mov si,offset m4_label
mov di,label_ofst
mov cx,06h
cld
rep cmpsb
mov bl,00h ; 0 = LSI-M4
jz set_mc_type
mov si,offset cal_label
mov di,label_ofst
mov cx,06h
rep cmpsb
mov bl,01h ; 1 = CAL-PC
jz set_mc_type
mov bl,02h ; 2 = UNKNOWN
;---------------------------------------------------------------------
; print machine type, and exit if not CAL-PC or LSI-M4
;---------------------------------------------------------------------
set_mc_type:
;
mov mc_type,bl
xor bh,bh
add bx,bx
add bx,offset machines
mov dx,[bx]
call print_string
cmp mc_type,02h
jb valid_hware
jmp reset
;---------------------------------------------------------------------
; print signon message
;---------------------------------------------------------------------
valid_hware:
;
mov dx,offset signon
call print_string
;---------------------------------------------------------------------
; get system dip switch setting
;---------------------------------------------------------------------
; settings returned in AL as follows:
;
; bit 0 - double sided drives
; bit 1 - quad density drives
; bit 2 - 8 inch drives
; bit 3 - hard disk present
; bit 4 - 2 floppy drives present (else only 1)
; bit 5 & 6 - hard disk type:
; 0 0 - 5 Mb ST-412 (M4) or Rodime RO201 (CAL)
; 0 1 - 10 Mb Rodime RO202
; 1 0 - 15 Mb Rodime RO203
; 1 1 - 20 Mb Rodime RO204
; bit 7 - half height 5 inch floppy drives fitted
;---------------------------------------------------------------------
get_system_type_switch:
;
call_prom get_switch
;---------------------------------------------------------------------
; if 8 inch floppy drives fitted abort with error
;---------------------------------------------------------------------
test_drive_size:
;
test al,bit2 ; test for 8" drives
jz test_number_sides
mov dx,offset eight_inch ; error message
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; if single sided floppy drives, abort with error
;---------------------------------------------------------------------
; NOTE: This switch is only set if 8" drives are fitted. If program
; program controls reaches here and it is set - weve goofed !
;
; If a 5.25" system is booted with this switch set, the system
; halts with the message: 'System not recognised'
;---------------------------------------------------------------------
test_number_sides:
test al,bit0 ; test for single or double sided
jnz test_number_drives ; if double sided jump forward
mov dx,offset single_sided
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; test if 1 or 2 floppies, if only 1 drive test also for hard disk
; if 2 drives set drive C, right hand drive
;---------------------------------------------------------------------
test_number_drives:
;
test al,bit4 ; test for 1 or 2 floppy drives
jz test_winchester ; if 1 drive, test for winchester
mov drive,02h ; set initially to drive C:
mov drvpos,01h ; set to right hand drive
jmp test_number_sides
;---------------------------------------------------------------------
; test for hard disk, if no hard disk print message & exit
;---------------------------------------------------------------------
test_winchester:
;
test al,bit3 ; test for winchester
jnz winchester_exists ; if there is a winchester jump forward
mov dx,offset one_drive
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; hard disk present so set to drive D, left hand drive
;---------------------------------------------------------------------
winchester_exists:
;
mov drive,03h ; set initially to drive D:
mov drvpos,0h ; set to left hand drive
;---------------------------------------------------------------------
; if quad density floppy drive, increment the drive reference letter
;---------------------------------------------------------------------
; NOTE: If the disk drive is quad density, the disk is treated as read
; only by the BIOS.
;---------------------------------------------------------------------
;
test_density:
;
test al,bit2 ; test for double or quad density drives
jz select_drive ; if double, jump forward
inc drive ; quad density, so change patch drive
;---------------------------------------------------------------------
; select required drive via a direct bios call,
; returns the following in this configuration:
; ax = dpb offset
; bx = dpe offset
; es = segment address
;---------------------------------------------------------------------
select_drive:
;
mov dx,offset bios_code
mov cl,032h
int cpm
;---------------------------------------------------------------------
; if invalid drive (dpb or dpe = 0), print message and exit
;---------------------------------------------------------------------
test_valid_dpb:
;
test ax,ax
jz drive_select_error
test bx,bx
jnz set_new_format
drive_select_error:
;
mov dx,offset select_error
jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; overwrite the old disk parameters with the new parameters
;---------------------------------------------------------------------
set_new_format:
;
mov si,offset new_dpb
mov di,ax
mov cx,24
cld
rep movsb
;---------------------------------------------------------------------
; get & display the drive that has been patched, and to what format
; before terminating
;---------------------------------------------------------------------
finished_message:
;
mov ax,drive
add al,'A'
mov drv_letter,al
mov dx,offset complete
;jmp exit_msg ; print message & exit
;---------------------------------------------------------------------
; print message at DX, reset all drives, and exit back to CP/M-86
;---------------------------------------------------------------------
exit_msg:
;
call print_string
reset: ; reset drives even if errors occur
;
mov cl,0dh
int cpm
exit:
;
xor cl,cl
xor dl,dl
int cpm
;---------------------------------------------------------------------
; subroutine: print string at offset DX
;---------------------------------------------------------------------
print_string:
;
mov cl,09h
int cpm
ret
;---------------------------------------------------------------------
; END OF CODE SEGMENT
;---------------------------------------------------------------------
;---------------------------------------------------------------------
; DATA SEGMENT
;---------------------------------------------------------------------
dseg
org 0100h
signon db ' Disk Patch Version 2.2 (C) S.Hunt 06-Apr-88',cr,lf,'$'
complete db cr,lf,'Drive '
drv_letter db 'X'
db ': set to Spectravideo SV328 Single Sided '
db 'Single Density format',cr,lf,'$'
machines dw offset m_four
dw offset cal_pc
dw offset unknown
m_four db cr,lf,'LSI M-FOUR$'
cal_pc db cr,lf,'CAL-PC$'
unknown db cr,lf,'Disk Patch only runs on the LSI M-FOUR or CAL-PC$'
wrong_version db cr,lf,'Disk Patch Requires CP/M-86 version 2.x$'
eight_inch db cr,lf,'Aborting - not configured for 8" drives$'
single_sided db cr,lf,'Aborting - not configured for single sided drives$'
one_drive db cr,lf,'Aborting - not configured for single drive machine$'
select_error db cr,lf,'Aborting - Unable to access disk parameters$'
mc_type db 02h ; machine type
m4_label db 'Lsi_M4' ; machine label in prom at FFFF:0005
cal_label db 'Cal_PC' ; " " " " " " "
bios_code db 09h ; select drive function
drive dw 00h ; drive code [CX]
dw 00h ; " " [DX]
;---------------------------------------------------------------------
; parameters for Spectravideo SV328 single sided single density format
;---------------------------------------------------------------------
new_dpb dw 022h ; spt
db 03h ; bsh
db 07h ; blm
db 0h ; exm
dw 09ch ; dsm
dw 03fh ; drm
db 0c0h ; al0
db 0h ; al1
dw 010h ; cks
dw 03h ; off
;---------------------------------------------------------------------
; parameters used by the firmware when accessing the disk controller.
; MUST follow on directly after the Disk Parameter Block.
;---------------------------------------------------------------------
flags db 00h ; parameter flags (initially SS DD)
; should be SS SD but won't work if set
db 0ah ; number of retries
db 011h ; physical sectors per track
drvpos db 01h ; right hand drive
db 00h ; ? don't know ?
dw 0290h ; total sectors per disk (only guesswork ?)
dw 0100h ; bytes per sector
db 0 ; just padding !!
;---------------------------------------------------------------------
; END OF DATA SEGMENT
;---------------------------------------------------------------------
end
;---------------------------------------------------------------------
; end of Disk Patch v2.20
;---------------------------------------------------------------------