Enterprise Forever

:UK => Programming => Topic started by: Saint on 2014.May.12. 22:13:53

Title: SD extension
Post by: Saint on 2014.May.12. 22:13:53
I have a question on the driver setup, Zozo. In your driver you have:

Code: [Select]
SPUF:           EQU 01800H
RAMMERET:       EQU 1A00H
RAM_START: EQU 0E000h ;RAM terĂ¼let kezdete
In mine I have:
Code: [Select]
SPUF:           EQU 0x0D00 ;Sector buffer offset
RAMMERET:       EQU 0x0F00 ;Mapped RAM size
RAM_START: EQU 0xF000 ;Start of mapped RAM, initialised to 0
However I'm not sure about SPUF. It seems to be used as an address in the code, not as an offset into the RAM section of the 16K ROM as I expected.

Also, I'm not sure about the amount of RAM free. Am I ok with 4kb-256b, or do I need 8kb?
Title: Re: SD extension
Post by: Zozosoft on 2014.May.12. 22:19:28
SPUF are temporary sector buffer during the partition detection. Currently on Page 0, but later possible to move to another segment.

Currently 4K looks ok. But if possible 8K then better, because both SD device have a similar configuration, more easy to develop.
Title: Re: SD extension
Post by: Saint on 2014.May.12. 22:36:07
Thanks Zozo. I have the driver detecting my card and showing the right number of sectors now, but I only have FAT16 and FAT32 formatted cards and when I try and access F:, I get "Invalid Drive", which I guess is expected as its not FAT12?

What's the best way to get a FAT12 formatted SD card? You cant just format from Win7 to FAT12 any more, FAT16 is the lowest supported.
Title: Re: SD extension
Post by: Zozosoft on 2014.May.12. 22:49:05
Yes currently only FAT12 supported by EXDOS.
Most easy way write out preformated VHD files to the card (I use Winimage 9.0).

Empty VHD files. (http://www.ep128.hu/Emu/Ep_ide_files.rar)
CHD with lot of programs. (http://www.ep128.hu/Emu/Ep_ide192m.rar)

Note: exist a card reader which are can't handle SD cards formated with FAT12.
I have a Hama "19 in 1 USB 2.0", Point of View "ALL-IN-1", Lenovo Thinkpad X60 and X220 built in SD slot, these are working. And have one DeLock, this is not working.

Under the stupid Windows you only see the first partition of the card. I readed somewhere need to modify one bit in the USB card reader driver, then the Windows think it is USB hard drive, then all partitions handled...
Title: Re: SD extension
Post by: Saint on 2014.May.12. 23:26:22
How do you write the disk image? All I can find is "Write Disk" which resizes the image to match my SD card (4gb) and writes this to the card?!

It doesn't seem to want to just write the raw sectors to the disk.

Edit: Never mind! Restore Virtual Hard Disk image is what you need... :)
Title: Re: SD extension
Post by: Saint on 2014.May.12. 23:32:58
Hmm, now the SDEXT detects partitions F:-K:, but doing dir of F: from the EXDOS command interpreter returns "Invalid Drive". Not sure why as it appears to be reading the sectors correctly as it recognises the partitions.

Could be because I have not yet finished writing read CID and OCR, only CSD to return the number of sectors?
Title: Re: SD extension
Post by: Zozosoft on 2014.May.12. 23:49:27
The EXDOS and SDEXT placed to which segments? SDEXT needed to higher segment, because need to detect partitions before the EXDOS ask it.
Title: Re: SD extension
Post by: Saint on 2014.May.12. 23:57:08
The EXDOS and SDEXT placed to which segments? SDEXT needed to higher segment, because need to detect partitions before the EXDOS ask it.

Ah, that will be it. My 4kb RAM segment is mapped to the first page of the flash at the moment so SDEXT is at 40 and EXDOS at 41-42. I'll switch this around so EXDOS is at 40-41 and SDEXT at 42...
Title: Re: SD extension
Post by: Saint on 2014.May.13. 19:48:07
Ok, getting closer. I moved the ROM locations around and wrote the CID and OCR parts of the DISKIO_CTRL, now I get: "Disk operation aborted" when I do :dir f:

Any ideas on what this might be Zozo, before I start checking everything... :)
Title: Re: SD extension
Post by: Zozosoft on 2014.May.13. 20:32:24
Your SD DISKIO send back error bits? If no then for quick try add XOR A at the end (no error).
Currently these not checked, A returned directly to EXDOS :oops:
Title: Re: SD extension
Post by: Zozosoft on 2014.May.13. 20:42:26
SD errors:
SD_NOINIT    db 001h ;card not initialised
SD_VERIFY    db 002h ;verify error
SD_LOSTDATA    db 004h ;data lost during transfer
SD_DSKCHNG    008h ;disk changed
SD_NORECORD    010h ;sector not found
SD_NODISK    020h ;card not inserted
SD_WRPROT    040h ;card write protected
SD_UNKNOWN    080h ;unknow, currently not definied error
Title: Re: SD extension
Post by: Saint on 2014.May.13. 21:20:18
Thanks! I saw that a=0 was no error, but wasn't sure about the flags, as you say they were not checked by your driver, so I have just been returning 0 or FF. I'll look at returning the correct flags for the functions.
Title: Re: SD extension
Post by: Zozosoft on 2014.May.13. 21:30:15
Currently you see directly the returned values (for debugging reason), for example *** Error 64 when the card write protected.
In the next version will be translated these to correct EXDOS/EXOS error numbers, and display the right messages.
Title: Re: SD extension
Post by: Saint on 2014.May.13. 23:00:56
Ok, I had forgotten to save some registers in one of my functions and it was making it return an error, it's now working! :)

I will now be playing some games...