Properly fixed the configuration variable and section delete functions;

Commented out the JEGA code.
This commit is contained in:
OBattler
2017-07-26 00:34:43 +02:00
parent 02f5d663d0
commit 8a01fc7ef2
6 changed files with 79 additions and 13 deletions

View File

@@ -45,6 +45,7 @@ static int old_overscan_color = 0;
int update_overscan = 0; int update_overscan = 0;
#ifdef JEGA
uint8_t jfont_sbcs_19[SBCS19_LEN]; /* 256 * 19( * 8) */ uint8_t jfont_sbcs_19[SBCS19_LEN]; /* 256 * 19( * 8) */
uint8_t jfont_dbcs_16[DBCS16_LEN]; /* 65536 * 16 * 2 (* 8) */ uint8_t jfont_dbcs_16[DBCS16_LEN]; /* 65536 * 16 * 2 (* 8) */
@@ -146,6 +147,7 @@ void ega_jega_read_font(ega_t *ega)
ega->font_index++; ega->font_index++;
ega->RSTAT |= 0x02; ega->RSTAT |= 0x02;
} }
#endif
void ega_out(uint16_t addr, uint8_t val, void *p) void ega_out(uint16_t addr, uint8_t val, void *p)
{ {
@@ -259,7 +261,11 @@ void ega_out(uint16_t addr, uint8_t val, void *p)
return; return;
case 0x3d1: case 0x3d1:
case 0x3d5: case 0x3d5:
#ifdef JEGA
if ((ega->crtcreg < 0xb9) || !ega->is_jega) if ((ega->crtcreg < 0xb9) || !ega->is_jega)
#else
if (ega->crtcreg < 0xb9)
#endif
{ {
crtcreg = ega->crtcreg & 0x1f; crtcreg = ega->crtcreg & 0x1f;
if (crtcreg <= 7 && ega->crtc[0x11] & 0x80) return; if (crtcreg <= 7 && ega->crtc[0x11] & 0x80) return;
@@ -274,6 +280,7 @@ void ega_out(uint16_t addr, uint8_t val, void *p)
} }
} }
} }
#ifdef JEGA
else else
{ {
switch(ega->crtcreg) switch(ega->crtcreg)
@@ -331,6 +338,7 @@ void ega_out(uint16_t addr, uint8_t val, void *p)
break; break;
} }
} }
#endif
break; break;
} }
} }
@@ -391,11 +399,16 @@ uint8_t ega_in(uint16_t addr, void *p)
return ega->crtcreg; return ega->crtcreg;
case 0x3d1: case 0x3d1:
case 0x3d5: case 0x3d5:
#ifdef JEGA
if ((ega->crtcreg < 0xb9) || !ega->is_jega) if ((ega->crtcreg < 0xb9) || !ega->is_jega)
#else
if (ega->crtcreg < 0xb9)
#endif
{ {
crtcreg = ega->crtcreg & 0x1f; crtcreg = ega->crtcreg & 0x1f;
return ega->crtc[crtcreg]; return ega->crtc[crtcreg];
} }
#ifdef JEGA
else else
{ {
switch(ega->crtcreg) switch(ega->crtcreg)
@@ -434,6 +447,8 @@ uint8_t ega_in(uint16_t addr, void *p)
return 0x00; return 0x00;
} }
} }
#endif
return 0xff;
case 0x3da: case 0x3da:
ega->attrff = 0; ega->attrff = 0;
ega->stat ^= 0x30; /*Fools IBM EGA video BIOS self-test*/ ega->stat ^= 0x30; /*Fools IBM EGA video BIOS self-test*/
@@ -534,6 +549,7 @@ void ega_poll(void *p)
{ {
if (fullchange) if (fullchange)
{ {
#ifdef JEGA
if (ega_jega_enabled(ega)) if (ega_jega_enabled(ega))
{ {
ega_render_text_jega(ega, drawcursor); ega_render_text_jega(ega, drawcursor);
@@ -542,6 +558,9 @@ void ega_poll(void *p)
{ {
ega_render_text_standard(ega, drawcursor); ega_render_text_standard(ega, drawcursor);
} }
#else
ega_render_text_standard(ega, drawcursor);
#endif
} }
} }
else else
@@ -1016,7 +1035,9 @@ void ega_common_defaults(ega_t *ega)
update_overscan = 0; update_overscan = 0;
#ifdef JEGA
ega->is_jega = 0; ega->is_jega = 0;
#endif
} }
void *ega_standalone_init() void *ega_standalone_init()
@@ -1138,6 +1159,7 @@ void *sega_standalone_init()
return ega; return ega;
} }
#ifdef JEGA
uint16_t chrtosht(FILE *fp) uint16_t chrtosht(FILE *fp)
{ {
uint16_t i, j; uint16_t i, j;
@@ -1243,6 +1265,7 @@ void *jega_standalone_init()
return ega; return ega;
} }
#endif
static int ega_standalone_available() static int ega_standalone_available()
{ {
@@ -1337,6 +1360,7 @@ device_t sega_device =
ega_config ega_config
}; };
#ifdef JEGA
device_t jega_device = device_t jega_device =
{ {
"AX JEGA", "AX JEGA",
@@ -1349,3 +1373,4 @@ device_t jega_device =
NULL, NULL,
ega_config ega_config
}; };
#endif

View File

@@ -91,11 +91,13 @@ typedef struct ega_t
int video_res_x, video_res_y, video_bpp; int video_res_x, video_res_y, video_bpp;
#ifdef JEGA
uint8_t RMOD1, RMOD2, RDAGS, RDFFB, RDFSB, RDFAP, RPESL, RPULP, RPSSC, RPSSU, RPSSL; uint8_t RMOD1, RMOD2, RDAGS, RDFFB, RDFSB, RDFAP, RPESL, RPULP, RPSSC, RPSSU, RPSSL;
uint8_t RPPAJ; uint8_t RPPAJ;
uint8_t RCMOD, RCCLH, RCCLL, RCCSL, RCCEL, RCSKW, ROMSL, RSTAT; uint8_t RCMOD, RCCLH, RCCLL, RCCSL, RCCEL, RCSKW, ROMSL, RSTAT;
int is_jega, font_index; int is_jega, font_index;
int chr_left, chr_wide; int chr_left, chr_wide;
#endif
} ega_t; } ega_t;
extern int update_overscan; extern int update_overscan;
@@ -113,6 +115,7 @@ extern device_t ega_device;
extern device_t cpqega_device; extern device_t cpqega_device;
extern device_t sega_device; extern device_t sega_device;
#ifdef JEGA
#define SBCS 0 #define SBCS 0
#define DBCS 1 #define DBCS 1
#define ID_LEN 6 #define ID_LEN 6
@@ -122,3 +125,4 @@ extern device_t sega_device;
extern uint8_t jfont_sbcs_19[SBCS19_LEN]; /* 256 * 19( * 8) */ extern uint8_t jfont_sbcs_19[SBCS19_LEN]; /* 256 * 19( * 8) */
extern uint8_t jfont_dbcs_16[DBCS16_LEN]; /* 65536 * 16 * 2 (* 8) */ extern uint8_t jfont_dbcs_16[DBCS16_LEN]; /* 65536 * 16 * 2 (* 8) */
#endif

View File

@@ -146,6 +146,7 @@ void ega_render_text_standard(ega_t *ega, int drawcursor)
} }
} }
#ifdef JEGA
static __inline int is_kanji1(uint8_t chr) static __inline int is_kanji1(uint8_t chr)
{ {
return (chr >= 0x81 && chr <= 0x9f) || (chr >= 0xe0 && chr <= 0xfc); return (chr >= 0x81 && chr <= 0x9f) || (chr >= 0xe0 && chr <= 0xfc);
@@ -374,6 +375,7 @@ void ega_render_text_jega(ega_t *ega, int drawcursor)
} }
} }
} }
#endif
void ega_render_2bpp_lowres(ega_t *ega) void ega_render_2bpp_lowres(ega_t *ega)
{ {

View File

@@ -29,7 +29,9 @@ extern uint8_t edatlookup[4][4];
void ega_render_blank(ega_t *ega); void ega_render_blank(ega_t *ega);
void ega_render_text_standard(ega_t *ega, int drawcursor); void ega_render_text_standard(ega_t *ega, int drawcursor);
#ifdef JEGA
void ega_render_text_jega(ega_t *ega, int drawcursor); void ega_render_text_jega(ega_t *ega, int drawcursor);
#endif
void ega_render_2bpp_lowres(ega_t *ega); void ega_render_2bpp_lowres(ega_t *ega);
void ega_render_2bpp_highres(ega_t *ega); void ega_render_2bpp_highres(ega_t *ega);

View File

@@ -1,5 +1,23 @@
/* Copyright holders: Sarah Walker /*
* see COPYING for more details * 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Configuration file handler.
*
* Version: @(#)config.c 1.0.0 2017/07/26
*
* Authors: Sarah Walker,
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Overdoze,
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
* Copyright 2017-2017 Fred N. van Kempen.
* Copyright 2017-2017 Overdoze.
* *
* NOTE: Forcing config files to be in Unicode encoding breaks it on * NOTE: Forcing config files to be in Unicode encoding breaks it on
* Windows XP, and possibly also Vista. Use -DANSI_CFG for use * Windows XP, and possibly also Vista. Use -DANSI_CFG for use
@@ -83,17 +101,14 @@ typedef struct entry_t
#define list_delete(old, head) \ #define list_delete(old, head) \
{ \ { \
struct list_t *cur = head; \
struct list_t *next = head; \ struct list_t *next = head; \
\ \
while (next->next != old) \ while ((next)->next != old) \
{ \ { \
cur = next; \ next = (next)->next; \
next = next->next; \
} \ } \
\ \
cur->next = next->next; \ (next)->next = (old)->next; \
free(next); \
} }
@@ -487,6 +502,7 @@ void config_delete_var(char *head, char *name)
return; return;
list_delete(&entry->list, &section->entry_head); list_delete(&entry->list, &section->entry_head);
free(entry);
return; return;
} }
@@ -504,6 +520,7 @@ void config_delete_section_if_empty(char *head)
if (entries_num(section) == 0) if (entries_num(section) == 0)
{ {
list_delete(&section->list, &config_head); list_delete(&section->list, &config_head);
free(section);
} }
return; return;

View File

@@ -1,8 +1,24 @@
/* Copyright holders: Sarah Walker /*
see COPYING for more details * 86Box A hypervisor and IBM PC system emulator that specializes in
*/ * running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Configuration file handler header.
*
* Version: @(#)config.h 1.0.0 2017/07/26
*
* Authors: Sarah Walker,
* Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
* Overdoze,
* Copyright 2008-2017 Sarah Walker.
* Copyright 2016-2017 Miran Grca.
* Copyright 2017-2017 Fred N. van Kempen.
* Copyright 2017-2017 Overdoze.
*/
extern wchar_t config_file_default[256]; extern wchar_t config_file_default[256];