+Larry Posted July 18, 2012 Share Posted July 18, 2012 Can anyone clue me in on how to read this string? 128 bytes, I believe. Thanks, Larry Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted July 18, 2012 Share Posted July 18, 2012 (edited) For CF: read the Identify Device buffer using command code $EC. You'll need a 16-bit data register or you can switch the drive to 8-bit PIO mode first. Name starts at word 27, IIRC, so that's byte offset 54 into the buffer. The ASCII bytes for the name are stored in reverse order: 2 , 1, 4, 3, etc, etc. Below are some bits of code from the SIDE driver which do this job. GET_MEDIA_NAME actually pulls the media name from the buffer, puts it some place else, then trims it to a manageable length. .local get_drive_model ; if media is a CF card, show the drive info lda #$80+$20 sta ddevic jsr id2 ; bios_identify_dev bcs cfa_rej jsr get_media_name clc cfa_rej rts .endl ; .local id2 ; get device info (bypasses bank switching) jsr set_internal_buf ; point to internal sector buffer lda #3 ; read full 512 bytes sta slenmsb lda #$EC ; IDENTIFY DEVICE command jmp sector_rw .endl ; .local get_media_name ldx #0 ldy #54 dn1 lda (bufrlo),y sta namebuf+1,x iny lda (bufrlo),y sta namebuf,x iny inx inx cpx #40 bcc dn1 trimsp2 ; get rid of trailing spaces dex bmi trimdone2 lda namebuf,x cmp #32 beq trimsp2 trimdone2 inx lda #0 sta namebuf,x cpx #40 bcc trimdone2 rts .endl ; Unsure what would be different about an SD card: I only use SD cards through an IDE-SD adapter, so the driver protocols are identical there. Edited July 18, 2012 by flashjazzcat 2 Quote Link to comment Share on other sites More sharing options...
+Larry Posted July 18, 2012 Author Share Posted July 18, 2012 Thanks, Jon! -Larry Quote Link to comment Share on other sites More sharing options...
Chilly Willy Posted July 19, 2012 Share Posted July 19, 2012 All the NeoMyth cart menus have SDIO support for SD/SDHC cards. SDIO is using the 4-bit parallel access of the SD card rather than the serial most interfaces use. It's easier to do on "lesser" systems since it just needs GPIO to the SD card. All the NeoMyth menus are open source and found here: http://code.google.com/p/neo-myth-menu/ The N64 menu uses C code everything but the main data transfer loop when reading sectors. The current code can detect and initialize an SD card in less than a second. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.