Revision | 2af5229221cc87b295c28867d47fef6c7f5df827 (tree) |
---|---|
Time | 2019-01-16 19:38:12 |
Author | inglorion <homemicro@ingl...> |
Commiter | inglorion |
describe program header in programming guide
@@ -25,6 +25,42 @@ | ||
25 | 25 | - ROM: |
26 | 26 | - $e000 through $ffff. |
27 | 27 | |
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 | + | |
28 | 64 | * Video Modes |
29 | 65 | |
30 | 66 | | Mode | Bit/Char | Pixels | Colors | Tiles | |