-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain2.a65
97 lines (71 loc) · 1.81 KB
/
main2.a65
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
; ----------------------------------
; 6of5
; ----------------------------------
main2
sei
; store stack pointer
tsx
stx o_sp
; don't call BASIC in the kernel's IRQ handler (we don't seem to need it on newer ROMs anymore)
lda #1
trb $1104
; copy over music via dma
dma_run music_copy_dma
; disable ROM protection to make chip RAM usable
; -> 0x20000-0x3ffff
htrap hyppo_toggle_rom_writeprot
; force to run at 48mhz
cpu_48mhz
; enable VIC-IV
vic_knock_iv
; print M65 model
jsr kernal_primm
string "D629: $"
lda util_m65model
jsr print_byte
lda #pet_cr
jsr kernal_chrout
; store irq address
lda reg_cinv
sta o_irq
lda reg_cinv+1
sta o_irq+1
; start demo
jsr demo_start
; reset memory mapping
map_default
jsr $038d ; tell BASIC about new memory mapping
; disable interface ROM for now, seems to be unused by regular kernal ROM
lda #%00100000
trb vic3_map
; used by rom: 0x0000-0x1fff
; free are now: 0x2000-0xcfff
; i/o: 0xd000-0xdfff
; kernal: 0xe000-0xffff
eom
cli
; kernal is running in the background, we can use many ROM routines,
; so start the next startup phase
jsr demo_main
sei
; reset memory mapping
map_default
jsr $038d ; tell BASIC about new memory mapping
; enable interface ROM again
lda #%00100000
tsb vic3_map
; enable ROM protection
htrap hyppo_toggle_rom_writeprot
; restore old IRQ
setirqa o_irq
; stop demo
jsr demo_stop
; enable BASIC IRQs again
lda #1
tsb $1104
; restore stack pointer
ldx o_sp
txs
cli
rts
o_sp byte 0