==== Disk System Infomation ==== Date 1998/05/17 Original By goroh Translated to english by sgt. bowhack 1. Start These things are explained in this document -configuration of each disk block -BIOS errors -ports -how to emulate it 2. Disk's configuration Disk System is composed of a group of multiple blocks and data called. Each block's ID is 1 byte at the beginning of each block and describes the block. 2-1. DISK Header Block (BlockID=1) Block that stores attribute Example of disk header(from Dead Zone) ADDRESS 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF ---------------------------------------------------------------------------- 00000000 01 2A 4E 49 4E 54 45 4E 44 4F 2D 48 56 43 2A 01 .*NINTENDO-HVC*. 00000010 47 46 4A 45 00 00 00 01 00 F2 FF FF FF FF FF 62 GFJE............ 00000020 02 27 49 61 00 00 02 00 4C 02 03 00 62 02 27 FF .'Ia....L...b.'. 00000030 FF FF FF FF 00 00 FF 02 -- -- -- -- -- -- -- -- ........ Byte Config ------------------------------------------------------------ (size 1byte) #$01 BlockID (size 14byte) *NINTENDO-HVC* recognition data for Famicom Disk (size 1byte) Maker recognition (size 4byte) Game recognition ID (size 1byte) Game Version Number (size 1byte) Disk side number(0:side-A 1:side-B) (size 1byte) Additional Disk #1 (size 1byte) Additional Disk #2 (size 1byte) Additional Disk #3 (size 1byte) $08 storage (size 30byte) reserved space(DiskBIOS not used) ------------------------------------------------------------ 2-2. File Amount Block (BlockID=2) Block storage number of files that is on the disk Block composition example(from Dead Zone) ADDRESS 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF ---------------------------------------------------------------------------- 00000000 02 08 -- -- -- -- -- -- -- -- -- -- -- -- -- -- .. Bye Config ------------------------------------------------------------ (size 1byte) #$02 BlockID (size 1byte) stores $06 several times ------------------------------------------------------------ 2-3. File Header Block (BlockID=3) Block stores file attributes. Block composition example(from Dead Zone) ADDRESS 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF ---------------------------------------------------------------------------- 00000000 03 00 00 4B 59 4F 44 41 4B 55 2D 00 28 E0 00 02 ...KYODAKU-..... Byte config (size 1byte) #$03 BlockID (size 1byte) file number(DiskBIOS doesn't use this data) (size 1byte) file number 2(DiskBIOS doesn't use this data) (size 8byte) file name(DiskBIOS doesn't use this data) (size 2byte) file storage placement (size 2byte) file size (size 1byte) file type (0:Data 1:Char Data 2:Name Table Data) (DiskBIOS doesn't distinguish between 1 & 2) 2-4. File Data Block (BlockID=4) Block stores data of a file (size 1byte) #$04 BlockID (size -----) File data 3. Position Arrangement Disk Header Block Several file block block ------ repeated several times --------- File header block File data block ------------------------------------------- 4. Disk Errors ERR.01 No disk card ERR.02 No disk power supply ERR.03 Broken prong on disk card ERR.04 Wrong maker ID ERR.05 Wrong game name ERR.06 Wrong version name ERR.07 A,B SIDE ERR.07 Side number wrong ERR.08 Disk #1 wrong(New-‹Sƒ–“‡ used only) ERR.09 Disk #2 wrong ERR.10 Disk #3 wrong ERR.20 ‹–”F screen data differs ERR.21 Disk header block(*NINTENDO-HVC*)part is wrong ERR.22 Disk header block reecognition #$01 isn't read and can ignores ERR.23 File recognition block #$02 can't read for several reasons and can ignores ERR.24 File header block recognition #$03 can't read and can ignore ERR.25 File data block recognition #$04 can't read and can ignore ERR.26 Can't save properly to disk card ERR.27 Block end mark seen and ends prematurely ERR.28,ERR.29 The disk unit and the same period can't take it. ERR.30 Disk card too full to save. ERR.31 Data number of a disk card doesn't match up. 5. DISK SYSTEM controls 4020 -W Timer IRQ Control Register 0 4021 -W Timer IRQ Control Register 1 4022 -W Timer IRQ Control Register 2 4023 -W Timer IRQ Control Register 3 analyzing at present 4024 -W Port Output 4025 -W Control Register Input 4bit eye(look?): Mirror (VRAM A10) 0:LHLH 1:LLHH Timing figure < includes a reading case > A init B motor_on C read_start_mark D IRQ_ENABLE E read_end_mark *1. readdata, 4030's 6bit = 0 *2. readdata, 4030's 5bit = 0 | A | B | C | D || E | 8bit |___|______|___|---||------___| 7bit |___|______|---|---||------___| 6bit |---|------|---|---||---------| 5bit |___|______|___|___||___---___| 3bit |---|------|---|---||---------| 2bit |---|---___|___|___||_________| 1bit |___|------|---|---||------___| Note | | | | || 1 2 | < If it writes it and is in bulk > A init B motor_on C write_start_mark & start write D IRQ_enable E write_end_mark *1. delay, writedata #$00 *2. writedata #$80 *3. writedata, 4030's 6bit = 0 *4. delay | A | B | C | D || E | 8bit |___|______|______|---||------___| 7bit |___|______|___---|---||------___| 6bit |---|------|------|---||---------| 5bit |___|______|______|___||___---___| 3bit |---|------|______|___||______---| 2bit |---|---___|______|___||_________| 1bit |___|------|------|---||------___| Note | | | 1 | 2 || 3 4 | 4026 -W ExPort Output Useful for output of expansion terminal where there's a shutter on the back of the ram card. 4030 R- Disk Status Register 0 -A-B---- Causes an error when A and B are 1 after it calls disk controller's inner info and the disk becomes full. 4031 R- Port Input When data is split data transferred becomes definite from a disk and are crowded while reading this address becomes crowded lu-chin split's it while in bulk 4032 R- Disk Status Register 1 -----PSD Disk unit information D media flag 0: Disk inserted 1: Disk not inserted S ready flag 0: Disk Ready 1: Disk Not Ready P protect flag 0: Write UnProtected 1: Write Protected 4033 ExPort Input B------- B: Disk Battely low 0: OK 1: LOW 4040-407F Wave Table Data 4080 Volume Control register bit TFffffff T: Volume Control Type 0:FadeIn,FadeOut 1:Immediate T=1 's time F:ignore ffffff: Volume 0:min(no sound)..3f:max T=0 's time F: FadeIn/FadeOut 0:FadeOut 1:FadeIn ffffff: FadeIn/FadeOut Speed 0:fast .. 3f:slow 4082 Frequence Control registere(LOW) bit ffffffff: frequence low 4083 Frequence Control registere(High) bit E---ffff E: if 1, Sound output disable ffff: frequence high "Do" sound of the middle of a keyboard becomes f=#096 4084 Efector Control register bit TFffffff T: Efector Control Type 0:FadeIn,FadeOut 1:Immediate T=1 's time F: ignore ffffff: Efector FadeOut Speed T=0 's time F: Efect FadeIn/FadeOut 0:FadeOut 1:FadeIn ffffff: FadeIn/FadeOut Speed 0:fast .. 3f:slow 4085 Efector State Control register bit Svvvvvvv S:keep this Efect Status vvvvvvv: Efect Status 4086 Efector Speed Control register(Low) 4087 Efector Speed COntrol register(High) RSssssss R: Reset S: Max Speed ssssss: Efector Speed 4088 ----ABCD unknown 4089 E------- E: Sound Out Enable/Disable 0:enable 1:disable 6. Cable specs Disk unit cable /~~~~~~~~~~~~\ | 1 3 5 7 9 B| | 2 4 6 8 A C| +------------+ 1:VCC 2:out MOTOR ON $4025's 3bit 3:GND 4:out READ $4025's 2bit 5:in Sense Voltage $4033's 8bit it understands the power situation when the motor is turned on 6:in Read Data[9] $4031 8:in Write Protect $4032's 3bit 9:in MediaSet $4032's 1bit A:out Write DATA $4024 B:out WRITE $4025's 1bit C:in Ready $4032's 2bit Extension cable /~~~~~~~~~~\ | 1 3 5 7 9| | 2 4 6 8 A| +----------+ 1:GND 2:VCC 3:in $4033's 1bit out $4026's 1bit 4:in $4033's 2bit out $4026's 2bit 5:in $4033's 3bit out $4026's 3bit 6:in $4033's 4bit out $4026's 4bit 7:in $4033's 5bit out $4026's 5bit 8:in $4033's 6bit out $4026's 6bit 9:in $4033's 7bit out $4026's 7bit A:NC 7. Emulator correspondence method -Use $6000-$DFFF for RAM -Arrange a pointer to show position of the current data of a disk -For $4025 timing figures, if IRQ occors at a stationary interval, when it does, use a pointer of the current data of a disk of 8 bits to look at the speed of one increment -Output data for the current pointer into $4031 -Using reading and writing of last data of each void block, refer to $4025 's timing figures (you can easily answer to the FDS file like this.) -$4025 's 2 bit shows how to get the beginning for a pointer of a disk, when it works (it returns it first) -$4030 returns a value that doesn't cause an error every time when being crowded when reading. -$4033 's 8bit shows a 0 at all times 7. Final This document shows how to do many things but is hard to understand. Mail me(goroh) for clarification. Again, I can analyze it, until I can read/write a current disk and write and convert it to a usable format that can be announced for a system. (?- Sgt. Bowhack)