davidgiven / cpm65

CP/M for the 6502
BSD 2-Clause "Simplified" License
267 stars 23 forks source link

Build for Apple II 3.5" as well #85

Open SvOlli opened 8 months ago

SvOlli commented 8 months ago

With the Apple II GS and the Apple II C plus, there are two machines capable of running CP/M 65, but can't due to a different disk format (3.5" instead of 5.25").

(And I'd really like to see CP/M 65 running on my real 2gs instead of just in an emulator.)

davidgiven commented 8 months ago

That's the 800kB format, right? Making a disk image should be easy as IIRC it's just the same as the later Macintosh 800kB format, but they'll need a whole new set of disk access routines and I'm still burnt out from doing the Apple II routines! If you have any pointers to example code that'll help...

polluks commented 1 month ago

SmartPort access it easy:

; Define SmartPort register addresses
SMARTPORT_COMMAND  = $C0E0
SMARTPORT_STATUS   = $C0E1
SMARTPORT_DATA     = $C0E2

; Command definitions
SMARTPORT_CMD_READ = $02
SMARTPORT_CMD_WRITE = $03

; Buffer for data transfer
BUFFER = $8000

; Initialize the SmartPort
INIT_SMARTPORT:
    LDA #$00
    STA SMARTPORT_COMMAND  ; Reset the SmartPort
    RTS
; Send a command to the SmartPort
SEND_COMMAND:
    LDX #$00
    STX SMARTPORT_STATUS   ; Clear status
    LDA #SMARTPORT_CMD_READ ; Load command (change to WRITE for write operation)
    STA SMARTPORT_COMMAND  ; Send command
    RTS
; Read data from the SmartPort
READ_DATA:
    LDY #$00
READ_LOOP:
    LDA SMARTPORT_STATUS
    BPL READ_LOOP         ; Wait until data is ready
    LDA SMARTPORT_DATA    ; Read data byte
    STA BUFFER, Y         ; Store in buffer
    INY
    CPY #$100             ; Assume 256 bytes to read
    BNE READ_LOOP
    RTS

; Write data to the SmartPort
WRITE_DATA:
    LDY #$00
WRITE_LOOP:
    LDA BUFFER, Y         ; Load data byte from buffer
    STA SMARTPORT_DATA    ; Write to SmartPort
    INY
    CPY #$100             ; Assume 256 bytes to write
    BNE WRITE_LOOP
    RTS
SEGStriker commented 3 weeks ago

Any progress? I guess adding more drives support should be easy. For example S6 D2 (5.25"), S5 D1, D2 (3.5"), S7 D1, D2 (HDD or another disk type).

davidgiven commented 3 weeks ago

I haven't actually touched it! Is 800kB disk access always through SmartPort or does it use a software-defined interface like the Apple II interface?

SEGStriker commented 3 weeks ago

The original one is just like Apple II interface, but designed for higher capacity, mostly in ProDOS: https://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Interface%20Cards/Disk%20Drive%20Controllers/Apple%20II%203.5%20Disk%20Controller%20Card/Manuals/Apple%203.5%20Disk%20Controller%20Card%20-%20Owner's%20Guide.pdf

And there are modern implementations like:

https://wiki.reactivemicro.com/Apple_II_3.5_Disk_Controller_Card https://www.bigmessowires.com/yellowstone (not only for FDDs) https://www.a2heaven.com/webshop/resources/pdf_document/18/8f/a.pdf - one of many A2Heaven controllers that supports high-capacity devices, with smartport compatibility

https://en.wikipedia.org/wiki/SuperDrive - It says in 1988 1.44 MB FDDs were introduced for Apple IIe, then in 1991 the controller...