Development Diary: Development started on ROM and new Bootloader

Development started on ROM and new Bootloader
kveroneau(Game Creator)
March 20, 2017, 2:29 a.m.

Since the recent major update, the entire 65c02 Virtual Machine has been overhauled and no longer supports a fake virtual file system. Instead, there is now a realistic block device available to all VMs. Since the original code was highly dependent on a fake file system for many operations, some of the 65c02 code now needs to be updated to support block devices.

Today, I made a few bug fixes to the 65c02 VM, and actually tested the block storage device. I am happy to say, that my initial tests proved successful. I started work on a simple disk ROM, which essentially just loads the first block from the block device into memory and JMPs to it. The bootloader which was loaded from the first block then looks at the file system meta data in block 1, and looks for KERNEL.SYS, and once found, loads it into memory, and JMPs to it. So far, this has worked perfectly. Each stage of the new block device boot process appears to be working as expected. Here is some output from the hexdump Linux command of the VMs raw memory:

00000200  a9 08 8d 8b ff a9 00 8d  8a ff 8d 8c ff 8d 8d ff  |................|
00000210  a9 01 8d 8e ff 4c 00 08  00 00 00 00 00 00 00 00  |.....L..........|
00000220  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000800  80 0b 4b 45 52 4e 45 4c  2e 53 59 53 00 a9 f5 8d  |..KERNEL.SYS....|
00000810  8b ff a9 01 8d 8c ff 8d  8e ff a9 08 85 fb a9 02  |................|
00000820  85 fa a9 f5 85 fd a9 01  85 fc a0 00 b1 fa 85 ff  |................|
00000830  b1 fc c5 ff d0 09 c8 a9  00 c5 ff d0 ef 80 0b a9  |................|
00000840  21 8d d0 ff a9 0a 8d d0  ff 00 b1 fc 8d 8c ff a9  |!...............|
00000850  f0 8d 8b ff a9 01 8d 8e  ff 00 00 00 00 00 00 00  |................|
00000860  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
0000f000  a9 fe 85 71 a9 00 85 70  a9 1f 85 f0 a0 00 b1 f0  |...q...p........|
0000f010  f0 0a 91 70 c8 a9 f0 91  70 c8 80 f2 a9 00 85 f0  |...p....p.......|
0000f020  a0 00 3f 00 fe a9 4e 85  80 a5 f1 85 81 a9 f2 20  |..?...N........ |
0000f030  d2 04 a0 4e ad 86 ff d0  3a 20 e3 04 a9 f2 8d 01  |...N....: ......|
0000f040  f2 3f 00 f2 a9 59 85 80  a9 f3 20 d2 04 a0 59 ad  |.?...Y.... ...Y.|
0000f050  86 ff d0 1f 20 e3 04 a9  f3 8d 01 f3 3f 00 f3 a0  |.... .......?...|
0000f060  ff a9 00 85 fa a9 08 85  fb a9 00 20 be 04 a9 02  |........... ....|
0000f070  85 f1 00 20 ec 04 80 e7  08 48 b1 f0 c9 00 f0 06  |... .....H......|
0000f080  8d d0 ff c8 d0 f4 68 28  60 08 48 ad e0 ff 91 f0  |......h(`.H.....|
0000f090  c9 0a f0 03 c8 d0 f4 a9  00 91 f0 68 28 60 48 5a  |...........h(`HZ|
0000f0a0  a0 00 b1 fa 85 ff b1 fc  c5 ff d0 0c c8 a9 00 c5  |................|
0000f0b0  ff d0 ef 85 ff 7a 68 60  a9 01 85 ff d0 f7 91 fa  |.....zh`........|
0000f0c0  88 d0 fb 91 fa 60 b1 fa  91 fc 88 d0 f9 b1 fa 91  |.....`..........|
0000f0d0  fc 60 48 a9 03 8d 82 ff  9c 83 ff 9c 85 ff 68 8d  |.`H...........h.|
0000f0e0  84 ff 60 20 78 00 a0 2b  20 78 00 60 a9 1f 8d d4  |..` x..+ x.`....|
0000f0f0  ff 20 78 00 a0 3c 20 78  00 a9 20 8d d4 ff 60 00  |. x..< x.. ...`.|
0000f100  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
0000f500  01 4b 45 52 4e 45 4c 2e  53 59 53 00 02 01 00 00  |.KERNEL.SYS.....|
0000f510  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*

Here you can see the ROM loaded at $200, the bootloader loaded at $800, and $f500 containing the file system meta data loaded in from disk, and finally the kernel loaded into $f000.

The ROM memory page will be read-only, so it's best to have it some place in the memory map where you will never write to. Since the stack is located at $100, $200 seems like an ideal location. The bootloader memory can be erased/reused after it's done JMPing into the kernel code. In fact, my kernel code handles this task already.

My next major task here is to update my 65c02 kernel code so that it will work correctly with the new block storage device. So, I will need to load in the file system driver first, perhaps using the existing loader code from the bootloader.

Looks like the new update which includes both block storage, and networking support is finally starting to take form. I also updated the Game Guide for the Host templates so that the current mission designers can better understand how to put together a host template with block storage.