Skip to content
Snippets Groups Projects
Commit 53e52f97 authored by deuce's avatar deuce
Browse files

Fix up changechar() and add support for toggling bg high/blink and

setting secondary charset
parent 6b52b42a
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,8 @@
#include <vidmodes.h>
#include <allfonts.h>
extern int crt_main_font;
extern int crt_secondary_font;
int changechar_height=16;
int changechar_func=0x1100;
int changechar_blk=0;
......@@ -22,6 +24,23 @@ void changechar (unsigned char *fmt, int ind, int qt)
if(ind < 0 || ind > 255 || ind+qt > 256)
return;
// Load default charset into all 8 possible blocks
if(crt_secondary_font == -99) {
int i;
int cfnt=getfont();
for(i=0; i<8; i++) {
conio_fontdata[255-i].eight_by_sixteen=(unsigned char *)malloc(16*256);
memcpy(conio_fontdata[255-i].eight_by_sixteen,conio_fontdata[cfnt].eight_by_sixteen,16*256);
conio_fontdata[255-i].eight_by_fourteen=(unsigned char *)malloc(14*256);
memcpy(conio_fontdata[255-i].eight_by_fourteen,conio_fontdata[cfnt].eight_by_fourteen,16*256);
conio_fontdata[255-i].eight_by_eight=(unsigned char *)malloc(8*256);
memcpy(conio_fontdata[255-i].eight_by_eight,conio_fontdata[cfnt].eight_by_eight,16*256);
conio_fontdata[255-i].desc="CRT Font";
}
crt_secondary_font=0;
}
if((vm=find_vmode(ti.currmode))!=-1) {
fontsize=vparams[vm].charheight*256;
newfont=malloc(fontsize);
......@@ -41,19 +60,24 @@ void changechar (unsigned char *fmt, int ind, int qt)
memcpy(newfont+(vparams[vm].charheight*ind), fmt, qt*vparams[vm].charheight);
switch(fontsize) {
case 4096:
FREE_AND_NULL(conio_fontdata[255].eight_by_sixteen);
conio_fontdata[255].eight_by_sixteen=newfont;
FREE_AND_NULL(conio_fontdata[255-changechar_blk].eight_by_sixteen);
conio_fontdata[255-changechar_blk].eight_by_sixteen=newfont;
break;
case 3586:
FREE_AND_NULL(conio_fontdata[255].eight_by_fourteen);
conio_fontdata[255].eight_by_fourteen=newfont;
FREE_AND_NULL(conio_fontdata[255-changechar_blk].eight_by_fourteen);
conio_fontdata[255-changechar_blk].eight_by_fourteen=newfont;
break;
case 2048:
FREE_AND_NULL(conio_fontdata[255].eight_by_eight);
conio_fontdata[255].eight_by_eight=newfont;
FREE_AND_NULL(conio_fontdata[255-changechar_blk].eight_by_eight);
conio_fontdata[255-changechar_blk].eight_by_eight=newfont;
break;
}
setfont(255,0,0);
if(changechar_blk==crt_main_font) {
setfont(255-crt_main_font, FALSE, 0);
}
if(changechar_blk==crt_secondary_font) {
setfont(255-crt_secondary_font, FALSE, 1);
}
}
}
......
#include <stdlib.h>
#include <string.h>
#include <ciolib.h>
#include <allfonts.h>
int crt_main_font=0;
int crt_secondary_font=-99;
void crtfontspec (int blkspec) //enables the display of two character fonts
{
asm push ax;
asm push bx;
_BL=blkspec;
_AX=0x1103;
asm int 0x10;
asm pop bx;
asm pop ax;
}
\ No newline at end of file
int new_main=(blkspec & 0x03) | ((blkspec & 0x10) >> 2);
int new_second=((blkspec >> 2) & 0x03) | ((blkspec & 0x20) >> 3);
// Load default charset into all 8 possible blocks
if(crt_secondary_font == -99) {
int i;
int cfnt=getfont();
for(i=0; i<8; i++) {
conio_fontdata[255-i].eight_by_sixteen=(unsigned char *)malloc(16*256);
memcpy(conio_fontdata[255-i].eight_by_sixteen,conio_fontdata[cfnt].eight_by_sixteen,16*256);
conio_fontdata[255-i].eight_by_fourteen=(unsigned char *)malloc(14*256);
memcpy(conio_fontdata[255-i].eight_by_fourteen,conio_fontdata[cfnt].eight_by_fourteen,16*256);
conio_fontdata[255-i].eight_by_eight=(unsigned char *)malloc(8*256);
memcpy(conio_fontdata[255-i].eight_by_eight,conio_fontdata[cfnt].eight_by_eight,16*256);
conio_fontdata[255-i].desc="CRT Font";
}
i=getvideoflags();
i|=CIOLIB_VIDEO_ALTCHARS;
setvideoflags(i);
}
crt_main_font=new_main;
setfont(255-crt_main_font, 0, 0);
crt_secondary_font=new_second;
setfont(255-crt_secondary_font, 0, 1);
}
......@@ -8,6 +8,7 @@ OBJS = \
$(OBJODIR)$(DIRSEP)crtbord$(OFILE) \
$(OBJODIR)$(DIRSEP)crtclrsc$(OFILE) \
$(OBJODIR)$(DIRSEP)crtdtect$(OFILE) \
$(OBJODIR)$(DIRSEP)crtfntsp$(OFILE) \
$(OBJODIR)$(DIRSEP)crtframe$(OFILE) \
$(OBJODIR)$(DIRSEP)crtframw$(OFILE) \
$(OBJODIR)$(DIRSEP)crtmode$(OFILE) \
......@@ -52,13 +53,12 @@ OBJS = \
$(OBJODIR)$(DIRSEP)savevidw$(OFILE) \
$(OBJODIR)$(DIRSEP)savvideo$(OFILE) \
$(OBJODIR)$(DIRSEP)savvidw2$(OFILE) \
$(OBJODIR)$(DIRSEP)textblnk$(OFILE) \
$(OBJODIR)$(DIRSEP)vmode$(OFILE) \
$(OBJODIR)$(DIRSEP)stubs$(OFILE)
REMOVED = \
$(OBJODIR)$(DIRSEP)crtdacr$(OFILE) \
$(OBJODIR)$(DIRSEP)crtfntsp$(OFILE) \
$(OBJODIR)$(DIRSEP)crtpage$(OFILE) \
$(OBJODIR)$(DIRSEP)crtpal$(OFILE) \
$(OBJODIR)$(DIRSEP)textblnk$(OFILE) \
$(OBJODIR)$(DIRSEP)boxwidth$(OFILE)
......@@ -8,14 +8,10 @@ void setdacpage(int page) {}
int getdacpgstate (void) {return(0);}
void crtfontspec (int blkspec) {}
void setcrtpage (int page) {}
int getpalreg (int regpal) {return(0);}
void setpalreg (int regpal, int val) {};
void settextblink (int cmd) {};
void setchrboxwidth (int cmd) {};
#define intm(intnum) asm int intnum
#include <ciolib.h>
void settextblink (int cmd) //if cmd==1 => set attribute bit 7 as enable blink
//bit (default), otherwise it becomes background intensity bit
{
cmd%=(unsigned)256u;
if ((unsigned)cmd>1)
return;
asm push ax;
asm push bx;
_BX=cmd;
_AX=0x1003;
intm (0x10);
asm pop bx;
asm pop ax;
}
\ No newline at end of file
int flags;
flags=getvideoflags();
if(cmd==1)
flags &= ~CIOLIB_VIDEO_BGBRIGHT;
else
flags |= CIOLIB_VIDEO_BGBRIGHT;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment