forked from aeriform-io/minicube64
-
Notifications
You must be signed in to change notification settings - Fork 0
/
64cube.inc
85 lines (70 loc) · 1.2 KB
/
64cube.inc
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
; we steal some space from the stack
; no one ever has a stack that big :P
; the control registers are at $100-$130
VIDEO = $100
COLORS = $101
INPUT = $102
AUDIO = $104
; NOTE NOTE
; normal 6502 has irq vectors at $fffe
; we have them at $010e
NMI_IRQ = $10c
VBLANK_IRQ = $10e
AUDIO_REGS = $110
AUDIO_VOLUME = $111
AUDIO_CHANNEL1 = $112
AUDIO_CHANNEL2 = $112+4
AUDIO_CHANNEL3 = $112+8
AUDIO_CHANNEL3 = $112+12
; handy macros
MACRO _setb value,dest
lda #value
sta dest
ENDM
MACRO _setw value,dest
lda #<value
sta dest
lda #>value
sta dest+1
ENDM
MACRO _movw value,dest
lda value
sta dest
lda value+1
sta dest+1
ENDM
MACRO _addw source,addition,dest
clc
lda source
adc addition
sta dest
lda source+1
adc addition+1
sta dest+1
ENDM
MACRO _addwb source,addition,dest
clc
lda source
adc addition
sta dest
lda source+1
adc #0
sta dest+1
ENDM
MACRO _addwi source,addition,dest
clc
lda source
adc #<addition
sta dest
lda source+1
adc #>addition
sta dest+1
ENDM
MACRO _unpack source,destination
_setw source,apd_src
_setw destination,apd_dest
jsr dc64f
ENDM
MACRO _halt
halt: jmp halt
ENDM