source: thomson/code/C/F14/waves.c@ 1180ce9

main
Last change on this file since 1180ce9 was 1180ce9, checked in by Adrien Destugues <pulkomandy@…>, 11 years ago

F14 - Forever young. Released at Forever 14

git-svn-id: svn://localhost/thomson@45 85ae3b6b-dc8f-4344-a89d-598714f2e4e5

  • Property mode set to 100644
File size: 2.0 KB
Line 
1// Here's the trick:
2// - unpack the logo to screen memory
3// - The color RAM doesn't move. Part with the logo is shown as expected,
4// below it is an area of single color (we can use the forme part without
5// visible artifacts)
6// - The pixel RAM has the visible copy of the logo, and an hidden copy of the
7// waving part below it
8// - We run over the logo lines, pick from the invisible part and copy to the
9// visible one
10// - Easy way: only vertical ondulations are done.
11// - To do horizontal ondulations, we'd need 8 versions of the logo, each
12// shifted one byte from the previous. This would fill a lot of RAM !
13
14#include <effect.h>
15
16extern unsigned char SIN[256];
17
18asm("\n"
19" .area .text \n"
20" INCLUDEBIN ../LOGO01.CRU \n"
21"forme_logo \n"
22);
23
24void init_L()
25{
26 // TODO clear screen to white
27 couleur();
28 for(unsigned int* i = (unsigned int*)(0); i < (unsigned int*)8000; i++)
29 {
30 *i = 0x7777;
31 }
32
33 forme();
34
35 asm("\n"
36" LDY #5000 \n"
37" LDU #forme_logo-1 \n"
38" LBSR exo2 \n"
39 :::"x", "y");
40
41 // Copy the bottom part of the logo to the top of the screen (pixels only)
42 // We will use this as a source for distorting the actual logo below.
43 unsigned int* src;
44 unsigned int* dest;
45 dest = (unsigned int*)1280;
46 for(src = (unsigned int*)5000; src >= (unsigned int*)3720;)
47 *dest-- = *src--;
48
49 couleur();
50
51 for(int y = 2280; y < 3560; y+=40)
52 {
53 for(int x = 0; x < 40; x+=2)
54 *(unsigned int*)(x+y) = 0x0707;
55 for(int x = 20; x < 28; x+=2)
56 *(unsigned int*)(x+y) = 0x1717;
57 }
58
59 for(int y = 3560; y < 5000; y+=40)
60 {
61 for(int x = 0; x < 40; x+=2)
62 *(unsigned int*)(x+y) = 0x8787;
63 for(int x = 20; x < 28; x+=2)
64 *(unsigned int*)(x+y) = 0x9797;
65 }
66
67 forme();
68
69 return;
70}
71
72
73void draw_L(int frame)
74{
75 for(int y = 0; y < 32; y++)
76 {
77 int offset = (y + (SIN[((y+frame)*4) & 0xFF] >> 6)) * 40;
78 for(int x = 0; x < 40; x++) {
79 *(unsigned int*)(x + y * 40 + 3720) =
80 *(unsigned int*)(x + offset);
81 }
82 }
83
84 asm("\n"
85"z TST 0xA7E7 \n"
86" BMI z \n"
87"bb TST 0xA7E7 \n"
88" BPL bb \n"
89 );
90}
91
Note: See TracBrowser for help on using the repository browser.