Hi Jeff,
the following program (i8085), which works in Double-Density with 512 Byte sectors with the SD-Emulator.
Code: Select all
; Start the programs at the base of the TPA
.org 0C000H
msize .equ 60 ;size of cp/m in Kbytes
;
;
;SYSTEM EQUATES FOR 1793 CONTROLLER
;
DWAIT .EQU 0C8H ;WAIT FOR DISK PORT
DCOM .EQU 0C0H ;DISK COMMAND PORT
DDATA .EQU 0C3H ;DISK DATA PORT
DSTAT .EQU 0C0H ;DISK STATUS PORT
DSEC .EQU 0C2H ;DISK SECTOR PORT
DTRK .EQU 0C1H ;DISK TRACK PORT
DSEL .EQU 0C4H ;DISK SELECT PORT
RSTCMD .EQU 07H ;Restore Command for 1793 Controller - 07H
RDCMD .EQU 80H ;READ COMMAND FOR 1793 CONTROLLER - 80H
WRTCMD .EQU 0A0H ;WRITE COMMAND FOR 1793 CONTROLLER -0A0H
SEEKCMD .EQU 17H ;SEEK COMMAND FOR 1793 CONTROLLER - 17H
;"bias" is the amount to add to addresses for > 20K
; (referred to as "b" throughout the text)
bias .equ (msize-20)*1024
ccp .equ 3400h+bias
bdos .equ ccp+0800h
bios .equ ccp+1600h
; getsys programs tracks 0 and 1 to memory at 3880h + bias
; register usage
; a (scratch register)
; b track count (0...76)
; c sector count (1...26)
; d,e (scratch register pair)
; h,l load address
; sp set to track address
gstart: ;start of getsys
lxi sp,ccp-0080h ;convenient place
lxi h,ccp-0080h ;set initial load
MVI B,0 ;start with track
MVI C,1 ;start with sector
START: MVI A,00000101B ;SELECT DISK A:, side 0 AT SINGLE DENSITY
OUT DSEL
MVI A,0D0H ;CLEAR ANY PENDING COMMAND
OUT DCOM
NOP ;ALLOW TIME FOR COMMAND SETTLING
NOP
NOP
NOP
HOME:
IN DSTAT ;GET STATUS
RRC
JC HOME ;WAIT FOR NOT BUSY COMPLETION
MVI A,RSTCMD ;ISSUE RESTORE CMND (10 MSEC. STEP RATE)
OUT DCOM
;OUT DWAIT
RDY1: IN DSTAT
ANI 10000001B ;Check for Drive-Ready
JNZ RDY1
CALL ENIRQ ;Call the IRQ settings
;
; begin the load operation
cold:
;lxi b,0001H ;b=Track 0, c=sector 2
mvi d,52 ;sects ;d=# sectors to load
;MVI E,0 ;SIDE-BIT 0=Side 0, 1=Side 1
;lxi h,ccp ;base transfer address
lsect: ;load the next sector
; insert inline code at this point to
; read one 512 byte sector from the
; track given in register b, sector
; given in register c,
; into the address given by <hl>
;branch to location "cold" if a read error occurs
;
MOV A,B ;Setup for Track
OUT DDATA ;Out to DATA register
NOP
NOP
MVI A,SEEKCMD ;
OUT DCOM
OUT DWAIT
NREAD1: IN DSTAT
ANI 00000001B
JNZ NREAD1
MVI A,00000101B
OUT DSEL
NREADY: IN DSTAT
ANI 00000001B ;Check for Drive-Ready
JNZ NREADY
EI
MOV A,C ;SETUP FOR SECTOR
OUT DSEC ;Out to Sector register
NOP
MVI A,WRTCMD ;SETUP READ COMMAND
OUT DCOM
NOP
RLOOP:
OUT DWAIT ;WAIT FOR DISK CONTROLLER
MOV A,M ;MOVE IT INTO MEMORY
OUT DDATA ;GET DATA FROM DISK
INX H ;INCREMENT MEMORY POINTER
JMP RLOOP ;GO GET NEXT BYTE
DI
RDONE: IN DSTAT
ANI 11111111B ;Check for Drive-Ready
JNZ RDONE
;go to next sector if load is incomplete
dcr d ;sects=sects-1
jz ENDE ;boot ;head. for the bios
; more sectors to load
;
;we aren't using a stack, so use <sp> as scratch
;register
; to hold the load address increment
;lxi sp,128 ;128 bytes per
;sector
;dad sp ;<hl> = <hl> + 128
inr c ;sector=sector + 1
mov a,c
cpi 27 ;last sector of
;track?
jc lsect ;no, go read
;another
;end of track, increment to next track
mvi c,1 ;sector = 1
inr b ;track = track + 1
jmp lsect ;for another group
ENIRQ: MVI A,0C3H ;JMP OP-code load in Accumulator
STA 02CH ;Store it in RAM for RST 5.5
PUSH D
PUSH H
LXI D,RDONE ;Fetch adress ao RDONE
XCHG
SHLD 02DH ;Store it in jump vector for RST 5.5
POP H
POP D
MVI A,00001110B ;Int mask for enable RST 5.5
SIM ;enable INT mask
RET
ENDE: RST 0
.end ;of boot loader
Regards, Frank