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

Contents of /public/oric/demos/SlideShowDemo/code/scroller.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: 4521 byte(s)
Adding a scroller, currently in the screen area but needs to move to the text zone
1
2 #define _picture_font_2 $9900
3
4 .dsb 256-(*&255)
5
6 // - Entry #43 '..\build\files\Font_16x16.hir'
7 // Loads at address 40960 starts on track 41 sector 1 and is 6 sectors long (1442 compressed bytes: 57% of 2528 bytes).
8 _FontBuffer .dsb 2528
9
10 .dsb 256-(*&255)
11
12 _ScrollBuffer .dsb 40*20
13
14
15 _ScrollerMessage
16 .byt "WELCOME TO THE DEFENCE FORCE SLIDE SHOW"
17
18
19 _ScrollerGenerate
20 .(
21 lda _ScrollerMessage,x
22
23 rts
24 .)
25
26 ; Using the 24x20 font, each letter is 3 bytes large (in practice the largest is 20 pixels wide)
27 ; Say a buffer 128 bytes large
28 ; 128/3 bytes=42 characters large
29 ; "WELCOME TO THE DEFENCE FORCE SLIDE SHOW" <- That's about 40 characters :S
30 ; 128*20=2560
31 ; 2560*6=15360
32 ;
33
34
35
36 /*
37 Fonts infos: http://cgi.algonet.se/htbin/cgiwrap?user=guld1&script=fonts.pl
38
39 Some scroll computation.
40
41 Say we have a 32x24 font
42
43 Displaying this message: "WELCOME TO DEFENCE FORCE ULTIMATE SLIDE DISK MUSIC SHOW, HOPE YOU WILL ENJOY IT!!!" (83 characters)
44 would use:
45 83*32=2656 pixels
46 2656/240=about 11 screens wide,
47 2656/50 =about 53 seconds scrolling time (at one pixel per frame - which is super slow)
48
49 2656/32 =83 bytes wide
50 83*24=1992 bytes for one scroll buffer
51 1992*6=11952 bytes for six preshifted buffers
52
53
54 32/6=5.3
55 5*6=30
56 6*6=36
57
58 Miriam's choices:
59 - millitary_15
60 - spaz_20 (19x20 plus spacing)
61 - classic_21_nice
62
63 Me:
64 - outline_24
65
66
67 */
68
69 // From achimiex
70
71
72
73 .zero
74
75
76 _MessageScrollerPtr .dsb 2
77
78
79 .text
80
81
82 _MessageScroller
83 .asc "Good news everyone! "
84 .asc "It is 7:56 on this mild norwegian morning, "
85 .asc "here at Kindergarden. "
86 .asc "Since party coding rules, I'm working on a small intro for the Alchimie-X. "
87 .asc "This logo was (hand) converted from H2O's original, the music is from David Whittaker, "
88 .asc "the rest was built by Dbug on the party place."
89 .asc "Looks like our friends from space are back??? "
90 .asc "Greeting to everybody at Kindergarden and Alchimie, and anyone else who deserves it :)"
91 .asc " "
92 .asc "The End :) Let's wrap..."
93
94 .asc " "
95 .byt 0
96
97
98
99 _ScrollerInit
100 ; Clear the scroller area
101 ldx #39
102 lda #64
103 ScrollerInitEraseLoop
104 sta _ScrollBuffer+40*0,x
105 sta _ScrollBuffer+40*1,x
106 sta _ScrollBuffer+40*2,x
107 sta _ScrollBuffer+40*3,x
108 sta _ScrollBuffer+40*4,x
109 sta _ScrollBuffer+40*5,x
110 sta _ScrollBuffer+40*6,x
111 sta _ScrollBuffer+40*7,x
112 dex
113 bne ScrollerInitEraseLoop
114
115
116 ; Write the characters in the bottom text area
117 ldy #32
118 ldx #0
119 loop_fill_text
120 tya
121 sta $bb80+40*26,x
122 iny
123 tya
124 sta $bb80+40*27,x
125 iny
126 inx
127 cpx #40
128 bne loop_fill_text
129
130
131 rts
132
133
134
135
136
137
138
139
140
141 ScrollerCounter .byt 0
142
143 ScrollerCharBuffer .byt 0,0,0,0,0,0,0,0 ; Buffer with character to scroll
144
145
146 _ScrollerDisplay
147 ;Break jmp Break
148
149 lda ScrollerCounter
150 beq ScrollerNewCharacter
151
152 dec ScrollerCounter
153 jmp ScrollerEndNewCharacter
154
155 ScrollerNewCharacter
156 lda #6
157 sta ScrollerCounter
158
159 readCharacter
160 ; Get character and write into the buffer
161 ldy #0
162 lda (_MessageScrollerPtr),y
163 beq ScrollerDisplayReset
164
165 jsr ScrollerIncPointer
166
167 ; Multiply by 8 the ASCII code to point in the font
168 sta tmp7
169 lda #0
170 sta tmp7+1
171
172 asl tmp7
173 rol tmp7+1
174
175 asl tmp7
176 rol tmp7+1
177
178 asl tmp7
179 rol tmp7+1
180
181 ; Add the font pointer
182 clc
183 lda #<_picture_font_2-32*8
184 adc tmp7
185 sta tmp7
186 lda #>_picture_font_2-32*8
187 adc tmp7+1
188 sta tmp7+1
189
190 ; Copy the character data to the scroller buffer
191 ldy #0
192 loopcopychar
193 lda (tmp7),y
194 ora #64
195 sta ScrollerCharBuffer,y
196 iny
197 cpy #8
198 bne loopcopychar
199
200 ScrollerEndNewCharacter
201
202
203 ;Break jmp Break
204
205 lda #<$a000
206 sta tmp6
207 lda #>$a000
208 sta tmp6+1
209
210
211 ldx #0
212 ScrollerDisplayLoopMessageY
213 ; Get pixel from character
214 clc
215 lda ScrollerCharBuffer,x
216 rol
217 cmp #192
218 and #$3F
219 ora #64
220 sta ScrollerCharBuffer,x
221
222 ; And then scroll the whole scanline
223 ldy #39
224 ScrollerDisplayLoopMessageX
225 lda (tmp6),y
226 rol
227 cmp #192
228 and #%00111111
229 ora #%01000000
230 sta (tmp6),y
231
232 dey
233 bne ScrollerDisplayLoopMessageX
234
235 clc
236 lda tmp6
237 adc #40
238 sta tmp6
239 bcc skipkipppp
240 inc tmp6+1
241 skipkipppp
242
243 inx
244 cpx #8
245 bne ScrollerDisplayLoopMessageY
246
247 rts
248
249
250 ScrollerDisplayReset
251 lda #<_MessageScroller
252 sta _MessageScrollerPtr
253 lda #>_MessageScroller
254 sta _MessageScrollerPtr+1
255 rts
256
257
258
259
260 ScrollerIncPointer
261 inc _MessageScrollerPtr
262 bne skipscrollermove
263 inc _MessageScrollerPtr+1
264 skipscrollermove
265 rts

  ViewVC Help
Powered by ViewVC 1.1.26