MC3 monitor 1.3
This release of my monitor ROM is actually divided into two parts. First there is the regular monitor program that is basically the same monitor 1.1 from before with some minor changes. Prompt remains the same ">". Secondly I have included my quick and dirty file system for the CF-card interface. I call it the Quickfile system. The Quickfile system can be called from the monitor program. The help menu of the monitor showing available commands > H MC3 monitor 1.3 Daniel Tufvesson 2013-2014 G Go (RTI) J Jump to address L Load S19 from console MC Memory change MD Memory dump RR Print contents of stack RS Reset stack pointer RC Change stack CC RA Change stack A RB Change stack B RX Change stack X RP Change stack PC P Select I/O page X Enter extended ROM > Changes to the monitor from 1.1 to 1.3 1. Added OUTS to the jump table. Prints space ($20) and returns. 2. Added PCRLF to the jump table. Prints CRLF ($0D $0A) and returns. 3. X command added. "Enter extended ROM". Jumps to $D000 where the Quickfile system is located. List of externally accessible routines in monitor 1.3 - This is a fixed jump table at beginning of ROM RETURN EQU $C000 RETURN TO MONITOR OUTCHAR EQU $C003 OUTPUT CHAR ON CONSOLE INCHAR EQU $C006 INPUT CHAR FROM CONSOLE AND ECHO PDATA EQU $C009 PRINT TEXT STRING @ X ENDED BY $04 OUTHR EQU $C00C PRINT RIGHT HEX CHAR @ X OUTHL EQU $C00F PRINT LEFT HEX CHAR @ X OUT2HS EQU $C012 PRINT 2 HEX CHARS @ X OUT4HS EQU $C015 PRINT 4 HEX CHARS @ X INHEX EQU $C018 INPUT 1 HEX CHAR TO A. CARRY SET = OK INBYTE EQU $C01B INPUT 1 BYTE TO A. CARRY SET = OK BADDR EQU $C01E INPUT ADDRESS TO X. CARRY SET = OK PCRLF EQU $C021 PRINT CRLF (NEW IN 1.3) OUTS EQU $C024 PRINT SPACE (NEW IN 1.3) The OUTS and PCRLF routines were added to improve compatibility with MIKBUG and EXBUG. Quickfile System - the new stuff After designing the CF-interface I thought for quite a while of implementing FAT or some other established file system but after a while I let that idea go. Most commonly used file systems are designed with a 16-bit or 32-bit CPU in mind and it was complicated for a small 8-bit 6800/6303 with no real benefits. I would not be moving the card to a modern PC for transfer anyway so compatibility was not really an issue and since flash memory today is really cheap I decided to go for a very simple approach. Pressing "X" in the monitor enters the extended ROM that provides the Quickfile menu. The prompt changes to ">>" to indicate extended/Quickfile mode. The Quickfile prompt fills in the full command for each key command. Pressing "H" will print "HELP" and show the available Quickfile commands. HELP - Display the list of available commands >> HELP QUICKFILE 1.0 C - CATALOG S - SAVE L - LOAD R - RUN LOAD D - DELETE N - NAME A - ATTRIBUTE I - INFO F - FORMAT Q - QUIT >> CATALOG - Lists the file catalog >> CATALOG CF-Test v0.1 R W X Hanoi R W X BlackJack R W X RTC watch R W X RTC set R W X Disasm R W X QF-doctor v0.1 R W X S19-export R W X STAR TREK 1.2 R W X Othello R W X Search Memory R W X 6850 Terminal R W X MIKBUG Patcher R W X 6850 Console R W X 6809 Emulator R W X >> Wildcards can be used for all file name lookups. Pressing any key during listing will abort printout. >> CATALOG 68* 6850 Terminal R W X 6850 Console R W X 6809 Emulator R W X >> The right column displays the file attributes R-Read, W-Write and X-Execute. SAVE - Save file to CF given file name, start address and end address >> SAVE Myfile START:0100 END:03FF OK >> LOAD - Load file from CF to memory. R flag must be set for loading. Wildcard can be used for file name. >> LOAD Disasm LOADING 8000-89FF OK >> RUN LOAD - Load file from CF to memory and execute. This command works exactly like LOAD but will execute program after load. Execution starts at load address. R and X flags must be set for loading and executing. DELETE - Delete a file. Wildcard can be used. W flag must be set for deletion. NAME - Change the name of a file ATTRIBUTE - Set or unset file attributes R, W or X. INFO - Display file information >> INFO Disasm NAME ATTR LOAD SIZE Disasm R W X 8000-89FF 0005 >> FORMAT - Erases entire CF and initializes all partitions QUIT - Return to monitor Pressing ESC during command entry will abort and return to prompt. File system details All sectors on the CF-card are addressed using 28-bit LBA which is a quite big number for a small 8-bit system. Therefore I decided to divide the CF-card into partitions of 65536 sectors (16 bits). That would make all partitions 64MB each and addressing data within them would require only 16-bit addressing. The 28-bit LBA could then be interpreted as P:PP:SS:SS where the P:PP equals 12-bit partition address and SS:SS equals 16-bit sector address. The first sector of every partition contains partition information. The easiest file system I could think of was to place one file in each partition. It's a lot of wasted space but using a 8GB or 16GB CF-card a small system as this one leaves oceans of space anyway. Partition header (12 Bytes) - 1st sector of every partition FSID RMB 4 ID FOR PARTITION TYPE - "MCFS" (Micro Computer File System) FSVER RMB 1 VERSION - RIGHT NOW ONLY $01 EXISTS FSSTART RMB 4 LBA OF PARTITION START - $0xxx0000 FSSIZE RMB 2 PARTITION SIZE - ALWAYS $FFFF FSPTYPE RMB 1 PARTITION TYPE - $00=EMPTY/UNUSED, $01=QUICKFILE Quickfile header (38 Bytes) - Follows directly after partition header for every Quickfile partition QFTYPE RMB 1 QUICKFILE TYPE - $01=STD/VERSION1 QFSIZE RMB 2 QUICKFILE SIZE IN BLOCKS/SECTORS QFNAME RMB 24 QUICKFILE NAME QFDATE RMB 7 QUICKFILE ISO DATE - BCD: YYYYMMDDHHMMSS QFATTR RMB 1 QUICKFILE ATTRIBUTES - SEE BELOW QFLOAD RMB 2 QUICKFILE LOAD ADDRESS - DEFAULT $0100 QFPREL RMB 1 QUICKFILE PRELOAD BLOCKS - SEE BELOW QFATTR - bit field for file attributes BIT 0 - Readable BIT 1 - Writeable BIT 2 - Executable BIT 3 to 7 - Unused (set to 0) QFPREL - preload bytes The number of bytes to load when loading or executing file. Used to limit the amount of data loaded initially. For small files this value is normally set to the same value as file length. Large files may contain data after the executable portion of the file that can be accessed by the program itself after execution. I have not yet used the ISO date field but thought it would be a good idea to plan ahead. Summary and source code The Quickfile system is definitely not the quickest or most effective file system available but it is simple and reliable. Implementing something similar for other 8-bit systems should be relatively easy. The partition header leaves room for other partition types so expanding this with more advanced functions is possible. The code is divided into two files. I wanted to keep the monitor separate. Updating the extended ROM / Quickfile is possible while keeping the monitor part of the ROM identical. Monitor 1.3 - source s19 ($C000 - $C703) Quickfile 1.0 - source s19 ($D000 - $DA3C)

Write a comment

Name or handle

E-mail (optional and not visible to others)

Comment


Code from above