-
Notifications
You must be signed in to change notification settings - Fork 0
/
linker.asm
64 lines (50 loc) · 1.38 KB
/
linker.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
org 0x2000
first_byte
run $
; As we want to reuse the system, it is mandatory to backup all these registers. Yep lots of space lost here ...
di
;;
; Uncrunch all data and code in memory
; we expect than crunching the two pages together increase compression ratio
exx : push ix, hl, de, bc
ex af, af' : push af
ld ix, crunched_data
ld de, 0xc000
call shrinkler_decrunch
pop af : ex af, af'
pop bc, de, hl, ix : exx
;;
; Copy page 0 at the appropriate place
ld hl, 0xc000 + page0_start - crunched_data
ld de, 0x8000
ld bc, page0_length
ldir
; TODO add an assertion to check that no system memory is destroyed there
;;
; Copy page 1 at the appropriate place
ld bc, 0x7fc7 : out (c), c
ld hl, 0xc000 + page1_start - crunched_data
ld de, 0x4000
ld bc, page1_length
ldir
ld bc, 0x7fc0 : out (c), c
ei
jp 0x8000
crunched_data
LZSHRINKLER
page0_start
incbin "page0.o"
page0_length equ $-page0_start
page1_start
incbin "page1.o"
page1_length equ $-page1_start
LZCLOSE
crunched_data_length equ $-crunched_data
include "demosystem/deshrink.asm"
nb_bytes = $-first_byte
assert page0_length < 0x1000, "you crash the linker there..."
assert crunched_data_length < 0x4000, "linker cannot work"
print "Summary"
print nb_bytes , " currently used"
print 4096 - nb_bytes, " remaining"
save "40.amd", first_byte, nb_bytes, DSK, "40_amd.dsk"