/[projet1]/public/oric/demos/SlideShowDemo/code/irq.s
Defence Force logotype

Contents of /public/oric/demos/SlideShowDemo/code/irq.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1050 - (show annotations)
Sun Dec 22 17:05:37 2013 UTC (6 years, 1 month ago) by dbug
File size: 2513 byte(s)
Adding a scroller, currently in the screen area but needs to move to the text zone
1
2 #define ENABLE_MUSIC 1
3
4 #define via_portb $0300
5 #define via_t1cl $0304
6 #define via_t1ch $0305
7 #define via_t1ll $0306
8 #define via_t1lh $0307
9 #define via_t2ll $0308
10 #define via_t2ch $0309
11 #define via_sr $030A
12 #define via_acr $030b
13 #define via_pcr $030c
14 #define via_ifr $030D
15 #define via_ier $030E
16 #define via_porta $030f
17
18
19 .zero
20
21 _VblCounter .dsb 1
22
23 _SystemFrameCounter
24 _SystemFrameCounter_low .dsb 1
25 _SystemFrameCounter_high .dsb 1
26
27
28 .text
29
30
31 _Stop
32 jmp _Stop
33 rts
34
35 /*
36 ;
37 ; Installs a simple 50hz Irq
38 ;
39 ; 304
40 ; 306
41 ; 307
42 bit $304 // VIA_T1CL ; Turn off interrupt early. (More on that below
43
44 ;Based on setting T1 to FFFF and adding to global counter in IRQ for up to 16.5
45 ;Million Clock Cycles.
46
47
48 #define VIA_T1CL $0304
49 #define VIA_T1CH $0305
50
51 #define VIA_T1LL $0306
52 #define VIA_T1LH $0307
53
54 _VSync
55 lda $300
56 vsync_wait
57 lda $30D
58 and #%00010000 ;test du bit cb1 du registre d'indicateur d'IRQ
59 beq vsync_wait
60 rts
61
62 */
63 _System_InstallIRQ_SimpleVbl
64 .(
65 sei
66
67 //
68 // Switch OFF interrupts, and enable Overlay RAM
69 // Because writing in ROM, is basicaly very hard !
70 //
71 sei
72 lda #%11111101
73 sta $314
74
75 // Set the VIA parameters
76 lda #<19966 ; 20000
77 sta $306
78 lda #>19966 ; 20000
79 sta $307
80
81 lda #0
82 sta _VblCounter
83 sta _SystemFrameCounter_low
84 sta _SystemFrameCounter_high
85
86 ;
87 ; Scroller
88 ;
89 jsr ScrollerDisplayReset
90
91
92 ;
93 ; Music player
94 ;
95 #ifdef ENABLE_MUSIC
96 ;jsr _Mym_Initialize
97 ;jsr _Mym_Initialize
98 #endif
99
100 // Install interrupt (this works only if overlay ram is disabled)
101 lda #<_InterruptCode_SimpleVbl
102 sta $FFFE
103 lda #>_InterruptCode_SimpleVbl
104 sta $FFFF
105
106 cli
107 rts
108 .)
109
110
111
112
113 _VSync
114 lda _VblCounter
115 beq _VSync
116 lda #0
117 sta _VblCounter
118 rts
119
120
121 _InterruptCode_SimpleVbl
122 _InterruptCode
123 bit $304
124 inc _VblCounter
125
126 .(
127 inc _SystemFrameCounter_low
128 bne skip
129 inc _SystemFrameCounter_high
130 skip
131 .)
132
133 pha
134 txa
135 pha
136 tya
137 pha
138
139
140 #ifdef ENABLE_MUSIC
141 jsr _Mym_PlayFrame
142 #endif
143
144 _InterruptCallBack_1
145 jsr _DoNothing
146
147 jsr _ScrollerDisplay
148
149 _InterruptCodeEnd
150 pla
151 tay
152 pla
153 tax
154 pla
155
156 rti
157
158
159 _DoNothing
160 rts

  ViewVC Help
Powered by ViewVC 1.1.26