-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmacros.a
75 lines (65 loc) · 1.13 KB
/
macros.a
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
;; -*- asm -*-
!addr {
Kernal_PrintImmediate = $fa17
Kernal_CursorPosition = $fff0
Kernal_SetWindow = $c02d
Kernal_GetChar = $ffe4
}
Color_Black = 0
Color_White = 1
Color_Red = 2
Color_Cyan = 3
Color_Purple = 4
Color_Green = 5
Color_Blue = 6
Color_Yellow = 7
Color_Orange = 8
Color_Brown = 9
Color_LtRed = 10
Color_DkGray = 11
Color_MdGray = 12
Color_LtGreen = 13
Color_LtBlue = 14
Color_LtGray = 15
!macro SaveRegisters {
pha
txa
pha
tya
pha
}
!macro RestoreRegisters {
pla
tay
pla
tax
pla
}
!macro PrintAt .x, .y {
ldx #.y
ldy #.x
clc
jsr Kernal_CursorPosition
jsr Kernal_PrintImmediate
}
!macro SetWindow .trow, .lcol, .brow, .rcol {
lda #.trow
ldx #.lcol
clc
jsr Kernal_SetWindow
lda #.brow
ldx #.rcol
sec
jsr Kernal_SetWindow
ldx #0
ldy #0
clc
jsr Kernal_CursorPosition
}
!macro ResetWindow {
+SetWindow 0, 0, 25, 40
}
;;; define a pixel row of a C64 hardware sprite
!macro SpriteLine .v {
!by .v >> 16, (.v >> 8) & 255, .v & 255
}