Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void vertical_scroll(char* buffer, int shift) {
- int i, j;
- char column[64];
- shift %= 64;
- for(i=0 ; i<16 ; i++) {
- for(j=0 ; j<64 ; j++) column[j] = buffer[(j<<4)+i];
- for(j=0 ; j<64 ; j++) buffer[(j<<4)+i] = column[(j-shift+64)&63];
- }
- }
- void horizontal_scroll(unsigned char* buffer, int shift) {
- int i, j;
- unsigned char line[16], Bshift, next;
- unsigned short word;
- shift %= 128;
- Bshift = 8-(shift&7);
- for(i=0 ; i<64 ; i++) {
- for(j=0 ; j<16 ; j++) line[j] = buffer[(i<<4)+((j-(shift>>3)+15)&15)];
- next = line[15];
- buffer[(i<<4)+15] = 0;
- for(j=15 ; j>0 ; j--) {
- word = next << Bshift;
- next = line[j-1];
- buffer[(i<<4)+j] |= *((char*)&word+1);
- buffer[(i<<4)+j-1] = *((char*)&word);
- }
- word = next << Bshift;
- buffer[(i<<4)] |= *((char*)&word+1);
- buffer[(i<<4)+15] |= *((char*)&word);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement