mirror of
https://github.com/isometimes/rpi4-osdev
synced 2024-11-21 17:50:40 +00:00
Starting port of the WordUp Graphics Toolkit to my OS
This commit is contained in:
parent
c0fffd881b
commit
7f06928f92
28 changed files with 2639 additions and 0 deletions
19
part12-wgt/Makefile
Normal file
19
part12-wgt/Makefile
Normal file
|
@ -0,0 +1,19 @@
|
|||
CFILES = $(wildcard *.c lib/*.c)
|
||||
OFILES = $(CFILES:.c=.o)
|
||||
LLVMPATH = /opt/homebrew/opt/llvm/bin
|
||||
CLANGFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -mcpu=cortex-a72+nosimd
|
||||
|
||||
all: clean kernel8.img
|
||||
|
||||
boot/boot.o: boot/boot.S
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c $< -o $@
|
||||
|
||||
%.o: %.c
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c $< -o $@
|
||||
|
||||
kernel8.img: boot/boot.o $(OFILES)
|
||||
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib boot/boot.o $(OFILES) -T boot/link.ld -o kernel8.elf
|
||||
$(LLVMPATH)/llvm-objcopy -O binary kernel8.elf kernel8.img
|
||||
|
||||
clean:
|
||||
/bin/rm kernel8.elf *.o bin/*.o boot/*.o lib/*.o *.img > /dev/null 2> /dev/null || true
|
80
part12-wgt/boot/boot.S
Normal file
80
part12-wgt/boot/boot.S
Normal file
|
@ -0,0 +1,80 @@
|
|||
#define LOCAL_CONTROL 0xff800000
|
||||
#define LOCAL_PRESCALER 0xff800008
|
||||
#define OSC_FREQ 54000000
|
||||
#define MAIN_STACK 0x400000
|
||||
|
||||
.section ".text.boot" // Make sure the linker puts this at the start of the kernel image
|
||||
|
||||
.global _start // Execution starts here
|
||||
|
||||
_start:
|
||||
ldr x0, =LOCAL_CONTROL // Sort out the timer
|
||||
str wzr, [x0]
|
||||
mov w1, 0x80000000
|
||||
str w1, [x0, #(LOCAL_PRESCALER - LOCAL_CONTROL)]
|
||||
|
||||
ldr x0, =OSC_FREQ
|
||||
msr cntfrq_el0, x0
|
||||
msr cntvoff_el2, xzr
|
||||
|
||||
// Check processor ID is zero (executing on main core), else hang
|
||||
mrs x1, mpidr_el1
|
||||
and x1, x1, #3
|
||||
cbz x1, 2f
|
||||
|
||||
// We're not on the main core, so hang in an infinite wait loop
|
||||
adr x5, spin_cpu0
|
||||
1: wfe
|
||||
ldr x4, [x5, x1, lsl #3]
|
||||
cbz x4, 1b
|
||||
|
||||
ldr x2, =__stack_start // Get ourselves a fresh stack - location depends on CPU core asking
|
||||
lsl x1, x1, #9 // Multiply core_number by 512
|
||||
add x3, x2, x1 // Add to the address
|
||||
mov sp, x3
|
||||
|
||||
mov x0, #0
|
||||
mov x1, #0
|
||||
mov x2, #0
|
||||
mov x3, #0
|
||||
br x4
|
||||
b 1b
|
||||
2: // We're on the main core!
|
||||
|
||||
// Set stack to start somewhere safe
|
||||
mov sp, #MAIN_STACK
|
||||
|
||||
// Clean the BSS section
|
||||
ldr x1, =__bss_start // Start address
|
||||
ldr w2, =__bss_size // Size of the section
|
||||
3: cbz w2, 4f // Quit loop if zero
|
||||
str xzr, [x1], #8
|
||||
sub w2, w2, #1
|
||||
cbnz w2, 3b // Loop if non-zero
|
||||
|
||||
// Jump to our main() routine in C (make sure it doesn't return)
|
||||
4: bl main
|
||||
// In case it does return, halt the master core too
|
||||
b 1b
|
||||
|
||||
.ltorg
|
||||
|
||||
.org 0xd8
|
||||
.globl spin_cpu0
|
||||
spin_cpu0:
|
||||
.quad 0
|
||||
|
||||
.org 0xe0
|
||||
.globl spin_cpu1
|
||||
spin_cpu1:
|
||||
.quad 0
|
||||
|
||||
.org 0xe8
|
||||
.globl spin_cpu2
|
||||
spin_cpu2:
|
||||
.quad 0
|
||||
|
||||
.org 0xf0
|
||||
.globl spin_cpu3
|
||||
spin_cpu3:
|
||||
.quad 0
|
35
part12-wgt/boot/link.ld
Normal file
35
part12-wgt/boot/link.ld
Normal file
|
@ -0,0 +1,35 @@
|
|||
SECTIONS
|
||||
{
|
||||
.text : { KEEP(*(.text.boot)) *(.text .text.* .gnu.linkonce.t*) }
|
||||
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r*) }
|
||||
PROVIDE(_data = .);
|
||||
.data : { *(.data .data.* .gnu.linkonce.d*) }
|
||||
.bss (NOLOAD) : {
|
||||
. = ALIGN(16);
|
||||
__bss_start = .;
|
||||
*(.bss .bss.*)
|
||||
*(COMMON)
|
||||
__bss_end = .;
|
||||
__bss_size = (__bss_end - __bss_start)>>3;
|
||||
}
|
||||
.cpu1Stack :
|
||||
{
|
||||
. = ALIGN(16);
|
||||
__stack_start = .;
|
||||
. = . + 512;
|
||||
__cpu1_stack = .;
|
||||
}
|
||||
.cpu2Stack :
|
||||
{
|
||||
. = . + 512;
|
||||
__cpu2_stack = .;
|
||||
}
|
||||
.cpu3Stack :
|
||||
{
|
||||
. = . + 512;
|
||||
__cpu3_stack = .;
|
||||
}
|
||||
_end = .;
|
||||
|
||||
/DISCARD/ : { *(.comment) *(.gnu*) *(.note*) *(.eh_frame*) }
|
||||
}
|
17
part12-wgt/examples/wgt01.c
Normal file
17
part12-wgt/examples/wgt01.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "wgt.h"
|
||||
#include "wpal.h"
|
||||
|
||||
// ######## WGT EXAMPLES ########
|
||||
|
||||
void wgt01()
|
||||
{
|
||||
vga256 (); /* Initializes WGT system */
|
||||
wsetcolor (vgapal[15]);
|
||||
wline (0, 0, 1919, 1079); /* Draw a line */
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
wgt01();
|
||||
while (1);
|
||||
}
|
105
part12-wgt/examples/wgt02.c
Normal file
105
part12-wgt/examples/wgt02.c
Normal file
|
@ -0,0 +1,105 @@
|
|||
#include "wgt.h"
|
||||
#include "wpal.h"
|
||||
|
||||
// ######## REQUIRED FUNCTIONS ########
|
||||
|
||||
unsigned long state0 = 1;
|
||||
unsigned long state1 = 2;
|
||||
|
||||
unsigned long rand(void)
|
||||
{
|
||||
unsigned long s1 = state0;
|
||||
unsigned long s0 = state1;
|
||||
|
||||
state0 = s0;
|
||||
s1 ^= s1 << 23;
|
||||
s1 ^= s1 >> 17;
|
||||
s1 ^= s0;
|
||||
s1 ^= s0 >> 26;
|
||||
state1 = s1;
|
||||
|
||||
return state0 + state1;
|
||||
}
|
||||
|
||||
void wait_msec(unsigned int n)
|
||||
{
|
||||
register unsigned long f, t, r;
|
||||
|
||||
// Get the current counter frequency
|
||||
asm volatile ("mrs %0, cntfrq_el0" : "=r"(f));
|
||||
// Read the current counter
|
||||
asm volatile ("mrs %0, cntpct_el0" : "=r"(t));
|
||||
// Calculate expire value for counter
|
||||
t+=((f/1000)*n)/1000;
|
||||
do{asm volatile ("mrs %0, cntpct_el0" : "=r"(r));}while(r<t);
|
||||
}
|
||||
|
||||
// ######## STUB FUNCTIONS ########
|
||||
|
||||
unsigned int kb = 0;
|
||||
|
||||
unsigned int kbhit(void) {
|
||||
kb++;
|
||||
return kb / 500;
|
||||
}
|
||||
|
||||
void getch(void) {
|
||||
wait_msec(0x500000);
|
||||
}
|
||||
|
||||
// ######## WGT EXAMPLES ########
|
||||
|
||||
void wgt02()
|
||||
{
|
||||
short x;
|
||||
short y;
|
||||
short i;
|
||||
|
||||
vga256 ();
|
||||
wcls (vgapal[0]); /* Clear screen with color 0 */
|
||||
|
||||
/* Put randomly coloured pixels in random screen coordinates */
|
||||
do {
|
||||
wsetcolor (vgapal[rand () % 256]);
|
||||
x = rand () % 1920;
|
||||
y = rand() % 1080;
|
||||
wputpixel (x, y);
|
||||
} while (kbhit () == 0);
|
||||
getch ();
|
||||
|
||||
wcls (vgapal[0]); /* Clear screen with color 0 */
|
||||
wsetcolor (vgapal[10]); /* Now we will draw with #10 */
|
||||
for (x = 0; x < 1920; x++)
|
||||
for (y = 0; y < 1080; y++)
|
||||
wfastputpixel (x, y); /* Fast due to no clipping checking */
|
||||
|
||||
getch ();
|
||||
wcls (vgapal[0]); /* Clears screen with color 0 */
|
||||
|
||||
/* Put randomly coloured pixels in the top left corner of the screen */
|
||||
for (i = 0; i < 15000; i++)
|
||||
{
|
||||
wsetcolor (vgapal[rand () % 256]);
|
||||
x = rand () % 960;
|
||||
y = rand () % 540;
|
||||
wputpixel (x, y);
|
||||
}
|
||||
|
||||
/* Now use wgetpixel to read image off screen */
|
||||
for (y = 0; y < 540; y++)
|
||||
for (x = 0; x < 960; x++)
|
||||
{
|
||||
wsetcolor (wgetpixel (x, y));
|
||||
wputpixel (x + 960, y + 540);
|
||||
}
|
||||
|
||||
getch ();
|
||||
|
||||
while (1);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
wgt02();
|
||||
while (1);
|
||||
}
|
124
part12-wgt/examples/wgt04.c
Normal file
124
part12-wgt/examples/wgt04.c
Normal file
|
@ -0,0 +1,124 @@
|
|||
#include "wgt.h"
|
||||
|
||||
#define MAX_RADIUS 100
|
||||
|
||||
// ######## REQUIRED FUNCTIONS ########
|
||||
|
||||
unsigned long state0 = 1;
|
||||
unsigned long state1 = 2;
|
||||
|
||||
unsigned long rand(void)
|
||||
{
|
||||
unsigned long s1 = state0;
|
||||
unsigned long s0 = state1;
|
||||
|
||||
state0 = s0;
|
||||
s1 ^= s1 << 23;
|
||||
s1 ^= s1 >> 17;
|
||||
s1 ^= s0;
|
||||
s1 ^= s0 >> 26;
|
||||
state1 = s1;
|
||||
|
||||
return state0 + state1;
|
||||
}
|
||||
|
||||
void wait_msec(unsigned int n)
|
||||
{
|
||||
register unsigned long f, t, r;
|
||||
|
||||
// Get the current counter frequency
|
||||
asm volatile ("mrs %0, cntfrq_el0" : "=r"(f));
|
||||
// Read the current counter
|
||||
asm volatile ("mrs %0, cntpct_el0" : "=r"(t));
|
||||
// Calculate expire value for counter
|
||||
t+=((f/1000)*n)/1000;
|
||||
do{asm volatile ("mrs %0, cntpct_el0" : "=r"(r));}while(r<t);
|
||||
}
|
||||
|
||||
// ######## STUB FUNCTIONS ########
|
||||
|
||||
unsigned int kb = 0;
|
||||
|
||||
unsigned int kbhit(void) {
|
||||
kb++;
|
||||
return kb / 500;
|
||||
}
|
||||
|
||||
void getch(void) {
|
||||
wait_msec(0x500000);
|
||||
kb = 0;
|
||||
}
|
||||
|
||||
// ######## WGT EXAMPLES ########
|
||||
|
||||
void wgt04()
|
||||
{
|
||||
color pal[256];
|
||||
int x, y, x2, y2, col, ctr;
|
||||
|
||||
vga256 (); /* Start graphics mode */
|
||||
|
||||
wtextcolor (vgapal[15]); /* Text will be white */
|
||||
ctr = 0; /* Start counter for first primitive */
|
||||
|
||||
do {
|
||||
wclip (0, 0, 1919, 1079); /* Clip to full screen */
|
||||
wouttextxy (230, 0, NULL, "WGT DEMO 4"); /* Display text */
|
||||
switch (ctr) /* Show primitive type */
|
||||
{
|
||||
case 0 : wouttextxy (0, 0, NULL, "Now using WLINE"); break;
|
||||
case 1 : wouttextxy (0, 0, NULL, "Now using WFLINE"); break;
|
||||
case 2 : wouttextxy (0, 0, NULL, "Now using WRECTANGLE"); break;
|
||||
case 3 : wouttextxy (0, 0, NULL, "Now using WBAR"); break;
|
||||
case 4 : wouttextxy (0, 0, NULL, "Now using WCIRCLE"); break;
|
||||
case 5 : wouttextxy (0, 0, NULL, "Now using WFILL_CIRCLE"); break;
|
||||
case 6 : wouttextxy (0, 0, NULL, "Now using WELLIPSE"); break;
|
||||
case 7 : wouttextxy (0, 0, NULL, "Now using WFILL_ELLIPSE"); break;
|
||||
case 8 : wouttextxy (0, 0, NULL, "Now using WSTYLELINE"); break;
|
||||
case 9 : wouttextxy (0, 0, NULL, "Now using WBUTT");
|
||||
wreadpalette (0, 255, pal);
|
||||
wsetrgb (253, 60, 60, 60, pal);
|
||||
wsetrgb (254, 50, 50, 50, pal);
|
||||
wsetrgb (255, 40, 40, 40, pal);
|
||||
wsetpalette (0, 255, pal);
|
||||
break;
|
||||
}
|
||||
wclip (0, 8, 1919, 1079); /* Clip all primitives below text line */
|
||||
|
||||
do {
|
||||
x = rand() % 1920; /* Randomize first point - (x,y) */
|
||||
y = rand() % 1080;
|
||||
x2 = rand() % 1920; /* Randomize second point - (x2,y2) */
|
||||
y2 = rand() % 1080;
|
||||
col = rand() % 256; /* Pick a color index to use */
|
||||
wsetcolor (vgapal[col]); /* Now use it */
|
||||
|
||||
switch (ctr) /* Perform primitive */
|
||||
{
|
||||
case 0 : wline (x, y, x2, y2); break;
|
||||
case 1 : wfline (x, rand() % 1072 + 8, x2, rand() % 1072 + 8); break;
|
||||
case 2 : wrectangle (x, y, x2, y2); break;
|
||||
case 3 : wbar (x, y, x2, y2); break;
|
||||
case 4 : wcircle (x, y, rand() % MAX_RADIUS); break;
|
||||
case 5 : wfill_circle (x, y, rand() % 100); break;
|
||||
case 6 : wellipse (x, y, rand() % MAX_RADIUS,
|
||||
rand() % MAX_RADIUS); break;
|
||||
case 7 : wfill_ellipse (x, y, rand() % MAX_RADIUS,
|
||||
rand() % MAX_RADIUS); break;
|
||||
case 8 : wstyleline (x, rand() % 1072 + 8, x2, rand() % 1072 + 8,
|
||||
rand() ); break;
|
||||
case 9 : wbutt (x, y, x2, y2); break;
|
||||
}
|
||||
} while (!kbhit ()); /* Stop when key is pressed */
|
||||
|
||||
getch (); /* Get key from buffer */
|
||||
wcls (vgapal[0]); /* Clear screen with black */
|
||||
ctr++; /* Increment counter to next primitive */
|
||||
} while (ctr < 10); /* Have we done all 10 ? */
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
wgt04();
|
||||
while (1);
|
||||
}
|
105
part12-wgt/examples/wgt07.c
Normal file
105
part12-wgt/examples/wgt07.c
Normal file
|
@ -0,0 +1,105 @@
|
|||
#include "wgt.h"
|
||||
|
||||
// ######## REQUIRED FUNCTIONS ########
|
||||
|
||||
unsigned long state0 = 1000;
|
||||
unsigned long state1 = 2000;
|
||||
|
||||
unsigned long rand(void)
|
||||
{
|
||||
unsigned long s1 = state0;
|
||||
unsigned long s0 = state1;
|
||||
|
||||
state0 = s0;
|
||||
s1 ^= s1 << 23;
|
||||
s1 ^= s1 >> 17;
|
||||
s1 ^= s0;
|
||||
s1 ^= s0 >> 26;
|
||||
state1 = s1;
|
||||
|
||||
return state0 + state1;
|
||||
}
|
||||
|
||||
void wait_msec(unsigned int n)
|
||||
{
|
||||
register unsigned long f, t, r;
|
||||
|
||||
// Get the current counter frequency
|
||||
asm volatile ("mrs %0, cntfrq_el0" : "=r"(f));
|
||||
// Read the current counter
|
||||
asm volatile ("mrs %0, cntpct_el0" : "=r"(t));
|
||||
// Calculate expire value for counter
|
||||
t+=((f/1000)*n)/1000;
|
||||
do{asm volatile ("mrs %0, cntpct_el0" : "=r"(r));}while(r<t);
|
||||
}
|
||||
|
||||
// ######## STUB FUNCTIONS ########
|
||||
|
||||
unsigned int kb = 0;
|
||||
|
||||
unsigned int kbhit(void) {
|
||||
kb++;
|
||||
return kb / 500;
|
||||
}
|
||||
|
||||
void getch(void) {
|
||||
wait_msec(0x500000);
|
||||
kb = 0;
|
||||
}
|
||||
|
||||
// ######## WGT EXAMPLES ########
|
||||
|
||||
void wgt07()
|
||||
{
|
||||
short x;
|
||||
short y;
|
||||
short col;
|
||||
color palette[255];
|
||||
|
||||
vga256 ();
|
||||
|
||||
// Set our palette
|
||||
for (y = 0; y < 64; y++)
|
||||
wsetrgb (y, y*4, y*4, y*4, palette);
|
||||
for (y = 0; y < 64; y++)
|
||||
wsetrgb (y + 64, y*4, 0, 0, palette);
|
||||
for (y = 0; y < 64; y++)
|
||||
wsetrgb (y + 128, 0, y*4, 0, palette);
|
||||
for (y = 0; y < 64; y++)
|
||||
wsetrgb (y + 192, 0, 0, y*4, palette);
|
||||
wsetpalette (0, 255, palette);
|
||||
|
||||
wcls (vgapal[0]);
|
||||
|
||||
wtextgrid (TEXTGRID_OFF);
|
||||
wtexttransparent (TEXTFGBG); /* Turn foreground and background on */
|
||||
|
||||
do {
|
||||
x = rand() % 1920;
|
||||
y = rand() % 1080;
|
||||
col = rand() % 256;
|
||||
wtextcolor (vgapal[col]);
|
||||
wouttextxy (x, y, NULL, "WordUp Graphics Toolkit");
|
||||
} while (!kbhit ());
|
||||
getch ();
|
||||
|
||||
wcls (0);
|
||||
wtextgrid (TEXTGRID_ON);
|
||||
|
||||
do {
|
||||
x = rand() % 240;
|
||||
y = rand() % 135;
|
||||
col = rand() % 256;
|
||||
wtextcolor (vgapal[col]);
|
||||
wtextbackground (vgapal[rand() % 256]);
|
||||
wouttextxy (x, y, NULL, "WordUp Graphics Toolkit");
|
||||
} while (!kbhit ());
|
||||
|
||||
getch ();
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
wgt07();
|
||||
while (1);
|
||||
}
|
16
part12-wgt/include/io.h
Normal file
16
part12-wgt/include/io.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#define PERIPHERAL_BASE 0xFE000000
|
||||
#define LEGACY_BASE 0x7E000000
|
||||
|
||||
void uart_init();
|
||||
void uart_writeText(char *buffer);
|
||||
void uart_loadOutputFifo();
|
||||
unsigned char uart_readByte();
|
||||
unsigned int uart_isReadByteReady();
|
||||
void uart_writeByteBlockingActual(unsigned char ch);
|
||||
void uart_update();
|
||||
void mmio_write(long reg, unsigned int val);
|
||||
unsigned int mmio_read(long reg);
|
||||
void gpio_useAsAlt0(unsigned int pin_number);
|
||||
void gpio_useAsAlt3(unsigned int pin_number);
|
||||
void uart_hex(unsigned int d);
|
||||
void uart_byte(unsigned char b);
|
34
part12-wgt/include/mb.h
Normal file
34
part12-wgt/include/mb.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
extern volatile unsigned int mbox[36];
|
||||
|
||||
enum {
|
||||
MBOX_REQUEST = 0
|
||||
};
|
||||
|
||||
enum {
|
||||
MBOX_CH_POWER = 0,
|
||||
MBOX_CH_FB = 1,
|
||||
MBOX_CH_VUART = 2,
|
||||
MBOX_CH_VCHIQ = 3,
|
||||
MBOX_CH_LEDS = 4,
|
||||
MBOX_CH_BTNS = 5,
|
||||
MBOX_CH_TOUCH = 6,
|
||||
MBOX_CH_COUNT = 7,
|
||||
MBOX_CH_PROP = 8 // Request from ARM for response by VideoCore
|
||||
};
|
||||
|
||||
enum {
|
||||
MBOX_TAG_SETPOWER = 0x28001,
|
||||
MBOX_TAG_SETCLKRATE = 0x38002,
|
||||
|
||||
MBOX_TAG_SETPHYWH = 0x48003,
|
||||
MBOX_TAG_SETVIRTWH = 0x48004,
|
||||
MBOX_TAG_SETVIRTOFF = 0x48009,
|
||||
MBOX_TAG_SETDEPTH = 0x48005,
|
||||
MBOX_TAG_SETPXLORDR = 0x48006,
|
||||
MBOX_TAG_GETFB = 0x40001,
|
||||
MBOX_TAG_GETPITCH = 0x40008,
|
||||
|
||||
MBOX_TAG_LAST = 0
|
||||
};
|
||||
|
||||
unsigned int mbox_call(unsigned char ch);
|
11
part12-wgt/include/multicore.h
Normal file
11
part12-wgt/include/multicore.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
extern unsigned int spin_cpu0;
|
||||
extern unsigned int spin_cpu1;
|
||||
extern unsigned int spin_cpu2;
|
||||
extern unsigned int spin_cpu3;
|
||||
|
||||
void start_core1(void (*func)(void));
|
||||
void start_core2(void (*func)(void));
|
||||
void start_core3(void (*func)(void));
|
||||
void clear_core1(void);
|
||||
void clear_core2(void);
|
||||
void clear_core3(void);
|
253
part12-wgt/include/terminal.h
Normal file
253
part12-wgt/include/terminal.h
Normal file
|
@ -0,0 +1,253 @@
|
|||
const unsigned int vgapal[16] = {
|
||||
0x000000,
|
||||
0x0000AA,
|
||||
0x00AA00,
|
||||
0x00AAAA,
|
||||
0xAA0000,
|
||||
0xAA00AA,
|
||||
0xAA5500,
|
||||
0xAAAAAA,
|
||||
0x555555,
|
||||
0x5555FF,
|
||||
0x55FF55,
|
||||
0x55FFFF,
|
||||
0xFF5555,
|
||||
0xFF55FF,
|
||||
0xFFFF55,
|
||||
0xFFFFFF
|
||||
};
|
||||
|
||||
enum {
|
||||
FONT_WIDTH = 8,
|
||||
FONT_HEIGHT = 8,
|
||||
FONT_BPG = 8, // Bytes per glyph
|
||||
FONT_BPL = 1, // Bytes per line
|
||||
FONT_NUMGLYPHS = 224
|
||||
};
|
||||
|
||||
const unsigned char font[FONT_NUMGLYPHS][FONT_BPG] = {
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space)
|
||||
{ 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!)
|
||||
{ 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (")
|
||||
{ 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#)
|
||||
{ 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($)
|
||||
{ 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%)
|
||||
{ 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&)
|
||||
{ 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (')
|
||||
{ 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (()
|
||||
{ 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ())
|
||||
{ 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*)
|
||||
{ 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,)
|
||||
{ 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.)
|
||||
{ 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/)
|
||||
{ 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0)
|
||||
{ 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1)
|
||||
{ 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2)
|
||||
{ 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3)
|
||||
{ 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4)
|
||||
{ 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5)
|
||||
{ 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6)
|
||||
{ 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7)
|
||||
{ 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8)
|
||||
{ 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9)
|
||||
{ 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:)
|
||||
{ 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (;)
|
||||
{ 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<)
|
||||
{ 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=)
|
||||
{ 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>)
|
||||
{ 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?)
|
||||
{ 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@)
|
||||
{ 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A)
|
||||
{ 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B)
|
||||
{ 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C)
|
||||
{ 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D)
|
||||
{ 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E)
|
||||
{ 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F)
|
||||
{ 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G)
|
||||
{ 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H)
|
||||
{ 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I)
|
||||
{ 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J)
|
||||
{ 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K)
|
||||
{ 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L)
|
||||
{ 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M)
|
||||
{ 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N)
|
||||
{ 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O)
|
||||
{ 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P)
|
||||
{ 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q)
|
||||
{ 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R)
|
||||
{ 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S)
|
||||
{ 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T)
|
||||
{ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U)
|
||||
{ 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V)
|
||||
{ 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W)
|
||||
{ 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X)
|
||||
{ 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y)
|
||||
{ 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z)
|
||||
{ 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([)
|
||||
{ 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\)
|
||||
{ 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (])
|
||||
{ 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_)
|
||||
{ 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`)
|
||||
{ 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a)
|
||||
{ 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b)
|
||||
{ 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c)
|
||||
{ 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d)
|
||||
{ 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e)
|
||||
{ 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f)
|
||||
{ 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g)
|
||||
{ 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h)
|
||||
{ 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i)
|
||||
{ 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j)
|
||||
{ 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k)
|
||||
{ 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l)
|
||||
{ 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m)
|
||||
{ 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n)
|
||||
{ 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o)
|
||||
{ 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p)
|
||||
{ 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q)
|
||||
{ 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r)
|
||||
{ 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s)
|
||||
{ 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t)
|
||||
{ 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u)
|
||||
{ 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v)
|
||||
{ 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w)
|
||||
{ 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x)
|
||||
{ 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y)
|
||||
{ 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z)
|
||||
{ 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({)
|
||||
{ 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|)
|
||||
{ 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (})
|
||||
{ 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007F
|
||||
{ 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x18, 0x30, 0x1E}, // U+00C7 (C cedille)
|
||||
{ 0x00, 0x33, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00FC (u umlaut)
|
||||
{ 0x38, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x1E, 0x00}, // U+00E9 (e aigu)
|
||||
{ 0x7E, 0xC3, 0x3C, 0x60, 0x7C, 0x66, 0xFC, 0x00}, // U+00E2 (a circumflex)
|
||||
{ 0x33, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E4 (a umlaut)
|
||||
{ 0x07, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E0 (a grave)
|
||||
{ 0x0C, 0x0C, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E5 (a ring)
|
||||
{ 0x00, 0x00, 0x1E, 0x03, 0x03, 0x1E, 0x30, 0x1C}, // U+00E7 (c cedille)
|
||||
{ 0x7E, 0xC3, 0x3C, 0x66, 0x7E, 0x06, 0x3C, 0x00}, // U+00EA (e circumflex)
|
||||
{ 0x33, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x1E, 0x00}, // U+00EB (e umlaut)
|
||||
{ 0x07, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x1E, 0x00}, // U+00E8 (e grave)
|
||||
{ 0x33, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00EF (i umlaut)
|
||||
{ 0x3E, 0x63, 0x1C, 0x18, 0x18, 0x18, 0x3C, 0x00}, // U+00EE (i circumflex)
|
||||
{ 0x07, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00EC (i grave)
|
||||
{ 0x63, 0x1C, 0x36, 0x63, 0x7F, 0x63, 0x63, 0x00}, // U+00C4 (A umlaut)
|
||||
{ 0x0C, 0x0C, 0x00, 0x1E, 0x33, 0x3F, 0x33, 0x00}, // U+00C5 (A ring)
|
||||
{ 0x07, 0x00, 0x3F, 0x06, 0x1E, 0x06, 0x3F, 0x00}, // U+00C8 (E grave)
|
||||
{ 0x00, 0x00, 0xFE, 0x30, 0xFE, 0x33, 0xFE, 0x00}, // U+00E6 (ae)
|
||||
{ 0x7C, 0x36, 0x33, 0x7F, 0x33, 0x33, 0x73, 0x00}, // U+00C6 (AE)
|
||||
{ 0x1E, 0x33, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F4 (o circumflex)
|
||||
{ 0x00, 0x33, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F6 (o umlaut)
|
||||
{ 0x00, 0x07, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F2 (o grave)
|
||||
{ 0x1E, 0x33, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00FB (u circumflex)
|
||||
{ 0x00, 0x07, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00F9 (u grave)
|
||||
{ 0x00, 0x33, 0x00, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+00FF (y umlaut)
|
||||
{ 0xC3, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x18, 0x00}, // U+00D6 (O umlaut)
|
||||
{ 0x33, 0x00, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+00DC (U umlaut)
|
||||
{ 0x18, 0x18, 0x7E, 0x03, 0x03, 0x7E, 0x18, 0x18}, // U+00A2 (dollarcents)
|
||||
{ 0x1C, 0x36, 0x26, 0x0F, 0x06, 0x67, 0x3F, 0x00}, // U+00A3 (pound sterling)
|
||||
{ 0x33, 0x33, 0x1E, 0x3F, 0x0C, 0x3F, 0x0C, 0x0C}, // U+00A5 (yen)
|
||||
{ 0x7C, 0xC6, 0x1C, 0x36, 0x36, 0x1C, 0x33, 0x1E}, // U+00A7 (paragraph)
|
||||
{ 0x70, 0xD8, 0x18, 0x3C, 0x18, 0x18, 0x1B, 0x0E}, // U+0192 (dutch florijn)
|
||||
{ 0x38, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E1 (a aigu)
|
||||
{ 0x1C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00ED (i augu)
|
||||
{ 0x00, 0x38, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F3 (o aigu)
|
||||
{ 0x00, 0x38, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00FA (u aigu)
|
||||
{ 0x00, 0x1F, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x00}, // U+00F1 (n ~)
|
||||
{ 0x3F, 0x00, 0x33, 0x37, 0x3F, 0x3B, 0x33, 0x00}, // U+00D1 (N ~)
|
||||
{ 0x3C, 0x36, 0x36, 0x7C, 0x00, 0x00, 0x00, 0x00}, // U+00AA (superscript a)
|
||||
{ 0x1C, 0x36, 0x36, 0x1C, 0x00, 0x00, 0x00, 0x00}, // U+00BA (superscript 0)
|
||||
{ 0x0C, 0x00, 0x0C, 0x06, 0x03, 0x33, 0x1E, 0x00}, // U+00BF (inverted ?)
|
||||
{ 0x00, 0x00, 0x00, 0x3F, 0x03, 0x03, 0x00, 0x00}, // U+2310 (gun pointing right)
|
||||
{ 0x00, 0x00, 0x00, 0x3F, 0x30, 0x30, 0x00, 0x00}, // U+00AC (gun pointing left)
|
||||
{ 0xC3, 0x63, 0x33, 0x7B, 0xCC, 0x66, 0x33, 0xF0}, // U+00BD (1/2)
|
||||
{ 0xC3, 0x63, 0x33, 0xBD, 0xEC, 0xF6, 0xF3, 0x03}, // U+00BC (1/4)
|
||||
{ 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00}, // U+00A1 (inverted !)
|
||||
{ 0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00}, // U+00AB (<<)
|
||||
{ 0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00}, // U+00BB (>>)
|
||||
{ 0x55, 0x00, 0xAA, 0x00, 0x55, 0x00, 0xAA, 0x00}, // U+2591 (25% solid)
|
||||
{ 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA}, // U+2592 (50% solid)
|
||||
{ 0xFF, 0xAA, 0xFF, 0x55, 0xFF, 0xAA, 0xFF, 0x55}, // U+2593 (75% solid)
|
||||
{ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08}, // U+2502 (thin vertical)
|
||||
{ 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08}, // U+2524 (down L, left L, up L)
|
||||
{ 0x08, 0x08, 0x08, 0x0F, 0x08, 0x0F, 0x08, 0x08}, // U+2561 (up L, down L, left D)
|
||||
{ 0x14, 0x14, 0x14, 0x14, 0x17, 0x14, 0x14, 0x14}, // U+2562 (up D, down D, left L)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x1F, 0x14, 0x14, 0x14}, // U+2556 (down D, left L)
|
||||
{ 0x00, 0x00, 0x00, 0x0F, 0x08, 0x0F, 0x08, 0x08}, // U+2555 (down L, left D)
|
||||
{ 0x14, 0x14, 0x14, 0x17, 0x10, 0x17, 0x14, 0x14}, // U+2563 (up D, down D, left D)
|
||||
{ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14}, // U+2551 (double vertical)
|
||||
{ 0x00, 0x00, 0x00, 0x1F, 0x10, 0x17, 0x14, 0x14}, // U+2557 (down D, left D)
|
||||
{ 0x14, 0x14, 0x14, 0x17, 0x10, 0x1F, 0x00, 0x00}, // U+255D (up D, left D)
|
||||
{ 0x14, 0x14, 0x14, 0x14, 0x1F, 0x00, 0x00, 0x00}, // U+255C (up D, left L)
|
||||
{ 0x08, 0x08, 0x08, 0x0F, 0x08, 0x0F, 0x00, 0x00}, // U+255B (up L, left D)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x0f, 0x08, 0x08, 0x08}, // U+2510 (down L, left L)
|
||||
{ 0x08, 0x08, 0x08, 0x08, 0xf8, 0x00, 0x00, 0x00}, // U+2514 (up L, right L)
|
||||
{ 0x08, 0x08, 0x08, 0x08, 0xff, 0x00, 0x00, 0x00}, // U+2534 (up L, right L, left L)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0xff, 0x08, 0x08, 0x08}, // U+252C (down L, right L, left L)
|
||||
{ 0x08, 0x08, 0x08, 0x08, 0xf8, 0x08, 0x08, 0x08}, // U+251C (down L, right L, up L)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00}, // U+2500 (thin horizontal)
|
||||
{ 0x08, 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08}, // U+253C (up L, right L, left L, down L)
|
||||
{ 0x08, 0x08, 0x08, 0xF8, 0x08, 0xF8, 0x08, 0x08}, // U+255E (up L, down L, right D)
|
||||
{ 0x14, 0x14, 0x14, 0x14, 0xF4, 0x14, 0x14, 0x14}, // U+255F (up D, down D, right L)
|
||||
{ 0x14, 0x14, 0x14, 0xF4, 0x04, 0xFC, 0x00, 0x00}, // U+255A (up D, right D)
|
||||
{ 0x00, 0x00, 0x00, 0xFC, 0x04, 0xF4, 0x14, 0x14}, // U+2554 (down D, right D)
|
||||
{ 0x14, 0x14, 0x14, 0xF7, 0x00, 0xFF, 0x00, 0x00}, // U+2569 (left D, right D, up D)
|
||||
{ 0x00, 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x14, 0x14}, // U+2566 (left D, right D, down D)
|
||||
{ 0x14, 0x14, 0x14, 0xF4, 0x04, 0xF4, 0x14, 0x14}, // U+2560 (up D, down D, right D)
|
||||
{ 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00}, // U+2550 (double horizontal)
|
||||
{ 0x14, 0x14, 0x14, 0xF7, 0x00, 0xF7, 0x14, 0x14}, // U+256C (left D, right D, down D, up D)
|
||||
{ 0x08, 0x08, 0x08, 0xFF, 0x00, 0xFF, 0x00, 0x00}, // U+2567 (left D, right D, up L)
|
||||
{ 0x14, 0x14, 0x14, 0x14, 0xFF, 0x00, 0x00, 0x00}, // U+2568 (left L, right L, up D)
|
||||
{ 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x08, 0x08}, // U+2564 (left D, right D, down L)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0xFF, 0x14, 0x14, 0x14}, // U+2565 (left L, right L, down D)
|
||||
{ 0x14, 0x14, 0x14, 0x14, 0xFC, 0x00, 0x00, 0x00}, // U+2559 (up D, right L)
|
||||
{ 0x08, 0x08, 0x08, 0xF8, 0x08, 0xF8, 0x00, 0x00}, // U+2558 (up L, right D)
|
||||
{ 0x00, 0x00, 0x00, 0xF8, 0x08, 0xF8, 0x08, 0x08}, // U+2552 (down L, right D)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0xFC, 0x14, 0x14, 0x14}, // U+2553 (down D, right L)
|
||||
{ 0x14, 0x14, 0x14, 0x14, 0xFF, 0x14, 0x14, 0x14}, // U+256B (left L, right L, down D, up D)
|
||||
{ 0x08, 0x08, 0x08, 0xFF, 0x08, 0xFF, 0x08, 0x08}, // U+256A (left D, right D, down L, up L)
|
||||
{ 0x08, 0x08, 0x08, 0x08, 0x0f, 0x00, 0x00, 0x00}, // U+2518 (up L, left L)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0xf8, 0x08, 0x08, 0x08}, // U+250C (down L, right L)
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, // U+2588 (solid)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF}, // U+2584 (bottom half)
|
||||
{ 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F}, // U+258C (left half)
|
||||
{ 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0}, // U+2590 (right half)
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00}, // U+2580 (top half)
|
||||
};
|
199
part12-wgt/lib/io.c
Normal file
199
part12-wgt/lib/io.c
Normal file
|
@ -0,0 +1,199 @@
|
|||
#include "../include/io.h"
|
||||
|
||||
// GPIO
|
||||
|
||||
enum {
|
||||
GPFSEL0 = PERIPHERAL_BASE + 0x200000,
|
||||
GPSET0 = PERIPHERAL_BASE + 0x20001C,
|
||||
GPCLR0 = PERIPHERAL_BASE + 0x200028,
|
||||
GPPUPPDN0 = PERIPHERAL_BASE + 0x2000E4
|
||||
};
|
||||
|
||||
enum {
|
||||
GPIO_MAX_PIN = 53,
|
||||
GPIO_FUNCTION_OUT = 1,
|
||||
GPIO_FUNCTION_ALT5 = 2,
|
||||
GPIO_FUNCTION_ALT3 = 7,
|
||||
GPIO_FUNCTION_ALT0 = 4
|
||||
};
|
||||
|
||||
enum {
|
||||
Pull_None = 0,
|
||||
Pull_Down = 1, // Are down and up the right way around?
|
||||
Pull_Up = 2
|
||||
};
|
||||
|
||||
void mmio_write(long reg, unsigned int val) { *(volatile unsigned int *)reg = val; }
|
||||
unsigned int mmio_read(long reg) { return *(volatile unsigned int *)reg; }
|
||||
|
||||
unsigned int gpio_call(unsigned int pin_number, unsigned int value, unsigned int base, unsigned int field_size, unsigned int field_max) {
|
||||
unsigned int field_mask = (1 << field_size) - 1;
|
||||
|
||||
if (pin_number > field_max) return 0;
|
||||
if (value > field_mask) return 0;
|
||||
|
||||
unsigned int num_fields = 32 / field_size;
|
||||
unsigned int reg = base + ((pin_number / num_fields) * 4);
|
||||
unsigned int shift = (pin_number % num_fields) * field_size;
|
||||
|
||||
unsigned int curval = mmio_read(reg);
|
||||
curval &= ~(field_mask << shift);
|
||||
curval |= value << shift;
|
||||
mmio_write(reg, curval);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned int gpio_set (unsigned int pin_number, unsigned int value) { return gpio_call(pin_number, value, GPSET0, 1, GPIO_MAX_PIN); }
|
||||
unsigned int gpio_clear (unsigned int pin_number, unsigned int value) { return gpio_call(pin_number, value, GPCLR0, 1, GPIO_MAX_PIN); }
|
||||
unsigned int gpio_pull (unsigned int pin_number, unsigned int value) { return gpio_call(pin_number, value, GPPUPPDN0, 2, GPIO_MAX_PIN); }
|
||||
unsigned int gpio_function(unsigned int pin_number, unsigned int value) { return gpio_call(pin_number, value, GPFSEL0, 3, GPIO_MAX_PIN); }
|
||||
|
||||
void gpio_useAsAlt0(unsigned int pin_number) {
|
||||
gpio_pull(pin_number, Pull_None);
|
||||
gpio_function(pin_number, GPIO_FUNCTION_ALT0);
|
||||
}
|
||||
|
||||
void gpio_useAsAlt3(unsigned int pin_number) {
|
||||
gpio_pull(pin_number, Pull_None);
|
||||
gpio_function(pin_number, GPIO_FUNCTION_ALT3);
|
||||
}
|
||||
|
||||
void gpio_useAsAlt5(unsigned int pin_number) {
|
||||
gpio_pull(pin_number, Pull_None);
|
||||
gpio_function(pin_number, GPIO_FUNCTION_ALT5);
|
||||
}
|
||||
|
||||
void gpio_initOutputPinWithPullNone(unsigned int pin_number) {
|
||||
gpio_pull(pin_number, Pull_None);
|
||||
gpio_function(pin_number, GPIO_FUNCTION_OUT);
|
||||
}
|
||||
|
||||
void gpio_setPinOutputBool(unsigned int pin_number, unsigned int onOrOff) {
|
||||
if (onOrOff) {
|
||||
gpio_set(pin_number, 1);
|
||||
} else {
|
||||
gpio_clear(pin_number, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// UART
|
||||
|
||||
enum {
|
||||
AUX_BASE = PERIPHERAL_BASE + 0x215000,
|
||||
AUX_IRQ = AUX_BASE,
|
||||
AUX_ENABLES = AUX_BASE + 4,
|
||||
AUX_MU_IO_REG = AUX_BASE + 64,
|
||||
AUX_MU_IER_REG = AUX_BASE + 68,
|
||||
AUX_MU_IIR_REG = AUX_BASE + 72,
|
||||
AUX_MU_LCR_REG = AUX_BASE + 76,
|
||||
AUX_MU_MCR_REG = AUX_BASE + 80,
|
||||
AUX_MU_LSR_REG = AUX_BASE + 84,
|
||||
AUX_MU_MSR_REG = AUX_BASE + 88,
|
||||
AUX_MU_SCRATCH = AUX_BASE + 92,
|
||||
AUX_MU_CNTL_REG = AUX_BASE + 96,
|
||||
AUX_MU_STAT_REG = AUX_BASE + 100,
|
||||
AUX_MU_BAUD_REG = AUX_BASE + 104,
|
||||
AUX_UART_CLOCK = 500000000,
|
||||
UART_MAX_QUEUE = 16 * 1024
|
||||
};
|
||||
|
||||
#define AUX_MU_BAUD(baud) ((AUX_UART_CLOCK/(baud*8))-1)
|
||||
|
||||
unsigned char uart_output_queue[UART_MAX_QUEUE];
|
||||
unsigned int uart_output_queue_write = 0;
|
||||
unsigned int uart_output_queue_read = 0;
|
||||
|
||||
void uart_init() {
|
||||
mmio_write(AUX_ENABLES, 1); //enable UART1
|
||||
mmio_write(AUX_MU_IER_REG, 0);
|
||||
mmio_write(AUX_MU_CNTL_REG, 0);
|
||||
mmio_write(AUX_MU_LCR_REG, 3); //8 bits
|
||||
mmio_write(AUX_MU_MCR_REG, 0);
|
||||
mmio_write(AUX_MU_IER_REG, 0);
|
||||
mmio_write(AUX_MU_IIR_REG, 0xC6); //disable interrupts
|
||||
mmio_write(AUX_MU_BAUD_REG, AUX_MU_BAUD(115200));
|
||||
gpio_useAsAlt5(14);
|
||||
gpio_useAsAlt5(15);
|
||||
mmio_write(AUX_MU_CNTL_REG, 3); //enable RX/TX
|
||||
}
|
||||
|
||||
unsigned int uart_isOutputQueueEmpty() {
|
||||
return uart_output_queue_read == uart_output_queue_write;
|
||||
}
|
||||
|
||||
unsigned int uart_isReadByteReady() { return mmio_read(AUX_MU_LSR_REG) & 0x01; }
|
||||
unsigned int uart_isWriteByteReady() { return mmio_read(AUX_MU_LSR_REG) & 0x20; }
|
||||
|
||||
unsigned char uart_readByte() {
|
||||
while (!uart_isReadByteReady());
|
||||
return (unsigned char)mmio_read(AUX_MU_IO_REG);
|
||||
}
|
||||
|
||||
void uart_writeByteBlockingActual(unsigned char ch) {
|
||||
while (!uart_isWriteByteReady());
|
||||
mmio_write(AUX_MU_IO_REG, (unsigned int)ch);
|
||||
}
|
||||
|
||||
void uart_loadOutputFifo() {
|
||||
while (!uart_isOutputQueueEmpty() && uart_isWriteByteReady()) {
|
||||
uart_writeByteBlockingActual(uart_output_queue[uart_output_queue_read]);
|
||||
uart_output_queue_read = (uart_output_queue_read + 1) & (UART_MAX_QUEUE - 1); // Don't overrun
|
||||
}
|
||||
}
|
||||
|
||||
void uart_writeByteBlocking(unsigned char ch) {
|
||||
unsigned int next = (uart_output_queue_write + 1) & (UART_MAX_QUEUE - 1); // Don't overrun
|
||||
|
||||
while (next == uart_output_queue_read) uart_loadOutputFifo();
|
||||
|
||||
uart_output_queue[uart_output_queue_write] = ch;
|
||||
uart_output_queue_write = next;
|
||||
}
|
||||
|
||||
void uart_writeText(char *buffer) {
|
||||
while (*buffer) {
|
||||
if (*buffer == '\n') uart_writeByteBlockingActual('\r');
|
||||
uart_writeByteBlockingActual(*buffer++);
|
||||
}
|
||||
}
|
||||
|
||||
void uart_drainOutputQueue() {
|
||||
while (!uart_isOutputQueueEmpty()) uart_loadOutputFifo();
|
||||
}
|
||||
|
||||
void uart_update() {
|
||||
uart_loadOutputFifo();
|
||||
|
||||
if (uart_isReadByteReady()) {
|
||||
unsigned char ch = uart_readByte();
|
||||
if (ch == '\r') uart_writeText("\n"); else uart_writeByteBlocking(ch);
|
||||
}
|
||||
}
|
||||
|
||||
void uart_hex(unsigned int d) {
|
||||
unsigned int n;
|
||||
int c;
|
||||
for(c=28;c>=0;c-=4) {
|
||||
// get highest tetrad
|
||||
n=(d>>c)&0xF;
|
||||
// 0-9 => '0'-'9', 10-15 => 'A'-'F'
|
||||
n+=n>9?0x37:0x30;
|
||||
|
||||
uart_writeByteBlockingActual(n);
|
||||
}
|
||||
}
|
||||
|
||||
void uart_byte(unsigned char b) {
|
||||
unsigned int n;
|
||||
int c;
|
||||
for(c=4;c>=0;c-=4) {
|
||||
// get highest tetrad
|
||||
n=(b>>c)&0xF;
|
||||
// 0-9 => '0'-'9', 10-15 => 'A'-'F'
|
||||
n+=n>9?0x37:0x30;
|
||||
|
||||
uart_writeByteBlockingActual(n);
|
||||
}
|
||||
uart_writeByteBlockingActual(' ');
|
||||
}
|
39
part12-wgt/lib/mb.c
Normal file
39
part12-wgt/lib/mb.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include "../include/io.h"
|
||||
|
||||
// The buffer must be 16-byte aligned as only the upper 28 bits of the address can be passed via the mailbox
|
||||
volatile unsigned int __attribute__((aligned(16))) mbox[36];
|
||||
|
||||
enum {
|
||||
VIDEOCORE_MBOX = (PERIPHERAL_BASE + 0x0000B880),
|
||||
MBOX_READ = (VIDEOCORE_MBOX + 0x0),
|
||||
MBOX_POLL = (VIDEOCORE_MBOX + 0x10),
|
||||
MBOX_SENDER = (VIDEOCORE_MBOX + 0x14),
|
||||
MBOX_STATUS = (VIDEOCORE_MBOX + 0x18),
|
||||
MBOX_CONFIG = (VIDEOCORE_MBOX + 0x1C),
|
||||
MBOX_WRITE = (VIDEOCORE_MBOX + 0x20),
|
||||
MBOX_RESPONSE = 0x80000000,
|
||||
MBOX_FULL = 0x80000000,
|
||||
MBOX_EMPTY = 0x40000000
|
||||
};
|
||||
|
||||
unsigned int mbox_call(unsigned char ch)
|
||||
{
|
||||
// 28-bit address (MSB) and 4-bit value (LSB)
|
||||
unsigned int r = ((unsigned int)((long) &mbox) &~ 0xF) | (ch & 0xF);
|
||||
|
||||
// Wait until we can write
|
||||
while (mmio_read(MBOX_STATUS) & MBOX_FULL);
|
||||
|
||||
// Write the address of our buffer to the mailbox with the channel appended
|
||||
mmio_write(MBOX_WRITE, r);
|
||||
|
||||
while (1) {
|
||||
// Is there a reply?
|
||||
while (mmio_read(MBOX_STATUS) & MBOX_EMPTY);
|
||||
|
||||
// Is it a reply to our message?
|
||||
if (r == mmio_read(MBOX_READ)) return mbox[1]==MBOX_RESPONSE; // Is it successful?
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
44
part12-wgt/lib/multicore.c
Normal file
44
part12-wgt/lib/multicore.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
#include "../include/multicore.h"
|
||||
|
||||
void store32(unsigned long address, unsigned long value)
|
||||
{
|
||||
*(unsigned long *) address = value;
|
||||
}
|
||||
|
||||
unsigned long load32(unsigned long address)
|
||||
{
|
||||
return *(unsigned long *) address;
|
||||
}
|
||||
|
||||
void start_core1(void (*func)(void))
|
||||
{
|
||||
store32((unsigned long)&spin_cpu1, (unsigned long)func);
|
||||
asm volatile ("sev");
|
||||
}
|
||||
|
||||
void start_core2(void (*func)(void))
|
||||
{
|
||||
store32((unsigned long)&spin_cpu2, (unsigned long)func);
|
||||
asm volatile ("sev");
|
||||
}
|
||||
|
||||
void start_core3(void (*func)(void))
|
||||
{
|
||||
store32((unsigned long)&spin_cpu3, (unsigned long)func);
|
||||
asm volatile ("sev");
|
||||
}
|
||||
|
||||
void clear_core1(void)
|
||||
{
|
||||
store32((unsigned long)&spin_cpu1, 0);
|
||||
}
|
||||
|
||||
void clear_core2(void)
|
||||
{
|
||||
store32((unsigned long)&spin_cpu2, 0);
|
||||
}
|
||||
|
||||
void clear_core3(void)
|
||||
{
|
||||
store32((unsigned long)&spin_cpu3, 0);
|
||||
}
|
177
part12-wgt/nline.c
Normal file
177
part12-wgt/nline.c
Normal file
|
@ -0,0 +1,177 @@
|
|||
#include "wgt.h"
|
||||
|
||||
void wfline (short x, short y, short x2, short y2)
|
||||
{
|
||||
short t, distance;
|
||||
short wx = 0, wy = 0, dx, dy, bdx, bdy, incx, incy;
|
||||
unsigned int *temp;
|
||||
|
||||
if ((y == y2) & (y >= ty) & (y < by + 1))
|
||||
{
|
||||
if (x > x2)
|
||||
{
|
||||
t = x; /* swap */
|
||||
x = x2;
|
||||
x2 = t;
|
||||
}
|
||||
|
||||
if (x < tx)
|
||||
x = tx;
|
||||
if (x2 > bx)
|
||||
x2 = bx;
|
||||
if (x2 - x + 1 > 0)
|
||||
memset (&abuf[y * WGT_SYS.xres + x], currentcolor, x2 - x + 1);
|
||||
}
|
||||
else if ((x == x2) & (x >= tx) & (x < bx + 1))
|
||||
{
|
||||
if (y > y2)
|
||||
{
|
||||
t = y;
|
||||
y = y2;
|
||||
y2 = t;
|
||||
}
|
||||
if (y < ty)
|
||||
y = ty;
|
||||
if (y2 > by)
|
||||
y2 = by;
|
||||
|
||||
temp = &abuf[y*WGT_SYS.xres + x];
|
||||
for (t = y; t <= y2; t++)
|
||||
{
|
||||
*temp = currentcolor;
|
||||
temp += WGT_SYS.xres;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dx = x2 - x;
|
||||
dy = y2 - y;
|
||||
t = 0;
|
||||
wx = 0;
|
||||
wy = 0;
|
||||
|
||||
if (dy < 0)
|
||||
incy = - 1;
|
||||
else incy = 1;
|
||||
|
||||
if (dx < 0)
|
||||
incx = - 1;
|
||||
else incx = 1;
|
||||
|
||||
bdx = abs (dx);
|
||||
bdy = abs (dy);
|
||||
if (bdx > bdy)
|
||||
distance = bdx;
|
||||
else distance = bdy;
|
||||
|
||||
temp = &abuf[y * WGT_SYS.xres + x];
|
||||
if (distance == bdx)
|
||||
{
|
||||
while (t <= distance)
|
||||
{
|
||||
*temp = currentcolor;
|
||||
wy += bdy;
|
||||
x += incx;
|
||||
temp += incx;
|
||||
t++;
|
||||
if (wy >= distance)
|
||||
{
|
||||
wy -= distance;
|
||||
y += incy;
|
||||
temp += incy * WGT_SYS.xres;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (t <= distance)
|
||||
{
|
||||
*temp = currentcolor;
|
||||
wx += bdx;
|
||||
if (wx >= distance)
|
||||
{
|
||||
wx -= distance;
|
||||
x += incx;
|
||||
temp += incx;
|
||||
}
|
||||
y += incy;
|
||||
temp += incy * WGT_SYS.xres;
|
||||
t++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wstyleline (short x, short y, short x2, short y2, unsigned short style)
|
||||
{
|
||||
short lc;
|
||||
short t, distance;
|
||||
short wx = 0, wy = 0, dx, dy, bdx, bdy, incx, incy;
|
||||
unsigned int *temp;
|
||||
|
||||
dx = x2 - x;
|
||||
dy = y2 - y;
|
||||
t = 0;
|
||||
wx = 0;
|
||||
wy = 0;
|
||||
lc = 0;
|
||||
|
||||
if (dy < 0)
|
||||
incy = - 1;
|
||||
else incy = 1;
|
||||
|
||||
if (dx < 0)
|
||||
incx = - 1;
|
||||
else incx = 1;
|
||||
|
||||
bdx = abs (dx);
|
||||
bdy = abs (dy);
|
||||
|
||||
if (bdx > bdy)
|
||||
distance = bdx;
|
||||
else distance = bdy;
|
||||
|
||||
temp = &abuf[y * WGT_SYS.xres + x];
|
||||
|
||||
if (distance == bdx)
|
||||
{
|
||||
while (t <= distance)
|
||||
{
|
||||
if ((style >> lc) % 2)
|
||||
*temp = currentcolor;
|
||||
lc++;
|
||||
if (lc > 15)
|
||||
lc = 0;
|
||||
wy += bdy;
|
||||
x += incx;
|
||||
temp += incx;
|
||||
t++;
|
||||
if (wy >= distance)
|
||||
{
|
||||
wy -= distance;
|
||||
y += incy;
|
||||
temp += incy * WGT_SYS.xres;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
while (t <= distance)
|
||||
{
|
||||
if ((style >> lc) % 2)
|
||||
*temp = currentcolor;
|
||||
/* Only draw a pixel if the bit is set */
|
||||
lc++;
|
||||
if (lc > 15)
|
||||
lc = 0;
|
||||
wx += bdx;
|
||||
if (wx >= distance)
|
||||
{
|
||||
wx -= distance;
|
||||
x += incx;
|
||||
temp += incx;
|
||||
}
|
||||
y += incy;
|
||||
temp += incy * WGT_SYS.xres;
|
||||
t++;
|
||||
}
|
||||
}
|
51
part12-wgt/wbox.c
Normal file
51
part12-wgt/wbox.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include "wgt.h"
|
||||
|
||||
void wrectangle (short x, short y, short x2, short y2)
|
||||
{
|
||||
wline (x, y, x2, y);
|
||||
wline (x2, y2, x, y2);
|
||||
wline (x, y, x, y2);
|
||||
wline (x2, y, x2, y2);
|
||||
}
|
||||
|
||||
void wbar (short x, short y, short x2, short y2)
|
||||
{
|
||||
short ctr,len;
|
||||
unsigned int *temp;
|
||||
|
||||
if (y2 < y)
|
||||
{
|
||||
/* swap y's */
|
||||
ctr = y;
|
||||
y = y2;
|
||||
y2 = ctr;
|
||||
}
|
||||
|
||||
if (x2 < x)
|
||||
{
|
||||
ctr = x;
|
||||
x = x2;
|
||||
x2 = ctr;
|
||||
}
|
||||
|
||||
if ((y <= by) & (y2 >= ty) & (x <= bx) & (x2 >= tx))
|
||||
/* If anything is within clipping */
|
||||
{
|
||||
if (y2 > by) y2 = by; /* Clip bar */
|
||||
if (x2 > bx) x2 = bx;
|
||||
if (y < ty) y = ty;
|
||||
if (x < tx) x = tx;
|
||||
|
||||
len = x2 - x + 1; /* Find number of pixels to set */
|
||||
if (len > 0)
|
||||
{
|
||||
temp = &abuf[y*WGT_SYS.xres + x];
|
||||
for (ctr = y; ctr <= y2; ctr++)
|
||||
{
|
||||
memset (temp, currentcolor, len);
|
||||
/* Draw a horizontal line */
|
||||
temp += WGT_SYS.xres; /* Go to next row */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
34
part12-wgt/wbutt.c
Normal file
34
part12-wgt/wbutt.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include "wgt.h"
|
||||
|
||||
void wbutt (short x, short y, short x2, short y2)
|
||||
{
|
||||
short ctr;
|
||||
|
||||
if (y2 < y)
|
||||
{
|
||||
/* swap y's */
|
||||
ctr = y;
|
||||
y = y2;
|
||||
y2 = ctr;
|
||||
}
|
||||
|
||||
if (x2 < x)
|
||||
{
|
||||
/* swap x's */
|
||||
ctr = x;
|
||||
x = x2;
|
||||
x2 = ctr;
|
||||
}
|
||||
wsetcolor (vgapal[0]);
|
||||
wrectangle (x - 1, y - 1, x2 + 1, y2 + 1);
|
||||
/* Clear area for button */
|
||||
wsetcolor (vgapal[254]);
|
||||
wbar (x, y, x2, y2); /* Draw inner bar */
|
||||
wsetcolor (vgapal[255]);
|
||||
wline (x2, y, x2, y2); /* Outline right and bottom edges */
|
||||
wline (x2, y2, x, y2);
|
||||
|
||||
wsetcolor (vgapal[253]); /* Use a different shade */
|
||||
wline (x, y, x2, y); /* Outline upper and left edges */
|
||||
wline (x, y, x, y2);
|
||||
}
|
135
part12-wgt/wcircle.c
Normal file
135
part12-wgt/wcircle.c
Normal file
|
@ -0,0 +1,135 @@
|
|||
#include "wgt.h"
|
||||
|
||||
static void hplotcircle (short x, short y, short x_center, short y_center)
|
||||
{
|
||||
unsigned short a,b,c,d;
|
||||
unsigned short startx, endx, x1, starty, endy, y1;
|
||||
|
||||
starty = y;
|
||||
endy = y + 1;
|
||||
startx = x;
|
||||
endx = x + 1;
|
||||
a = y + y_center;
|
||||
b = y_center - y;
|
||||
for (x1 = startx; x1 < endx; x1++)
|
||||
{
|
||||
c = x1 + x_center;
|
||||
d = x_center - x1;
|
||||
wputpixel(c, a);
|
||||
wputpixel(c, b);
|
||||
wputpixel(d, b);
|
||||
wputpixel(d, a);
|
||||
}
|
||||
a = x + y_center;
|
||||
b = y_center - x;
|
||||
for (y1 = starty; y1 < endy; y1++)
|
||||
{
|
||||
c = y1 + x_center;
|
||||
d = x_center - y1;
|
||||
wputpixel(c, a);
|
||||
wputpixel(c, b);
|
||||
wputpixel(d, b);
|
||||
wputpixel(d, a);
|
||||
}
|
||||
}
|
||||
|
||||
void wcircle (short x_center, short y_center, short radius)
|
||||
{
|
||||
short x,y,delta;
|
||||
y = radius;
|
||||
delta = 3 - 2 * radius;
|
||||
x = 0;
|
||||
while (x < y)
|
||||
{
|
||||
hplotcircle (x, y, x_center, y_center);
|
||||
if (delta < 0)
|
||||
delta += 4 * x + 6;
|
||||
else
|
||||
{
|
||||
delta += 4 * (x - y) + 10;
|
||||
y--;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
x = y;
|
||||
if (y >= 0)
|
||||
hplotcircle (x, y, x_center, y_center);
|
||||
}
|
||||
|
||||
static void fplotcircle (short x, short y, short x_center, short y_center)
|
||||
{
|
||||
unsigned int *ptr;
|
||||
short display,display2;
|
||||
|
||||
display = x * 2;
|
||||
display2 = x_center - x;
|
||||
if (x + x_center > bx)
|
||||
display = bx + 1 - (x_center - x);
|
||||
if (display2 < tx)
|
||||
{
|
||||
display -= tx - display2;
|
||||
display2 = tx;
|
||||
}
|
||||
if (display > 0)
|
||||
{
|
||||
if ((y + y_center <= by) && (y + y_center >= ty))
|
||||
{
|
||||
ptr = &abuf[(y + y_center)*(WGT_SYS.xres) + display2];
|
||||
memset (ptr, currentcolor, display);
|
||||
}
|
||||
|
||||
if ((y_center - y >= ty) && (y_center - y <= by))
|
||||
{
|
||||
ptr = &abuf[(y_center - y)*(WGT_SYS.xres) + display2];
|
||||
memset (ptr, currentcolor, display);
|
||||
}
|
||||
}
|
||||
display = y*2;
|
||||
display2 = x_center - y;
|
||||
|
||||
if (y + x_center > bx)
|
||||
display = bx + 1 - (x_center - y);
|
||||
if (display2 < tx)
|
||||
{
|
||||
display -= tx - display2;
|
||||
display2 = tx;
|
||||
}
|
||||
|
||||
if (display < 0)
|
||||
return;
|
||||
|
||||
if ((x + y_center <= by) && (x + y_center >= ty))
|
||||
{
|
||||
ptr = &abuf[(x + y_center) * (WGT_SYS.xres) + display2];
|
||||
memset (ptr, currentcolor, display);
|
||||
}
|
||||
|
||||
if ((y_center - x >= ty) && (y_center - x <= by))
|
||||
{
|
||||
ptr = &abuf[(y_center - x) * (WGT_SYS.xres) + display2];
|
||||
memset (ptr, currentcolor, display);
|
||||
}
|
||||
}
|
||||
|
||||
void wfill_circle (short x_center, short y_center, short radius)
|
||||
{
|
||||
short x,y,delta;
|
||||
y = radius;
|
||||
delta = 3 - 2 * radius;
|
||||
x = 0;
|
||||
while (x < y)
|
||||
{
|
||||
fplotcircle (x, y, x_center, y_center);
|
||||
if (delta < 0)
|
||||
delta += (4 * x + 6);
|
||||
else
|
||||
{
|
||||
delta += 4 * (x - y) + 10;
|
||||
y--;
|
||||
}
|
||||
x++;
|
||||
}
|
||||
x = y;
|
||||
if (y >= 0)
|
||||
fplotcircle (x, y, x_center, y_center);
|
||||
}
|
14
part12-wgt/wclip.c
Normal file
14
part12-wgt/wclip.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "wgt.h"
|
||||
|
||||
void wclip (short x, short y, short x2, short y2)
|
||||
{
|
||||
tx = x; /* Upper x limit */
|
||||
ty = y; /* Upper y limit */
|
||||
bx = x2; /* Lower x limit */
|
||||
by = y2; /* Lower y limit */
|
||||
/* Stay within screen bounds, no negatives */
|
||||
if (tx < 0) tx = 0;
|
||||
if (ty < 0) ty = 0;
|
||||
if (bx >= WGT_SYS.xres) bx = WGT_SYS.xres - 1;
|
||||
if (by >= WGT_SYS.yres) by = WGT_SYS.yres - 1;
|
||||
}
|
488
part12-wgt/wdefaults.c
Normal file
488
part12-wgt/wdefaults.c
Normal file
|
@ -0,0 +1,488 @@
|
|||
#include "wgt.h"
|
||||
|
||||
/* VGA 256 colour default palette */
|
||||
unsigned int vgapal[256] = {
|
||||
rgb( 0, 0, 0),
|
||||
rgb( 0, 0,170),
|
||||
rgb( 0,170, 0),
|
||||
rgb( 0,170,170),
|
||||
rgb(170, 0, 0),
|
||||
rgb(170, 0,170),
|
||||
rgb(170, 85, 0),
|
||||
rgb(170,170,170),
|
||||
rgb( 85, 85, 85),
|
||||
rgb( 85, 85,255),
|
||||
rgb( 85,255, 85),
|
||||
rgb( 85,255,255),
|
||||
rgb(255, 85, 85),
|
||||
rgb(255, 85,255),
|
||||
rgb(255,255, 85),
|
||||
rgb(255,255,255),
|
||||
rgb( 0, 0, 0),
|
||||
rgb( 20, 20, 20),
|
||||
rgb( 32, 32, 32),
|
||||
rgb( 44, 44, 44),
|
||||
rgb( 56, 56, 56),
|
||||
rgb( 68, 68, 68),
|
||||
rgb( 80, 80, 80),
|
||||
rgb( 97, 97, 97),
|
||||
rgb(113,113,113),
|
||||
rgb(129,129,129),
|
||||
rgb(145,145,145),
|
||||
rgb(161,161,161),
|
||||
rgb(182,182,182),
|
||||
rgb(202,202,202),
|
||||
rgb(226,226,226),
|
||||
rgb(255,255,255),
|
||||
rgb( 0, 0,255),
|
||||
rgb( 64, 0,255),
|
||||
rgb(125, 0,255),
|
||||
rgb(190, 0,255),
|
||||
rgb(255, 0,255),
|
||||
rgb(255, 0,190),
|
||||
rgb(255, 0,125),
|
||||
rgb(255, 0, 64),
|
||||
rgb(255, 0, 0),
|
||||
rgb(255, 64, 0),
|
||||
rgb(255,125, 0),
|
||||
rgb(255,190, 0),
|
||||
rgb(255,255, 0),
|
||||
rgb(190,255, 0),
|
||||
rgb(125,255, 0),
|
||||
rgb( 64,255, 0),
|
||||
rgb( 0,255, 0),
|
||||
rgb( 0,255, 64),
|
||||
rgb( 0,255,125),
|
||||
rgb( 0,255,190),
|
||||
rgb( 0,255,255),
|
||||
rgb( 0,190,255),
|
||||
rgb( 0,125,255),
|
||||
rgb( 0, 64,255),
|
||||
rgb(125,125,255),
|
||||
rgb(157,125,255),
|
||||
rgb(190,125,255),
|
||||
rgb(222,125,255),
|
||||
rgb(255,125,255),
|
||||
rgb(255,125,222),
|
||||
rgb(255,125,190),
|
||||
rgb(255,125,157),
|
||||
rgb(255,125,125),
|
||||
rgb(255,157,125),
|
||||
rgb(255,190,125),
|
||||
rgb(255,222,125),
|
||||
rgb(255,255,125),
|
||||
rgb(222,255,125),
|
||||
rgb(190,255,125),
|
||||
rgb(157,255,125),
|
||||
rgb(125,255,125),
|
||||
rgb(125,255,157),
|
||||
rgb(125,255,190),
|
||||
rgb(125,255,222),
|
||||
rgb(125,255,255),
|
||||
rgb(125,222,255),
|
||||
rgb(125,190,255),
|
||||
rgb(125,157,255),
|
||||
rgb(182,182,255),
|
||||
rgb(198,182,255),
|
||||
rgb(218,182,255),
|
||||
rgb(234,182,255),
|
||||
rgb(255,182,255),
|
||||
rgb(255,182,234),
|
||||
rgb(255,182,218),
|
||||
rgb(255,182,198),
|
||||
rgb(255,182,182),
|
||||
rgb(255,198,182),
|
||||
rgb(255,218,182),
|
||||
rgb(255,234,182),
|
||||
rgb(255,255,182),
|
||||
rgb(234,255,182),
|
||||
rgb(218,255,182),
|
||||
rgb(198,255,182),
|
||||
rgb(182,255,182),
|
||||
rgb(182,255,198),
|
||||
rgb(182,255,218),
|
||||
rgb(182,255,234),
|
||||
rgb(182,255,255),
|
||||
rgb(182,234,255),
|
||||
rgb(182,218,255),
|
||||
rgb(182,198,255),
|
||||
rgb( 0, 0,113),
|
||||
rgb( 28, 0,113),
|
||||
rgb( 56, 0,113),
|
||||
rgb( 85, 0,113),
|
||||
rgb(113, 0,113),
|
||||
rgb(113, 0, 85),
|
||||
rgb(113, 0, 56),
|
||||
rgb(113, 0, 28),
|
||||
rgb(113, 0, 0),
|
||||
rgb(113, 28, 0),
|
||||
rgb(113, 56, 0),
|
||||
rgb(113, 85, 0),
|
||||
rgb(113,113, 0),
|
||||
rgb( 85,113, 0),
|
||||
rgb( 56,113, 0),
|
||||
rgb( 28,113, 0),
|
||||
rgb( 0,113, 0),
|
||||
rgb( 0,113, 28),
|
||||
rgb( 0,113, 56),
|
||||
rgb( 0,113, 85),
|
||||
rgb( 0,113,113),
|
||||
rgb( 0, 85,113),
|
||||
rgb( 0, 56,113),
|
||||
rgb( 0, 28,113),
|
||||
rgb( 56, 56,113),
|
||||
rgb( 68, 56,113),
|
||||
rgb( 85, 56,113),
|
||||
rgb( 97, 56,113),
|
||||
rgb(113, 56,113),
|
||||
rgb(113, 56, 97),
|
||||
rgb(113, 56, 85),
|
||||
rgb(113, 56, 68),
|
||||
rgb(113, 56, 56),
|
||||
rgb(113, 68, 56),
|
||||
rgb(113, 85, 56),
|
||||
rgb(113, 97, 56),
|
||||
rgb(113,113, 56),
|
||||
rgb( 97,113, 56),
|
||||
rgb( 85,113, 56),
|
||||
rgb( 68,113, 56),
|
||||
rgb( 56,113, 56),
|
||||
rgb( 56,113, 68),
|
||||
rgb( 56,113, 85),
|
||||
rgb( 56,113, 97),
|
||||
rgb( 56,113,113),
|
||||
rgb( 56, 97,113),
|
||||
rgb( 56, 85,113),
|
||||
rgb( 56, 68,113),
|
||||
rgb( 80, 80,113),
|
||||
rgb( 89, 80,113),
|
||||
rgb( 97, 80,113),
|
||||
rgb(105, 80,113),
|
||||
rgb(113, 80,113),
|
||||
rgb(113, 80,105),
|
||||
rgb(113, 80, 97),
|
||||
rgb(113, 80, 89),
|
||||
rgb(113, 80, 80),
|
||||
rgb(113, 89, 80),
|
||||
rgb(113, 97, 80),
|
||||
rgb(113,105, 80),
|
||||
rgb(113,113, 80),
|
||||
rgb(105,113, 80),
|
||||
rgb( 97,113, 80),
|
||||
rgb( 89,113, 80),
|
||||
rgb( 80,113, 80),
|
||||
rgb( 80,113, 89),
|
||||
rgb( 80,113, 97),
|
||||
rgb( 80,113,105),
|
||||
rgb( 80,113,113),
|
||||
rgb( 80,105,113),
|
||||
rgb( 80, 97,113),
|
||||
rgb( 80, 89,113),
|
||||
rgb( 0, 0, 64),
|
||||
rgb( 16, 0, 64),
|
||||
rgb( 32, 0, 64),
|
||||
rgb( 48, 0, 64),
|
||||
rgb( 64, 0, 64),
|
||||
rgb( 64, 0, 48),
|
||||
rgb( 64, 0, 32),
|
||||
rgb( 64, 0, 16),
|
||||
rgb( 64, 0, 0),
|
||||
rgb( 64, 16, 0),
|
||||
rgb( 64, 32, 0),
|
||||
rgb( 64, 48, 0),
|
||||
rgb( 64, 64, 0),
|
||||
rgb( 48, 64, 0),
|
||||
rgb( 32, 64, 0),
|
||||
rgb( 16, 64, 0),
|
||||
rgb( 0, 64, 0),
|
||||
rgb( 0, 64, 16),
|
||||
rgb( 0, 64, 32),
|
||||
rgb( 0, 64, 48),
|
||||
rgb( 0, 64, 64),
|
||||
rgb( 0, 48, 64),
|
||||
rgb( 0, 32, 64),
|
||||
rgb( 0, 16, 64),
|
||||
rgb( 32, 32, 64),
|
||||
rgb( 40, 32, 64),
|
||||
rgb( 48, 32, 64),
|
||||
rgb( 56, 32, 64),
|
||||
rgb( 64, 32, 64),
|
||||
rgb( 64, 32, 56),
|
||||
rgb( 64, 32, 48),
|
||||
rgb( 64, 32, 40),
|
||||
rgb( 64, 32, 32),
|
||||
rgb( 64, 40, 32),
|
||||
rgb( 64, 48, 32),
|
||||
rgb( 64, 56, 32),
|
||||
rgb( 64, 64, 32),
|
||||
rgb( 56, 64, 32),
|
||||
rgb( 48, 64, 32),
|
||||
rgb( 40, 64, 32),
|
||||
rgb( 32, 64, 32),
|
||||
rgb( 32, 64, 40),
|
||||
rgb( 32, 64, 48),
|
||||
rgb( 32, 64, 56),
|
||||
rgb( 32, 64, 64),
|
||||
rgb( 32, 56, 64),
|
||||
rgb( 32, 48, 64),
|
||||
rgb( 32, 40, 64),
|
||||
rgb( 44, 44, 64),
|
||||
rgb( 48, 44, 64),
|
||||
rgb( 52, 44, 64),
|
||||
rgb( 60, 44, 64),
|
||||
rgb( 64, 44, 64),
|
||||
rgb( 64, 44, 60),
|
||||
rgb( 64, 44, 52),
|
||||
rgb( 64, 44, 48),
|
||||
rgb( 64, 44, 44),
|
||||
rgb( 64, 48, 44),
|
||||
rgb( 64, 52, 44),
|
||||
rgb( 64, 60, 44),
|
||||
rgb( 64, 64, 44),
|
||||
rgb( 60, 64, 44),
|
||||
rgb( 52, 64, 44),
|
||||
rgb( 48, 64, 44),
|
||||
rgb( 44, 64, 44),
|
||||
rgb( 44, 64, 48),
|
||||
rgb( 44, 64, 52),
|
||||
rgb( 44, 64, 60),
|
||||
rgb( 44, 64, 64),
|
||||
rgb( 44, 60, 64),
|
||||
rgb( 44, 52, 64),
|
||||
rgb( 44, 48, 64),
|
||||
rgb( 0, 0, 0),
|
||||
rgb( 0, 0, 0),
|
||||
rgb( 0, 0, 0),
|
||||
rgb( 0, 0, 0),
|
||||
rgb( 0, 0, 0),
|
||||
rgb( 0, 0, 0),
|
||||
rgb( 0, 0, 0),
|
||||
rgb( 0, 0, 0)
|
||||
};
|
||||
|
||||
unsigned char vgafont[224][8] = {
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0000 (nul)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0001
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0002
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0003
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0004
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0005
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0006
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0007
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0008
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0009
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000A
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000B
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000C
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000D
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000E
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+000F
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0010
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0011
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0012
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0013
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0014
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0015
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0016
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0017
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0018
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0019
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001A
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001B
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001C
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001D
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001E
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+001F
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0020 (space)
|
||||
{ 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, // U+0021 (!)
|
||||
{ 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0022 (")
|
||||
{ 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 0x00}, // U+0023 (#)
|
||||
{ 0x0C, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x0C, 0x00}, // U+0024 ($)
|
||||
{ 0x00, 0x63, 0x33, 0x18, 0x0C, 0x66, 0x63, 0x00}, // U+0025 (%)
|
||||
{ 0x1C, 0x36, 0x1C, 0x6E, 0x3B, 0x33, 0x6E, 0x00}, // U+0026 (&)
|
||||
{ 0x06, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0027 (')
|
||||
{ 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00}, // U+0028 (()
|
||||
{ 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00}, // U+0029 ())
|
||||
{ 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, // U+002A (*)
|
||||
{ 0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // U+002B (+)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+002C (,)
|
||||
{ 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00}, // U+002D (-)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+002E (.)
|
||||
{ 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00}, // U+002F (/)
|
||||
{ 0x3E, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x3E, 0x00}, // U+0030 (0)
|
||||
{ 0x0C, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00}, // U+0031 (1)
|
||||
{ 0x1E, 0x33, 0x30, 0x1C, 0x06, 0x33, 0x3F, 0x00}, // U+0032 (2)
|
||||
{ 0x1E, 0x33, 0x30, 0x1C, 0x30, 0x33, 0x1E, 0x00}, // U+0033 (3)
|
||||
{ 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x78, 0x00}, // U+0034 (4)
|
||||
{ 0x3F, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00}, // U+0035 (5)
|
||||
{ 0x1C, 0x06, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00}, // U+0036 (6)
|
||||
{ 0x3F, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00}, // U+0037 (7)
|
||||
{ 0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+0038 (8)
|
||||
{ 0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00}, // U+0039 (9)
|
||||
{ 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00}, // U+003A (:)
|
||||
{ 0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06}, // U+003B (;)
|
||||
{ 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00}, // U+003C (<)
|
||||
{ 0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00}, // U+003D (=)
|
||||
{ 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00}, // U+003E (>)
|
||||
{ 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00}, // U+003F (?)
|
||||
{ 0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00}, // U+0040 (@)
|
||||
{ 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00}, // U+0041 (A)
|
||||
{ 0x3F, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x3F, 0x00}, // U+0042 (B)
|
||||
{ 0x3C, 0x66, 0x03, 0x03, 0x03, 0x66, 0x3C, 0x00}, // U+0043 (C)
|
||||
{ 0x1F, 0x36, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00}, // U+0044 (D)
|
||||
{ 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x46, 0x7F, 0x00}, // U+0045 (E)
|
||||
{ 0x7F, 0x46, 0x16, 0x1E, 0x16, 0x06, 0x0F, 0x00}, // U+0046 (F)
|
||||
{ 0x3C, 0x66, 0x03, 0x03, 0x73, 0x66, 0x7C, 0x00}, // U+0047 (G)
|
||||
{ 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00}, // U+0048 (H)
|
||||
{ 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0049 (I)
|
||||
{ 0x78, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E, 0x00}, // U+004A (J)
|
||||
{ 0x67, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00}, // U+004B (K)
|
||||
{ 0x0F, 0x06, 0x06, 0x06, 0x46, 0x66, 0x7F, 0x00}, // U+004C (L)
|
||||
{ 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x00}, // U+004D (M)
|
||||
{ 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00}, // U+004E (N)
|
||||
{ 0x1C, 0x36, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00}, // U+004F (O)
|
||||
{ 0x3F, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x0F, 0x00}, // U+0050 (P)
|
||||
{ 0x1E, 0x33, 0x33, 0x33, 0x3B, 0x1E, 0x38, 0x00}, // U+0051 (Q)
|
||||
{ 0x3F, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x67, 0x00}, // U+0052 (R)
|
||||
{ 0x1E, 0x33, 0x07, 0x0E, 0x38, 0x33, 0x1E, 0x00}, // U+0053 (S)
|
||||
{ 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0054 (T)
|
||||
{ 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x00}, // U+0055 (U)
|
||||
{ 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0056 (V)
|
||||
{ 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00}, // U+0057 (W)
|
||||
{ 0x63, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00}, // U+0058 (X)
|
||||
{ 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x1E, 0x00}, // U+0059 (Y)
|
||||
{ 0x7F, 0x63, 0x31, 0x18, 0x4C, 0x66, 0x7F, 0x00}, // U+005A (Z)
|
||||
{ 0x1E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x1E, 0x00}, // U+005B ([)
|
||||
{ 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00}, // U+005C (\)
|
||||
{ 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00}, // U+005D (])
|
||||
{ 0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00}, // U+005E (^)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, // U+005F (_)
|
||||
{ 0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+0060 (`)
|
||||
{ 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x6E, 0x00}, // U+0061 (a)
|
||||
{ 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3B, 0x00}, // U+0062 (b)
|
||||
{ 0x00, 0x00, 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x00}, // U+0063 (c)
|
||||
{ 0x38, 0x30, 0x30, 0x3e, 0x33, 0x33, 0x6E, 0x00}, // U+0064 (d)
|
||||
{ 0x00, 0x00, 0x1E, 0x33, 0x3f, 0x03, 0x1E, 0x00}, // U+0065 (e)
|
||||
{ 0x1C, 0x36, 0x06, 0x0f, 0x06, 0x06, 0x0F, 0x00}, // U+0066 (f)
|
||||
{ 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0067 (g)
|
||||
{ 0x07, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x67, 0x00}, // U+0068 (h)
|
||||
{ 0x0C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+0069 (i)
|
||||
{ 0x30, 0x00, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // U+006A (j)
|
||||
{ 0x07, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x67, 0x00}, // U+006B (k)
|
||||
{ 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+006C (l)
|
||||
{ 0x00, 0x00, 0x33, 0x7F, 0x7F, 0x6B, 0x63, 0x00}, // U+006D (m)
|
||||
{ 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x00}, // U+006E (n)
|
||||
{ 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+006F (o)
|
||||
{ 0x00, 0x00, 0x3B, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // U+0070 (p)
|
||||
{ 0x00, 0x00, 0x6E, 0x33, 0x33, 0x3E, 0x30, 0x78}, // U+0071 (q)
|
||||
{ 0x00, 0x00, 0x3B, 0x6E, 0x66, 0x06, 0x0F, 0x00}, // U+0072 (r)
|
||||
{ 0x00, 0x00, 0x3E, 0x03, 0x1E, 0x30, 0x1F, 0x00}, // U+0073 (s)
|
||||
{ 0x08, 0x0C, 0x3E, 0x0C, 0x0C, 0x2C, 0x18, 0x00}, // U+0074 (t)
|
||||
{ 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00}, // U+0075 (u)
|
||||
{ 0x00, 0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00}, // U+0076 (v)
|
||||
{ 0x00, 0x00, 0x63, 0x6B, 0x7F, 0x7F, 0x36, 0x00}, // U+0077 (w)
|
||||
{ 0x00, 0x00, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x00}, // U+0078 (x)
|
||||
{ 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+0079 (y)
|
||||
{ 0x00, 0x00, 0x3F, 0x19, 0x0C, 0x26, 0x3F, 0x00}, // U+007A (z)
|
||||
{ 0x38, 0x0C, 0x0C, 0x07, 0x0C, 0x0C, 0x38, 0x00}, // U+007B ({)
|
||||
{ 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, // U+007C (|)
|
||||
{ 0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00}, // U+007D (})
|
||||
{ 0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007E (~)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // U+007F
|
||||
{ 0x1E, 0x33, 0x03, 0x33, 0x1E, 0x18, 0x30, 0x1E}, // U+00C7 (C cedille)
|
||||
{ 0x00, 0x33, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00FC (u umlaut)
|
||||
{ 0x38, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x1E, 0x00}, // U+00E9 (e aigu)
|
||||
{ 0x7E, 0xC3, 0x3C, 0x60, 0x7C, 0x66, 0xFC, 0x00}, // U+00E2 (a circumflex)
|
||||
{ 0x33, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E4 (a umlaut)
|
||||
{ 0x07, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E0 (a grave)
|
||||
{ 0x0C, 0x0C, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E5 (a ring)
|
||||
{ 0x00, 0x00, 0x1E, 0x03, 0x03, 0x1E, 0x30, 0x1C}, // U+00E7 (c cedille)
|
||||
{ 0x7E, 0xC3, 0x3C, 0x66, 0x7E, 0x06, 0x3C, 0x00}, // U+00EA (e circumflex)
|
||||
{ 0x33, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x1E, 0x00}, // U+00EB (e umlaut)
|
||||
{ 0x07, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x1E, 0x00}, // U+00E8 (e grave)
|
||||
{ 0x33, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00EF (i umlaut)
|
||||
{ 0x3E, 0x63, 0x1C, 0x18, 0x18, 0x18, 0x3C, 0x00}, // U+00EE (i circumflex)
|
||||
{ 0x07, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00EC (i grave)
|
||||
{ 0x63, 0x1C, 0x36, 0x63, 0x7F, 0x63, 0x63, 0x00}, // U+00C4 (A umlaut)
|
||||
{ 0x0C, 0x0C, 0x00, 0x1E, 0x33, 0x3F, 0x33, 0x00}, // U+00C5 (A ring)
|
||||
{ 0x07, 0x00, 0x3F, 0x06, 0x1E, 0x06, 0x3F, 0x00}, // U+00C8 (E grave)
|
||||
{ 0x00, 0x00, 0xFE, 0x30, 0xFE, 0x33, 0xFE, 0x00}, // U+00E6 (ae)
|
||||
{ 0x7C, 0x36, 0x33, 0x7F, 0x33, 0x33, 0x73, 0x00}, // U+00C6 (AE)
|
||||
{ 0x1E, 0x33, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F4 (o circumflex)
|
||||
{ 0x00, 0x33, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F6 (o umlaut)
|
||||
{ 0x00, 0x07, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F2 (o grave)
|
||||
{ 0x1E, 0x33, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00FB (u circumflex)
|
||||
{ 0x00, 0x07, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00F9 (u grave)
|
||||
{ 0x00, 0x33, 0x00, 0x33, 0x33, 0x3E, 0x30, 0x1F}, // U+00FF (y umlaut)
|
||||
{ 0xC3, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x18, 0x00}, // U+00D6 (O umlaut)
|
||||
{ 0x33, 0x00, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x00}, // U+00DC (U umlaut)
|
||||
{ 0x18, 0x18, 0x7E, 0x03, 0x03, 0x7E, 0x18, 0x18}, // U+00A2 (dollarcents)
|
||||
{ 0x1C, 0x36, 0x26, 0x0F, 0x06, 0x67, 0x3F, 0x00}, // U+00A3 (pound sterling)
|
||||
{ 0x33, 0x33, 0x1E, 0x3F, 0x0C, 0x3F, 0x0C, 0x0C}, // U+00A5 (yen)
|
||||
{ 0x7C, 0xC6, 0x1C, 0x36, 0x36, 0x1C, 0x33, 0x1E}, // U+00A7 (paragraph)
|
||||
{ 0x70, 0xD8, 0x18, 0x3C, 0x18, 0x18, 0x1B, 0x0E}, // U+0192 (dutch florijn)
|
||||
{ 0x38, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00}, // U+00E1 (a aigu)
|
||||
{ 0x1C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00}, // U+00ED (i augu)
|
||||
{ 0x00, 0x38, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00}, // U+00F3 (o aigu)
|
||||
{ 0x00, 0x38, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00}, // U+00FA (u aigu)
|
||||
{ 0x00, 0x1F, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x00}, // U+00F1 (n ~)
|
||||
{ 0x3F, 0x00, 0x33, 0x37, 0x3F, 0x3B, 0x33, 0x00}, // U+00D1 (N ~)
|
||||
{ 0x3C, 0x36, 0x36, 0x7C, 0x00, 0x00, 0x00, 0x00}, // U+00AA (superscript a)
|
||||
{ 0x1C, 0x36, 0x36, 0x1C, 0x00, 0x00, 0x00, 0x00}, // U+00BA (superscript 0)
|
||||
{ 0x0C, 0x00, 0x0C, 0x06, 0x03, 0x33, 0x1E, 0x00}, // U+00BF (inverted ?)
|
||||
{ 0x00, 0x00, 0x00, 0x3F, 0x03, 0x03, 0x00, 0x00}, // U+2310 (gun pointing right)
|
||||
{ 0x00, 0x00, 0x00, 0x3F, 0x30, 0x30, 0x00, 0x00}, // U+00AC (gun pointing left)
|
||||
{ 0xC3, 0x63, 0x33, 0x7B, 0xCC, 0x66, 0x33, 0xF0}, // U+00BD (1/2)
|
||||
{ 0xC3, 0x63, 0x33, 0xBD, 0xEC, 0xF6, 0xF3, 0x03}, // U+00BC (1/4)
|
||||
{ 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00}, // U+00A1 (inverted !)
|
||||
{ 0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00}, // U+00AB (<<)
|
||||
{ 0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00}, // U+00BB (>>)
|
||||
{ 0x55, 0x00, 0xAA, 0x00, 0x55, 0x00, 0xAA, 0x00}, // U+2591 (25% solid)
|
||||
{ 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA}, // U+2592 (50% solid)
|
||||
{ 0xFF, 0xAA, 0xFF, 0x55, 0xFF, 0xAA, 0xFF, 0x55}, // U+2593 (75% solid)
|
||||
{ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08}, // U+2502 (thin vertical)
|
||||
{ 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08}, // U+2524 (down L, left L, up L)
|
||||
{ 0x08, 0x08, 0x08, 0x0F, 0x08, 0x0F, 0x08, 0x08}, // U+2561 (up L, down L, left D)
|
||||
{ 0x14, 0x14, 0x14, 0x14, 0x17, 0x14, 0x14, 0x14}, // U+2562 (up D, down D, left L)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x1F, 0x14, 0x14, 0x14}, // U+2556 (down D, left L)
|
||||
{ 0x00, 0x00, 0x00, 0x0F, 0x08, 0x0F, 0x08, 0x08}, // U+2555 (down L, left D)
|
||||
{ 0x14, 0x14, 0x14, 0x17, 0x10, 0x17, 0x14, 0x14}, // U+2563 (up D, down D, left D)
|
||||
{ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14}, // U+2551 (double vertical)
|
||||
{ 0x00, 0x00, 0x00, 0x1F, 0x10, 0x17, 0x14, 0x14}, // U+2557 (down D, left D)
|
||||
{ 0x14, 0x14, 0x14, 0x17, 0x10, 0x1F, 0x00, 0x00}, // U+255D (up D, left D)
|
||||
{ 0x14, 0x14, 0x14, 0x14, 0x1F, 0x00, 0x00, 0x00}, // U+255C (up D, left L)
|
||||
{ 0x08, 0x08, 0x08, 0x0F, 0x08, 0x0F, 0x00, 0x00}, // U+255B (up L, left D)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x0f, 0x08, 0x08, 0x08}, // U+2510 (down L, left L)
|
||||
{ 0x08, 0x08, 0x08, 0x08, 0xf8, 0x00, 0x00, 0x00}, // U+2514 (up L, right L)
|
||||
{ 0x08, 0x08, 0x08, 0x08, 0xff, 0x00, 0x00, 0x00}, // U+2534 (up L, right L, left L)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0xff, 0x08, 0x08, 0x08}, // U+252C (down L, right L, left L)
|
||||
{ 0x08, 0x08, 0x08, 0x08, 0xf8, 0x08, 0x08, 0x08}, // U+251C (down L, right L, up L)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00}, // U+2500 (thin horizontal)
|
||||
{ 0x08, 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08}, // U+253C (up L, right L, left L, down L)
|
||||
{ 0x08, 0x08, 0x08, 0xF8, 0x08, 0xF8, 0x08, 0x08}, // U+255E (up L, down L, right D)
|
||||
{ 0x14, 0x14, 0x14, 0x14, 0xF4, 0x14, 0x14, 0x14}, // U+255F (up D, down D, right L)
|
||||
{ 0x14, 0x14, 0x14, 0xF4, 0x04, 0xFC, 0x00, 0x00}, // U+255A (up D, right D)
|
||||
{ 0x00, 0x00, 0x00, 0xFC, 0x04, 0xF4, 0x14, 0x14}, // U+2554 (down D, right D)
|
||||
{ 0x14, 0x14, 0x14, 0xF7, 0x00, 0xFF, 0x00, 0x00}, // U+2569 (left D, right D, up D)
|
||||
{ 0x00, 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x14, 0x14}, // U+2566 (left D, right D, down D)
|
||||
{ 0x14, 0x14, 0x14, 0xF4, 0x04, 0xF4, 0x14, 0x14}, // U+2560 (up D, down D, right D)
|
||||
{ 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00}, // U+2550 (double horizontal)
|
||||
{ 0x14, 0x14, 0x14, 0xF7, 0x00, 0xF7, 0x14, 0x14}, // U+256C (left D, right D, down D, up D)
|
||||
{ 0x08, 0x08, 0x08, 0xFF, 0x00, 0xFF, 0x00, 0x00}, // U+2567 (left D, right D, up L)
|
||||
{ 0x14, 0x14, 0x14, 0x14, 0xFF, 0x00, 0x00, 0x00}, // U+2568 (left L, right L, up D)
|
||||
{ 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x08, 0x08}, // U+2564 (left D, right D, down L)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0xFF, 0x14, 0x14, 0x14}, // U+2565 (left L, right L, down D)
|
||||
{ 0x14, 0x14, 0x14, 0x14, 0xFC, 0x00, 0x00, 0x00}, // U+2559 (up D, right L)
|
||||
{ 0x08, 0x08, 0x08, 0xF8, 0x08, 0xF8, 0x00, 0x00}, // U+2558 (up L, right D)
|
||||
{ 0x00, 0x00, 0x00, 0xF8, 0x08, 0xF8, 0x08, 0x08}, // U+2552 (down L, right D)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0xFC, 0x14, 0x14, 0x14}, // U+2553 (down D, right L)
|
||||
{ 0x14, 0x14, 0x14, 0x14, 0xFF, 0x14, 0x14, 0x14}, // U+256B (left L, right L, down D, up D)
|
||||
{ 0x08, 0x08, 0x08, 0xFF, 0x08, 0xFF, 0x08, 0x08}, // U+256A (left D, right D, down L, up L)
|
||||
{ 0x08, 0x08, 0x08, 0x08, 0x0f, 0x00, 0x00, 0x00}, // U+2518 (up L, left L)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0xf8, 0x08, 0x08, 0x08}, // U+250C (down L, right L)
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, // U+2588 (solid)
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF}, // U+2584 (bottom half)
|
||||
{ 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F}, // U+258C (left half)
|
||||
{ 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0}, // U+2590 (right half)
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00}, // U+2580 (top half)
|
||||
};
|
110
part12-wgt/wellipse.c
Normal file
110
part12-wgt/wellipse.c
Normal file
|
@ -0,0 +1,110 @@
|
|||
#include "wgt.h"
|
||||
|
||||
void wellipse (short x_center, short y_center, short x_radius, short y_radius)
|
||||
{
|
||||
short x, y;
|
||||
long aa, aa2, bb, bb2, d, dx, dy;
|
||||
|
||||
x = 0;
|
||||
y = y_radius;
|
||||
aa = (int)x_radius * (int)x_radius;
|
||||
aa2 = 2 * aa;
|
||||
bb = (int)y_radius * (int)y_radius;
|
||||
bb2 = 2 * bb;
|
||||
|
||||
d = bb - aa * (int)y_radius + aa / 4;
|
||||
dx = 0;
|
||||
dy = aa2 * (int)y_radius;
|
||||
|
||||
wputpixel (x_center, y_center - y);
|
||||
wputpixel (x_center, y_center + y);
|
||||
wputpixel (x_center - x_radius, y_center);
|
||||
wputpixel (x_center + x_radius, y_center);
|
||||
|
||||
while (dx < dy)
|
||||
{
|
||||
if (d > 0)
|
||||
{
|
||||
y--;
|
||||
dy -= aa2;
|
||||
d -= dy;
|
||||
}
|
||||
x++;
|
||||
dx += bb2;
|
||||
d += bb + dx;
|
||||
|
||||
wputpixel (x_center + x, y_center + y);
|
||||
wputpixel (x_center - x, y_center + y);
|
||||
wputpixel (x_center + x, y_center - y);
|
||||
wputpixel (x_center - x, y_center - y);
|
||||
}
|
||||
|
||||
d += (3 * (aa - bb) / 2 - (dx + dy)) / 2;
|
||||
while (y > 0)
|
||||
{
|
||||
if (d < 0)
|
||||
{
|
||||
x++;
|
||||
dx += bb2;
|
||||
d += bb + dx;
|
||||
}
|
||||
|
||||
y--; dy -= aa2; d += aa - dy;
|
||||
wputpixel (x_center + x, y_center + y);
|
||||
wputpixel (x_center - x, y_center + y);
|
||||
wputpixel (x_center + x, y_center - y);
|
||||
wputpixel (x_center - x, y_center - y);
|
||||
}
|
||||
}
|
||||
|
||||
void wfill_ellipse (short x_center, short y_center, short x_radius, short y_radius)
|
||||
{
|
||||
short x, y;
|
||||
long aa, aa2, bb, bb2, d, dx, dy;
|
||||
|
||||
x = 0;
|
||||
y = y_radius;
|
||||
aa = (int)x_radius * (int)x_radius;
|
||||
aa2 = 2 * aa;
|
||||
bb = (int)y_radius * (int)y_radius;
|
||||
bb2 = 2 * bb;
|
||||
d = bb - aa * (int)y_radius + aa / 4;
|
||||
dx = 0;
|
||||
dy = aa2 * (int)y_radius;
|
||||
|
||||
while (dx < dy)
|
||||
{
|
||||
if (d > 0)
|
||||
{
|
||||
wline (x_center + x, y_center + y, x_center - x, y_center + y);
|
||||
wline (x_center + x, y_center - y, x_center - x, y_center - y);
|
||||
y--;
|
||||
dy -= aa2;
|
||||
d -= dy;
|
||||
}
|
||||
x++;
|
||||
dx += bb2;
|
||||
d += bb + dx;
|
||||
|
||||
}
|
||||
wline (x_center + x, y_center + y, x_center - x, y_center + y);
|
||||
wline (x_center + x, y_center - y, x_center - x, y_center - y);
|
||||
|
||||
d += (3 * (aa - bb) / 2 - (dx + dy)) / 2;
|
||||
while (y > 0)
|
||||
{
|
||||
if (d < 0)
|
||||
{
|
||||
x++;
|
||||
dx += bb2;
|
||||
d += bb + dx;
|
||||
}
|
||||
|
||||
y--;
|
||||
dy -= aa2;
|
||||
d += aa - dy;
|
||||
|
||||
wline (x_center + x, y_center + y, x_center - x, y_center + y);
|
||||
wline (x_center + x, y_center - y, x_center - x, y_center - y);
|
||||
}
|
||||
}
|
37
part12-wgt/wgt.c
Normal file
37
part12-wgt/wgt.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
#include "wgt.h"
|
||||
|
||||
block abuf; /* pointer to the active screen */
|
||||
unsigned int currentcolor;
|
||||
short tx = 0,ty = 0,bx = 1919,by = 1079; /* clipping variables */
|
||||
|
||||
wgt_sys WGT_SYS;
|
||||
|
||||
// ######## HELPER FUNCTIONS ########
|
||||
|
||||
void *memset(void *dest, int val, unsigned len)
|
||||
{
|
||||
unsigned int *ptr = dest;
|
||||
while (len-- > 0)
|
||||
*ptr++ = val;
|
||||
return dest;
|
||||
}
|
||||
|
||||
int abs(int i)
|
||||
{
|
||||
return i < 0 ? -i : i;
|
||||
}
|
||||
|
||||
int strlen(const char *str)
|
||||
{
|
||||
const char *s;
|
||||
|
||||
for (s = str; *s; ++s);
|
||||
return (s - str);
|
||||
}
|
||||
|
||||
// ######## WGT FUNCTIONS ########
|
||||
|
||||
void wcls (unsigned int col)
|
||||
{
|
||||
memset (abuf, col, WGT_SYS.xres * WGT_SYS.yres);
|
||||
}
|
81
part12-wgt/wgt.h
Normal file
81
part12-wgt/wgt.h
Normal file
|
@ -0,0 +1,81 @@
|
|||
#include "include/mb.h"
|
||||
|
||||
#define NULL 0
|
||||
#define rgb(r,g,b) (r<<16)|(g<<8)|b
|
||||
|
||||
typedef struct {
|
||||
short xres;
|
||||
short yres;
|
||||
short videomode;
|
||||
long videobanksize;
|
||||
short (*bankswitch)(short);
|
||||
short screenwidth;
|
||||
short screenheight;
|
||||
} wgt_sys;
|
||||
extern wgt_sys WGT_SYS;
|
||||
|
||||
/* A single palette register definition */
|
||||
typedef struct
|
||||
{
|
||||
unsigned char r,g,b;
|
||||
} color;
|
||||
extern unsigned int vgapal[256];
|
||||
|
||||
/* A font definition */
|
||||
typedef unsigned char * wgtfont;
|
||||
extern unsigned char vgafont[224][8];
|
||||
|
||||
/* Text grid settings */
|
||||
#define TEXTGRID_OFF 0
|
||||
#define TEXTGRID_ON 1
|
||||
|
||||
/* Text transparency settings */
|
||||
#define TEXTFG 0
|
||||
#define TEXTBG 1
|
||||
#define TEXTFGBG 2
|
||||
|
||||
/* Pointer to the active drawing page */
|
||||
typedef unsigned int *block;
|
||||
extern block abuf;
|
||||
|
||||
/* Current drawing color */
|
||||
extern unsigned int currentcolor;
|
||||
|
||||
/* Clipping boundaries */
|
||||
extern short bx,by,tx,ty;
|
||||
|
||||
// ######## HELPER FUNCTIONS ########
|
||||
|
||||
void *memset(void *dest, int val, unsigned len);
|
||||
int abs(int i);
|
||||
int strlen(const char *str);
|
||||
|
||||
// ######## WGT FUNCTIONS ########
|
||||
|
||||
void vga256(void);
|
||||
void wsetcolor (unsigned int col);
|
||||
void wline (short x, short y, short x2, short y2);
|
||||
void whline (short x1, short x2, short y);
|
||||
void wcls (unsigned int col);
|
||||
unsigned int wgetpixel (short x, short y);
|
||||
void wputpixel (short x, short y);
|
||||
void wfastputpixel (short x, short y);
|
||||
void wclip (short x, short y, short x2, short y2);
|
||||
void wcircle (short x_center, short y_center, short radius);
|
||||
void wfill_circle (short x_center, short y_center, short radius);
|
||||
void wrectangle (short x, short y, short x2, short y2);
|
||||
void wbar (short x, short y, short x2, short y2);
|
||||
void wbutt (short x, short y, short x2, short y2);
|
||||
void wsetrgb (unsigned char num, unsigned char red, unsigned char green, unsigned char blue, color *pal);
|
||||
void wsetpalette (unsigned char start, unsigned char finish, color *pal);
|
||||
void wreadpalette (unsigned char start, unsigned char finish, color *palc);
|
||||
void wfline (short x, short y, short x2, short y2);
|
||||
void wstyleline (short x, short y, short x2, short y2, unsigned short style);
|
||||
void wellipse (short x_center, short y_center, short x_radius, short y_radius);
|
||||
void wfill_ellipse (short x_center, short y_center, short x_radius, short y_radius);
|
||||
void wouttextxy (short x, short y, wgtfont font, char *string);
|
||||
short woutchar (short asc, short xc, short yc, wgtfont font);
|
||||
void wtextcolor (unsigned int col);
|
||||
void wtextbackground (unsigned int col);
|
||||
void wtexttransparent (short transparent);
|
||||
void wtextgrid (short onoff);
|
123
part12-wgt/wline.c
Normal file
123
part12-wgt/wline.c
Normal file
|
@ -0,0 +1,123 @@
|
|||
#include "wgt.h"
|
||||
|
||||
void wline (short x, short y, short x2, short y2)
|
||||
{
|
||||
short t;
|
||||
short wx = 0, wy = 0;
|
||||
short dx, dy;
|
||||
short bdx, bdy;
|
||||
short incx, incy, addrow;
|
||||
unsigned int *temp;
|
||||
|
||||
if ((x != x2) && (y != y2)) /* Diagonal lines */
|
||||
{
|
||||
dx = x2 - x;
|
||||
dy = y2 - y;
|
||||
t = 0;
|
||||
wx = 0;
|
||||
wy = 0;
|
||||
if (dy < 0)
|
||||
incy = - 1;
|
||||
else incy = 1;
|
||||
addrow = incy * WGT_SYS.xres;
|
||||
if (dx < 0)
|
||||
incx = - 1;
|
||||
else incx = 1;
|
||||
bdx = abs (dx);
|
||||
bdy = abs (dy);
|
||||
temp = &abuf[y * WGT_SYS.xres + x];
|
||||
if (bdx > bdy)
|
||||
{
|
||||
while (t <= bdx)
|
||||
{
|
||||
if ((x >= tx) && (y >= ty) && (y <= by) && (x <= bx)) /* Clip */
|
||||
*temp = currentcolor;
|
||||
wy += bdy;
|
||||
x += incx;
|
||||
temp += incx;
|
||||
t++;
|
||||
if (wy >= bdx)
|
||||
{
|
||||
wy -= bdx;
|
||||
y += incy;
|
||||
temp += addrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (t <= bdy)
|
||||
{
|
||||
if ((x >= tx) & (y >= ty) & (y <= by) & (x <= bx))
|
||||
*temp = currentcolor;
|
||||
wx += bdx;
|
||||
if (wx >= bdy)
|
||||
{
|
||||
wx -= bdy;
|
||||
x += incx;
|
||||
temp += incx;
|
||||
}
|
||||
y += incy;
|
||||
temp += addrow;
|
||||
t++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((y == y2) && (y >= ty) && (y <= by))
|
||||
/* Horizontal line */
|
||||
{
|
||||
if (x > x2) /* Swap x coords */
|
||||
{
|
||||
t = x;
|
||||
x = x2;
|
||||
x2 = t;
|
||||
}
|
||||
if (x < tx)
|
||||
x = tx; /* Clip the line */
|
||||
if (x2 > bx)
|
||||
x2 = bx;
|
||||
if (x2 - x >= 0)
|
||||
memset (&abuf[y * WGT_SYS.xres + x], currentcolor, x2 - x + 1);
|
||||
}
|
||||
else if ((x == x2) && (x >= tx) && (x <= bx))
|
||||
/* Vertical line */
|
||||
{
|
||||
if (y > y2) /* Swap y coords */
|
||||
{
|
||||
t = y;
|
||||
y = y2;
|
||||
y2 = t;
|
||||
}
|
||||
if (y < ty)
|
||||
y = ty; /* Clip the line */
|
||||
if (y2 > by)
|
||||
y2 = by;
|
||||
temp = &abuf[y * WGT_SYS.xres + x];
|
||||
for (t = y; t <= y2; t++)
|
||||
{
|
||||
*temp = currentcolor;
|
||||
temp += WGT_SYS.xres;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void whline (short x1, short x2, short y)
|
||||
{
|
||||
int t;
|
||||
int length;
|
||||
|
||||
if (x1 > x2) /* Swap x coords */
|
||||
{
|
||||
t = x1;
|
||||
x1 = x2;
|
||||
x2 = t;
|
||||
}
|
||||
if (x1 < tx)
|
||||
x1 = tx; /* Clip the line */
|
||||
if (x2 > bx)
|
||||
x2 = bx;
|
||||
|
||||
length = x2 - x1 + 1;
|
||||
if (length > 0)
|
||||
memset (&abuf[y * WGT_SYS.xres + x1], currentcolor, length);
|
||||
}
|
17
part12-wgt/wpixel.c
Normal file
17
part12-wgt/wpixel.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "wgt.h"
|
||||
|
||||
unsigned int wgetpixel (short x, short y)
|
||||
{
|
||||
return abuf[y * WGT_SYS.xres + x];
|
||||
}
|
||||
|
||||
void wputpixel (short x, short y)
|
||||
{
|
||||
if ((y <= by) & (x <= bx) & (y >= ty) & (x >= tx))
|
||||
abuf[y * WGT_SYS.xres + x] = currentcolor;
|
||||
}
|
||||
|
||||
void wfastputpixel (short x, short y)
|
||||
{
|
||||
abuf[y * WGT_SYS.xres + x] = currentcolor;
|
||||
}
|
36
part12-wgt/wsetcol.c
Normal file
36
part12-wgt/wsetcol.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
#include "wgt.h"
|
||||
|
||||
void wsetcolor (unsigned int col)
|
||||
{
|
||||
currentcolor = col;
|
||||
}
|
||||
|
||||
void wsetrgb (unsigned char num, unsigned char red, unsigned char green, unsigned char blue, color *pal)
|
||||
{
|
||||
if (red > 255) red = 255; /* Check for maximum values */
|
||||
if (green > 255) green = 255;
|
||||
if (blue > 255) blue = 255;
|
||||
|
||||
pal += num; /* Adjust pointer to proper index */
|
||||
pal->r = red; /* Set values for RGB */
|
||||
pal->g = green;
|
||||
pal->b = blue;
|
||||
}
|
||||
|
||||
void wsetpalette (unsigned char start, unsigned char finish, color *pal)
|
||||
{
|
||||
for (int i = start; i <= finish; i++)
|
||||
{
|
||||
vgapal[i] = rgb(pal[i].r, pal[i].g, pal[i].b);
|
||||
}
|
||||
}
|
||||
|
||||
void wreadpalette (unsigned char start, unsigned char finish, color *palc)
|
||||
{
|
||||
for (int i = start; i <= finish; i++)
|
||||
{
|
||||
palc[i].r = (vgapal[i] >> 16) & 0xFF;
|
||||
palc[i].g = (vgapal[i] >> 8) & 0xFF;
|
||||
palc[i].b = vgapal[i] & 0xFF;
|
||||
}
|
||||
}
|
59
part12-wgt/wsetmode.c
Normal file
59
part12-wgt/wsetmode.c
Normal file
|
@ -0,0 +1,59 @@
|
|||
#include "wgt.h"
|
||||
|
||||
void vga256(void)
|
||||
{
|
||||
mbox[0] = 35*4; // Length of message in bytes
|
||||
mbox[1] = MBOX_REQUEST;
|
||||
|
||||
mbox[2] = MBOX_TAG_SETPHYWH; // Tag identifier
|
||||
mbox[3] = 8; // Value size in bytes
|
||||
mbox[4] = 8; // Value size in bytes (again!)
|
||||
mbox[5] = 1920; // Value(width)
|
||||
mbox[6] = 1080; // Value(height)
|
||||
|
||||
mbox[7] = MBOX_TAG_SETVIRTWH;
|
||||
mbox[8] = 8;
|
||||
mbox[9] = 8;
|
||||
mbox[10] = 1920;
|
||||
mbox[11] = 1080;
|
||||
|
||||
mbox[12] = MBOX_TAG_SETVIRTOFF;
|
||||
mbox[13] = 8;
|
||||
mbox[14] = 8;
|
||||
mbox[15] = 0; // Value(x)
|
||||
mbox[16] = 0; // Value(y)
|
||||
|
||||
mbox[17] = MBOX_TAG_SETDEPTH;
|
||||
mbox[18] = 4;
|
||||
mbox[19] = 4;
|
||||
mbox[20] = 32; // Bits per pixel
|
||||
|
||||
mbox[21] = MBOX_TAG_SETPXLORDR;
|
||||
mbox[22] = 4;
|
||||
mbox[23] = 4;
|
||||
mbox[24] = 1; // RGB
|
||||
|
||||
mbox[25] = MBOX_TAG_GETFB;
|
||||
mbox[26] = 8;
|
||||
mbox[27] = 8;
|
||||
mbox[28] = 4096; // FrameBufferInfo.pointer
|
||||
mbox[29] = 0; // FrameBufferInfo.size
|
||||
|
||||
mbox[30] = MBOX_TAG_GETPITCH;
|
||||
mbox[31] = 4;
|
||||
mbox[32] = 4;
|
||||
mbox[33] = 0; // Bytes per line
|
||||
|
||||
mbox[34] = MBOX_TAG_LAST;
|
||||
|
||||
// Check call is successful and we have a pointer with depth 32
|
||||
if (mbox_call(MBOX_CH_PROP) && mbox[20] == 32 && mbox[28] != 0) {
|
||||
mbox[28] &= 0x3FFFFFFF; // Convert GPU address to ARM address
|
||||
WGT_SYS.xres = mbox[10]; // Actual physical width
|
||||
WGT_SYS.yres = mbox[11]; // Actual physical height
|
||||
WGT_SYS.screenwidth = mbox[10];
|
||||
WGT_SYS.screenheight = mbox[11];
|
||||
|
||||
abuf = (unsigned int *)((long)mbox[28]);
|
||||
}
|
||||
}
|
196
part12-wgt/wtext.c
Normal file
196
part12-wgt/wtext.c
Normal file
|
@ -0,0 +1,196 @@
|
|||
#include "wgt.h"
|
||||
|
||||
short xc, yc, cstart, cend, curspeed;
|
||||
short grid, trans, fore, back;
|
||||
short wfontsize;
|
||||
|
||||
void wouttextxy (short x, short y, wgtfont font, char *string)
|
||||
{
|
||||
short ctr,wd;
|
||||
|
||||
xc = x;
|
||||
if ((grid == 0) | (font != NULL)) /* custom font */
|
||||
for (ctr = 0; ctr < strlen (string); ctr++)
|
||||
{
|
||||
wd = woutchar (string[ctr], xc, y, font);
|
||||
/* output one char */
|
||||
xc += wd; /* x coord increases by width */
|
||||
}
|
||||
else
|
||||
for (ctr = 0; ctr < strlen (string); ctr++)
|
||||
woutchar (string[ctr], x + ctr - 1, y, font);
|
||||
/* output one char */
|
||||
}
|
||||
|
||||
short woutchar (short asc, short xc, short yc, wgtfont font)
|
||||
{
|
||||
short asc_8, i, j, msk,g;
|
||||
short maskon, letteron, pixon;
|
||||
short col, clp;
|
||||
wgtfont orig;
|
||||
int ofs, width = 8, height;
|
||||
short xclip, yclip; /* Clipping */
|
||||
short xadd = 0,yadd = 0;
|
||||
block temp; /* Temporary block to write to abuf */
|
||||
wgtfont FONTROM;
|
||||
|
||||
FONTROM = (unsigned char *)&vgafont;
|
||||
|
||||
if ((asc < 256) && (asc >= 0))
|
||||
{
|
||||
if (font == NULL) /* default font */
|
||||
{
|
||||
width = 8;
|
||||
if (grid == 1)
|
||||
{
|
||||
xc = xc * 8; /* Multiply by grid size */
|
||||
yc = yc * 8;
|
||||
}
|
||||
|
||||
if (xc + 7 > bx) /* Check clipping */
|
||||
xclip = bx - xc;
|
||||
else xclip = 7;
|
||||
if (yc + 7 > by)
|
||||
yclip = by - yc;
|
||||
else yclip = 7;
|
||||
|
||||
if (xc < tx)
|
||||
{
|
||||
xadd = tx - xc;
|
||||
xclip -= tx - xc;
|
||||
xc = tx;
|
||||
}
|
||||
if (yc < ty)
|
||||
{
|
||||
yadd = ty - yc;
|
||||
yclip -= (ty - yc);
|
||||
yc = ty;
|
||||
}
|
||||
|
||||
|
||||
if ((xclip >= 0) && (yclip >= 0))
|
||||
{
|
||||
maskon = (trans != 0); /* setup colour transparency flags */
|
||||
letteron = (trans != 1);
|
||||
asc_8 = asc << 3 ;
|
||||
temp = &abuf[yc*WGT_SYS.xres + xc]; /* For quick access */
|
||||
|
||||
for (j = 0; j <= yclip; j++)
|
||||
{
|
||||
msk = *((unsigned char *)(FONTROM + asc_8 + j + yadd));
|
||||
/* read font from ROM */
|
||||
msk = msk << xadd;
|
||||
for (i = 0; i <= xclip; i++)
|
||||
{
|
||||
pixon = ((msk & 1) > 0);
|
||||
if (letteron & pixon) /* Put the right colour */
|
||||
*temp = fore;
|
||||
else if (maskon & !(pixon))
|
||||
*temp = back;
|
||||
msk = msk >> 1;
|
||||
temp++;
|
||||
}
|
||||
temp += WGT_SYS.xres - 1 - xclip;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (asc < 128) /* using a custom font */
|
||||
{
|
||||
orig = font; /* start at font ptr */
|
||||
font += 15; /* skip over header */
|
||||
ofs = *(short *)font; /* read integer offset of char table */
|
||||
font = orig + ofs + (2 * asc); /* reset ptr, move to offset of char table */
|
||||
ofs = *(short *)font; /* read integer offset of char data */
|
||||
font = orig + ofs; /* reset ptr, move to offset of char data */
|
||||
|
||||
width = *(short *)font; /* read width and height */
|
||||
height = *(short *)(font + 2);
|
||||
font += 4;
|
||||
|
||||
for (i = 8; i <= 64; i += 8) /* make a multiple of 8 */
|
||||
{
|
||||
/* eg. if width is 7, make it 8 (round up) */
|
||||
if (i >= width)
|
||||
break;
|
||||
}
|
||||
clp = i;
|
||||
|
||||
if (xc + width > bx) /* Check clipping */
|
||||
xclip = bx - xc + 1;
|
||||
else xclip = width;
|
||||
if (yc + height > by)
|
||||
yclip = by - yc + 1;
|
||||
else yclip = height;
|
||||
|
||||
if (yc < ty)
|
||||
{
|
||||
yadd = ty - yc;
|
||||
yclip -= (ty - yc);
|
||||
font += (ty - yc)*clp / 8;
|
||||
yc = ty;
|
||||
}
|
||||
|
||||
if ((xclip >= 0) && (yclip >= 0))
|
||||
{
|
||||
if ((xclip / 8) != clp / 8)
|
||||
clp = (clp - xclip) / 8;
|
||||
else clp = 0;
|
||||
|
||||
maskon = (trans != 0);
|
||||
letteron = (trans != 1);
|
||||
temp = &abuf[yc*WGT_SYS.xres + xc]; /* For quick access */
|
||||
col = - 1;
|
||||
for (j = 0; j < yclip; j++)
|
||||
{
|
||||
msk = *font;
|
||||
for (g = 0; g < xclip; g++)
|
||||
{
|
||||
col++;
|
||||
if (col > 7)
|
||||
{
|
||||
font++;
|
||||
msk = *font;
|
||||
col = 0;
|
||||
}
|
||||
if (xc + g >= tx)
|
||||
{
|
||||
pixon = ((msk & 128) > 0);
|
||||
if (letteron && pixon)
|
||||
*temp = fore;
|
||||
else if (maskon && !(pixon))
|
||||
*temp = back;
|
||||
}
|
||||
msk = msk << 1;
|
||||
temp++;
|
||||
}
|
||||
temp += WGT_SYS.xres - xclip;
|
||||
font += clp;
|
||||
col = 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
void wtextcolor (unsigned int col)
|
||||
{
|
||||
fore = col;
|
||||
}
|
||||
|
||||
void wtextbackground (unsigned int col)
|
||||
{
|
||||
back = col;
|
||||
}
|
||||
|
||||
void wtexttransparent (short transparent)
|
||||
{
|
||||
trans = transparent;
|
||||
}
|
||||
|
||||
void wtextgrid (short onoff)
|
||||
{
|
||||
if ((onoff != 0) & (onoff != 1))
|
||||
onoff = 1;
|
||||
grid = onoff;
|
||||
}
|
Loading…
Reference in a new issue