Summary Files Commits Branches @commit @diff @stats
path: root / catalan / basic_starter.a65
blob: 52424185bb636ff6f6d363a3d48e8e86c7db54ad (plain) (blame)
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
/* PRG format
 *   Contains two bytes of header data, address from which
 *   the rest of the file will be loaded into memory.
 * BASIC memory starts at addr 2048, we effectively place "10 SYS 2064"
 * and an end of program after it. Then immedately afterwards
 * we place our command on addr 2064.
 *   When BASIC loads up, it runs "10 SYS 2064" and passes up execution there.
 *   Then, when we return, we get a zero which indicates termination.
 */

/* The starting address is defined by the value (label or alias) "main".
 * Since in basic we need to provide a decimal string, but we store a decimal value, we need
 * to do this complicated convertion.
 */
#define main_addr_ch1 "0" + main / 10000
#define main_addr_ch2 "0" + (main - main / 10000 * 10000) / 1000
#define main_addr_ch3 "0" + (main - main / 1000 * 1000) / 100
#define main_addr_ch4 "0" + (main - main / 100 * 100) / 10
#define main_addr_ch5 "0" + main - main / 10 * 10

.word $0801 ; Header -- addr 2049
* = $0801   ; Program Counter

.(
	.word eol
	.word 10
	.byt $9e," "
	.byt main_addr_ch1,main_addr_ch2,main_addr_ch3,main_addr_ch4,main_addr_ch5,0
eol	.word 0
.)

// vim: noet ts=8 sw=0 lcs=tab\:\ \