-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadme.txt
116 lines (105 loc) · 3.88 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
S(ilent)Drive is a CP/M disk drive emulator working over serial port. It needs to include few bytes of code into BIOS of a CP/M machine .
Can be run on host with JAVA 11 and above.
Implements CP/M disk geometry and commands:
home
track
read
write
Directory sectors are marked green. File area sectors are pale red when not in used and dark red when occupied.
- Stores files on host file system. Supports injecting files from input directory
- Displays drive allocation map, directory listing with file sizes
- Contents of DEFAULT directory is injected into CP/M disk on start
- FORMAt clears all contents of CP/M disk
- IMPORT does a one time import of files in IN directory
- Auto import does periodic import of files in IN directory
- DELETE deletes selected files from CP/M disk
- EXPORT saves all files from CP/M disk into host OUT directory
When contents of the CP/M disk is changed independently from CP/M itself, the CP/M must be reinitialised to re-read disk directory.
Bellow are example BIOS routines:
;------------------------------------------------------------------------------
;
; S(ilent) Drive - communicates with virtual drive's host over MUART's serial port
;
;------------------------------------------------------------------------------
;
; Command "R" - read sector
ReadSector: lda seek_disk ; get drive number
ora a ; is it first (virtual)dirve?
jnz read_flp ; no, it is floppy drive
mvi b,'R' ; command read
call SendCmd ; send it
mvi d,128 ; counter
lhld DMAADR ; address to HL
ReadSector2: call ReadByte ; read byte
mov m,a ; store byte
inx h ; increment address
dcr d ; decrement counter
jnz ReadSector2 ; loop
xra a ; flag success
ret ;
;
; Command "W" - write sector
WriteSector: lda seek_disk ; get drive number
ora a ; is it first (virtual)dirve?
jnz write_flp ; no, it is floppy drive
mvi b,'W' ; write command
call SendCmd ; send it
mvi d,128 ; counter
lhld DMAADR ; address to HL
mvi b,0 ; checksum
WriteSector2: mov a,m ; fetch byte from RAM
mov c,a ; move to C
add b ; compute checksum
mov b,a ; move to B
call SendByte ; send byte from C
inx h ; increment address
dcr d ; decrement counter
jnz WriteSector2 ; loop
jmp SendChksum ; send checksum
;
; Send track and sector number
SendSecTrk: mvi c,'T' ; track char
call SendByte ; send byte
lda SEKTRK ; track nr. to A
call SendByteA ; send byte
mvi c,'S' ; sector char
call SendByte ; send byte
lda SEKSEC ; sector nr. to A
jmp SendByteA ; send and return
;
; Send checksum
SendChksum: mov c,b ; get checksum
call SendByte ; send it
call ReadByte ; wait for acknowledge
xri '@' ; check success
ret ; return
;
; Read byte from MUART's serial port
ReadByte: in MUART_ADDR+0Fh ; 8256 status
ani 40h ; char received?
jz ReadByte ; no wait
in MUART_ADDR+07 ; get the char
ret
;
; Send byte from A (or C) over MUART's serial port
SendByteA: mov c,a ; move to C
SendByte: in MUART_ADDR+0Fh ; 8256 status
ani 20h ; out buffer free ?
jz SendByte ; no wait
mov a,c ; char to A
out MUART_ADDR+07 ; send
ret
;
SendCmd: mvi c,':' ; start command sequence
call SendByte ; send start char
mov c,b ; get command
call SendByte ; send command
jmp SendSecTrk ; send rest
;
; for virtual drive just store, floppies need deblocking alg
SETSEC: lda seek_disk ; get drive number
ora a ; is it first (virtual)dirve?
jnz setsec_flp ; no, it is floppy drive
mov a,c ; get lower byte
sta seek_sector ; store sector
ret