mirror of
https://github.com/V2RetroComputing/analog.git
synced 2024-06-06 04:29:32 +00:00
f7d4779880
Progress on PCPI mode bug fixes. PCPI mode is now working again, but the config interface is still broken enough to prevent the use of the config utility while in this mode.. Sending the FORMAT command from the monitor rom returns the card to defaults. Replace n with the slot number the card is installed in: Correction of mousetext / inverse / flashing handling on IIe see https://github.com/V2RetroComputing/analog/issues/3 ]CALL -151 *CnF0:46 4F 52 4D 41 54 00 00 Monochrome mode & color palettes are now implemented. $C0n1: Monochrome mode & palette $80: B&W $90: Inverse $A0: Amber $B0: Inverse Amber $C0: Green $D0: Inverse Green $E0: Commodore 64 Theme $F0: Use IIgs palette $C0n2: Mirror of IIgs TBCOLOR register $C0n3: Mirror of IIgs BORDER register
77 lines
2.7 KiB
C
77 lines
2.7 KiB
C
#include <pico/stdlib.h>
|
|
#include "vgabuf.h"
|
|
#include "render.h"
|
|
#include "character_rom.h"
|
|
#include "vgaout.h"
|
|
|
|
static inline uint_fast8_t __time_critical_func(char_terminal_bits)(uint_fast8_t ch, uint_fast8_t glyph_line) {
|
|
uint_fast8_t bits = terminal_character_rom[((uint_fast16_t)ch << 3) | glyph_line];
|
|
if(ch & 0x80) {
|
|
// normal character
|
|
return bits & 0x7f;
|
|
}
|
|
|
|
if((bits & 0x80) == 0) {
|
|
// inverse character
|
|
return bits ^ 0x7f;
|
|
} else {
|
|
// flashing character
|
|
return (bits ^ text_flasher_mask) & 0x7f;
|
|
}
|
|
}
|
|
|
|
|
|
void __time_critical_func(render_terminal)() {
|
|
for(int line=0; line < 24; line++) {
|
|
render_terminal_line(line);
|
|
}
|
|
}
|
|
|
|
|
|
void __time_critical_func(render_terminal_line)(unsigned int line) {
|
|
const uint8_t *page = (const uint8_t *)terminal_memory;
|
|
const uint8_t *line_buf = page + (line * 80);
|
|
|
|
for(uint glyph_line=0; glyph_line < 8; glyph_line++) {
|
|
struct vga_scanline *sl = vga_prepare_scanline();
|
|
uint sl_pos = 0;
|
|
|
|
// Pad 40 pixels on the left to center horizontally
|
|
sl->data[sl_pos++] = (text_border|THEN_EXTEND_7) | ((text_border|THEN_EXTEND_7) << 16); // 16 pixels per word
|
|
sl->data[sl_pos++] = (text_border|THEN_EXTEND_7) | ((text_border|THEN_EXTEND_7) << 16); // 16 pixels per word
|
|
sl->data[sl_pos++] = (text_border|THEN_EXTEND_3) | ((text_border|THEN_EXTEND_3) << 16); // 8 pixels per word
|
|
|
|
for(uint col=0; col < 80; ) {
|
|
// Grab 14 pixels from the next two characters
|
|
uint32_t bits_a = char_terminal_bits(line_buf[col], glyph_line);
|
|
col++;
|
|
uint32_t bits_b = char_terminal_bits(line_buf[col], glyph_line);
|
|
col++;
|
|
|
|
uint32_t bits = (bits_a << 7) | bits_b;
|
|
|
|
// Translate each pair of bits into a pair of pixels
|
|
for(int i=0; i < 7; i++) {
|
|
uint32_t pixeldata = (bits & 0x2000) ? (text_fore) : (text_back);
|
|
pixeldata |= (bits & 0x1000) ?
|
|
(((uint32_t)text_fore) << 16) :
|
|
(((uint32_t)text_back) << 16);
|
|
bits <<= 2;
|
|
|
|
sl->data[sl_pos] = pixeldata;
|
|
sl_pos++;
|
|
}
|
|
}
|
|
|
|
// Pad 40 pixels on the left to center horizontally
|
|
sl->data[sl_pos++] = (text_border|THEN_EXTEND_7) | ((text_border|THEN_EXTEND_7) << 16); // 16 pixels per word
|
|
sl->data[sl_pos++] = (text_border|THEN_EXTEND_7) | ((text_border|THEN_EXTEND_7) << 16); // 16 pixels per word
|
|
sl->data[sl_pos++] = (text_border|THEN_EXTEND_3) | ((text_border|THEN_EXTEND_3) << 16); // 8 pixels per word
|
|
|
|
sl->length = sl_pos;
|
|
sl->repeat_count = 1;
|
|
vga_submit_scanline(sl);
|
|
}
|
|
}
|
|
|