I was quite tempted to open another thread for this, so we don't get too out of topic, so if anybody feels this should be done, please feel free to move this message.
I already said I am not a hardware guy, but I work with some hardware people that are used to deal with microcontrollers and such hardware, so I approached one of them and asked about this matter.
His idea (based on what I know and my own vision, which might not be correct) is that it should be possible and "quite easy" to build an emulator of the disk based on a PIC microcontroller. He says there exist modules to connect the PIC to SD cards and USB pendrives and even with LCD displays that could build the part in charge of selecting a disk image.
The PIC code (that could be done in C), should just emulate the behaviour of the controller, reading the values written to page 3 through an input port and outputting data as necessary. Extra I/O lines in ports can be used to generate or read the ROMDIS, MAP, IO, IO CONTROL and IRQ signals. The PIC should just implement some kind of finite state machine emulating the behaviour of the disk drive.
I am talking by memory, so I might be wrong, but I suppose it could be possible to connect the adress/data buses to input/output ports and use the IO CONTROL line to indicate the PIC when it has to read the value in the address bus and act accordingly. For instance, when reading a sector in a microdisk controller, my code (Fabrice's, really) does this:
Code: Select all
read_data
lda $0318
bmi read_data
lda $0313
sta (pbufl),y
iny
bne read_data
inc pbufh
jmp read_data
This is an infinite loop, which is exited with the interrupt service routine that follows:
Code: Select all
irq_handler
.(
bit $030D
bpl fdc_irq
pha ; cancel any VIA interrupt when overlay ram is active
lda #$7F
sta $030D
pla
rti
fdc_irq
pla ; get rid of IRQ context
pla
pla
lda diskcntrl
sta $0314 ; disables disk irq
lda $0310 ; gets status and resets irq
and #$7c
sta __status
rts
.)
Ok, this is all quite complicated, and might be wrong (can anybody elighten me?) but this is the most complicated function. However the code must be there in Euphoric, so we might have a reference of how this is done in the FDC part of the emulator.
Unfortunately I was not able to spot the difficulties of such a design, so my colleague could not dig any further. Some difficulties that may exist:
The PIC should be fast enough to put the correct value on the data bus whenever a given address is put in the address bus. Also should be fast enough to read the data bus whenever needed. Is there a need of some kind of fine-timing here?
Are the lines on the Oric side TTL? Any restrictions here?
We need to add the part of the EPROM. Is there any difficulty I don't see here?
This guy told me that there should be no problem reading the dsk file and even keeping a whole sector into the PICs memory.
Anything I could ask/comment?
Cheers