Added VERA font
This commit is contained in:
parent
87534ab708
commit
904ab244be
|
@ -0,0 +1,3 @@
|
||||||
|
.vscode/**
|
||||||
|
*.bin
|
||||||
|
*.o
|
3
Makefile
3
Makefile
|
@ -24,7 +24,8 @@ clean:
|
||||||
-name '*.lst' \
|
-name '*.lst' \
|
||||||
\) -delete
|
\) -delete
|
||||||
@find src -type f \( \
|
@find src -type f \( \
|
||||||
-name '*.o' \
|
-name '*.o' -o \
|
||||||
|
-name '*.bin' \
|
||||||
\) -delete
|
\) -delete
|
||||||
|
|
||||||
.PHONY: flash
|
.PHONY: flash
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import sys, traceback
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
flip_d = False
|
||||||
|
|
||||||
|
if len(sys.argv)<2:
|
||||||
|
print('ERROR: Please specify at least one file to convert!')
|
||||||
|
print('Note: character size is calculated based on resolution assuming 16x16 grid.\n')
|
||||||
|
|
||||||
|
for i in range(len(sys.argv)-1):
|
||||||
|
if sys.argv[i+1][:1]!='-':
|
||||||
|
continue
|
||||||
|
if sys.argv[i+1]=='-f':
|
||||||
|
flip_d = True
|
||||||
|
|
||||||
|
for i in range(len(sys.argv)-1):
|
||||||
|
if sys.argv[i+1][:1]=='-':
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
print(f'Processing "{sys.argv[i+1]}"...')
|
||||||
|
img = Image.open(sys.argv[i+1])
|
||||||
|
width, height = img.size
|
||||||
|
cw = width>>4
|
||||||
|
ch = height>>4
|
||||||
|
print(f'({width},{height}) => char({cw},{ch})')
|
||||||
|
pixels = img.load()
|
||||||
|
f = open(f'{sys.argv[i+1]}.bin','wb')
|
||||||
|
ba = bytearray()
|
||||||
|
for y in range(16):
|
||||||
|
for x in range(16):
|
||||||
|
for py in range(ch):
|
||||||
|
outbyte = 0
|
||||||
|
for px in range(cw):
|
||||||
|
if flip_d:
|
||||||
|
outbyte = outbyte << 1
|
||||||
|
if pixels[(x*cw)+px,(y*ch)+py]>0:
|
||||||
|
if flip_d:
|
||||||
|
outbyte = outbyte | 1
|
||||||
|
else:
|
||||||
|
outbyte = outbyte | (1<<(px&7))
|
||||||
|
if (px&7)==7:
|
||||||
|
ba.append(outbyte)
|
||||||
|
outbyte=0
|
||||||
|
f.write(ba)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f'Exception caught!\n"{traceback.format_exc()}"')
|
||||||
|
|
||||||
|
print('Task completed.\n')
|
|
@ -15,7 +15,8 @@ CFLAGS := -I include \
|
||||||
--strong-inline \
|
--strong-inline \
|
||||||
--force-switch jump-table
|
--force-switch jump-table
|
||||||
|
|
||||||
ASFLAGS := -I include \
|
ASFLAGS := -I . \
|
||||||
|
-I include \
|
||||||
--code-model=large \
|
--code-model=large \
|
||||||
--data-model=huge
|
--data-model=huge
|
||||||
|
|
||||||
|
@ -61,3 +62,11 @@ endif
|
||||||
%.o: %.s
|
%.o: %.s
|
||||||
@echo "Assembling $@..."
|
@echo "Assembling $@..."
|
||||||
@$(AS) $(ASFLAGS) -o $@ $<
|
@$(AS) $(ASFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
.SUFFIXES: .png .bin .ase
|
||||||
|
%.png: %.ase
|
||||||
|
aseprite -b $< -save-as $@
|
||||||
|
|
||||||
|
%.bin: %.png
|
||||||
|
bin/makechrom -f $<
|
||||||
|
mv $<.bin $@
|
||||||
|
|
|
@ -3,18 +3,26 @@ KERNEL_ASM_SRC := $(wildcard src/kernel/*.s) \
|
||||||
$(wildcard src/kernel/*/*/*.s) \
|
$(wildcard src/kernel/*/*/*.s) \
|
||||||
$(wildcard src/kernel/*/*/*/*.s) \
|
$(wildcard src/kernel/*/*/*/*.s) \
|
||||||
$(wildcard src/kernel/*/*/*/*.s)
|
$(wildcard src/kernel/*/*/*/*.s)
|
||||||
|
|
||||||
KERNEL_C_SRC := $(wildcard src/kernel/*.c) \
|
KERNEL_C_SRC := $(wildcard src/kernel/*.c) \
|
||||||
$(wildcard src/kernel/*/*.c) \
|
$(wildcard src/kernel/*/*.c) \
|
||||||
$(wildcard src/kernel/*/*/*.c) \
|
$(wildcard src/kernel/*/*/*.c) \
|
||||||
$(wildcard src/kernel/*/*/*/*.c) \
|
$(wildcard src/kernel/*/*/*/*.c) \
|
||||||
$(wildcard src/kernel/*/*/*/*/*.c)
|
$(wildcard src/kernel/*/*/*/*/*.c)
|
||||||
|
|
||||||
|
FONT_SOURCES := $(wildcard src/kernel/hardware/vera/vera_font_*.ase)
|
||||||
|
|
||||||
KERNEL_OBJ := $(KERNEL_ASM_SRC:.s=.o)
|
KERNEL_OBJ := $(KERNEL_ASM_SRC:.s=.o)
|
||||||
KERNEL_OBJ += $(KERNEL_C_SRC:.c=.o)
|
KERNEL_OBJ += $(KERNEL_C_SRC:.c=.o)
|
||||||
|
|
||||||
|
FONTS := $(FONT_SOURCES:.ase=.bin)
|
||||||
|
|
||||||
KERNEL_LDFLAGS := --list-file build/kernel.lst
|
KERNEL_LDFLAGS := --list-file build/kernel.lst
|
||||||
|
|
||||||
build/kernel.bin: $(KERNEL_OBJ)
|
build/kernel.bin: $(KERNEL_OBJ)
|
||||||
echo "Linking $@..."
|
echo "Linking $@..."
|
||||||
|
echo "$(FONTS)"
|
||||||
$(LD) -o $@ config/kernel.scm $(LDFLAGS) $(KERNEL_LDFLAGS) $^
|
$(LD) -o $@ config/kernel.scm $(LDFLAGS) $(KERNEL_LDFLAGS) $^
|
||||||
mv build/kernel.raw $@
|
mv build/kernel.raw $@
|
||||||
|
|
||||||
|
src/kernel/hardware/vera/vera_font.o: $(FONTS)
|
|
@ -23,11 +23,9 @@
|
||||||
(section (low_rom #xC08000))
|
(section (low_rom #xC08000))
|
||||||
(section code)
|
(section code)
|
||||||
(section farcode)
|
(section farcode)
|
||||||
(section cdata)
|
|
||||||
(section switch)
|
(section switch)
|
||||||
(section near)
|
(section near)
|
||||||
(section data)
|
(section cfar)
|
||||||
(section chuge)
|
|
||||||
(section ihuge)
|
(section ihuge)
|
||||||
(section data_init_table)
|
(section data_init_table)
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
//
|
|
||||||
// include/macros.h
|
// include/macros.h
|
||||||
// Utility macros for Calypsi compiler and assembler
|
// Utility macros for Calypsi compiler and assembler
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
; SPDX-License-Identifier: MIT
|
|
||||||
;
|
|
||||||
; src/kernel/cstartup.s
|
; src/kernel/cstartup.s
|
||||||
; Critical boot and init code before calling main()
|
; Critical boot and init code before calling main()
|
||||||
;
|
|
||||||
; Copyright © 2024 Kyle J Cardoza <Kyle.Cardoza@icloud.com>
|
|
||||||
|
|
||||||
;;; Startup variant, change attribute value if you make your own
|
;;; Startup variant, change attribute value if you make your own
|
||||||
.rtmodel cstartup,"sentinel65x"
|
.rtmodel cstartup,"sentinel65x"
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
; SPDX-License-Identifier: MIT
|
||||||
|
;
|
||||||
|
; src/kernel/vera_font.s
|
||||||
|
; Assembly file to load the VERA font into the ROM image
|
||||||
|
;
|
||||||
|
; Copyright © 2024 Kyle J Cardoza <Kyle.Cardoza@icloud.com>
|
||||||
|
|
||||||
|
.section cfar,rodata
|
||||||
|
vera_font_0:
|
||||||
|
.incbin "vera_font_0.bin"
|
Loading…
Reference in New Issue