-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscroll.c
64 lines (49 loc) · 1.91 KB
/
scroll.c
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
/*****************************************
NAAGTRO version 2
scroll.c Scrolling text effect
(C) March 5, 2023 M. Feliks
*****************************************/
#include <string.h>
#include "scroll.h"
#include "naagtro.h"
static char scrolltext[] = "New Age ASM Group proudly presents a short intro made by Majuma in pure 32-bit Assembler ;) *** If you want to join our group or just have any reason for contacting us, visit our web page: www.naag.prv.pl *** Greetings are scrolling to all members of NAAG: HaRv3sTeR, Klemik, tOudi, SEM, pkmiecik, Overlord, Oolv, Miodzio, asmCode, _TeStON_, Zedd and anybody I forgot... Keep coding ! ";
static unsigned char scrollbuffer[320 * 8];
static unsigned int curr_char = 0, curr_col = 0;
void init_scroll()
{
memset(scrollbuffer, 0, 320 * 8);
}
void do_scroll(int y, unsigned char* frame_buffer)
{
char my_char = scrolltext[curr_char % ( (sizeof (scrolltext) / sizeof (char)) - 1)];
if (my_char >= 'a' && my_char <= 'z') {
my_char += ('A' - 'a');
}
unsigned char* ptr_char = &chardata[((my_char - ' ') & 63) << 3];
int col_idx = 7 - (curr_col & 7);
for (int i = 0; i < 8; i++, ptr_char++) {
if ((*ptr_char >> col_idx) & 1) {
*(scrollbuffer + i * 320 + 319) = (unsigned char)(64 + i);
}
else {
*(scrollbuffer + i * 320 + 319) = 0;
}
}
for (int i = 0; i < 8; i++) {
unsigned char* ptr_buffer = scrollbuffer + 320 * i;
for (int j = 0; j < 319; j++, ptr_buffer++) {
*ptr_buffer = *(ptr_buffer + 1);
}
}
unsigned char* ptr_buffer = scrollbuffer;
unsigned char* ptr_fb = frame_buffer + y * 320;
for (int i = 0; i < 320 * 8; i++, ptr_buffer++, ptr_fb++) {
if (*ptr_buffer != 0) {
*ptr_fb = *ptr_buffer;
}
}
curr_col++;
if (curr_col % 8 == 0) {
curr_char++;
}
}