Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| builderpages:plasmo:tinyz280:cfboot_operation [2024/04/14 08:53] – Revision from 2024-04-14 | builderpages:plasmo:tinyz280:cfboot_operation [2026/06/15 13:14] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | /* Imported from Wayback Machine | ||
| + | | ||
| + | | ||
| + | | ||
| + | */ | ||
| + | |||
| + | ====== Bootstrap from Compact Flash ====== | ||
| + | |||
| + | This is the design description of cold boot software out of a compact flash. | ||
| + | |||
| + | The motivation is two folds. First is cost saving since a set of ROM is not required resulting in smaller pc board and fewer parts. Second is ease of programming that CF can easily reprogrammed in-situ. | ||
| + | |||
| + | ===== Introduction ===== | ||
| + | |||
| + | This concept works the best for processor with 16-bit wide data bus because it matches with CF's native 16-bit data bus. At power up (or when reset button is pressed), a state machine (CFinit) holds the CPU in reset while configure the CF to read the boot sector (first sector of a CF disk). The boot sector contains a cold bootstrap code that copies a CF loader into memory and jump to it. After CF is configured to read the boot sector, the state machine also configure the memory map so memory location 0-0x1FF are mapped to the CF's data register where content of the boot sector will stream out with each CPU read. The state machine then negates CPU RESET and CPU begin fetch instruction starting from location 0. Because the CF data register is basically a 256 words deep FIFO that the cold bootstrap code must be written such that there are no looping. The state machine contains a register that can be cleared by software which will restore the memory map of 0-0x1FF to normal memory. | ||
| + | |||
| + | ===== CFinit State Machine ===== | ||
| + | |||
| + | State Transition: | ||
| + | |||
| + | read CF Status register bit 7 (BSY) & bit 6 (DRDY) until (BSY==0 AND DRDY==1) | ||
| + | |||
| + | Write 0x1 to CF Sector Count register | ||
| + | |||
| + | Write 0x1 to CF Sector register | ||
| + | |||
| + | Write 0x0 to CF Cylinder Low register | ||
| + | |||
| + | Write 0x0 to CF Cylinder High register | ||
| + | |||
| + | Write 0x0 to CF Drive/Head register | ||
| + | |||
| + | Write 0x20 (Read) to CF Command register | ||
| + | |||
| + | Read CF Status register bit 7 (BSY) & bit 3 (DRQ) until (BSY==0 AND DRQ==1) | ||
| + | |||
| + | Remap 0x0 - 0x1FF to CF Data register and Release RESET to Z280 | ||
| + | |||
| + | ===== Memory Map Configuration ===== | ||
| + | |||
| + | ===== Cold Bootstrap Code ===== | ||
| + | |||
| + | This is the code that will be in memory once cold bootstrap is done loading: | ||
| + | |||
| + | <code code> | ||
| + | ; 2/10/2018 | ||
| + | ; copy program in track 0, sector 2 & 3 and run | ||
| + | CFdata | ||
| + | CFerr equ 0C2h ;CF error reg | ||
| + | CFsectcnt | ||
| + | CF07 equ 0C7h ;CF LA0-7 | ||
| + | CF815 equ 0C9h ;CF LA8-15 | ||
| + | CF1623 | ||
| + | CF2427 | ||
| + | CFstat | ||
| + | org 1000h | ||
| + | ; ld sp, | ||
| + | ld d,2 ; points to sector to read | ||
| + | ld hl, | ||
| + | ld c, | ||
| + | moresect: | ||
| + | ld a,1 ; read 1 sector | ||
| + | out (CFsectcnt), | ||
| + | ld a,d ; read sector pointed by reg D | ||
| + | cp 4 ; read sector 2 & 3 only | ||
| + | jp z, | ||
| + | out (CF07), | ||
| + | ; no need to setup track, it is setup by CFinit state machine | ||
| + | ; xor a ; clear reg A | ||
| + | ; out (CF1623), | ||
| + | ; out (CF815),a | ||
| + | ld a,20h ; read sector command | ||
| + | out (CFstat), | ||
| + | readdrq: | ||
| + | in a, | ||
| + | and 8 ; bit 3 is DRQ, wait for it to set | ||
| + | jp z,readdrq | ||
| + | |||
| + | ld b,0h ; sector has 256 16-bit data | ||
| + | db 0edh, | ||
| + | ; inirw ; reg HL and c are already setup at the top | ||
| + | in a, | ||
| + | inc d | ||
| + | jp moresect | ||
| + | </ | ||
| + | |||
| + | This is the [[https:// | ||
