This file requires the I2C driver:
Examples\I2C\Devices\AT24C512drv.fth
Assuming that a single device is used gives a disk size of 64 kbytes.
Disk sectors are referenced by a block number, 0..DISK_SIZE-1.
Other example disk drivers may be found in the folder %FileSysDir%\Drivers.
#64 kb BLOCK_SIZE / equ #SECTORS/DISK \ -- n
Number of sectors per disk.
: show-drive-details \ addr --
Display drive details from given data buffer
: (drive-id) \ -- buff
Allocates a 512 byte structure that includes the disk size in
sectors. For IDE and CompactFlash drives, this word should use
the IDE-ID ($EC) command.
: write-block \ blk# caddr -- flag ; 0=bad
Write the buffer at caddr to the disk sector blk#.
: read-f-block \ blk# caddr -- t/f ; 0=bad
Read the disk sector blk# into the buffer at caddr.
: erase-block \ blk# -- t/f
Erase (set to zero) the given disk block.
: InitDisk \ --
Initialise disk access hardware