/[projet1]/public/oric/mym_player/irq.s
Defence Force logotype

Contents of /public/oric/mym_player/irq.s

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1073 - (show annotations)
Sun Jan 12 19:46:23 2014 UTC (5 years, 10 months ago) by dbug
File size: 2378 byte(s)
First version of the revamped mym player tool chain.
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 ;
88 ; Music player
89 ;
90 #ifdef ENABLE_MUSIC
91 ;jsr _Mym_Initialize
92 ;jsr _Mym_Initialize
93 #endif
94
95 // Install interrupt (this works only if overlay ram is disabled)
96 lda #<_InterruptCode_SimpleVbl
97 sta $FFFE
98 lda #>_InterruptCode_SimpleVbl
99 sta $FFFF
100
101 cli
102 rts
103 .)
104
105
106
107
108 _VSync
109 lda _VblCounter
110 beq _VSync
111 lda #0
112 sta _VblCounter
113 rts
114
115
116 _InterruptCode_SimpleVbl
117 _InterruptCode
118 bit $304
119 inc _VblCounter
120
121 .(
122 inc _SystemFrameCounter_low
123 bne skip
124 inc _SystemFrameCounter_high
125 skip
126 .)
127
128 pha
129 txa
130 pha
131 tya
132 pha
133
134
135 #ifdef ENABLE_MUSIC
136 jsr _Mym_PlayFrame
137 #endif
138
139 _InterruptCodeEnd
140 pla
141 tay
142 pla
143 tax
144 pla
145
146 rti
147
148

  ViewVC Help
Powered by ViewVC 1.1.26