1 unstable release
| 0.1.1 | Dec 21, 2025 |
|---|
#1465 in Programming languages
83KB
2K
SLoC
kz80_db
A dBASE II clone for the Z80 RetroShield.
This project generates a Z80 ROM that implements a subset of dBASE II, the classic database management system from 1981. It runs on the RetroShield Z80 with SD card storage emulation.
Features
- Authentic dBASE II file format compatibility
- Interactive command-line interface
- SD card storage via I/O port emulation
Commands
| Command | Description |
|---|---|
USE <file> |
Open a database file |
LIST |
Display all records |
DISPLAY |
Show current record in detail |
GO <n> |
Navigate to record n |
SKIP |
Move to next record |
DELETE [n] |
Mark record as deleted |
RECALL [n] |
Unmark deleted record |
PACK |
Permanently remove deleted records |
REPLACE |
Update a field value |
LOCATE |
Search for a record |
COUNT |
Count total records |
CREATE |
Create a new database |
APPEND |
Add a new record |
QUIT |
Exit the program |
Startup File
Like the original dBASE II, kz80_db supports automatic command execution at startup. If a file named STARTUP.CMD exists in the storage directory, its contents will be executed as commands when the program starts.
Example STARTUP.CMD:
USE MYDB
COUNT
This will automatically open the MYDB database and display the record count.
File Extensions
The .DBF extension is automatically appended to database filenames if no extension is provided, matching original dBASE II behavior:
USE MYDBopensMYDB.DBFUSE MYDB.DBFalso opensMYDB.DBF
Building
cargo build --release
./target/release/kz80_db
This generates db.bin, a Z80 ROM image.
Running
Use with the RetroShield emulator:
../emulator/retroshield db.bin
Testing
cargo test
Runs both unit tests and integration tests (requires the emulator).
dBASE II File Format
The implementation uses the authentic dBASE II format:
Header (8 bytes):
- Byte 0: Version (0x02)
- Bytes 1-2: Record count (16-bit LE)
- Bytes 3-6: Last update date
- Byte 7: Record length
Field Descriptors (16 bytes each):
- Bytes 0-10: Field name
- Byte 11: Type (C=Character, N=Numeric)
- Byte 12: Field length
- Terminated by 0x0D
Records:
- First byte: Delete flag (space=active, *=deleted)
- Remaining bytes: Field data (space-padded)
License
BSD 3-Clause. See LICENSE.
Dependencies
~54KB