Subversion Repositories Shiroi

Rev

Rev 12 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 12 Rev 13
Line 1... Line 1...
1
/* $Id: text.c 12 2024-08-29 04:19:08Z nishi $ */
1
/* $Id: text.c 13 2024-08-29 04:36:14Z nishi $ */
2
 
2
 
3
#include "text.h"
3
#include "text.h"
4
 
4
 
5
#include "char.h"
5
#include "char.h"
6
#include "video.h"
6
#include "video.h"
Line 56... Line 56...
56
	return caps ? keylist_caps[top * 13 + bot] : keylist[top * 13 + bot];
56
	return caps ? keylist_caps[top * 13 + bot] : keylist[top * 13 + bot];
57
}
57
}
58
 
58
 
59
void clear(void){
59
void clear(void){
60
	int i;
60
	int i;
61
	int size = mull(scrwidth, scrheight);
61
	int size = muli(scrwidth, scrheight);
62
	setvramaddr(0);
62
	setvramaddr(0);
63
	for(i = 0; i < size; i++) vramchar(' ');
63
	for(i = 0; i < size; i++) vramchar(' ');
64
}
64
}
65
 
65
 
66
void scroll_y(void){
66
void scroll_y(void){
67
	int i;
67
	int i;
68
	int size = mull(scrwidth, scrheight - 1);
68
	int size = muli(scrwidth, scrheight - 1);
69
	for(i = 0; i < size; i++){
69
	for(i = 0; i < size; i++){
70
		setreadvramaddr(i + 32);
70
		setreadvramaddr(i + 32);
71
		unsigned char ch = getvramchar();
71
		unsigned char ch = getvramchar();
72
		setvramaddr(i);
72
		setvramaddr(i);
73
		vramchar(ch);
73
		vramchar(ch);
Line 87... Line 87...
87
		p = p << 4;
87
		p = p << 4;
88
	}
88
	}
89
}
89
}
90
 
90
 
91
void cursor(void){
91
void cursor(void){
92
	setvramaddr(mull(posy, scrwidth) + posx);
92
	setvramaddr(muli(posy, scrwidth) + posx);
93
	_vramchar(136 + 8 * cursorcolor);
93
	_vramchar(136 + 8 * cursorcolor);
94
	cursorindex++;
94
	cursorindex++;
95
	if(cursorindex == 2){
95
	if(cursorindex == 2){
96
		cursorcolor++;
96
		cursorcolor++;
97
		cursorindex = 0;
97
		cursorindex = 0;
Line 104... Line 104...
104
		cury++;
104
		cury++;
105
	}
105
	}
106
}
106
}
107
 
107
 
108
void killcursor(void){
108
void killcursor(void){
109
	setvramaddr(mull(cury, scrwidth) + curx);
109
	setvramaddr(muli(cury, scrwidth) + curx);
110
	vramchar(' ');
110
	vramchar(' ');
111
}
111
}
112
 
112
 
113
void putchar(char c){
113
void putchar(char c){
114
	if(c == '\r'){
114
	if(c == '\r'){
115
		posx = 0;
115
		posx = 0;
116
	}else if(c == '\n'){
116
	}else if(c == '\n'){
117
		posy++;
117
		posy++;
118
	}else{
118
	}else{
119
		setvramaddr(mull(posy, scrwidth) + posx);
119
		setvramaddr(muli(posy, scrwidth) + posx);
120
		vramchar(c);
120
		vramchar(c);
121
		posx++;
121
		posx++;
122
		if(posx == scrwidth){
122
		if(posx == scrwidth){
123
			posx = 0;
123
			posx = 0;
124
			posy++;
124
			posy++;