-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathreset.a65
More file actions
119 lines (114 loc) · 1.95 KB
/
Copy pathreset.a65
File metadata and controls
119 lines (114 loc) · 1.95 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
.link page $c0
#include "memmap.i65"
#include "dma.i65"
; NMI - called on VBlank
NMI_ROUTINE:
sep #$20 : .as
rep #$10 : .xl
lda #$00
pha
plb
lda screen_dma_disable
bne +
ldx #BG1_TILE_BASE+32*9
stx $2116
DMA7(#$01, #40*64, #^BG1_TILE_BUF, #!BG1_TILE_BUF+64*9, #$18)
ldx #BG2_TILE_BASE+32*9
stx $2116
DMA7(#$01, #40*64, #^BG2_TILE_BUF, #!BG2_TILE_BUF+64*9, #$18)
ldx #BG2_TILE_BASE
stx $2116
DMA7(#$01, #64*9, #^BG2_TILE_BUF, #!BG2_TILE_BUF, #$18)
+
lda bar_yl ; calculate (Y-1) * 8 - 2
dec
asl
asl
dec
asl
sta bar_y ; physical pos = logical pos * 8 - 8
cmp #224
bne +
lda #1
+
sta bar_y
cmp #113
bcs lower_half
sta hdma_math
lda #$01
sta hdma_math+3
bra math_cont
lower_half
sbc #111
sta hdma_math+3
lda #112
sta hdma_math
math_cont
lda bar_xl ; get logical cursor X pos
asl
dec
asl
sta bar_x ; physical pos = logical pos * 4 - 2
sta $2126 ; window 1 left
lda bar_wl ; get logical cursor width
asl
asl ; pixel width = logical width * 4 + 1
inc
sta bar_w ; = physical width
clc
adc bar_x ; + X start coord
sta $2127 ; window 1 right
lda @CFG_ENABLE_SCREENSAVER
beq +
rep #$20 : .al
sep #$10 : .xs
lda pad1mem
and #$fff0
beq nobuttonspressed
buttonspressed
stz idle_count
lda bright_limit
tax
stx tgt_bright
ldx #$01
stx fade_speed
stx fade_count
nobuttonspressed
inc idle_count
lda idle_count
cmp #IDLE_THRES
sep #$20 : .as
bne +
; no input for a long time
ldx #$03
stx tgt_bright
ldx #$10
stx fade_speed
stz fade_count
+
lda fade_count
cmp fade_speed
bne +
stz fade_count
lda cur_bright
cmp tgt_bright
beq +
bpl bright_down
bright_up
inc
sta cur_bright
sta $2100
bra +
bright_down
dec
sta cur_bright
sta $2100
+ lda #$01
sta isr_done
inc fade_count
rtl
; IRQ_ROUTINE - called when IRQ triggered
IRQ_ROUTINE:
sep #$20 : .as
lda $4211 ; Acknowledge IRQ
rtl