Создать ответ 
 
Рейтинг темы:
  • Голосов: 0 - Средняя оценка: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Question about reading and writing data with sd card
Автор Сообщение
kof888 Не на форуме
Продвинутый
***

Сообщений: 189
Зарегистрирован: 29.06.2009
Рейтинг: 5
Сказал спасибо: 8
Поблагодарили 61 раз(а) в 27 сообщ.
Сообщение: #1
Шокирован Question about reading and writing data with sd card
HI, megavolt85 swat, some time ago I passed this post

https://segaxtreme.net/threads/sdloader-...ves.25275/


Learn about using SD cards on the sega Saturn(Thanks to Murzik for writing)

Now I feel that I have almost mastered it, Big Grin

so I started to play with the SD card of DC again.

After learning the source code of DreamShell, I finally finished writing a small program, which can be executed directly from the application file manager, or can also be made into a cdi format run

The function of this program is very simple, it will detect the SD card, if the detection is passed, it will generate the bios (DC_BIOS.BIN) and flash (DC_FLASH.BIN) files of your dreamcast host on the root directory of the SD card.

Because I wrote the assembly directly, the file is not big, 5kb after decompressionBig Grin
In order to reduce the complexity of the program, I do not consider cards smaller than 4G, so this program only supports SD TF cards greater than or equal to 4G

(Thanks to megavolt85 swat Murzik, and everyone who contributed to DreamShell)

[Изображение: 92_12451_a1880491d539d4e.jpg]


I encountered some problems in the process of writing the program, so I would like to ask for advice

1 If you use the SD card on the DC, you will use the spi mode like Saturn, right?
If yes, by looking at the data, the CRC check digit of the SPI mode command (command) is not needed
(Only need 0x95 of CMD0 and 0x87 of CMD8, others can be directly replaced by 1)


So the first question is, if the sd card is used on the dc, does the CRC check digit of the command (command) have to be calculated and filled in?
(I found that the source code of DreamShell has been calculated and used, but in the program I wrote myself, I have not used it, but it is normal after testing)



2 In my program, I don't use the cache, but the source code of DreamShell uses the pref instruction to transfer data to the cache when writing data to the SD card. Does using the cache improve the writing speed? (Because I tested it myself, using the pref command did not increase the speed, but the speed decreased. Is the way I used it wrong?
Код:
sub_cache:
        add        r4, r5             r4 = memory address (32-byte alignment)
        mov        #0xe0, r0          r5 = 0x200
        and        r0, r4
loc_cache_1:
        pref       @r4
        cmp/hs     r4, r5
        bt/s       loc_cache_1
        add        #0x20, r4
        rts
        nop


3 In the source code of DreamShell, 5 nop idle cycles are added to most instructions of the sd card. Is it to consider the compatibility of some SD cards?
(In my sd cards and tf cards, I have tested that if the 5 nop idle cycles are removed, there will be no error. Maybe I missed something?



4 The last question, why can't I go back to the application file manager after executing my program from the application file managerBig Grin


There are a lot of questions, thank you for your reply~


please forget my bad language, i don't know english, i use google translate


This program has passed the test in the following tf sd card
[Изображение: 92_12451_a07bcde3ba40da2.jpg]








This program failed the test in the following tf sd cards
The reason why the 2 TF cards failed the test was that they were smaller than 4G

But this 16G Toshiba sd card failed the test, which is more interesting, because even if I copy the ds folder in, start the DreamShell image with gdemu after booting, it still prompts that the SD card is not found

but this card directly uses GDEMU to play games. Normal, I guess this kind of card does not support spi mode?
[Изображение: 92_12451_98fc2a8d6a0b0b1.jpg]


Прикрепления
.zip  sd1.zip (Размер: 2.91 Кб / Загрузок: 2)
(Последний раз сообщение было отредактировано 30.12.2022 в 08:03, отредактировал пользователь kof888.)
30.12.2022 06:59
Найти все сообщения Цитировать это сообщение
Создать ответ 


Сообщения в этой теме
Question about reading and writing data with sd card - kof888 - 30.12.2022 06:59

Похожие темы
Тема: Автор Ответов: Просмотров: Посл. сообщение
Улыбка A few questions about using sd card kof888 5 5064 03.03.2022 12:46
Посл. сообщение: fafadou
  SD Card Адаптор для Dreamcast и запуск игр. ands 51 206289 09.04.2017 04:47
Посл. сообщение: SILENT_Pavel
  SD card mod Dreamcast. Какую флешку лучше использовать? DreamcastFANpro 18 60753 24.09.2016 08:05
Посл. сообщение: SWAT
  Проблемы с SD card DreamcastFANpro 44 112014 13.09.2016 19:50
Посл. сообщение: ands

Переход:


Пользователи просматривают эту тему: 1 Гость(ей)