Skip to content

Commit 9ad2e50

Browse files
committed
Improved auto-configuration, detect "Apple //e enhanced".
IIe and //e enhanced are now separately detected and the font type is automatically adjusted. The manual config switch for enhanced/unenhanced fonts is removed. Overriding is still possible by setting the machine type to "IIe" vs "IIe enhanced". #12
1 parent 1c910f7 commit 9ad2e50

File tree

9 files changed

+111
-89
lines changed

9 files changed

+111
-89
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
*.gch
22
*.pyc
3+
*.lst
4+
*.bin
35
_BUILD/PICO
46
_BUILD/PICO2
57
_BUILD/RELEASE

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The project is a collaboration with Ralle Palaveev. His related hardware project
1414
* [A2DVI Hardware](https://github.com/rallepalaveev/A2DVI)
1515

1616
The hardware is based on the PICO controller board.
17-
Both, original **PICO (RP2040)** and newer **PICO2 (RP2350)** mouldes are supported.
17+
Both, original **PICO (RP2040)** and newer **PICO2 (RP2350)** modules are supported.
1818
Separate firmware is provided for the two PICO variants.
1919

2020
![PICO_vs_PICO2](images/PICO_PICO2.jpg)
@@ -67,14 +67,15 @@ The A2DVI firmware tries to auto-detect your machine type - and adjusts various
6767
This also automatically adjusts the character set, if the current selection does not match the machine (with firmware >= v1.1):
6868

6969
* When an Apple IIe is detected, but an Apple II font is selected, it switches to "Apple IIe US character set".
70+
* When an "Apple //e enhanced" is detected, then the "enhanced" variant of the font is used. Otherwise, for the "unenhanced IIe" the "unenhanced" fonts are used (with firmware >= v1.4).
7071
* When an Apple II is detected, but an Apple IIe font is selected, it switches to "Apple II+ US character set".
7172

7273
If you do not want the automatic font switching (i.e. you want to use an Apple II font on the IIe), then disable the auto-detection by setting a *fixed* machine type.
7374

74-
If your A2DVI is installed in a specific/fixed machine, it's recommended to set the configuration to a fixed type.
75+
If your A2DVI is installed in a specific/fixed machine, it's recommended to set "machine type" to the matching fixed type.
7576

7677
## Rendering Options
77-
* **Monochrome Mode**: configures the display of monochrom video modes. Selects display as black & white, green or amber (the most popular 1980s CRT types).
78+
* **Monochrome Mode**: configures the display of monochrome video modes. Selects display as black & white, green or amber (the most popular 1980s CRT types).
7879
* **Color Mode**: configures the display of color video modes. Selects "color" or "monochrome". When "monochrome" is selected, then all video modes are in monochrome.
7980
* **Scan Lines**: enables an effect to mimic the look of original CRT screens with scan lines.
8081
* **Analog Rendering Effects**: configures the rendering of double-LORES and double-HIRES video modes.
@@ -99,8 +100,9 @@ Included fonts for Apple IIe:
99100

100101
* **US**, **UK**, **French**, **German**, **Italian**, **Spanish**, **Swedish/Finnish**, **Hebrew**, **Pravetz/Cyrillic**
101102

102-
* The IIe fonts are "*enhanced character sets*" (include "mouse text characters" required for the "*enhanced* //e").
103-
There is a separate configuration option to disable "enhanced fonts": this replaces the mousetext characters with normal characters, like on an original "*unenhanced* Apple //e".
103+
* For the Apple IIe the "enhanced" or "unenhanced" variant of the IIe font is used - according to the machine type ("Apple IIe" vs "Apple //e enhanced").
104+
The machine is either auto-detected, or can be set manually.
105+
(The difference between the "*enhanced*" and "*unenhanced*" fonts are the graphical "mouse text characters", which only the "Apple //e enhanced" supported.)
104106

105107
Included fonts for Apple II:
106108

@@ -164,7 +166,7 @@ Connect the single pin on the A2DVI card to the language switch signal "ALTCHR",
164166

165167
## Video7 Support
166168
Video7 provided additional color text and video modes for the Apple IIe.
167-
Some (all?) of these modes were also available with other video cards, like the "Apple Extended 80 column Text/AppleColor Card".
169+
Some of these modes were also available with other video cards, like the "Apple Extended 80 column Text/AppleColor Card".
168170

169171
A2DVI supports these extended video modes - even if your Apple IIe only has a standard 80 column card (and no extended video card).
170172

@@ -177,7 +179,7 @@ The extra video modes:
177179

178180
The following photo shows the difference of the default vs enhanced DHGR video mode (as supported by DazzleDraw).
179181
This video mode provides a mix of 140x192 pixels in 16 colors (just like default DHGR),
180-
but uses an unused 8th data bit to switich to a 560pixel/line monochrome resolution for a block of 7 bits:
182+
but uses an unused 8th data bit to switch to a 560pixel/line monochrome resolution for a block of 7 bits:
181183

182184
![Video7](images/A2DVI_Video7_DHGR.jpg)
183185

@@ -237,7 +239,7 @@ The A2DVI firmware supports the font selection protocol of ROMX/ROMXe devices.
237239

238240
* ROMX supports selecting between 16 different fonts.
239241
* A2DVI maps the 16 fonts selected by ROMX to A2DVI's 16 custom font slots. So you can upload and change those 16 fonts as you wish.
240-
* When ROMX selectes an empty custom font slot (1-16), then one of the built-in fonts (1-16) is used instead.
242+
* When ROMX selects an empty custom font slot (1-16), then one of the built-in fonts (1-16) is used instead.
241243

242244
# Photos
243245
Here are some photos showing A2DVI in action - using the DVI/HDMI connection.
@@ -284,7 +286,7 @@ Firmware updates of an A2DVI card are easy and safe:
284286
* **Flash** (permanent) vs temporary configuration.
285287
* **Card registers** for configuration.
286288
* **Configuration menu**.
287-
* **Debug monitor** (Apple II video softswitches, 6502 CPU state).
289+
* **Debug monitor** (Apple II video soft switches, 6502 CPU state).
288290
* **PICO2 (RP2350) support**.
289291
* **Analog rendering effects** for Double-HIRES/Double-LORES (optional).
290292
* **ROMX font selection**.

firmware/applebus/businterface.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ static inline void __time_critical_func(machine_auto_detection)(uint32_t address
4343
if(current_machine == MACHINE_AUTO)
4444
{
4545
if((apple_memory[0x0403] == 0xD8) && (apple_memory[0x404] == 0xE5)) { // "Xe" = ROMXe
46-
detected_machine = MACHINE_IIE;
47-
set_machine(MACHINE_IIE);
46+
detected_machine = MACHINE_IIE_ENH;
47+
set_machine(MACHINE_IIE_ENH);
4848
} else if((apple_memory[0x0412] == 0xC5) && (apple_memory[0x0413] == 0xD8)) {// "EX" = ROMX
4949
detected_machine = MACHINE_II;
5050
set_machine(MACHINE_II);
@@ -54,8 +54,8 @@ static inline void __time_critical_func(machine_auto_detection)(uint32_t address
5454
set_machine(MACHINE_IIGS);
5555
#endif
5656
} else if((apple_memory[0x416] == 0xAF) && (apple_memory[0x0417] == 0xE5)) { // "/e" = Apple //e Enhanced
57-
detected_machine = MACHINE_IIE;
58-
set_machine(MACHINE_IIE);
57+
detected_machine = MACHINE_IIE_ENH;
58+
set_machine(MACHINE_IIE_ENH);
5959
} else if((apple_memory[0x413] == 0xE5) && (apple_memory[0x0415] == 0xDD)) { // "e ]" = Apple //e Unenhanced
6060
detected_machine = MACHINE_IIE;
6161
set_machine(MACHINE_IIE);

firmware/config/config.c

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ volatile compat_t detected_machine = MACHINE_AUTO;
3838
volatile compat_t cfg_machine = MACHINE_AUTO;
3939
volatile compat_t current_machine = MACHINE_AUTO;
4040
volatile bool language_switch = false; // false: main/local char set, true: alternate char set (normally fixed to US default)
41-
volatile bool enhanced_font_enabled;
41+
volatile bool unenhance_font; // switch to explicitly "unenhance" a font (by removing the mouse text characters)
4242
volatile uint8_t reload_charsets = 4;
4343

4444
uint8_t cfg_videx_selection = 0; //0:DISABLED
@@ -76,7 +76,7 @@ struct __attribute__((__packed__)) config_t
7676
uint8_t alt_charset; // selection for alternate video ROM (usually fixed to US charset)
7777

7878
uint8_t input_switch_mode;
79-
uint8_t enhanced_font_enabled;
79+
uint8_t OBSOLETE_enhanced_font_enabled; // no longer used (replaced by MACHINE_IIE_ENH)
8080
uint8_t video7_enabled;
8181
uint8_t debug_lines_enabled;
8282

@@ -155,28 +155,47 @@ void __time_critical_func(set_machine)(compat_t machine)
155155
{
156156
switch(machine)
157157
{
158+
case MACHINE_IIE:
159+
case MACHINE_IIE_ENH:
160+
internal_flags &= ~IFLAGS_IIGS_REGS;
161+
internal_flags |= IFLAGS_IIE_REGS;
162+
break;
163+
#ifdef MACHINE_IIGS
164+
case MACHINE_IIGS:
165+
internal_flags &= ~IFLAGS_IIE_REGS;
166+
internal_flags |= IFLAGS_IIGS_REGS;
167+
break;
168+
#endif
158169
case MACHINE_AUTO:
159170
case MACHINE_AGAT7:
160171
case MACHINE_AGAT9:
161172
case MACHINE_BASIS:
162173
case MACHINE_PRAVETZ:
163174
case MACHINE_II:
175+
default:
164176
internal_flags &= ~(IFLAGS_IIGS_REGS|IFLAGS_IIE_REGS);
165177
break;
178+
}
166179

167-
case MACHINE_IIE:
168-
internal_flags &= ~IFLAGS_IIGS_REGS;
169-
internal_flags |= IFLAGS_IIE_REGS;
170-
break;
171-
172-
case MACHINE_IIGS:
173-
internal_flags &= ~IFLAGS_IIE_REGS;
174-
internal_flags |= IFLAGS_IIGS_REGS;
175-
break;
176-
177-
default:
178-
break;
180+
if (machine == MACHINE_IIE)
181+
{
182+
// we need to "unenhance" the fonts for the IIe (unenhanced)
183+
if (!unenhance_font)
184+
{
185+
unenhance_font = true;
186+
reload_charsets |= 3;
187+
}
179188
}
189+
else
190+
{
191+
// all other machines, including "//e enhanced": leave fonts unchanged
192+
if (unenhance_font)
193+
{
194+
unenhance_font = false;
195+
reload_charsets |= 3;
196+
}
197+
}
198+
180199
if ((current_machine == MACHINE_AUTO)&&
181200
(machine != MACHINE_AUTO))
182201
{
@@ -244,7 +263,7 @@ void DELAYED_COPY_CODE(config_load_charsets)(void)
244263
// local font
245264
memcpy32(character_rom, character_roms[check_valid_font(cfg_local_charset)], CHARACTER_ROM_SIZE);
246265

247-
if (!enhanced_font_enabled)
266+
if (unenhance_font)
248267
{
249268
// unenhance the font, by overwriting the mousetext characters
250269
memcpy32(&character_rom[0x40*8], &character_rom[0], 0x20*8);
@@ -256,7 +275,7 @@ void DELAYED_COPY_CODE(config_load_charsets)(void)
256275
// alternate fixed US font (with language switch)
257276
memcpy32(&character_rom[0x800], character_roms[check_valid_font(cfg_alt_charset)], CHARACTER_ROM_SIZE);
258277

259-
if (!enhanced_font_enabled)
278+
if (unenhance_font)
260279
{
261280
// unenhance the font, by overwriting the mousetext characters
262281
memcpy32(&character_rom[0x800+0x40*8], &character_rom[0x800], 0x20*8);
@@ -293,6 +312,11 @@ void config_load(void)
293312
}
294313

295314
cfg_machine = (cfg->machine_type <= MACHINE_MAX_CFG) ? cfg->machine_type : MACHINE_AUTO;
315+
if ((cfg_machine == MACHINE_IIE)&&(cfg->OBSOLETE_enhanced_font_enabled != 0))
316+
{
317+
// convert old config setting
318+
cfg_machine = MACHINE_IIE_ENH;
319+
}
296320
set_machine(cfg_machine);
297321

298322
SET_IFLAG(cfg->scanline_emulation, IFLAGS_SCANLINEEMU);
@@ -313,7 +337,7 @@ void config_load(void)
313337
config_setflags();
314338

315339
input_switch_mode = cfg->input_switch_mode;
316-
enhanced_font_enabled = (cfg->enhanced_font_enabled != 0);
340+
unenhance_font = (cfg_machine == MACHINE_IIE);
317341

318342
color_mode = (cfg->color_mode <= 2) ? cfg->color_mode : 0;
319343

@@ -344,7 +368,7 @@ void config_load_defaults(void)
344368
set_machine(detected_machine);
345369

346370
input_switch_mode = ModeSwitchLangCycle;
347-
enhanced_font_enabled = true;
371+
unenhance_font = false;
348372

349373
cfg_local_charset = DEFAULT_LOCAL_CHARSET;
350374
cfg_alt_charset = DEFAULT_ALT_CHARSET;
@@ -380,7 +404,6 @@ void DELAYED_COPY_CODE(config_save)(void)
380404
new_config->local_charset = cfg_local_charset;
381405
new_config->alt_charset = cfg_alt_charset;
382406
new_config->input_switch_mode = input_switch_mode;
383-
new_config->enhanced_font_enabled = enhanced_font_enabled;
384407

385408
// update flash
386409
config_flash_write(cfg, (uint8_t *)new_config, new_config_size);

firmware/config/config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ typedef enum
3333
{
3434
MACHINE_II = 0,
3535
MACHINE_IIE = 1,
36-
MACHINE_IIGS = 2, // currently not supported
36+
MACHINE_IIE_ENH = 2,
3737
MACHINE_AGAT7 = 3,
3838
MACHINE_AGAT9 = 4,
3939
MACHINE_BASIS = 5,
4040
MACHINE_PRAVETZ = 6,
4141
MACHINE_MAX_CFG = MACHINE_PRAVETZ, // valid maximum option for config, otherwise "AUTO" is assumed
42+
// MACHINE_IIGS = 7, // currently not supported
4243
MACHINE_INVALID = 0xfe,
4344
MACHINE_AUTO = 0xff
4445
} compat_t;
@@ -81,7 +82,6 @@ extern uint8_t cfg_videx_selection;
8182
extern volatile uint8_t reload_charsets;
8283

8384
extern volatile bool language_switch;
84-
extern volatile bool enhanced_font_enabled;
8585

8686
typedef enum {
8787
COLOR_MODE_BW = 0,

0 commit comments

Comments
 (0)