Fix lingering issues with config and font utilities

This commit is contained in:
David Kuder 2023-04-14 01:35:42 -04:00
parent 34c697e2aa
commit ed8ccc3b20
8 changed files with 397 additions and 173 deletions

View File

@ -12,7 +12,8 @@ FONT_OBJS = 01.us.une.cf 02.clintonv1.cf 03.reactive.cf 04.danpaymar.cf \
15.frenchenh.cf 16.frenchune.cf 17.hebrewenh.cf 18.hebrewune.cf \
19.plus.enh.cf 1a.plus.une.cf 1b.katakana.cf 1c.cyrillic.cf \
1d.greek.cf 1e.esperanto.cf 1f.videx.cf 20.plus.une.cf \
21.us.enh.cf 22.us.enh.cf 23.cyrillic.cf 24.pcbold.cf
21.us.enh.cf 22.us.enh.cf 23.cyrillic.cf 24.pcbold.cf \
25.aniron.cf
SYSTEM_TARGETS = menu
BASE_TARGETS = menu config fontmgr
@ -77,6 +78,12 @@ disks: $(addprefix $(OBJDIR)/,$(addsuffix .po,$(DISK_TARGETS)))
$(OBJDIR)/%.xf: fonts/00.us.enh.pf fonts/%.pf
tools/xorfont US.ENH....00.PF $^ $@
$(OBJDIR)/1a.plus.une.xf: fonts/19.plus.enh.pf fonts/1a.plus.une.pf
tools/xorfont PLUS.ENH..19.PF $^ $@
$(OBJDIR)/20.plus.une.xf: fonts/19.plus.enh.pf fonts/20.plus.une.pf
tools/xorfont PLUS.ENH..19.PF $^ $@
$(OBJDIR)/%.cf: $(OBJDIR)/%.xf
tools/rlefont $< $@
@ -124,7 +131,7 @@ $(OBJDIR)/disk525b.po: $(addprefix $(OBJDIR)/,$(addsuffix .base,$(DISK525B_OBJS)
java -jar $(AC) -p $@ VDRIVE/VSDRIVE SYS 0x2000 <adtpro/vsdrive
java -jar $(AC) -p $@ VDRIVE/VSDRIVE.LOW SYS 0x2000 <adtpro/vsdrive.low
$(OBJDIR)/disk525c.po: $(OBJDIR)/menu.system $(addprefix $(OBJDIR)/,$(addsuffix .base,$(DISK525B_OBJS))) $(addprefix $(OBJDIR)/,$(addsuffix .enh,$(DISK525B_OBJS)))
$(OBJDIR)/disk525c.po: $(OBJDIR)/menu.system fonts $(addprefix $(OBJDIR)/,$(addsuffix .base,$(DISK525C_OBJS))) $(addprefix $(OBJDIR)/,$(addsuffix .enh,$(DISK525C_OBJS)))
@cp prodos/pd525.po $@
java -jar $(AC) -n $@ FONTS
java -jar $(ACX) mkdir -d=$@ FONTS
@ -150,7 +157,7 @@ $(OBJDIR)/disk525c.po: $(OBJDIR)/menu.system $(addprefix $(OBJDIR)/,$(addsuffix
java -jar $(AC) -p $@ FONTMGR.BASE SYS 0x2000 <$(OBJDIR)/fontmgr.base
java -jar $(AC) -p $@ FONTMGR.ENH SYS 0x2000 <$(OBJDIR)/fontmgr.enh
$(OBJDIR)/disk525d.po: $(OBJDIR)/menu.system $(addprefix $(OBJDIR)/,$(addsuffix .base,$(DISK525B_OBJS))) $(addprefix $(OBJDIR)/,$(addsuffix .enh,$(DISK525B_OBJS)))
$(OBJDIR)/disk525d.po: $(OBJDIR)/menu.system fonts $(addprefix $(OBJDIR)/,$(addsuffix .base,$(DISK525D_OBJS))) $(addprefix $(OBJDIR)/,$(addsuffix .enh,$(DISK525D_OBJS)))
@cp prodos/pd525.po $@
java -jar $(AC) -n $@ FONTS
java -jar $(ACX) mkdir -d=$@ FONTS
@ -165,17 +172,19 @@ $(OBJDIR)/disk525d.po: $(OBJDIR)/menu.system $(addprefix $(OBJDIR)/,$(addsuffix
java -jar $(AC) -p $@ FONTS/HEBREWENH.17.CF BIN 0xCF27 <$(OBJDIR)/17.hebrewenh.cf
java -jar $(AC) -p $@ FONTS/HEBREWUNE.18.CF BIN 0xCF27 <$(OBJDIR)/18.hebrewune.cf
java -jar $(AC) -p $@ FONTS/PLUS.ENH..19.PF BIN 0xF027 <fonts/19.plus.enh.pf
java -jar $(AC) -p $@ FONTS/PLUS.UNE..1A.PF BIN 0xF027 <fonts/1a.plus.une.pf
java -jar $(AC) -p $@ FONTS/PLUS.UNE..1A.CF BIN 0xCF27 <$(OBJDIR)/1a.plus.une.cf
java -jar $(AC) -p $@ FONTS/KATAKANA..1B.PF BIN 0xF027 <fonts/1b.katakana.pf
java -jar $(AC) -p $@ FONTS/CYRILLIC..1C.CF BIN 0xCF27 <$(OBJDIR)/1c.cyrillic.cf
java -jar $(AC) -p $@ FONTS/GREEK.....1D.CF BIN 0xCF27 <$(OBJDIR)/1d.greek.cf
java -jar $(AC) -p $@ FONTS/ESPERANTO.1E.CF BIN 0xCF27 <$(OBJDIR)/1e.esperanto.cf
java -jar $(AC) -p $@ FONTS/VIDEX.....1F.CF BIN 0xCF27 <$(OBJDIR)/1f.videx.cf
java -jar $(AC) -p $@ FONTS/PLUS.UNE..20.PF BIN 0xF027 <fonts/20.plus.une.pf
java -jar $(AC) -p $@ FONTS/PLUS.UNE..20.CF BIN 0xCF27 <$(OBJDIR)/20.plus.une.cf
java -jar $(AC) -p $@ FONTS/US.ENH....21.CF BIN 0xCF27 <$(OBJDIR)/21.us.enh.cf
java -jar $(AC) -p $@ FONTS/US.ENH....22.CF BIN 0xCF27 <$(OBJDIR)/22.us.enh.cf
java -jar $(AC) -p $@ FONTS/CYRILLIC..23.CF BIN 0xCF27 <$(OBJDIR)/23.cyrillic.cf
java -jar $(AC) -p $@ FONTS/PCBOLD....24.CF BIN 0xCF27 <$(OBJDIR)/24.pcbold.cf
java -jar $(AC) -p $@ FONTS/ANIRON....25.CF BIN 0xCF27 <$(OBJDIR)/25.aniron.cf
java -jar $(AC) -p $@ FONTS/ANIRON....25.PF BIN 0xF027 <fonts/25.aniron.pf
java -jar $(AC) -p $@ MENU.SYSTEM SYS 0x2000 <$(OBJDIR)/menu.system
java -jar $(AC) -p $@ MENU.BASE SYS 0x2000 <$(OBJDIR)/menu.base
java -jar $(AC) -p $@ MENU.ENH SYS 0x2000 <$(OBJDIR)/menu.enh
@ -228,17 +237,19 @@ $(OBJDIR)/disk35.po: $(OBJDIR)/menu.system $(addprefix $(OBJDIR)/,$(addsuffix .b
java -jar $(AC) -p $@ FONTS/HEBREWENH.17.CF BIN 0xCF27 <$(OBJDIR)/17.hebrewenh.cf
java -jar $(AC) -p $@ FONTS/HEBREWUNE.18.CF BIN 0xCF27 <$(OBJDIR)/18.hebrewune.cf
java -jar $(AC) -p $@ FONTS/PLUS.ENH..19.PF BIN 0xF027 <fonts/19.plus.enh.pf
java -jar $(AC) -p $@ FONTS/PLUS.UNE..1A.PF BIN 0xF027 <fonts/1a.plus.une.pf
java -jar $(AC) -p $@ FONTS/PLUS.UNE..1A.CF BIN 0xCF27 <$(OBJDIR)/1a.plus.une.cf
java -jar $(AC) -p $@ FONTS/KATAKANA..1B.PF BIN 0xF027 <fonts/1b.katakana.pf
java -jar $(AC) -p $@ FONTS/CYRILLIC..1C.CF BIN 0xCF27 <$(OBJDIR)/1c.cyrillic.cf
java -jar $(AC) -p $@ FONTS/GREEK.....1D.CF BIN 0xCF27 <$(OBJDIR)/1d.greek.cf
java -jar $(AC) -p $@ FONTS/ESPERANTO.1E.CF BIN 0xCF27 <$(OBJDIR)/1e.esperanto.cf
java -jar $(AC) -p $@ FONTS/VIDEX.....1F.CF BIN 0xCF27 <$(OBJDIR)/1f.videx.cf
java -jar $(AC) -p $@ FONTS/PLUS.UNE..20.PF BIN 0xCF27 <fonts/20.plus.une.pf
java -jar $(AC) -p $@ FONTS/PLUS.UNE..20.CF BIN 0xCF27 <$(OBJDIR)/20.plus.une.cf
java -jar $(AC) -p $@ FONTS/US.ENH....21.CF BIN 0xCF27 <$(OBJDIR)/21.us.enh.cf
java -jar $(AC) -p $@ FONTS/US.ENH....22.CF BIN 0xCF27 <$(OBJDIR)/22.us.enh.cf
java -jar $(AC) -p $@ FONTS/CYRILLIC..23.CF BIN 0xCF27 <$(OBJDIR)/23.cyrillic.cf
java -jar $(AC) -p $@ FONTS/PCBOLD....24.CF BIN 0xCF27 <$(OBJDIR)/24.pcbold.cf
java -jar $(AC) -p $@ FONTS/ANIRON....25.CF BIN 0xCF27 <$(OBJDIR)/25.aniron.cf
java -jar $(AC) -p $@ FONTS/ANIRON....25.PF BIN 0xF027 <fonts/25.aniron.pf
java -jar $(AC) -p $@ MENU.BASE SYS 0x2000 <$(OBJDIR)/menu.base
java -jar $(AC) -p $@ MENU.ENH SYS 0x2000 <$(OBJDIR)/menu.enh
java -jar $(AC) -p $@ CONFIG.BASE SYS 0x2000 <$(OBJDIR)/config.base

BIN
fonts/25.aniron.pf Normal file

Binary file not shown.

View File

@ -1,7 +1,7 @@
#define NEWCONFIG_MAGIC 0x0001434E // "NC\x01\x00"
#define NEWCONFIG_EOF_MARKER 0x00464F45 // "EOF\x00"
#define CFGTOKEN_REVISION 0x0001434E // "RV\xXX\x00"
#define CFGTOKEN_REVISION 0x00015652 // "RV\xXX\x00"
#define CFGTOKEN_MODE_VGA 0x0000564D // "MV\x00\x00" VGA
#define CFGTOKEN_MODE_PCPI 0x00005A4D // "MZ\x00\x00" PCPI Applicard
@ -41,6 +41,8 @@
#define CFGTOKEN_JD_HOST 0x0000484A // "JH\x00\x01" JetDirect Hostname
#define CFGTOKEN_JD_PORT 0x0200444A // "JD\x00\x01" JetDirect Port
#define CFGTOKEN_FONT_00 0x00004656 // "VF\xXX\x00" Custom default font
#define CFGTOKEN_MONO_00 0x00005056 // "VP\x00\x00" Full Color Video
#define CFGTOKEN_MONO_80 0x00805056 // "VP\x80\x00" B&W Video
#define CFGTOKEN_MONO_90 0x00905056 // "VP\x90\x00" B&W Inverse

View File

@ -373,6 +373,9 @@ int parse_config() {
case CFGTOKEN_HOST_PRAVETZ:
machine = MACHINE_PRAVETZ;
break;
case CFGTOKEN_HOST_BASIS:
machine = MACHINE_BASIS;
break;
case CFGTOKEN_MUX_LOOP:
serialmux[(ptr[i] >> 16) & 1] = SERIAL_LOOP;
break;
@ -405,11 +408,11 @@ int parse_config() {
break;
case CFGTOKEN_WIFI_SSID:
memset(wifi_ssid, 0, sizeof(wifi_ssid));
strncpy(wifi_ssid, (char*)(ptr+1), (ptr[i] >> 24));
strncpy(wifi_ssid, (char*)(&ptr[i+1]), (ptr[i] >> 24));
break;
case CFGTOKEN_WIFI_PSK:
memset(wifi_psk, 0, sizeof(wifi_psk));
strncpy(wifi_psk, (char*)(ptr+1), (ptr[i] >> 24));
strncpy(wifi_psk, (char*)(&ptr[i+1]), (ptr[i] >> 24));
break;
case CFGTOKEN_WIFI_IP:
wifi_address = ptr[i+1];
@ -419,11 +422,25 @@ int parse_config() {
break;
case CFGTOKEN_JD_HOST:
memset(jd_host, 0, sizeof(jd_host));
strncpy(jd_host, (char*)(ptr+1), (ptr[i] >> 24));
strncpy(jd_host, (char*)(&ptr[i+1]), (ptr[i] >> 24));
break;
case CFGTOKEN_JD_PORT:
jd_port = ptr[i+1];
break;
case CFGTOKEN_FONT_00:
default_font = (ptr[i] >> 16) & 0x2F;
break;
case CFGTOKEN_MONO_00:
mono_palette = (ptr[i] >> 20) & 0xF;
if(mono_palette) mono_palette = (mono_palette & 0x7) + 1;
break;
case CFGTOKEN_TBCOLOR:
terminal_fgcolor = (ptr[i] >> 20) & 0xF;
terminal_bgcolor = (ptr[i] >> 16) & 0xF;
break;
case CFGTOKEN_BORDER:
terminal_border = (ptr[i] >> 16) & 0xF;
break;
}
// Advance by the number of dwords for this token
@ -437,11 +454,17 @@ int build_config(uint32_t rev) {
int i = 0;
uint32_t *ptr = (uint32_t*)blockbuffer;
memset(blockbuffer, 0, sizeof(blockbuffer));
memset(blockbuffer, 0xFF, sizeof(blockbuffer));
ptr[i++] = NEWCONFIG_MAGIC;
ptr[i++] = CFGTOKEN_REVISION | ((rev & 0xff) << 16);
ptr[i++] = CFGTOKEN_MONO_00 | ((((uint32_t)mono_palette) & 0xF) << 20);
ptr[i++] = CFGTOKEN_FONT_00 | ((((uint32_t)default_font) & 0x2F) << 20);
if(mono_palette) {
ptr[i++] = CFGTOKEN_MONO_80 | ((((uint32_t)mono_palette-1) & 0xF) << 20);
} else {
ptr[i++] = CFGTOKEN_MONO_00;
}
ptr[i++] = CFGTOKEN_TBCOLOR | ((((uint32_t)terminal_fgcolor) & 0xF) << 20) | ((((uint32_t)terminal_bgcolor) & 0xF) << 16);
ptr[i++] = CFGTOKEN_BORDER | ((((uint32_t)terminal_border) & 0xF) << 16);
@ -529,11 +552,11 @@ int build_config(uint32_t rev) {
}
ptr[i++] = CFGTOKEN_WIFI_SSID | (((uint32_t)strlen(wifi_ssid)+1) << 24);
strncpy((char*)ptr, wifi_ssid, 31);
strncpy((char*)(&ptr[i]), wifi_ssid, longmin(strlen(wifi_ssid)+1,31));
i += (strlen(wifi_ssid)+4) >> 2;
ptr[i++] = CFGTOKEN_WIFI_PSK | (((uint32_t)strlen(wifi_psk)+1) << 24);
strncpy((char*)ptr, wifi_psk, 31);
strncpy((char*)(&ptr[i]), wifi_psk, longmin(strlen(wifi_psk)+1,31));
i += (strlen(wifi_psk)+4) >> 2;
ptr[i++] = CFGTOKEN_WIFI_IP;
@ -543,12 +566,14 @@ int build_config(uint32_t rev) {
ptr[i++] = wifi_netmask;
ptr[i++] = CFGTOKEN_JD_HOST | (((uint32_t)strlen(jd_host)+1) << 24);
strncpy((char*)ptr, jd_host, 31);
strncpy((char*)(&ptr[i]), jd_host, longmin(strlen(jd_host)+1,31));
ptr += (strlen(jd_host)+4) >> 2;
ptr[i++] = CFGTOKEN_JD_PORT;
ptr[i++] = jd_port;
ptr[i++] = NEWCONFIG_EOF_MARKER;
return i*4;
}
@ -604,7 +629,7 @@ void cfgfile_upload(char *pdfile, uint16_t block) {
CF_PTRL = 0;
CF_PTRH = 0;
for(i = 0; i < sizeof(blockbuffer); i++) {
CF_DATA = blockbuffer[i];
CF_DATW = blockbuffer[i];
}
if(cfg_cmd1("fw", block)) {
@ -664,7 +689,7 @@ void cfgfile_download(char *pdfile, uint16_t block) {
CF_PTRL = 0;
CF_PTRH = 0;
for(i = 0; i < sizeof(blockbuffer); i++) {
blockbuffer[i] = CF_DATA;
blockbuffer[i] = CF_DATR;
}
byteswritten = fwrite(blockbuffer, 1, sizeof(blockbuffer), f);
@ -688,7 +713,7 @@ cleanup:
}
void restore_config() {
uint16_t next;
uint16_t last, next;
// Get current config blocks
if(cfg_cmd0("fc")) {
@ -699,11 +724,25 @@ void restore_config() {
ok_button();
return;
}
next = RPY_BUFFER[5];
next <<= 8;
next |= RPY_BUFFER[4];
last = RPY_BUFFER[3];
last <<= 8;
last |= RPY_BUFFER[2];
if(cfg_cmd1("fe", last)) {
backdrop(PROGNAME);
window(" Error ", 28, 7, 1);
gotoy(11); gotox(7);
cprintf("Unable to erase block $%4X", block);
ok_button();
goto cleanup;
}
cfgfile_upload("CONFIG.BACKUP", next);
}
@ -732,7 +771,7 @@ cleanup:
void read_config() {
int i;
uint16_t last;
uint16_t next, last;
backdrop(PROGNAME);
window(" Please Wait ", 26, 6, 1);
@ -768,7 +807,7 @@ void read_config() {
CF_PTRL = 0;
CF_PTRH = 0;
for(i = 0; i < sizeof(blockbuffer); i++) {
blockbuffer[i] = CF_DATA;
blockbuffer[i] = CF_DATR;
}
parse_config();
@ -817,7 +856,7 @@ int write_config() {
CF_PTRL = 0;
CF_PTRH = 0;
for(i = 0; i < sizeof(blockbuffer); i++) {
CF_DATA = blockbuffer[i];
CF_DATW = blockbuffer[i];
}
if(cfg_cmd1("fw", next)) {
@ -876,12 +915,14 @@ int format_card(void) {
goto cleanup;
}
last = RPY_BUFFER[3];
last <<= 8;
last |= RPY_BUFFER[2];
next = RPY_BUFFER[5];
next <<= 8;
next |= RPY_BUFFER[4];
last = RPY_BUFFER[3];
last <<= 8;
last |= RPY_BUFFER[2];
if(last != next) {
if(cfg_cmd1("fe", last)) {
backdrop(PROGNAME);
@ -1636,12 +1677,9 @@ void main (void) {
int selected_item = 0;
int y = 12 - 6;
#if 0
if(!prompt_slot(PROGNAME)) {
exec("MENU.SYSTEM", "");
return;
goto cleanup;
}
#endif
switch(get_ostype() & 0xF0) {
default:
@ -1656,7 +1694,6 @@ void main (void) {
break;
}
#if 0
backdrop(PROGNAME);
window(" Please Wait ", 26, 6, 1);
gotoy(11); gotox(9);
@ -1665,13 +1702,12 @@ void main (void) {
cputs("your screen may flicker.");
read_config();
#endif
while(paint_menu >= 0) {
if(paint_menu == 2) {
backdrop(PROGNAME);
window(" Main Menu ", 24, 15, 0);
window(" Main Menu ", 26, 15, 0);
gotoy(y+5); gotox(8);
repeatchar(CHAR_BORDER_BOTTOM, 24);
gotoy(y+10); gotox(8);
@ -1762,5 +1798,11 @@ void main (void) {
break;
}
}
cleanup:
backdrop(PROGNAME);
gotoy(12); gotox(13);
cputs("Launching Menu");
exec("MENU.SYSTEM", "");
}

View File

@ -18,12 +18,12 @@ volatile uint16_t cardslot = 3;
#define RIGHT_ARROW 0xD5
#define DOWN_ARROW 0xCA
#else
#define UP_ARROW '^'
#define UP_ARROW ('+' | 0x80)
#define RIGHT_ARROW ('>' | 0x80)
#define DOWN_ARROW 'v'
#define DOWN_ARROW ('+' | 0x80)
#endif
#define FONT_MAX 18
#define FONT_MAX 15
int selected_entry = 0;
int top_entry = 0;
@ -40,6 +40,32 @@ char prefix[FILENAME_MAX];
char pathname[FILENAME_MAX];
char fontname[FILENAME_MAX];
typedef struct fontentry_s {
char pathname[FILENAME_MAX];
char fontname[FILENAME_MAX];
} fontentry_t;
fontentry_t fontlist[FONT_MAX];
void print_menu_select(char *str, int width, int highlighted, int selected) {
revers(highlighted);
if(selected) {
cputs(" [");
} else {
cputs(" ");
}
printlimited(str, width - 4);
if(selected) {
cputs("] ");
} else {
cputs(" ");
}
width -= longmin(width, strlen(str) + 4);
if(width > 0)
repeatchar(' ', width);
revers(0);
}
void print_menu_item(char *str, int highlighted) {
revers(highlighted);
cputs(str);
@ -47,6 +73,8 @@ void print_menu_item(char *str, int highlighted) {
}
void remove_font(uint16_t block) {
char dummy;
backdrop(PROGNAME);
window(" Please Wait ", 26, 6, 1);
gotoy(11); gotox(13);
@ -54,17 +82,23 @@ void remove_font(uint16_t block) {
gotoy(12); gotox(8);
cputs("your screen may flicker.");
if(cfg_cmd1("fe", block)) {
if(cfg_cmd1("Ce", block)) {
backdrop(PROGNAME);
message(" Error ", "Unable to erase block.");
return;
goto cleanup;
}
backdrop(PROGNAME);
message(" Success ", "Block erased.");
cleanup:
dummy = *(volatile char*)0xCFFF;
}
void upload_font(uint8_t *buffer) {
char dummy;
uint16_t i;
backdrop(PROGNAME);
window(" Please Wait ", 26, 6, 1);
gotoy(11); gotox(13);
@ -72,14 +106,23 @@ void upload_font(uint8_t *buffer) {
gotoy(12); gotox(8);
cputs("your screen may flicker.");
if(cfg_cmd1("CT", (uint16_t)buffer)) {
CF_PTRL = 0;
CF_PTRH = 0;
for(i = 0; i < 4096; i++) {
CF_DATW = buffer[i];
}
if(cfg_cmd0("CT")) {
backdrop(PROGNAME);
message(" Error ", "Communication Error");
return;
goto cleanup;
}
backdrop(PROGNAME);
message(" Success ", "Font uploaded.");
cleanup:
dummy = *(volatile char*)0xCFFF;
}
int write_font(uint8_t *buffer, uint16_t block) {
@ -90,16 +133,29 @@ int write_font(uint8_t *buffer, uint16_t block) {
backdrop(PROGNAME);
window(" Please Wait ", 26, 6, 1);
gotoy(11); gotox(13);
cputs("Flashing font,");
cputs("Erasing flash,");
gotoy(12); gotox(8);
cputs("your screen may flicker.");
dummy = *(volatile char*)0xCFFF;
for(i = 0; i < 4096; i++) {
CF_DATA = buffer[i];
if(cfg_cmd1("Ce", block)) {
backdrop(PROGNAME);
message(" Error ", "Unable to erase block.");
goto cleanup;
}
if(cfg_cmd1("fw", block)) {
backdrop(PROGNAME);
window(" Please Wait ", 26, 6, 1);
gotoy(11); gotox(13);
cputs("Writing flash,");
gotoy(12); gotox(8);
cputs("your screen may flicker.");
CF_PTRL = 0;
CF_PTRH = 0;
for(i = 0; i < 4096; i++) {
CF_DATW = buffer[i];
}
if(cfg_cmd1("Cw", block)) {
backdrop(PROGNAME);
message(" Error ", "Unable to write block.");
goto cleanup;
@ -126,15 +182,16 @@ int read_font(uint8_t *buffer, uint16_t block) {
gotoy(12); gotox(8);
cputs("your screen may flicker.");
dummy = *(volatile char*)0xCFFF;
if(cfg_cmd1("fr", block)) {
if(cfg_cmd1("Cr", block)) {
backdrop(PROGNAME);
message(" Error ", "Unable to read block.");
goto cleanup;
}
CF_PTRL = 0;
CF_PTRH = 0;
for(i = 0; i < 4096; i++) {
buffer[i] = CF_DATA;
buffer[i] = CF_DATR;
}
backdrop(PROGNAME);
@ -153,48 +210,48 @@ typedef struct font_slot_s {
} font_slot_t;
font_slot_t font_slot[] = {
{ " 00 US (Enh) ", 0x00 },
{ " 01 US (UnEnh) ", 0x01 },
{ " 02 Clinton Turner V1 ", 0x02 },
{ " 03 ReActiveMicro (Enh) ", 0x03 },
{ " 04 Dan Paymar (Enh) ", 0x04 },
{ " 05 Blippo Black (Enh) ", 0x05 },
{ " 06 Byte (Enh) ", 0x06 },
{ " 07 Colossal (Enh) ", 0x07 },
{ " 08 Count (Enh) ", 0x08 },
{ " 09 Flow (Enh) ", 0x09 },
{ " 0A Gothic (Enh) ", 0x0a },
{ " 0B Outline (Enh) ", 0x0b },
{ " 0C PigFont (Enh) ", 0x0c },
{ " 0D Pinocchio (Enh) ", 0x0d },
{ " 0E Slant (Enh) ", 0x0e },
{ " 0F Stop (Enh) ", 0x0f },
{ "00 US Enh", 0x00 },
{ "01 US UnEnh", 0x01 },
{ "02 Clinton Turner V1", 0x02 },
{ "03 ReActiveMicro Enh", 0x03 },
{ "04 Dan Paymar Enh", 0x04 },
{ "05 Blippo Black Enh", 0x05 },
{ "06 Byte Enh", 0x06 },
{ "07 Colossal Enh", 0x07 },
{ "08 Count Enh", 0x08 },
{ "09 Flow Enh", 0x09 },
{ "0A Gothic Enh", 0x0a },
{ "0B Outline Enh", 0x0b },
{ "0C PigFont Enh", 0x0c },
{ "0D Pinocchio Enh", 0x0d },
{ "0E Slant Enh", 0x0e },
{ "0F Stop Enh", 0x0f },
{ " 10 Euro (UnEnh) ", 0x10 },
{ " 11 Euro (Enh) ", 0x11 },
{ " 12 Clinton Turner V2 ", 0x12 },
{ " 13 German (Enh) ", 0x13 },
{ " 14 German (UnEnh) ", 0x14 },
{ " 15 French (Enh) ", 0x15 },
{ " 16 French (UnEnh) ", 0x16 },
{ " 17 Hebrew (Enh) ", 0x17 },
{ " 18 Hebrew (UnEnh) ", 0x18 },
{ " 19 Apple II+ (Enh) ", 0x19 },
{ " 1A Apple II+ (UnEnh) ", 0x1a },
{ " 1B Katakana (Enh) ", 0x1b },
{ " 1C Cyrillic (Enh) ", 0x1c },
{ " 1D Greek (Enh) ", 0x1d },
{ " 1E Esperanto (Enh) ", 0x1e },
{ " 1F Videx (Enh) ", 0x1f },
{ "10 Euro UnEnh", 0x10 },
{ "11 Euro Enh", 0x11 },
{ "12 Clinton Turner V2", 0x12 },
{ "13 German Enh", 0x13 },
{ "14 German UnEnh", 0x14 },
{ "15 French Enh", 0x15 },
{ "16 French UnEnh", 0x16 },
{ "17 Hebrew Enh", 0x17 },
{ "18 Hebrew UnEnh", 0x18 },
{ "19 Apple II+ Enh", 0x19 },
{ "1A Apple II+ UnEnh", 0x1a },
{ "1B Katakana Enh", 0x1b },
{ "1C Cyrillic Enh", 0x1c },
{ "1D Greek Enh", 0x1d },
{ "1E Esperanto Enh", 0x1e },
{ "1F Videx Enh", 0x1f },
{ " 20 Apple II/II+ ", 0x20 },
{ " 21 Apple IIe ", 0x21 },
{ " 22 Apple IIgs ", 0x22 },
{ " 23 Pravetz ", 0x23 },
{ " 24 Custom ", 0x24 },
{ " 25 Custom ", 0x25 },
{ " 26 Custom ", 0x26 },
{ " 27 Custom ", 0x27 },
{ "20 Apple II/II+", 0x20 },
{ "21 Apple IIe", 0x21 },
{ "22 Apple IIgs", 0x22 },
{ "23 Pravetz", 0x23 },
{ "24 Custom", 0x24 },
{ "25 Custom", 0x25 },
{ "26 Custom", 0x26 },
{ "27 Custom", 0x27 },
};
uint8_t parsehex8(char *str) {
@ -227,62 +284,95 @@ uint8_t parsehex8(char *str) {
}
int slot_menu() {
int paint_menu = 2;
int paint_menu = 0x7;
int selected_slot = 0;
int top = 0;
int y, i;
uint8_t block = parsehex8(fontname);
int total_slots = (sizeof(font_slot)/sizeof(font_slot_t));
#if 0
// Try to find a matching slot from our table
for(i = 0; i < (sizeof(font_slot)/sizeof(font_slot_t)); i++) {
if(block == font_slot[i].block) {
selected_slot = i;
top = (selected_slot / 15) * 15;
top = (selected_slot / FONT_MAX) * FONT_MAX;
break;
}
}
#endif
while(paint_menu >= 0) {
if(paint_menu == 2) {
while(paint_menu != -1) {
if(paint_menu & 0x4) {
backdrop(PROGNAME);
window(" Font Slot? ", 24, 17, 0);
paint_menu = 1;
window(" Font Slot? ", 28, FONT_MAX+2, 0);
}
if(paint_menu > 0) {
if(paint_menu & 0x2) {
y=5;
if((top > 0) || (total_slots >= (FONT_MAX+top))) {
for(i = 1; i < FONT_MAX-1; i++) {
gotoy(y+i); gotox(31);
cputc(CHAR_SCROLLBAR_LEFT);
if(((i < (FONT_MAX / 3)) && (top < (total_slots / 3))) ||
((i >= (FONT_MAX / 3)) && (i < ((FONT_MAX * 2) / 3)) && (top >= (total_slots / 3)) && (top < (total_slots * 2) / 3)) ||
((i >= ((FONT_MAX * 2) / 3)) && (top >= ((total_slots * 2) / 3)))) {
cputc(CHAR_SCROLLBAR_FULL);
} else {
cputc(CHAR_SCROLLBAR_EMPTY);
}
cputc(CHAR_SCROLLBAR_RIGHT);
}
gotoy(y-1); gotox(32);
cputc(CHAR_SCROLLBAR_TOP);
gotoy(y+0); gotox(31);
cputc(CHAR_SCROLLBAR_LEFT);
cputc(UP_ARROW);
cputc(CHAR_SCROLLBAR_RIGHT);
gotoy(y+FONT_MAX-1); gotox(31);
cputc(CHAR_SCROLLBAR_LEFT);
cputc(DOWN_ARROW);
cputc(CHAR_SCROLLBAR_RIGHT);
gotoy(y+FONT_MAX); gotox(32);
cputc(CHAR_SCROLLBAR_BOTTOM);
}
}
if(paint_menu & 0x1) {
for(y = 0; y < 15; y++) {
i = y+top;
if(i < (sizeof(font_slot)/sizeof(font_slot_t))) {
gotoy(5+y); gotox(9);
print_menu_item(font_slot[i].entry, (selected_slot == i));
gotoy(5+y); gotox(7);
print_menu_select(font_slot[i].entry, 24, (selected_slot == i), 0);
} else {
gotoy(5+y); gotox(9);
repeatchar(' ', 22);
gotoy(5+y); gotox(7);
repeatchar(' ', 24);
}
}
paint_menu = 0;
}
paint_menu = 0;
switch(cgetc()) {
case 0x08:
case 0x0B:
if(selected_slot > 0) {
selected_slot--;
if(selected_slot < top)
paint_menu |= 1;
if(selected_slot < top) {
top = (selected_slot / 15) * 15;
paint_menu |= 2;
}
}
paint_menu = 1;
break;
case 0x0A:
case 0x15:
if(selected_slot < ((sizeof(font_slot)/sizeof(font_slot_t))-1)) {
selected_slot++;
if(selected_slot > top + 14)
paint_menu |= 1;
if(selected_slot > top + 14) {
top = (selected_slot / 15) * 15;
paint_menu |= 2;
}
}
paint_menu = 1;
break;
case 0x1B:
return -1;
@ -379,6 +469,12 @@ int open_fontdir(void) {
ext = strrchr (ent->d_name, '.');
if (!ext || (strcasecmp (ext, ".pf") && strcasecmp (ext, ".cf")))
continue;
if (total_fonts < (sizeof(fontlist)/sizeof(fontentry_t))) {
strcpy(fontlist[total_fonts].pathname, prefix);
strcat(fontlist[total_fonts].pathname, ent->d_name);
strcpy(fontlist[total_fonts].fontname, ent->d_name);
}
total_fonts++;
}
@ -481,7 +577,8 @@ int load_font(void) {
i = 0;
while(i < 2048) {
fontbuffer[i++] ^= filebuffer[i++];
fontbuffer[i] ^= filebuffer[i];
i++;
}
fclose(f);
}
@ -524,12 +621,7 @@ void index_fonts(void) {
rewinddir(fontdir);
backdrop(PROGNAME);
line_count = 0;
if(top_entry > 0) {
gotoy(2); gotox(1);
cputc(UP_ARROW);
}
while (ent = readdir(fontdir)) {
ext = strrchr (ent->d_name, '.');
if (!ext || (strcasecmp (ext, ".pf") && strcasecmp (ext, ".cf")))
@ -542,25 +634,14 @@ void index_fonts(void) {
}
if(line_count < FONT_MAX) {
gotoy(3+line_count);
if(current_entry == selected_entry) {
gotox(1);
cputc(RIGHT_ARROW);
arrow_line = 3+line_count;
}
gotox(3);
printlimited(ent->d_name, 32);
cputs("\r\n");
strcpy(fontlist[line_count].pathname, prefix);
strcat(fontlist[line_count].pathname, ent->d_name);
strcpy(fontlist[line_count].fontname, ent->d_name);
current_entry++;
line_count++;
}
}
more_fonts = (total_fonts > current_entry);
if(more_fonts) {
gotoy(21); gotox(1);
cputc(DOWN_ARROW);
}
}
int select_font(void) {
@ -571,13 +652,13 @@ int select_font(void) {
if(load_font()) {
action_menu();
}
return 1;
return 0xB;
case 'T':
case 't':
if(load_font()) {
upload_font(fontbuffer);
}
return 1;
return 0xB;
case 'I':
case 'i':
if(load_font()) {
@ -586,7 +667,7 @@ int select_font(void) {
write_font(fontbuffer, font_slot[selected_slot].block);
}
}
return 1;
return 0xB;
case 0x08:
case 0x0B:
// Left (UP)
@ -599,19 +680,12 @@ int select_font(void) {
// Entry is on the same page, don't re-read the disk directory
if((selected_entry >= top_entry) && (selected_entry < (top_entry + line_count))) {
gotoy(arrow_line); gotox(1);
cputc(' ');
arrow_line = 3+(selected_entry - top_entry);
gotoy(arrow_line); gotox(1);
cputc(RIGHT_ARROW);
break;
return 0x1;
} else {
// Entry is on another page, re-read the disk directory
top_entry = (selected_entry / FONT_MAX) * FONT_MAX;
return 1;
return 0x7;
}
return 1;
return 0;
case 0x0A:
case 0x15:
// Right (DOWN)
@ -624,36 +698,89 @@ int select_font(void) {
// Entry is on the same page, don't re-read the disk directory
if((selected_entry >= top_entry) && (selected_entry < (top_entry + line_count))) {
gotoy(arrow_line); gotox(1);
cputc(' ');
arrow_line = 3+(selected_entry - top_entry);
gotoy(arrow_line); gotox(1);
cputc(RIGHT_ARROW);
break;
return 0x1;
} else {
// Entry is on another page, re-read the disk directory
top_entry = (selected_entry / FONT_MAX) * FONT_MAX;
return 1;
return 0x7;
}
return 1;
return 0;
case 0x1B:
// Abort
return 0;
return -1;
}
}
}
void browse_fonts(void) {
int paint_menu = 0xF;
int i;
int y = 12 - 7;
if(!open_fontdir()) {
backdrop(PROGNAME);
message(" Error ", "Unable to open font folder.");
return;
}
do {
index_fonts();
} while(select_font());
while(paint_menu >= 0) {
if(paint_menu & 0x8) {
backdrop(PROGNAME);
window(" Font Browser ", 26, 17, 0);
}
if(paint_menu & 0x4) {
top_entry = (selected_entry / FONT_MAX) * FONT_MAX;
index_fonts();
}
if(paint_menu & 0x2) {
more_fonts = (total_fonts >= (FONT_MAX+top_entry));
if((top_entry > 0) || (more_fonts)) {
for(i = 1; i < FONT_MAX-1; i++) {
gotoy(y+i); gotox(30);
cputc(CHAR_SCROLLBAR_LEFT);
if(i < (FONT_MAX / 3)) {
if(top_entry > (total_fonts / 3)) {
cputc(CHAR_SCROLLBAR_EMPTY);
} else {
cputc(CHAR_SCROLLBAR_FULL);
}
} else if(i < ((FONT_MAX * 2) / 3)) {
cputc(CHAR_SCROLLBAR_FULL);
} else {
if(top_entry < (total_fonts / 3)) {
cputc(CHAR_SCROLLBAR_EMPTY);
} else {
cputc(CHAR_SCROLLBAR_FULL);
}
}
cputc(CHAR_SCROLLBAR_RIGHT);
}
gotoy(y-1); gotox(31);
cputc(CHAR_SCROLLBAR_TOP);
gotoy(y+0); gotox(30);
cputc(CHAR_SCROLLBAR_LEFT);
cputc(UP_ARROW);
cputc(CHAR_SCROLLBAR_RIGHT);
gotoy(y+FONT_MAX-1); gotox(30);
cputc(CHAR_SCROLLBAR_LEFT);
cputc(DOWN_ARROW);
cputc(CHAR_SCROLLBAR_RIGHT);
gotoy(y+FONT_MAX); gotox(31);
cputc(CHAR_SCROLLBAR_BOTTOM);
}
}
if(paint_menu & 0x1) {
for(i = 0; i < longmin((total_fonts-top_entry), FONT_MAX); i++) {
gotoy(y+i); gotox(8);
print_menu_select(fontlist[i].fontname, 22, (selected_entry == i+top_entry), 0);
}
while(i < FONT_MAX) {
gotoy(y+i); gotox(8);
repeatchar(' ', 22);
i++;
}
}
paint_menu = select_font();
};
closedir(fontdir);
}
@ -679,6 +806,12 @@ int main_menu_action(int action) {
remove_font(font_slot[selected_slot].block);
}
return 2;
case 3:
selected_slot = slot_menu();
if(selected_slot >= 0) {
CARD_REGISTER(0x0B) = selected_slot;
}
return 2;
}
return 1;
}
@ -690,21 +823,21 @@ void main_menu(void) {
for(;;) {
if(paint_menu == 2) {
backdrop(PROGNAME);
window(" Main Menu ", 24, 7, 0);
window(" Main Menu ", 26, 9, 0);
paint_menu = 1;
}
if(paint_menu > 0) {
gotoy(10); gotox(9);
revers(selected_action == 0);
cputs(" Browse fonts ");
gotoy(9); gotox(8);
print_menu_select("Browse fonts", 24, (selected_action == 0), 0);
gotoy(12); gotox(9);
revers(selected_action == 1);
cputs(" Download stored font ");
gotoy(11); gotox(8);
print_menu_select("Download stored font", 24, (selected_action == 1), 0);
gotoy(14); gotox(9);
revers(selected_action == 2);
cputs(" Remove stored font ");
gotoy(13); gotox(8);
print_menu_select("Remove stored font", 24, (selected_action == 2), 0);
gotoy(15); gotox(8);
print_menu_select("Select current font", 24, (selected_action == 3), 0);
revers(0);
paint_menu = 0;
@ -723,6 +856,10 @@ void main_menu(void) {
case 'r':
paint_menu = main_menu_action(selected_action = 2);
break;
case 'S':
case 's':
paint_menu = main_menu_action(selected_action = 3);
break;
case 0x08:
case 0x0B:
if(selected_action > 0)
@ -731,11 +868,12 @@ void main_menu(void) {
break;
case 0x0A:
case 0x15:
if(selected_action < 2)
if(selected_action < 3)
selected_action++;
paint_menu = 1;
break;
case 0x1B:
backdrop(PROGNAME);
if(confirm(" Are you sure? ", "Quit the Font Manager?"))
return;
@ -751,8 +889,7 @@ void main_menu(void) {
void main (void) {
if(!prompt_slot(PROGNAME)) {
exec("MENU.SYSTEM", "");
return;
goto cleanup;
}
backdrop(PROGNAME);
@ -760,6 +897,11 @@ void main (void) {
cputs("Indexing Fonts");
main_menu();
clrscr();
cleanup:
backdrop(PROGNAME);
gotoy(12); gotox(13);
cputs("Launching Menu");
exec("MENU.SYSTEM", "");
}

View File

@ -45,8 +45,8 @@ menu_t launcher[] = {
{ 0, MENU_LAUNCH_NOCHECKARGS, " Font Manager ", "FONTMGR.ENH", "FONTMGR.BASE", "" },
{ 0, MENU_SEPARATOR, NULL, NULL, NULL, NULL },
{ 0, MENU_LAUNCH_NOCHECKARGS, " Applesoft Basic ", "BASIC.SYSTEM", "BASIC.SYSTEM", "" },
{ 0, MENU_LAUNCH_NOCHECKARGS, " ADTPRO ", "ADTPRO/ADTPRO", "ADTPRO/ADTPRO", "" },
{ 0, MENU_LAUNCH_NOCHECKARGS, " VSDRIVE ", "VDRIVE/VSDRIVE", "VDRIVE/VSDRIVE", "" },
{ 0, MENU_LAUNCH_NOCHECKARGS, " ADTPro Serial ", "ADTPRO/ADTPRO", "ADTPRO/ADTPRO", "" },
{ 0, MENU_LAUNCH_NOCHECKARGS, " Virtual Serial Drive ", "VDRIVE/VSDRIVE", "VDRIVE/VSDRIVE", "" },
{ 0, MENU_SEPARATOR, NULL, NULL, NULL, NULL },
{ 1, MENU_EXIT, " Exit ", NULL, NULL, NULL },
{ 0, MENU_TERMINATOR, NULL, NULL, NULL, NULL },
@ -72,12 +72,22 @@ int main_menu_action(int action) {
f = fopen(launcher[action].filename_enhanced, "rb");
if(f != NULL) {
fclose(f);
backdrop(PROGNAME);
gotoy(12); gotox(9);
cputs("Launching Application");
exec(launcher[action].filename_enhanced, launcher[action].arguments);
}
#endif
f = fopen(launcher[action].filename_base, "rb");
if(f != NULL) {
fclose(f);
backdrop(PROGNAME);
gotoy(12); gotox(9);
cputs("Launching Application");
exec(launcher[action].filename_base, launcher[action].arguments);
}

View File

@ -12,6 +12,12 @@
#define CHAR_BORDER_TOP_LEFT 0xDA
#define CHAR_BORDER_TOP_RIGHT 0xDF
#define CHAR_TITLEBAR_FOLDER 0xD4
#define CHAR_SCROLLBAR_FULL 0xA0
#define CHAR_SCROLLBAR_EMPTY 0xD6
#define CHAR_SCROLLBAR_RIGHT 0xDF
#define CHAR_SCROLLBAR_LEFT 0xDA
#define CHAR_SCROLLBAR_TOP 0xDC
#define CHAR_SCROLLBAR_BOTTOM 0xDC
#define CHAR_BORDER_BOTTOM_LEFT ' '
#define CHAR_BORDER_BOTTOM_RIGHT ' '
#else
@ -25,6 +31,12 @@
#define CHAR_BORDER_TOP_LEFT '.'
#define CHAR_BORDER_TOP_RIGHT '.'
#define CHAR_TITLEBAR_FOLDER '_'
#define CHAR_SCROLLBAR_FULL 0xA0
#define CHAR_SCROLLBAR_EMPTY ':'
#define CHAR_SCROLLBAR_RIGHT ' '
#define CHAR_SCROLLBAR_LEFT ' '
#define CHAR_SCROLLBAR_TOP ' '
#define CHAR_SCROLLBAR_BOTTOM ' '
#define CHAR_BORDER_BOTTOM_LEFT '\''
#define CHAR_BORDER_BOTTOM_RIGHT '\''
#endif

View File

@ -7,9 +7,10 @@
#define VGA_TBCOLOR CARD_REGISTER(0x2)
#define VGA_BORDER CARD_REGISTER(0x3)
#define CF_PTRL *((volatile unsigned char *)(0xC0ED | (cardslot << 8)))
#define CF_PTRH *((volatile unsigned char *)(0xC0EE | (cardslot << 8)))
#define CF_DATA *((volatile unsigned char *)(0xC0EF | (cardslot << 8)))
#define CF_PTRL *((volatile unsigned char *)(0xC0EC | (cardslot << 8)))
#define CF_PTRH *((volatile unsigned char *)(0xC0ED | (cardslot << 8)))
#define CF_DATR *((volatile unsigned char *)(0xC0EE | (cardslot << 8)))
#define CF_DATW *((volatile unsigned char *)(0xC0EF | (cardslot << 8)))
#define CMD_BUFFER ((volatile unsigned char *)(0xC0F0 | (cardslot << 8)))
#define RPY_BUFFER ((volatile unsigned char *)(0xC0F8 | (cardslot << 8)))
@ -71,10 +72,12 @@ void hexprint(volatile uint8_t *buf, int size) {
int cfg_cmd3(char *cmd, uint16_t param0, uint16_t param1, uint16_t param2) {
uint16_t timeout = 0x1fff;
#if 0
gotoy(16); gotox(8);
cputc(cmd[0]);
cputc(cmd[1]);
cprintf(" $%04X $%04X $%04X", param0, param1, param2);
#endif
RPY_BUFFER[7] = 0xFF;
CMD_BUFFER[7] = (param2 >> 8) & 0xFF;
@ -103,8 +106,10 @@ int cfg_cmd3(char *cmd, uint16_t param0, uint16_t param1, uint16_t param2) {
if(timeout > 0) timeout--;
}
#if 0
gotoy(18); gotox(8);
hexprint(RPY_BUFFER, 8);
#endif
return (timeout == 0) || (RPY_BUFFER[0] != REPLY_OK);
}