forked from markmoxon/elite-source-code-nes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelite-source-header.asm
81 lines (67 loc) · 2.64 KB
/
elite-source-header.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
; ******************************************************************************
;
; NES ELITE GAME SOURCE (iNES HEADER)
;
; NES Elite was written by Ian Bell and David Braben and is copyright D. Braben
; and I. Bell 1991/1992
;
; The code on this site has been reconstructed from a disassembly of the version
; released on Ian Bell's personal website at http://www.elitehomepage.org/
;
; The commentary is copyright Mark Moxon, and any misunderstandings or mistakes
; in the documentation are entirely my fault
;
; The terminology and notations used in this commentary are explained at
; https://www.bbcelite.com/about_site/terminology_used_in_this_commentary.html
;
; The deep dive articles referred to in this commentary can be found at
; https://www.bbcelite.com/deep_dives
;
; ------------------------------------------------------------------------------
;
; This source file produces the following binary file:
;
; * header.bin
;
; ******************************************************************************
INCLUDE "1-source-files/main-sources/elite-build-options.asm"
_NTSC = (_VARIANT = 1)
_PAL = (_VARIANT = 2)
; ******************************************************************************
;
; ELITE iNES HEADER
;
; Produces the binary file header.bin.
;
; ******************************************************************************
CODE% = $8000
LOAD% = $8000
ORG CODE%
; ******************************************************************************
;
; Name: iNES header
; Type: Variable
; Category: Start and end
; Summary: The iNES header for running in an emulator
;
; ******************************************************************************
EQUS "NES" ; Bytes #0 to #2 = identification string for iNES file
EQUB $1A ; Byte #3 = identification string terminator
EQUB 8 ; Byte #4 = 8 pages of 16K ROM = 128K
EQUB 0 ; Byte #5 = 0 = board uses CHR RAM
EQUB %00010010 ; Byte #6 = mapper and WRAM configuration
;
; * Bit 1 set = Cartridge contains battery-backed RAM
; at $6000 to $7FFF
;
; * Bits 4-7 = mapper number, %0001 = MMC1
EQUB 0 ; Bytes #7 to #15 are zero and have no effect
EQUD 0
EQUD 0
; ******************************************************************************
;
; Save header.bin
;
; ******************************************************************************
PRINT "S.header.bin ", ~CODE%, " ", ~P%, " ", ~LOAD%, " ", ~LOAD%
SAVE "3-assembled-output/header.bin", CODE%, P%, LOAD%