Commit MetaInfo

Revision2af5229221cc87b295c28867d47fef6c7f5df827 (tree)
Time2019-01-16 19:38:12
Authoringlorion <homemicro@ingl...>
Commiteringlorion

Log Message

describe program header in programming guide

Change Summary

Incremental Difference

diff -r 301efb061ab0 -r 2af5229221cc docs/programming.txt
--- a/docs/programming.txt Mon Jan 14 21:45:42 2019 -0800
+++ b/docs/programming.txt Wed Jan 16 02:38:12 2019 -0800
@@ -25,6 +25,42 @@
2525 - ROM:
2626 - $e000 through $ffff.
2727
28+* Program Header
29+
30+At startup, the Home Micro looks for a cartridge to load a program
31+from. The program is identified by a header, whose format is given
32+below. As is usual for the 6502, values that span multiple bytes are
33+stored least significant byte first; for example, $1080 would be
34+stored as $80, $10.
35+
36+| Start | Length | Description |
37+|-------+--------+-------------------------------------|
38+| 0 | 2 | magic "HM" |
39+| 2 | 2 | version $00, $01 |
40+| 4 | 2 | entry point |
41+| 6 | 2 | bytes per page |
42+| 8 | 2 | position of first byte on cartridge |
43+| 10 | 2 | number of bytes to load |
44+| 12 | 2 | address at which to load first byte |
45+| 14 | 2 | reserved (set to 0) |
46+
47+For example, a header of
48+
49+: 48 4D
50+: 00 01
51+: 00 20
52+: 20 00
53+: 40 00
54+: 00 10
55+: 00 30
56+: 00 00
57+
58+would cause the ROM to start reading at cartridge address 64 ($0400)
59+and load 4096 bytes ($1000) into memory starting at address 768
60+($0300). Once done loading, it would jump to address 512 ($0200). It
61+would also store 32 ($0020) in the variable that holds the cartridge
62+page size. This value is used when writing to the cartridge.
63+
2864 * Video Modes
2965
3066 | Mode | Bit/Char | Pixels | Colors | Tiles |
Show on old repository browser