aboutsummaryrefslogtreecommitdiffstats
path: root/data/bacldr.asm
blob: 80e99ec9da7baf33644f894402d5b7a80d11c34c (plain)
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
	org 0			; This code must be position-independent

	defc BOFA=65052
	defc LOAD=0DDDDh	; Load address placeholder
	defc ENTRY=0BBBBh	; Entrypoint address placeholder

	ld hl,(BOFA)
	ld b,0
	ld c,(hl)		; BC <- length of BASIC prefix
	add hl,bc

	ld de,LOAD

	; Get data block length
loop:
	ld a,(hl)
	sub 8
	jp c,ENTRY		; END is a shorter line than any data line

	; Skip length byte + line number (2 bytes) + string opcode (3 bytes)
	ld c,6
	add hl,bc

	; Copy remaining data
	ld c,a
	ldir

	; Skip return + CR
	inc hl
	inc hl
	jr loop