diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..78680af --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "files.associations": { + "*.s": "assembly", + "*.forth": "forth", + "syscalls_m68k.h": "c" + } +} \ No newline at end of file diff --git a/C256Mgr/__pycache__/foenix.cpython-37.pyc b/C256Mgr/__pycache__/foenix.cpython-37.pyc new file mode 100644 index 0000000..7a17348 Binary files /dev/null and b/C256Mgr/__pycache__/foenix.cpython-37.pyc differ diff --git a/C256Mgr/__pycache__/intelhex.cpython-37.pyc b/C256Mgr/__pycache__/intelhex.cpython-37.pyc new file mode 100644 index 0000000..ef992dd Binary files /dev/null and b/C256Mgr/__pycache__/intelhex.cpython-37.pyc differ diff --git a/C256Mgr/__pycache__/srec.cpython-37.pyc b/C256Mgr/__pycache__/srec.cpython-37.pyc new file mode 100644 index 0000000..adc259f Binary files /dev/null and b/C256Mgr/__pycache__/srec.cpython-37.pyc differ diff --git a/C256Mgr/__pycache__/wdc.cpython-37.pyc b/C256Mgr/__pycache__/wdc.cpython-37.pyc new file mode 100644 index 0000000..96178f8 Binary files /dev/null and b/C256Mgr/__pycache__/wdc.cpython-37.pyc differ diff --git a/C256Mgr/c256mgr.py b/C256Mgr/c256mgr.py new file mode 100644 index 0000000..c87f512 --- /dev/null +++ b/C256Mgr/c256mgr.py @@ -0,0 +1,324 @@ +import intelhex +import wdc +import foenix +import srec +import configparser +import re +import sys +import argparse +import os + +from serial.tools import list_ports + +FLASH_SIZE = 524288 # Required size of flash file: 512 KB +CHUNK_SIZE = 4096 # Size of block of binary data to transfer + +label_file = "" +to_send = "" +port = "" +start_address = "" +count = "" +label = "" + +def confirm(question): + return input(question).lower().strip()[:1] == "y" + +def revision(port): + """Get the version code for the debug port.""" + c256 = foenix.FoenixDebugPort() + try: + c256.open(port) + c256.enter_debug() + try: + data = c256.get_revision() + return "%X" % data + finally: + c256.exit_debug() + finally: + c256.close() + +def upload_binary(port, filename, address): + """Upload a binary file into the C256 memory.""" + with open(filename, "rb") as f: + c256 = foenix.FoenixDebugPort() + try: + c256.open(port) + c256.enter_debug() + try: + current_addr = int(address, 16) + block = f.read(CHUNK_SIZE) + while block: + c256.write_block(current_addr, block) + current_addr += len(block) + block = f.read(CHUNK_SIZE) + finally: + c256.exit_debug() + finally: + c256.close() + +def program_flash(port, filename, hex_address): + """Program the flash memory using the contents of the C256's RAM.""" + + base_address = int(hex_address, 16) + address = base_address + print("About to upload image to address 0x{:X}".format(address), flush=True) + + if os.path.getsize(filename) == FLASH_SIZE: + if confirm("Are you sure you want to reprogram the flash memory? (y/n): "): + with open(filename, "rb") as f: + c256 = foenix.FoenixDebugPort() + try: + c256.open(port) + c256.enter_debug() + try: + block = f.read(CHUNK_SIZE) + while block: + c256.write_block(address, block) + address += len(block) + block = f.read(CHUNK_SIZE) + + print("Binary file uploaded...", flush=True) + c256.erase_flash() + print("Flash memory erased...", flush=True) + c256.program_flash(base_address) + print("Flash memory programmed...") + finally: + c256.exit_debug() + finally: + c256.close() + else: + print("The provided flash file is not the right size.") + +def dereference(port, file, label): + """Get the address contained in the pointer with the label in the label file.""" + c256 = foenix.FoenixDebugPort() + try: + address = lookup(file, label) + c256.open(port) + c256.enter_debug() + try: + data = c256.read_block(int(address, 16), 3) + deref = data[2] << 16 | data[1] << 8 | data[0] + return "%X" % deref + finally: + c256.exit_debug() + finally: + c256.close() + +def lookup(file, label): + """Return the hex address linked to the passed label in the label file.""" + with open(file) as f: + for line in f: + match = re.match('^(\S+)\s*\=\s*\$(\S+)', line) + if match: + if match.group(1) == label: + return match.group(2) + sys.stderr.write("Could not find a definition for that label.\n") + sys.exit(2) + +def display(base_address, data): + """Write a block of data to the console in a nice, hexadecimal format.""" + + text_buff = "" + for i in range(0, len(data)): + if (i % 16) == 0: + if text_buff != "": + sys.stdout.write(" {}\n".format(text_buff)) + text_buff = "" + sys.stdout.write("{:06X}: ".format(base_address + i)) + elif (i % 8) == 0: + sys.stdout.write(" ") + sys.stdout.write("{:02X}".format(data[i])) + + b = bytearray(1) + b[0] = data[i] + if (b[0] & 0x80 == 0): + c = b.decode('ascii') + if c.isprintable(): + text_buff = text_buff + c + else: + text_buff = text_buff + "." + else: + text_buff = text_buff + "." + + sys.stdout.write(' {}\n'.format(text_buff)) + +def send_wdc(port, filename): + """Send the data in the hex file 'filename' to the C256 on the given serial port.""" + infile = wdc.WdcBinFile() + c256 = foenix.FoenixDebugPort() + try: + c256.open(port) + infile.open(filename) + try: + infile.set_handler(lambda address, data: c256.write_block(address, data)) + c256.enter_debug() + try: + # Process the lines in the hex file + infile.read_blocks() + finally: + c256.exit_debug() + finally: + infile.close() + finally: + c256.close() + +def send_srec(port, filename): + """Send the data in the SREC hex file 'filename' to the C256 on the given serial port.""" + infile = srec.SRECFile() + c256 = foenix.FoenixDebugPort() + try: + c256.open(port) + infile.open(filename) + try: + infile.set_handler(lambda address, data: c256.write_block(address, bytes.fromhex(data))) + c256.enter_debug() + try: + # Process the lines in the hex file + infile.read_lines() + finally: + c256.exit_debug() + finally: + infile.close() + finally: + c256.close() + +def send(port, filename): + """Send the data in the hex file 'filename' to the C256 on the given serial port.""" + infile = intelhex.HexFile() + c256 = foenix.FoenixDebugPort() + try: + c256.open(port) + infile.open(filename) + try: + infile.set_handler(lambda address, data: c256.write_block(address, bytes.fromhex(data))) + c256.enter_debug() + try: + # Process the lines in the hex file + infile.read_lines() + finally: + c256.exit_debug() + finally: + infile.close() + finally: + c256.close() + +def get(port, address, length): + """Read a block of data from the C256.""" + c256 = foenix.FoenixDebugPort() + try: + c256.open(port) + c256.enter_debug() + try: + data = c256.read_block(int(address, 16), int(length, 16)) + + display(int(address, 16), data) + finally: + c256.exit_debug() + finally: + c256.close() + +def list_serial_ports(): + serial_ports = list_ports.comports() + + if len(serial_ports) == 0: + print("No serial ports found") + + for serial_port in serial_ports: + print(f"{serial_port.device}") + print(f" Description: {serial_port.description}") + print(f" Manufacturer: {serial_port.manufacturer}") + print(f" Product: {serial_port.product}") + print() + + +config = configparser.ConfigParser() +config.read('c256.ini') + +parser = argparse.ArgumentParser(description='Manage the C256 Foenix through its debug port.') +parser.add_argument("--port", dest="port", default=config['DEFAULT'].get('port', 'COM3'), + help="Specify the serial port to use to access the C256 debug port.") + +parser.add_argument("--list-ports", dest="list_ports", action="store_true", + help="List available serial ports.") + +parser.add_argument("--label-file", dest="label_file", default=config['DEFAULT'].get('labels', 'basic8'), + help="Specify the label file to use for dereference and lookup") + +parser.add_argument("--count", dest="count", default="10", help="the number of bytes to read") + +parser.add_argument("--dump", metavar="ADDRESS", dest="dump_address", + help="Read memory from the C256's memory and display it.") + +parser.add_argument("--deref", metavar="LABEL", dest="deref_name", + help="Lookup the address stored at LABEL and display the memory there.") + +parser.add_argument("--lookup", metavar="LABEL", dest="lookup_name", + help="Display the memory starting at the address indicated by the label.") + +parser.add_argument("--revision", action="store_true", dest="revision", + help="Display the revision code of the debug interface.") + +parser.add_argument("--flash", metavar="BINARY FILE", dest="flash_file", + help="Attempt to reprogram the flash using the binary file provided.") + +parser.add_argument("--binary", metavar="BINARY FILE", dest="binary_file", + help="Upload a binary file to the C256's RAM.") + +parser.add_argument("--address", metavar="ADDRESS", dest="address", + default=config['DEFAULT'].get('flash_address', '380000'), + help="Provide the starting address of the memory block to use in flashing memory.") + +parser.add_argument("--upload", metavar="HEX FILE", dest="hex_file", + help="Attempt to reprogram the flash using the binary file provided.") + +parser.add_argument("--upload-wdc", metavar="BINARY FILE", dest="wdc_file", + help="Upload a WDCTools binary hex file. (WDCLN.EXE -HZ)") + +parser.add_argument("--upload-srec", metavar="SREC FILE", dest="srec_file", + help="Upload a Motorola SREC hex file.") + +options = parser.parse_args() + +try: + if options.port != "": + if options.hex_file: + send(options.port, options.hex_file) + + elif options.wdc_file: + send_wdc(options.port, options.wdc_file) + + elif options.srec_file: + send_srec(options.port, options.srec_file) + + elif options.deref_name and options.label_file: + address = dereference(options.port, options.label_file, options.deref_name) + get(options.port, address, options.count) + + elif options.lookup_name and options.label_file: + address = lookup(options.label_file, options.lookup_name) + get(options.port, address, options.count) + + elif options.dump_address: + get(options.port, options.dump_address, options.count) + + elif options.revision: + rev = revision(options.port) + print(rev) + + elif options.address and options.binary_file: + upload_binary(options.port, options.binary_file, options.address) + + elif options.address and options.flash_file: + program_flash(options.port, options.flash_file, options.address) + + elif options.list_ports: + list_serial_ports() + + else: + parser.print_help() + else: + parser.print_help() +finally: + print + diff --git a/C256Mgr/foenix.py b/C256Mgr/foenix.py new file mode 100644 index 0000000..a0f827c --- /dev/null +++ b/C256Mgr/foenix.py @@ -0,0 +1,140 @@ +import serial + +class FoenixDebugPort: + """Provide the conneciton to a C256 Foenix debug port.""" + connection = 0 + status0 = 0 + status1 = 0 + + def open(self, port): + """Open a connection to the C256 Foenix.""" + self.connection = serial.Serial(port=port, + baudrate=6000000, + bytesize=serial.EIGHTBITS, + parity=serial.PARITY_NONE, + stopbits=serial.STOPBITS_ONE, + timeout=60, + write_timeout=60) + try: + self.connection.open() + except: + self.connection.close() + self.connection.open() + + def is_open(self): + return self.connection.is_open() + + def close(self): + """Close the connection to the C256 Foenix.""" + self.connection.close() + + def enter_debug(self): + """Send the command to make the C256 Foenix enter its debug mode.""" + self.transfer(0x80, 0, 0, 0) + + def exit_debug(self): + """Send the command to make the C256 Foenix leave its debug mode. + This will make the C256 reset. + """ + self.transfer(0x81, 0, 0, 0) + + def erase_flash(self): + """Send the command to have the C256 Foenix erase its flash memory.""" + self.transfer(0x11, 0, 0, 0) + + def get_revision(self): + """Gets the revision code for the debug interface. + RevB2's revision code is 0, RevC4A is 1.""" + self.transfer(0xFE, 0, 0, 0) + return self.status1 + + def program_flash(self, address): + """Send the command to have the C256 Foenix reprogram its flash memory. + Data to be written should already be in the C256's RAM at address.""" + self.transfer(0x10, address, 0, 0) + + def write_block(self, address, data): + """Write a block of data to the specified starting address in the C256's memory.""" + self.transfer(0x01, address, data, 0) + + def read_block(self, address, length): + """Read a block of data of the specified length from the specified starting address of the C256's memory.""" + return self.transfer(0x00, address, 0, length) + + def readbyte(self): + b = self.connection.read(1) + return b[0] + + def transfer(self, command, address, data, read_length): + """Send a command to the C256 Foenix""" + + self.status0 = 0 + self.status1 = 0 + lrc = 0 + length = 0 + if data == 0: + length = read_length + else: + length = len(data) + + # if command == 0x80: + # print('Switching to debug mode') + # elif command == 0x81: + # print('Resetting') + # else: + # print('Writing data of length {:X} to {:X}'.format(length, address)) + + command_bytes = command.to_bytes(1, 'big') + address_bytes = address.to_bytes(3, 'big') + length_bytes = length.to_bytes(2, 'big') + + header = bytearray(7) + header[0] = 0x55 + header[1] = command_bytes[0] + header[2] = address_bytes[0] + header[3] = address_bytes[1] + header[4] = address_bytes[2] + header[5] = length_bytes[0] + header[6] = length_bytes[1] + + for i in range(0, 6): + lrc = lrc ^ header[i] + + if data: + for i in range(0, length): + lrc = lrc ^ data[i] + + lrc_bytes = lrc.to_bytes(1, 'big') + + if data: + packet = header + data + lrc_bytes + written = self.connection.write(packet) + if written != len(packet): + raise Exception("Could not write packet correctly.") + else: + packet = header + lrc_bytes + written = self.connection.write(packet) + if written != len(packet): + raise Exception("Could not write packet correctly.") + # print('Sent [{}]'.format(packet.hex())) + + c = 0 + while c != 0xAA: + c = self.readbyte() + + # print('Got 0xAA') + + read_bytes = 0 + + if c == 0xAA: + self.status0 = self.readbyte() + self.status1 = self.readbyte() + + if read_length > 0: + read_bytes = self.connection.read(read_length) + + read_lrc = self.readbyte() + + # print("Status: {:X}, {:X}".format(self.status0, self.status1)) + + return read_bytes diff --git a/C256Mgr/intelhex.py b/C256Mgr/intelhex.py new file mode 100644 index 0000000..224d0e1 --- /dev/null +++ b/C256Mgr/intelhex.py @@ -0,0 +1,52 @@ +import re + +class HexFile: + """Read information from an Intel Hex file.""" + + file = 0 + base_address = 0 + handler = 0 + + def __init__(self): + self.file = 0 + self.base_address = 0 + self.handler = 0 + + def open(self, filename): + self.file = open(filename, 'r') + + def set_handler(self, proc): + self.handler = proc + + def close(self): + self.file.close() + + def read_lines(self): + line = self.file.readline() + while line: + self.parse_line(line) + line = self.file.readline() + + def parse_line(self, line): + m = re.match("^:([0-9a-fA-F]{2})([0-9a-fA-F]{4})([0-9a-fA-F]{2})([0-9a-fA-F]*)([0-9a-fA-F]{2})", line) + size = int(m.group(1), 16) + address = int(m.group(2), 16) + code = int(m.group(3), 16) + data = m.group(4) + crc = int(m.group(5), 16) + if code == 0: + if self.handler: + # print('Sending record to {:X}'.format(self.base_address + address)) + self.handler(self.base_address + address, data) + + elif code == 2: + # Set the base address based on a segment + self.base_address = int(data, 16) << 4 # shity 80x86 real mode addressing : take the address an do *16 to get the final address + # print('Setting base address to {:X}'.format(self.base_address)) + + elif code == 4: + # Set the base address given on address[31..16] + self.base_address = int(data, 16) << 16 + # print('Setting base address to {:X}'.format(self.base_address)) + + diff --git a/C256Mgr/srec.py b/C256Mgr/srec.py new file mode 100644 index 0000000..5c3d6bf --- /dev/null +++ b/C256Mgr/srec.py @@ -0,0 +1,73 @@ +import re + +class SRECFile: + """Read information from a Motorola SREC file.""" + + file = 0 + handler = 0 + + def __init__(self): + self.file = 0 + self.handler = 0 + + def open(self, filename): + self.file = open(filename, 'r') + + def set_handler(self, proc): + self.handler = proc + + def close(self): + self.file.close() + + def read_lines(self): + line = self.file.readline() + while line: + self.parse_line(line) + line = self.file.readline() + + def parse_line(self, line): + # Format of line will vary based on the type, so let's get the type first + m = re.match("^S([0-9a-fA-F])([0-9a-fA-F]+)", line) + code = int(m.group(1), 16) + hex_digits = m.group(2) + + # Codes... + # 0 = Comment/header + # 1 = Data with 16-bit address + # 2 = Data with 24-bit address + # 3 = Data with 32-bit address + # 4 = Reserved + # 5 = 16-bit record count + # 6 = 24-bit record count + # 7 = 32-bit start address + # 8 = 24-bit start address + # 9 = 16-bit start address + # + # This code will ignore all records by 1, 2, and 3 + + if code == 1: + # Unpack a record with a 16-bit address + m2 = re.match("^([0-9a-fA-F]{2})([0-9a-fA-F]{4})([0-9a-fA-F]*)([0-9a-fA-F]{2})", hex_digits) + count = int(m2.group(1), 16) + address = int(m2.group(2), 16) + data = m2.group(3) + crc = int(m2.group(4), 16) + self.handler(address, data) + + elif code == 2: + # Unpack a record with a 24-bit address + m2 = re.match("^([0-9a-fA-F]{2})([0-9a-fA-F]{6})([0-9a-fA-F]*)([0-9a-fA-F]{2})", hex_digits) + count = int(m2.group(1), 16) + address = int(m2.group(2), 16) + data = m2.group(3) + crc = int(m2.group(4), 16) + self.handler(address, data) + + elif code == 3: + # Unpack a record with a 32-bit address + m2 = re.match("^([0-9a-fA-F]{2})([0-9a-fA-F]{8})([0-9a-fA-F]*)([0-9a-fA-F]{2})", hex_digits) + count = int(m2.group(1), 16) + address = int(m2.group(2), 16) + data = m2.group(3) + crc = int(m2.group(4), 16) + self.handler(address, data) diff --git a/C256Mgr/wdc.py b/C256Mgr/wdc.py new file mode 100644 index 0000000..f5cf65b --- /dev/null +++ b/C256Mgr/wdc.py @@ -0,0 +1,49 @@ +from pathlib import Path + +## +# See: http://www.westerndesigncenter.com/wdc/datasheets/Assembler_Linker.pdf +# page 37 +# +# Initial byte 'Z' as signature. +# +# Then for each block: +# 3 byte address +# 3 byte length +# length bytes of data +# +# The final block has an address and length of 0. +# + +class WdcBinFile: + """Reads information from WDCTools BIN formated file""" + data = 0 + handler = 0 + + def __init__(self): + pass + + def open(self, filename): + self.data = Path(filename).read_bytes() + + def close(self): + self.data = [] + + def set_handler(self, proc): + self.handler = proc + + def read_blocks(self): + offset = 1 + while offset < len(self.data): + (addr, block, offset) = self.__read_block(self.data, offset) + if addr > 0: + self.handler(addr, block) + + def __read_block(self, data, offset): + addr = int.from_bytes(data[offset:offset+3], byteorder='little', signed=False) + size = int.from_bytes(data[offset+3:offset+6], byteorder='little', signed=False) + if addr == 0: + return (0, [], offset+6) + block = data[offset+6:offset+6+size] + return (addr, block, offset+6+size) + + diff --git a/c256.ini b/c256.ini new file mode 100644 index 0000000..443fa15 --- /dev/null +++ b/c256.ini @@ -0,0 +1,4 @@ +[DEFAULT] +port=COM9 +labels=sample.lbl +flash_address=380000 diff --git a/deref.bat b/deref.bat new file mode 100644 index 0000000..8a3d5b1 --- /dev/null +++ b/deref.bat @@ -0,0 +1,9 @@ +@echo off +REM Print the contents of memory, given the label of a pointer to the start address +REM usage: deref {label} +if [%2%]==[] ( + python C256Mgr\c256mgr.py --deref %1 +) ELSE ( + python C256Mgr\c256mgr.py --deref %1 --count %2 +) + diff --git a/docs/gabe_details.txt b/docs/gabe_details.txt new file mode 100644 index 0000000..03bfab7 --- /dev/null +++ b/docs/gabe_details.txt @@ -0,0 +1,19 @@ +assign CS_GABE_Config_o = ( iBUS_A_i[16:6] == 11'b0_0000_0000_00) & iBUS_CS_GABE_i; // $00C00000..$00C0003F - Control Registers +assign CS_A2560K_KB_o = ( iBUS_A_i[16:6] == 11'b0_0000_0000_01) & iBUS_CS_GABE_i; // $00C00040..$00C0007F - Control Registers + +assign CS_RTC_o = ( iBUS_A_i[16:7] == 10'b0_0000_0000_1) & iBUS_CS_GABE_i; // $00C00000..$00C0008F - Control Registers +assign CS_Interrupt_Ctrl_o = ( iBUS_A_i[16:8] == 9'b0_0000_0001) & iBUS_CS_GABE_i; // $00C00100..$00C001FF - Interrupt Controllers +assign CS_Timer_o = ( iBUS_A_i[16:8] == 9'b0_0000_0010) & iBUS_CS_GABE_i; // $00C00200..$00C002FF - Timer Block +assign CS_SDCard_o = ( iBUS_A_i[16:8] == 9'b0_0000_0011) & iBUS_CS_GABE_i; // $00C00300..$00C003FF - SD Card Controller +assign CS_IDE_o = ( iBUS_A_i[16:8] == 9'b0_0000_0100) & iBUS_CS_GABE_i; // $00C00400..$00C004FF - IDE +assign CS_Joystick_o = ( iBUS_A_i[16:8] == 9'b0_0000_0101) & iBUS_CS_GABE_i; // $00C00500..$00C005FF - JOYSTICK/JOYPAD + +assign CS_NIC_o = ( iBUS_A_i[16:9] == 8'b0_0000_011) & iBUS_CS_GABE_i; // $00C00600..$00C007FF - NIC +// LPC Block +assign CS_LPC_o = (iBUS_A_i[16:10] == 7'b0_0010_00) & iBUS_CS_GABE_i; // $00C02000..$00C023FF - LPC +// Math Block +assign CS_UNSIGNED_MULT_o = ( iBUS_A_i[16:5] == 12'b0_0011_0000_000) & iBUS_CS_GABE_i; // $00C03000..$00C0301F - 32 x 32 Unsigned +assign CS_SIGNED_MULT_o = ( iBUS_A_i[16:5] == 12'b0_0011_0000_001) & iBUS_CS_GABE_i; // $00C03020..$00C0303F - 32 x 32 Signed +assign CS_UNSIGNED_DIV_o = ( iBUS_A_i[16:5] == 12'b0_0011_0000_010) & iBUS_CS_GABE_i; // $00C03040..$00C0305F - 32 x 32 Unsigned +assign CS_SIGNED_DIV_o = ( iBUS_A_i[16:5] == 12'b0_0011_0000_011) & iBUS_CS_GABE_i; // $00C03060..$00C0307F - 32 x 32 Signed +assign CS_MATH_FLOAT_o = ( iBUS_A_i[16:7] == 8'b0_0100_000) & iBUS_CS_GABE_i; // $00C04000..$00C041FF - Float Module \ No newline at end of file diff --git a/docs/interrupts_details.txt b/docs/interrupts_details.txt new file mode 100644 index 0000000..62952da --- /dev/null +++ b/docs/interrupts_details.txt @@ -0,0 +1,26 @@ +lirq0 <= { DAC0_Playback_Done_IRQ_i, 1'b0, DAC1_Playback_Done_IRQ_i, 1'b0, BTX_IRQ_i[3:0], 2'b00, OPL3_EXT_IRQ_i, OPN2_EXT_IRQ_i, OPM_IXT_IRQ_i, SD_IRQ_i, SD_Card_Insert_i, IDE_IRQ_i, + + +RTC_IRQ_i, 2'b00, ~Timer4_i, ~Timer3_i, ~Timer2_i, ~Timer1_i, ~Timer0_i, !MPU_401_int_PulSe[3], !FDC_int_PulSe[3], !LPT1_int_PulSe[3], !COM2_int_PulSe[3], !COM1_int_PulSe[3], !Mouse_int_PulSe[3], A2560K_Keyboard_IRQ_i , !Keyboard_int_PulSe[3], //16bits + + + +VID_B_HP_INT1n_i, 1'b0, VKY_III_Channel_B_IRQ_i, VID_A_HP_INT1n_i, 1'b0, VKY_III_Channel_A_IRQ_i }; //16bits +case(CPU_A_i[4:1]) + 4'b0000: begin pending[15:0] <= (pending[15:0] & ~CPU_D_i); end + 4'b0001: begin pending[31:16] <= (pending[31:16] & ~CPU_D_i); end + 4'b0010: begin pending[47:32] <= (pending[47:32] & ~CPU_D_i); end + 4'b0011: begin Temp_Reg_Unused[0] <= CPU_D_i; end + 4'b0100: begin pol[15:0] <= CPU_D_i; end + 4'b0101: begin pol[31:16] <= CPU_D_i; end + 4'b0110: begin pol[47:32] <= CPU_D_i; end + 4'b0111: begin Temp_Reg_Unused[1] <= CPU_D_i; end + 4'b1000: begin edgen[15:0] <= CPU_D_i; end + 4'b1001: begin edgen[31:16]<= CPU_D_i; end + 4'b1010: begin edgen[47:32]<= CPU_D_i; end + 4'b1011: begin Temp_Reg_Unused[2] <= CPU_D_i; end + 4'b1100: begin mask[15:0] <= CPU_D_i; end + 4'b1101: begin mask[31:16] <= CPU_D_i; end + 4'b1110: begin mask[47:32] <= CPU_D_i; end + 4'b1111: begin Temp_Reg_Unused[3] <= CPU_D_i; end + default: begin end \ No newline at end of file diff --git a/docs/math_details.txt b/docs/math_details.txt new file mode 100644 index 0000000..e3afb97 --- /dev/null +++ b/docs/math_details.txt @@ -0,0 +1,35 @@ +5'b00000: iBUS_D_FixedMATH_o = UnsignedMult[1]; + 5'b00001: iBUS_D_FixedMATH_o = UnsignedMult[0]; + 5'b00010: iBUS_D_FixedMATH_o = UnsignedMult[3]; + 5'b00011: iBUS_D_FixedMATH_o = UnsignedMult[2]; + 5'b00100: iBUS_D_FixedMATH_o = UnsignedMultOutput[31:16]; + 5'b00101: iBUS_D_FixedMATH_o = UnsignedMultOutput[15:0]; + 5'b00110: iBUS_D_FixedMATH_o = UnsignedMultOutput[63:48]; + 5'b00111: iBUS_D_FixedMATH_o = UnsignedMultOutput[47:32]; + // Signed Mult + 5'b01000: iBUS_D_FixedMATH_o = SignedMult[1]; + 5'b01001: iBUS_D_FixedMATH_o = SignedMult[0]; + 5'b01010: iBUS_D_FixedMATH_o = SignedMult[3]; + 5'b01011: iBUS_D_FixedMATH_o = SignedMult[2]; + 5'b01100: iBUS_D_FixedMATH_o = SignedMultOutput[31:16]; + 5'b01101: iBUS_D_FixedMATH_o = SignedMultOutput[15:0]; + 5'b01110: iBUS_D_FixedMATH_o = SignedMultOutput[63:48]; + 5'b01111: iBUS_D_FixedMATH_o = SignedMultOutput[47:32]; + // Unsigned Div + 5'b10000: iBUS_D_FixedMATH_o = UnsignedDiv[1]; + 5'b10001: iBUS_D_FixedMATH_o = UnsignedDiv[0]; + 5'b10010: iBUS_D_FixedMATH_o = UnsignedDiv[3]; + 5'b10011: iBUS_D_FixedMATH_o = UnsignedDiv[2]; + 5'b10100: iBUS_D_FixedMATH_o = UnsignedDivisionQuotient[31:16]; + 5'b10101: iBUS_D_FixedMATH_o = UnsignedDivisionQuotient[15:0]; + 5'b10110: iBUS_D_FixedMATH_o = UnsignedDivisionremain[31:16]; + 5'b10111: iBUS_D_FixedMATH_o = UnsignedDivisionremain[15:0]; + // Signed Div + 5'b11000: iBUS_D_FixedMATH_o = SignedDiv[1]; + 5'b11001: iBUS_D_FixedMATH_o = SignedDiv[0]; + 5'b11010: iBUS_D_FixedMATH_o = SignedDiv[3]; + 5'b11011: iBUS_D_FixedMATH_o = SignedDiv[2]; + 5'b11100: iBUS_D_FixedMATH_o = SignedDivisionQuotient[31:16]; + 5'b11101: iBUS_D_FixedMATH_o = SignedDivisionQuotient[15:0]; + 5'b11110: iBUS_D_FixedMATH_o = SignedDivisionremain[31:16]; + 5'b11111: iBUS_D_FixedMATH_o = SignedDivisionremain[15:0]; \ No newline at end of file diff --git a/docs/sound_details.txt b/docs/sound_details.txt new file mode 100644 index 0000000..566133c --- /dev/null +++ b/docs/sound_details.txt @@ -0,0 +1,23 @@ +assign CS_BEATRIX_Config_o = ( iBUS_A_i[16:8] == 9'b0_0000_0000) & iBUS_CS_BEATRIX_i; // $00C20000..$00C200FF - Control Registers +// PSG +assign CS_Ext_PSG_o = ( iBUS_A_i[16:4] == 9'b0_0000_0001_0000) & iBUS_CS_BEATRIX_i; // $00C20100..$00C2010F - Extern PSG +assign CS_Int_L_PSG_o = ( iBUS_A_i[16:4] == 9'b0_0000_0001_0001) & iBUS_CS_BEATRIX_i; // $00C20110..$00C2011F - Internal PSG - L Channel +assign CS_Int_R_PSG_o = ( iBUS_A_i[16:4] == 9'b0_0000_0001_0010) & iBUS_CS_BEATRIX_i; // $00C20120..$00C2012F - Internal PSG - R Channel +assign CS_Int_S_PSG_o = ( iBUS_A_i[16:4] == 9'b0_0000_0001_0011) & iBUS_CS_BEATRIX_i; // $00C20130..$00C2013F - Internal PSG - S Channel +// External Devices +assign CS_OPL3_o = ( iBUS_A_i[16:9] == 8'b0_0000_001) & iBUS_CS_BEATRIX_i; // $00C20200..$00C203FF - Extern OPL3 +assign CS_Ext_OPN2_o = ( iBUS_A_i[16:9] == 8'b0_0000_010) & iBUS_CS_BEATRIX_i; // $00C20400..$00C205FF - Extern OPN2 +assign CS_Ext_OPM_o = ( iBUS_A_i[16:9] == 8'b0_0000_011) & iBUS_CS_BEATRIX_i; // $00C20600..$00C207FF - Extern OPM +assign CS_Ext_L_SID_o = ( iBUS_A_i[16:8] == 9'b0_0000_1000) & iBUS_CS_BEATRIX_i; // $00C20800..$00C208FF - Extern Left SID +assign CS_Ext_R_SID_o = ( iBUS_A_i[16:8] == 9'b0_0000_1001) & iBUS_CS_BEATRIX_i; // $00C20900..$00C209FF - Extern Right SID +// Internal Devices +assign CS_Int_OPN2_o = ( iBUS_A_i[16:9] == 8'b0_0000_101) & iBUS_CS_BEATRIX_i; // $00C20A00..$00C20BFF - Internal OPN2 +assign CS_Int_OPM_o = ( iBUS_A_i[16:9] == 8'b0_0000_110) & iBUS_CS_BEATRIX_i; // $00C20C00..$00C20DFF - Internal OPM +assign CS_CODEC_o = ( iBUS_A_i[16:9] == 8'b0_0000_111) & iBUS_CS_BEATRIX_i; // $00C20E00..$00C20FFF - CODEC + +assign CS_Int_L_SID_o = ( iBUS_A_i[16:9] == 8'b0_0001_000) & iBUS_CS_BEATRIX_i; // $00C21000..$00C211FF - Internal SID Left +assign CS_Int_R_SID_o = ( iBUS_A_i[16:9] == 8'b0_0001_001) & iBUS_CS_BEATRIX_i; // $00C21200..$00C213FF - Internal SID Right +assign CS_Int_S_SID_o = ( iBUS_A_i[16:9] == 8'b0_0001_010) & iBUS_CS_BEATRIX_i; // $00C21400..$00C215FF - Internal SID Stereo + +assign CS_CPU_2_DAC48_o = ( iBUS_A_i[16:8] == 9'b0_0010_0000) & iBUS_CS_BEATRIX_i; // $00C20000..$00C000FF - CPU 2 DAC - 48Khz +assign CS_CPU_2_DAC44_o = ( iBUS_A_i[16:8] == 9'b0_0010_0001) & iBUS_CS_BEATRIX_i; // $00C20100..$00C001FF - CPU 2 DAC - 44Khz \ No newline at end of file diff --git a/docs/syscalls.md b/docs/syscalls.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/syscalls.ods b/docs/syscalls.ods new file mode 100644 index 0000000..112e774 Binary files /dev/null and b/docs/syscalls.ods differ diff --git a/docs/syscalls.tex b/docs/syscalls.tex new file mode 100644 index 0000000..e69de29 diff --git a/docs/vicky_details.txt b/docs/vicky_details.txt new file mode 100644 index 0000000..bea7d7c --- /dev/null +++ b/docs/vicky_details.txt @@ -0,0 +1,101 @@ +MasterControl[0] = Text Mode Enable +MasterControl[1] = Text Mode overlay +MasterControl[2] = Graphic Mode Enable +MasterControl[9:8] = resolution - 00: 640x480, 01:800x600, 10: 1024x768 (doesn't work yet), 11: 640x400 (I didn't try yet) +MasterControl[10] = Doubling Pixel +MasterControl[16] = GAMMA Enable +MasterControl[17] = Enable Manual GAMMA Enable +MasterControl[18] = Turn OFF sync (to monitor in sleep mode) +it is 32 bits Register and always should be treated as such +Mimiru Miru — Today at 7:01 PM +Do you also have this for the border and cursor control registers? +c256foenix — Today at 7:01 PM +BorderControlReg0 and BorderControlReg1 are a 32bits Register +BorderControlReg[0] = Border Enable +BorderControlReg[6:4] = X Scroll +BorderControlReg[13:8] = X Size +BorderControlReg[21:16] = Y Size +Dude, chill out! +Mimiru Miru — Today at 7:01 PM +Sorry! +c256foenix — Today at 7:01 PM +I am decyphering my own Verilog Code +Mimiru Miru — Today at 7:01 PM +ah ok +c256foenix — Today at 7:02 PM +BorderControl2 and BoardControl3 are 1x 32 bit register +BorderControlColor[23:0] = RGB; +Cursor Control Register is made out of MasterControl[8] and MasterControl[9] +CursorControl[0] = Cursor Enable +CursorControl[2:1] = Flash Rate = 00: 1 per Sec, 01: 2 per sec, 10: 4 per sec, 11: 5 per sec +CursorControl[15:8] = Reg Rext Pointer Offset (not sure if we still use that) +CursorControl[23:16] = Cursor Character +CursorControl[31:24] = Cursor Color +Cursor Control Register Position is made out of MasterControl[10] and MasterControl[11] +Cursor Control Position[15:0] = X Position +Cursor Control Position[31:16] = Y Position + + +assign CS_VICKY_REG_A_o = ( iBUS_A_i[16:7] == 10'b0_0000_0000_0) & iBUS_CS_VICKY_A_i; // $00C40000..$00C4007F - Control Registers + +assign CS_Mouse_Ptr_A_Graphics_o = ( iBUS_A_i[16:10] == 7'b0_0000_01) & iBUS_CS_VICKY_A_i; // $00C40400..$00C80BFF - Mouser Pointer graphics 16x16 ARGB x2 +assign CS_Mouse_Ptr_A_Registers_o = ( iBUS_A_i[16:8] == 9'b0_0000_1100) & iBUS_CS_VICKY_A_i; // $00C40C00..$00C80CFF - Mouser Pointer Registers + + + + + +assign CS_GAMMA_B_A_o = ( iBUS_A_i[16:8] == 9'b0_0100_0000) & iBUS_CS_VICKY_A_i; // $00C44000..$00C440FF - GAMMA Blue +assign CS_GAMMA_G_A_o = ( iBUS_A_i[16:8] == 9'b0_0100_0001) & iBUS_CS_VICKY_A_i; // $00C44100..$00C441FF - GAMMA Green +assign CS_GAMMA_R_A_o = ( iBUS_A_i[16:8] == 9'b0_0100_0010) & iBUS_CS_VICKY_A_i; // $00C44200..$00C442FF - GAMMA Red + + + +// Channel A TEXT MEM +assign CS_TextMemory_A_o = (iBUS_A_i[16:14] == 3'b0_00) & iBUS_CS_VICKY_MEM_A_i; //$C60000 - $C63FFF +assign CS_ColorMemory_A_o = (iBUS_A_i[16:14] == 3'b0_10) & iBUS_CS_VICKY_MEM_A_i; //$C68000 - $C6BFFF +assign CS_BF_CLUT_A_o = (iBUS_A_i[16:06] == 11'b0_1100_0100_00) & iBUS_CS_VICKY_MEM_A_i; //$C6C400 - $C6C43F +assign CS_BG_CLUT_A_o = (iBUS_A_i[16:06] == 11'b0_1100_0100_01) & iBUS_CS_VICKY_MEM_A_i; //$C6C440 - $C6C47F +assign CS_VICKY_REG_B_o = ( iBUS_A_i[16:7] == 10'b0_0000_0000_0) & iBUS_CS_VICKY_B_i; // $00C80000..$00C8007F - Control Registers +assign CS_Bitmap_B_Registers_o = ( iBUS_A_i[16:8] == 9'b0_0000_0001) & iBUS_CS_VICKY_B_i; // $00C80100..$00C801FF - Bitmap Control Registers +assign CS_Tile0_B_Registers_o = ( iBUS_A_i[16:7] == 10'b0_0000_0010_0) & iBUS_CS_VICKY_B_i; // $00C80200..$00C8027F - TileMap Control Registers +assign CS_Tile1_B_Registers_o = ( iBUS_A_i[16:7] == 10'b0_0000_0010_1) & iBUS_CS_VICKY_B_i; // $00C80280..$00C802FF - TileSet Control Registers +assign CS_Collisions_B_Registers_o = ( iBUS_A_i[16:8] == 9'b0_0000_0011) & iBUS_CS_VICKY_B_i; // $00C80300..$00C803FF - Collision Control Registers +assign CS_Mouse_Ptr_B_Graphics_o = ( iBUS_A_i[16:10] == 7'b0_0000_01) & iBUS_CS_VICKY_B_i; // $00C80400..$00C80BFF - Mouser Pointer graphics 16x16 ARGB x2 +assign CS_Mouse_Ptr_B_Registers_o = ( iBUS_A_i[16:8] == 9'b0_0000_1100) & iBUS_CS_VICKY_B_i; // $00C80C00..$00C80CFF - Mouser Pointer Registers + +assign CS_Sprites_B_Registers_o = ( iBUS_A_i[16:12] == 5'b0_0001) & iBUS_CS_VICKY_B_i; // $00C81000..$00C81FFF - Sprites Registers +assign CS_LUT0_B_o = ( iBUS_A_i[16:13] == 4'b0_001) & iBUS_CS_VICKY_B_i; // $00C82000..$00C83FFF - LUT +assign CS_GAMMA_B_B_o = ( iBUS_A_i[16:8] == 9'b0_0100_0000) & iBUS_CS_VICKY_B_i; // $00C84000..$00C840FF - GAMMA Blue +assign CS_GAMMA_G_B_o = ( iBUS_A_i[16:8] == 9'b0_0100_0001) & iBUS_CS_VICKY_B_i; // $00C84100..$00C841FF - GAMMA Green +assign CS_GAMMA_R_B_o = ( iBUS_A_i[16:8] == 9'b0_0100_0010) & iBUS_CS_VICKY_B_i; // $00C84200..$00C842FF - GAMMA Red + +// $00CA_0000 - $00CB_FFFF - VICKY TEXT MODE Internal Memory and CLUT +// Channel B +assign CS_TextMemory_B_o = (iBUS_A_i[16:14] == 3'b000) & iBUS_CS_VICKY_MEM_B_i; //$CA0000 - $CA3FFF +assign CS_ColorMemory_B_o = (iBUS_A_i[16:14] == 3'b010) & iBUS_CS_VICKY_MEM_B_i; //$CA8000 - $CABFFF +assign CS_BF_CLUT_B_o = (iBUS_A_i[16:06] == 11'b0_1100_0100_00) & iBUS_CS_VICKY_MEM_B_i; //$CAC400 - $CAC43F +assign CS_BG_CLUT_B_o = (iBUS_A_i[16:06] == 11'b0_1100_0100_01) & iBUS_CS_VICKY_MEM_B_i; //$CAC440 - $CAC47F + SYSTEM + +assign CS0 = ( Internal_Address[23:21] == 3'b000 ) & ( UserData | UserProgram | SuperData | SuperProgram ); //$00 (2M) +assign CS1 = ( Internal_Address[23:21] == 3'b001 ) & ( UserData | UserProgram | SuperData | SuperProgram ); //$02 (2M) +// System RAM +assign CS_MERA = ( Internal_Address[23:22] == 2'b01 ) & ( UserData | SuperData ); //$040000 - $07FFFF (4M) (out of 64Meg) + +// Video RAM +assign CS_VRAM_A = ( Internal_Address[23:21] == 3'b100 ) & ( UserData | SuperData ); //$080000 - 09FFFF (2M) (out of 8M) +assign CS_VRAM_B = ( Internal_Address[23:21] == 3'b101 ) & ( UserData | SuperData ); //$0A0000 - 0BFFFF (2M) (out of 8M) + +assign CS_GABE = ( Internal_Address[23:17] == 7'b1100_000 ) & ( UserData | SuperData ); //$C0 +assign CS_BEATRIX = ( Internal_Address[23:17] == 7'b1100_001 ) & ( UserData | SuperData ); //$C2 +// Vicky Channel A +assign CS_VICKY_A = ( Internal_Address[23:17] == 7'b1100_010 ) & ( UserData | SuperData ); //$C4 +assign CS_VICKY_MEM_A = ( Internal_Address[23:17] == 7'b1100_011 ) & ( UserData | SuperData ); //$C6 +//$00C6_8000 - $00C9_FFFF - Reserved +// Vicky Channel B +assign CS_VICKY_B = ( Internal_Address[23:17] == 7'b1100_100 ) & ( UserData | SuperData ); //$C8 +assign CS_VICKY_MEM_B = ( Internal_Address[23:17] == 7'b1100_101 ) & ( UserData | SuperData ); //$CA + +assign FLASH0 = ( Internal_Address[23:21] == 3'b111 ) & ( SuperData | SuperProgram ); //$E0_0000 +assign FLASH1 = 1'b0; diff --git a/dump.bat b/dump.bat new file mode 100644 index 0000000..4a5c4af --- /dev/null +++ b/dump.bat @@ -0,0 +1,9 @@ +@echo off +REM Print the contents of memory +REM usage: dump {start address} [{byte count}] + +if [%2%]==[] ( + python C256Mgr\c256mgr.py --dump %1 +) ELSE ( + python C256Mgr\c256mgr.py --dump %1 --count %2 +) \ No newline at end of file diff --git a/flash.bat b/flash.bat new file mode 100644 index 0000000..d6fd2b2 --- /dev/null +++ b/flash.bat @@ -0,0 +1,8 @@ +@echo off +REM Reprogram the flash memory on the C256 Foenix + +if [%2%]==[] ( + python C256Mgr\c256mgr.py --flash %1 +) ELSE ( + python C256Mgr\c256mgr.py --flash %1 --address %2 +) \ No newline at end of file diff --git a/lookup.bat b/lookup.bat new file mode 100644 index 0000000..7adf681 --- /dev/null +++ b/lookup.bat @@ -0,0 +1,9 @@ +@echo off +REM Print the contents of memory at the labeled address +REM usage: lookup {label} + +if [%2%]==[] ( + python C256Mgr\c256mgr.py --lookup %1 +) ELSE ( + python C256Mgr\c256mgr.py --lookup %1 --count %2 +) \ No newline at end of file diff --git a/revision.bat b/revision.bat new file mode 100644 index 0000000..4fa5802 --- /dev/null +++ b/revision.bat @@ -0,0 +1,3 @@ +@echo off +REM Get the revision code of the C256 Foenix's debug interface +python C256Mgr\c256mgr.py --revision diff --git a/run256.bat b/run256.bat new file mode 100644 index 0000000..b203bdb --- /dev/null +++ b/run256.bat @@ -0,0 +1,2 @@ +@echo off +python C256Mgr\c256mgr.py --upload %1 diff --git a/runsrec.bat b/runsrec.bat new file mode 100644 index 0000000..a456e70 --- /dev/null +++ b/runsrec.bat @@ -0,0 +1,2 @@ +@echo off +python C256Mgr\c256mgr.py --upload-srec %1 diff --git a/src/Makefile b/src/Makefile index c251075..52fb53f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,7 +1,7 @@ export AS = vasmm68k_mot export ASFLAGS = -quiet -Fvobj -nowarn=62 export CC = vc -export CFLAGS = +../vbcc/config/m68k-foenix -I. -Iinclude +export CFLAGS = +../vbcc/config/m68k-foenix -I. -Iinclude -DCPU=32 -DSYSTEM=4 export RM = cmd /C del /Q /F cpu = m68k @@ -17,8 +17,8 @@ all: foenixmcp.s68 $(cpu) $(cpu): $(MAKE) --directory=$@ -foenixmcp.s68: foenixmcp.o $(cpu) - $(CC) $(CFLAGS) -o foenixmcp.s68 foenixmcp.o $(cpu_c_obj) +foenixmcp.s68: foenixmcp.o text_screen.o $(cpu) + $(CC) $(CFLAGS) -o foenixmcp.s68 foenixmcp.o text_screen.o $(cpu_c_obj) %.o: %.c $(DEPS) $(CC) -S -c -o $@ $< $(CFLAGS) diff --git a/src/foenixmcp.c b/src/foenixmcp.c index f7f9b12..e9859dc 100644 --- a/src/foenixmcp.c +++ b/src/foenixmcp.c @@ -2,13 +2,25 @@ * Startup file for the Foenix/MCP */ +#include + +#include "sys_general.h" #include "m68k/syscalls_m68k.h" +#include "text_screen.h" + +void print(short screen, char * message) { + int i; + for (i = 0; i < strlen(message); i++) { + text_put_raw(screen, message[i]); + } +} int main(int argc, char * argv[]) { - bconout('A'); - bconout('B'); - bconout('C'); + text_init(); + print(0, "Hello from Screen A!"); + print(1, "Hello from Screen B!"); + /* Infinite loop... */ while (1) {}; } diff --git a/src/include/A2560K/VICKYIII_General.h b/src/include/A2560K/VICKYIII_General.h new file mode 100644 index 0000000..425a51c --- /dev/null +++ b/src/include/A2560K/VICKYIII_General.h @@ -0,0 +1,96 @@ +/* + * Registers and memory blocks for VICKY III + */ + +#ifndef __VICKYIII_General_H +#define __VICKYIII_General_H + +/* + * Screen Channel A + */ + +#define MasterControlReg_A ((volatile uint32_t *)0x00C40000) +#define BorderControlReg_L_A ((volatile uint32_t *)0x00C40004) +#define BorderControlReg_H_A ((volatile uint32_t *)0x00C40008) +#define BackGroundControlReg_A ((volatile uint32_t *)0x00C4000C) +#define CursorControlReg_L_A ((volatile uint32_t *)0x00C40010) +#define CursorControlReg_H_A ((volatile uint32_t *)0x00C40014) + +#define LineInterrupt0_A ((volatile uint16_t *)0x00C40018) +#define LineInterrupt1_A ((volatile uint16_t *)0x00C4001A) +#define LineInterrupt2_A ((volatile uint16_t *)0x00C4001C) +#define LineInterrupt3_A ((volatile uint16_t *)0x00C4001E) + +#define MousePointer_Mem_A ((volatile uint16_t *)0x00C40400) +#define MousePtr_A_CTRL_Reg ((volatile uint16_t *)0x00C40C00) + +#define MousePtr_A_X_Pos ((volatile uint16_t *)0x00C40C02) +#define MousePtr_A_Y_Pos ((volatile uint16_t *)0x00C40C04) +#define MousePtr_A_Mouse0 ((volatile uint16_t *)0x00C40C0A) +#define MousePtr_A_Mouse1 ((volatile uint16_t *)0x00C40C0C) +#define MousePtr_A_Mouse2 ((volatile uint16_t *)0x00C40C0E) + +#define ScreenText_A ((volatile char *)0x00C60000) // Text matrix +#define ColorText_A ((volatile uint8_t *)0x00C68000) // Color matrix +#define FG_CLUT_A ((volatile uint16_t *)0x00C6C400) // Foreground LUT +#define BG_CLUT_A ((volatile uint16_t *)0x00C6C440) // Background LUT + +/* + * Screen Channel B + */ + +#define MasterControlReg_B ((volatile uint32_t *)0x00C80000) +#define BorderControlReg_L_B ((volatile uint32_t *)0x00C80004) +#define BorderControlReg_H_B ((volatile uint32_t *)0x00C80008) +#define BackGroundControlReg_B ((volatile uint32_t *)0x00C8000C) +#define CursorControlReg_L_B ((volatile uint32_t *)0x00C80010) +#define CursorControlReg_H_B ((volatile uint32_t *)0x00C80014) + +#define LineInterrupt0_B ((volatile uint16_t *)0x00C80018) +#define LineInterrupt1_B ((volatile uint16_t *)0x00C8001A) +#define LineInterrupt2_B ((volatile uint16_t *)0x00C8001C) +#define LineInterrupt3_B ((volatile uint16_t *)0x00C8001E) + +#define MousePointer_Mem_B ((volatile uint16_t *)0x00C80400) +#define MousePtr_B_CTRL_Reg ((volatile uint16_t *)0x00C80C00) + +#define MousePtr_B_X_Pos ((volatile uint16_t *)0x00C80C02) +#define MousePtr_B_Y_Pos ((volatile uint16_t *)0x00C80C04) +#define MousePtr_B_Mouse0 ((volatile uint16_t *)0x00C80C0A) +#define MousePtr_B_Mouse1 ((volatile uint16_t *)0x00C80C0C) +#define MousePtr_B_Mouse2 ((volatile uint16_t *)0x00C80C0E) + +#define ScreenText_B ((volatile char *)0x00CA0000) // Text matrix +#define ColorText_B ((volatile uint8_t *)0x00CA8000) // Color matrix +#define FG_CLUT_B ((volatile uint16_t *)0x00CAC400) // Foreground LUT +#define BG_CLUT_B ((volatile uint16_t *)0x00CAC440) // Background LUT + +#define BM0_Control_Reg ((volatile uint16_t *)0x00C80100) +#define BM0_Addy_Pointer_Reg ((volatile uint16_t *)0x00C80104) + +#define Sprite_0_CTRL ((volatile uint16_t *)0x00C81000) +#define Sprite_0_ADDY_HI ((volatile uint16_t *)0x00C81002) +#define Sprite_0_POS_X ((volatile uint16_t *)0x00C81004) +#define Sprite_0_POS_Y ((volatile uint16_t *)0x00C81006) + +/* + * Color lookup tables + */ + +#define LUT_0 ((volatile uint8_t *)0x00C82000) +#define LUT_1 ((volatile uint8_t *)0x00C82400) +#define LUT_2 ((volatile uint8_t *)0x00C82800) +#define LUT_3 ((volatile uint8_t *)0x00C82C00) +#define LUT_4 ((volatile uint8_t *)0x00C83000) +#define LUT_5 ((volatile uint8_t *)0x00C83400) +#define LUT_6 ((volatile uint8_t *)0x00C83800) +#define LUT_7 ((volatile uint8_t *)0x00C83C00) + +/* + * Location of VRAM + */ + +#define VRAM_Bank0 ((volatile uint8_t *)0x00800000) +#define VRAM_Bank1 ((volatile uint8_t *)0x00A00000) + +#endif \ No newline at end of file diff --git a/src/include/FMX/vickyii_general.h b/src/include/FMX/vickyii_general.h new file mode 100644 index 0000000..8780dbb --- /dev/null +++ b/src/include/FMX/vickyii_general.h @@ -0,0 +1,60 @@ +/** + * Definitions for the Vicky graphics controller + */ + +#ifndef __VICKYII_GENERAL_H +#define __VICKYII_GENERAL_H + +#define VKY_MASTER_CONTROL_L 0xAF0000 +#define Mstr_Ctrl_Text_Mode_En 0x01 +#define Mstr_Ctrl_Text_Overlay 0x02 +#define Mstr_Ctrl_Graph_Mode_En 0x04 +#define Mstr_Ctrl_Bitmap_En 0x08 +#define Mstr_Ctrl_TileMap_En 0x10 +#define Mstr_Ctrl_Sprite_En 0x20 +#define Mstr_Ctrl_GAMMA_En 0x40 +#define Mstr_Ctrl_Disable_Vid 0x80 + +#define VKY_MASTER_CONTROL_H 0xAF0001 +#define VKY_RESOLUTION_640_480 0 +#define VKY_RESOLUTION_320_240 2 +#define VKY_RESOLUTION_800_600 1 +#define VKY_RESOLUTION_400_300 3 + +#define BORDER_CTRL_REG 0xAF0004 +#define Border_Ctrl_Enable 0x01 +#define BORDER_COLOR_B 0xAF0005 +#define BORDER_COLOR_G 0xAF0006 +#define BORDER_COLOR_R 0xAF0007 +#define BORDER_X_SIZE 0xAF0008 // X- Values: 0 - 32 (Default: 32) +#define BORDER_Y_SIZE 0xAF0009 // Y- Values 0 - 32 (Default: 32) + +#define BACKGROUND_COLOR_B 0xAF000D // When in Graphic Mode, if a pixel is "0" then the Background pixel is chosen +#define BACKGROUND_COLOR_G 0xAF000E +#define BACKGROUND_COLOR_R 0xAF000F + +#define VKY_TXT_CURSOR_CTRL_REG 0xAF0010 // [0] Enable Text Mode +#define Vky_Cursor_Enable 0x01 +#define Vky_Cursor_Flash_Rate0 0x02 // 00 - 1/Sec, 01 - 2/Sec, 10 - 4/Sec, 11 - 5/Sec +#define Vky_Cursor_Flash_Rate1 0x04 +#define Vky_Cursor_FONT_Page0 0x08 // Pick Font Page 0 or Font Page 1 +#define Vky_Cursor_FONT_Page1 0x10 // Pick Font Page 0 or Font Page 1 +#define VKY_TXT_START_ADD_PTR 0xAF0011 // This is an offset to change the Starting address of the Text Mode Buffer (in x) +#define VKY_TXT_CURSOR_CHAR_REG 0xAF0012 + +#define VKY_TXT_CURSOR_COLR_REG 0xAF0013 +#define VKY_TXT_CURSOR_X_REG_L 0xAF0014 +#define VKY_TXT_CURSOR_X_REG_H 0xAF0015 +#define VKY_TXT_CURSOR_Y_REG_L 0xAF0016 +#define VKY_TXT_CURSOR_Y_REG_H 0xAF0017 + +#define MAX_TEXT_COLORS 15 // The maximum number of colors in the text LUTs +#define FG_CHAR_LUT_PTR 0xAF1F40 // Text screen foreground color LUT +#define BG_CHAR_LUT_PTR 0xAF1F80 // Text screen background color LUT + +#define FONT_MEMORY_BANK0 0xAF8000 // The memory area for the font + +#define CS_TEXT_MEM_PTR 0xAFA000 // The text cell matrix +#define CS_COLOR_MEM_PTR 0xAFC000 // The color cell matrix + +#endif \ No newline at end of file diff --git a/src/include/types.h b/src/include/types.h index ce91974..ba3a0c7 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -16,4 +16,26 @@ typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; +typedef unsigned char bool; + +// +// A color (BGR) +// +typedef struct s_color3 { + uint8_t blue; + uint8_t green; + uint8_t red; +} t_color3; + +// +// A color entry for a color lookup table (BGRA) +// +typedef struct s_color4 { + uint8_t blue; + uint8_t green; + uint8_t red; + uint8_t alpha; +} t_color4; + + #endif diff --git a/src/include/vicky_general.h b/src/include/vicky_general.h new file mode 100644 index 0000000..0ee0c3d --- /dev/null +++ b/src/include/vicky_general.h @@ -0,0 +1,19 @@ +/* + * Include file for the basic set of VICKY registers + */ + +#ifndef __vicky_general_h +#define __vicky_general_h + +#include "types.h" + +// #if SYSTEM == A2560K +// /* VICKY registers for the A2560K */ +#include "A2560K/VICKYIII_General.h" + +// #elif SYSTEM == C256_FMX || SYSTEM == C256_U || SYSTEM == C256_U_PLUS +// /* VICKY registers for the C256 FMX, U, and U+ */ +// #include "FMX/vicky_general.h" +// #endif + +#endif diff --git a/src/m68k/startup_m68k.s b/src/m68k/startup_m68k.s index 4f7cbdd..2fe8b07 100644 --- a/src/m68k/startup_m68k.s +++ b/src/m68k/startup_m68k.s @@ -2,6 +2,11 @@ xdef _bios xdef ___exit + section "vectors",code + + dc.l ___STACK ; Initial stack pointer + dc.l coldboot ; Initial PC + code coldboot: lea ___STACK,sp diff --git a/src/mapfile b/src/mapfile new file mode 100644 index 0000000..8445fdc --- /dev/null +++ b/src/mapfile @@ -0,0 +1,170 @@ +..\vbcc\targets\m68k-foenix\lib\libvc.a (_main.o) needed due to ___main + +Files: + startup_m68k.o: vectors 0(8), CODE 10000(62) hex + ..\vbcc\targets\m68k-foenix\lib\libvc.a (_main.o): CODE 10064(be), DATA 105c8(4), BSS 105d0(4) hex + foenixmcp.o: CODE 10124(95) hex + text_screen.o: CODE 101bc(39a), BSS 105d4(44) hex + bios_m68k.o: CODE 10558(40), DATA 105cc(4) hex + syscalls_m68k.o: CODE 10598(1e) hex + INITEXIT: .dtors 105b6(8), .ctors 105be(8) hex + + +Section mapping (numbers in hex): +------------------------------ + 00000000 vectors (size 8) + 00000000 - 00000008 startup_m68k.o(vectors) +------------------------------ + 00010000 text (size 5b6) + 00010000 - 00010062 startup_m68k.o(CODE) + 00010064 - 00010122 _main.o(CODE) + 00010124 - 000101b9 foenixmcp.o(CODE) + 000101bc - 00010556 text_screen.o(CODE) + 00010558 - 00010598 bios_m68k.o(CODE) + 00010598 - 000105b6 syscalls_m68k.o(CODE) +------------------------------ + 000105b6 .dtors (size 8, allocated 0) + 000105b6 - 000105be INITEXIT(.dtors) +------------------------------ + 000105be .ctors (size 8, allocated 0) + 000105be - 000105c6 INITEXIT(.ctors) +------------------------------ + 000105c8 data (size 8, allocated 4) + 000105c8 - 000105cc _main.o(DATA) + 000105cc - 000105d0 bios_m68k.o(DATA) +------------------------------ + 000105d0 bss (size 48, allocated 0) + 000105d0 - 000105d4 _main.o(BSS) + 000105d4 - 00010618 text_screen.o(BSS) + + +Symbols of text: + 0x00000000 l17: local abs, size 0 + 0x00000000 l5: local abs, size 0 + 0x00000000 l57: local abs, size 0 + 0x00000000 l3: local abs, size 0 + 0x00000000 l59: local abs, size 0 + 0x00000000 l19: local abs, size 0 + 0x00000004 l3: local abs, size 0 + 0x00000004 l5: local abs, size 0 + 0x00000008 l31: local abs, size 0 + 0x00000008 l6: local abs, size 0 + 0x00000008 l13: local abs, size 0 + 0x00000008 l43: local abs, size 0 + 0x0000000c l27: local abs, size 0 + 0x0000000c l18: local abs, size 0 + 0x0000000c l9: local abs, size 0 + 0x0000000c l11: local abs, size 0 + 0x00000014 l34: local abs, size 0 + 0x00000014 l45: local abs, size 0 + 0x00000018 l13: local abs, size 0 + 0x00000018 l52: local abs, size 0 + 0x00000018 l20: local abs, size 0 + 0x0000001c l25: local abs, size 0 + 0x0000007c l32: local abs, size 0 + 0x000000fc l11: local abs, size 0 + 0x0000040c l7: local abs, size 0 + 0x0000043c l43: local abs, size 0 + 0x0000047c l18: local abs, size 0 + 0x00000c00 l29: local abs, size 0 + 0x00000c00 l4: local abs, size 0 + 0x00000c00 l41: local abs, size 0 + 0x00000c04 l16: local abs, size 0 + 0x00000c3c l50: local abs, size 0 + 0x00010000 coldboot: local reloc, size 0 + 0x00010014 clrloop: local reloc, size 0 + 0x00010024 callmain: local reloc, size 0 + 0x0001002a ___exit: global reloc, size 0 + 0x0001002c _bios: global reloc, size 0 + 0x00010054 h_trap_13: local reloc, size 0 + 0x00010064 __Exit: global reloc, size 0 + 0x0001007e l12: local reloc, size 0 + 0x0001008a l14: local reloc, size 0 + 0x0001008e l13: local reloc, size 0 + 0x0001009c l15: local reloc, size 0 + 0x000100b0 _exit: global reloc, size 0 + 0x000100ce l27: local reloc, size 0 + 0x000100da l28: local reloc, size 0 + 0x000100e2 l23: local reloc, size 0 + 0x000100e8 ___main: global reloc, size 0 + 0x000100fe l39: local reloc, size 0 + 0x00010106 l40: local reloc, size 0 + 0x00010124 _print: global reloc, size 0 + 0x00010134 l3: local reloc, size 0 + 0x0001014e l6: local reloc, size 0 + 0x00010150 l4: local reloc, size 0 + 0x00010160 l1: local reloc, size 0 + 0x00010160 l5: local reloc, size 0 + 0x00010168 _main: global reloc, size 0 + 0x00010184 l14: local reloc, size 0 + 0x00010186 l16: local reloc, size 0 + 0x00010188 l10: local reloc, size 0 + 0x0001018c l12: local reloc, size 0 + 0x000101a4 l13: local reloc, size 0 + 0x000101bc _text_init: global reloc, size 0 + 0x0001025a l2: local reloc, size 0 + 0x00010260 _text_set_cursor: global reloc, size 0 + 0x0001027e l9: local reloc, size 0 + 0x000102f2 l10: local reloc, size 0 + 0x000102f2 l7: local reloc, size 0 + 0x000102f8 _text_set_xy: global reloc, size 0 + 0x00010310 l16: local reloc, size 0 + 0x000103b0 l17: local reloc, size 0 + 0x000103b0 l14: local reloc, size 0 + 0x000103b8 _text_setsizes: global reloc, size 0 + 0x000103c6 l23: local reloc, size 0 + 0x000103f8 l21: local reloc, size 0 + 0x000103f8 l24: local reloc, size 0 + 0x00010400 _text_set_color: global reloc, size 0 + 0x00010416 l30: local reloc, size 0 + 0x0001045e l28: local reloc, size 0 + 0x0001045e l31: local reloc, size 0 + 0x00010464 _text_clear: global reloc, size 0 + 0x00010472 l37: local reloc, size 0 + 0x0001049c l39: local reloc, size 0 + 0x000104ae l42: local reloc, size 0 + 0x000104b0 l40: local reloc, size 0 + 0x000104d6 l35: local reloc, size 0 + 0x000104d6 l38: local reloc, size 0 + 0x000104d6 l41: local reloc, size 0 + 0x000104dc _text_put_raw: global reloc, size 0 + 0x000104ee l48: local reloc, size 0 + 0x0001054a l46: local reloc, size 0 + 0x0001054a l49: local reloc, size 0 + 0x00010550 _text_put_ansi: global reloc, size 0 + 0x00010554 l53: local reloc, size 0 + 0x00010554 l55: local reloc, size 0 + 0x00010554 l56: local reloc, size 0 + 0x00010558 _impl_bconout: global reloc, size 0 + 0x00010572 l1: local reloc, size 0 + 0x00010574 _bios_dispatch: global reloc, size 0 + 0x00010588 l9: local reloc, size 0 + 0x00010590 l10: local reloc, size 0 + 0x00010592 l6: local reloc, size 0 + 0x00010592 l8: local reloc, size 0 + 0x00010598 _bconout: global reloc, size 0 + 0x000105b2 l1: local reloc, size 0 + +Symbols of .dtors: + 0x000105b6 ___DTOR_LIST__: global reloc object, size 8 + +Symbols of .ctors: + 0x000105be ___CTOR_LIST__: global reloc object, size 8 + +Symbols of data: + 0x000105c8 l21: local reloc, size 0 + 0x000105cc _text_cursor_0: global reloc, size 0 + +Symbols of bss: + 0x000105d0 ___firstexit: global reloc, size 0 + 0x000105d4 l1: local reloc, size 0 + +Linker symbols: + 0x00010000 RAMSTART: global abs, size 0 + 0x00010000 RAMSIZE: global abs, size 0 + 0x00000400 STACKLEN: global abs, size 0 + 0x00010618 ___heap: global abs, size 0 + 0x0001fc00 ___heapend: global abs, size 0 + 0x000105d0 ___BSSSTART: global abs, size 0 + 0x00000048 ___BSSSIZE: global abs, size 0 + 0x00020000 ___STACK: global abs, size 0 diff --git a/src/rsrc/font/MSX_8x8.bin b/src/rsrc/font/MSX_8x8.bin new file mode 100644 index 0000000..3a16fc2 Binary files /dev/null and b/src/rsrc/font/MSX_8x8.bin differ diff --git a/src/rsrc/font/MSX_8x8.h b/src/rsrc/font/MSX_8x8.h new file mode 100644 index 0000000..980cb57 --- /dev/null +++ b/src/rsrc/font/MSX_8x8.h @@ -0,0 +1,174 @@ +unsigned char MSX_8x8[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x28, 0x28, 0x28, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x28, 0x28, 0x7c, 0x28, 0x7c, 0x28, 0x28, 0x00, + 0x10, 0x3c, 0x50, 0x38, 0x14, 0x78, 0x10, 0x00, 0x60, 0x64, 0x08, 0x10, + 0x20, 0x4c, 0x0c, 0x00, 0x20, 0x50, 0x50, 0x20, 0x54, 0x48, 0x34, 0x00, + 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x40, 0x40, + 0x40, 0x20, 0x10, 0x00, 0x10, 0x08, 0x04, 0x04, 0x04, 0x08, 0x10, 0x00, + 0x10, 0x54, 0x38, 0x10, 0x38, 0x54, 0x10, 0x00, 0x00, 0x10, 0x10, 0x7c, + 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, + 0x38, 0x44, 0x44, 0x54, 0x44, 0x44, 0x38, 0x00, 0x10, 0x30, 0x50, 0x10, + 0x10, 0x10, 0x7c, 0x00, 0x38, 0x44, 0x04, 0x08, 0x30, 0x40, 0x7c, 0x00, + 0x38, 0x44, 0x04, 0x18, 0x04, 0x44, 0x38, 0x00, 0x08, 0x18, 0x28, 0x48, + 0x7c, 0x08, 0x08, 0x00, 0x7c, 0x40, 0x70, 0x08, 0x04, 0x08, 0x70, 0x00, + 0x18, 0x20, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x7c, 0x44, 0x08, 0x10, + 0x10, 0x10, 0x10, 0x00, 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, 0x00, + 0x38, 0x44, 0x44, 0x3c, 0x04, 0x08, 0x30, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x20, 0x00, + 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x7c, 0x00, + 0x00, 0x7c, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0x00, + 0x38, 0x44, 0x04, 0x08, 0x10, 0x00, 0x10, 0x00, 0x38, 0x44, 0x04, 0x34, + 0x54, 0x54, 0x38, 0x00, 0x10, 0x28, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x00, + 0x78, 0x24, 0x24, 0x38, 0x24, 0x24, 0x78, 0x00, 0x18, 0x24, 0x40, 0x40, + 0x40, 0x24, 0x18, 0x00, 0x70, 0x28, 0x24, 0x24, 0x24, 0x28, 0x70, 0x00, + 0x7c, 0x40, 0x40, 0x78, 0x40, 0x40, 0x7c, 0x00, 0x7c, 0x40, 0x40, 0x78, + 0x40, 0x40, 0x40, 0x00, 0x38, 0x44, 0x40, 0x5c, 0x44, 0x44, 0x38, 0x00, + 0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x00, 0x38, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x38, 0x00, 0x1c, 0x08, 0x08, 0x08, 0x48, 0x48, 0x30, 0x00, + 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, 0x00, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x7c, 0x00, 0x44, 0x6c, 0x54, 0x54, 0x44, 0x44, 0x44, 0x00, + 0x44, 0x44, 0x64, 0x54, 0x4c, 0x44, 0x44, 0x00, 0x38, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x38, 0x00, 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, + 0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, 0x00, 0x78, 0x44, 0x44, 0x78, + 0x50, 0x48, 0x44, 0x00, 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, 0x00, + 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x38, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x28, 0x10, 0x00, + 0x44, 0x44, 0x44, 0x54, 0x54, 0x6c, 0x44, 0x00, 0x44, 0x44, 0x28, 0x10, + 0x28, 0x44, 0x44, 0x00, 0x44, 0x44, 0x44, 0x38, 0x10, 0x10, 0x10, 0x00, + 0x7c, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7c, 0x00, 0x3c, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x3c, 0x00, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, + 0x3c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x3c, 0x00, 0x10, 0x28, 0x44, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, + 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x04, + 0x3c, 0x44, 0x3c, 0x00, 0x40, 0x40, 0x58, 0x64, 0x44, 0x64, 0x58, 0x00, + 0x00, 0x00, 0x38, 0x44, 0x40, 0x44, 0x38, 0x00, 0x04, 0x04, 0x34, 0x4c, + 0x44, 0x4c, 0x34, 0x00, 0x00, 0x00, 0x38, 0x44, 0x7c, 0x40, 0x38, 0x00, + 0x18, 0x24, 0x20, 0x78, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x38, 0x44, + 0x44, 0x3c, 0x04, 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x44, 0x00, + 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x38, 0x00, 0x00, 0x08, 0x00, 0x18, + 0x08, 0x08, 0x48, 0x30, 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00, + 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x68, 0x54, + 0x54, 0x54, 0x54, 0x00, 0x00, 0x00, 0x58, 0x64, 0x44, 0x44, 0x44, 0x00, + 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x58, 0x64, + 0x64, 0x58, 0x40, 0x40, 0x00, 0x00, 0x34, 0x4c, 0x4c, 0x34, 0x04, 0x04, + 0x00, 0x00, 0x58, 0x64, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x3c, 0x40, + 0x38, 0x04, 0x78, 0x00, 0x20, 0x20, 0x78, 0x20, 0x20, 0x24, 0x18, 0x00, + 0x00, 0x00, 0x48, 0x48, 0x48, 0x48, 0x34, 0x00, 0x00, 0x00, 0x44, 0x44, + 0x44, 0x28, 0x10, 0x00, 0x00, 0x00, 0x44, 0x44, 0x54, 0x54, 0x28, 0x00, + 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x44, 0x44, + 0x4c, 0x34, 0x04, 0x38, 0x00, 0x00, 0x7c, 0x08, 0x10, 0x20, 0x7c, 0x00, + 0x0c, 0x10, 0x10, 0x20, 0x10, 0x10, 0x0c, 0x00, 0x10, 0x10, 0x10, 0x00, + 0x10, 0x10, 0x10, 0x00, 0x30, 0x08, 0x08, 0x04, 0x08, 0x08, 0x30, 0x00, + 0x20, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, + 0x7c, 0x7c, 0x7c, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0xfe, 0x38, 0x7c, 0x00, + 0x00, 0x6c, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x38, 0x38, 0xfe, 0xfe, + 0x54, 0x10, 0x7c, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, + 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c, 0x00, 0x7c, 0xfe, 0xfe, 0xfe, + 0xfe, 0xfe, 0x7c, 0x00, 0x10, 0x78, 0x26, 0x38, 0x54, 0x20, 0x1e, 0x00, + 0x00, 0x10, 0x3c, 0x10, 0x3c, 0x5a, 0x32, 0x00, 0x00, 0x00, 0x48, 0x44, + 0x44, 0x44, 0x20, 0x00, 0x00, 0x38, 0x00, 0x38, 0x44, 0x04, 0x18, 0x00, + 0x00, 0x38, 0x00, 0x78, 0x10, 0x30, 0x4c, 0x00, 0x00, 0x10, 0x7c, 0x12, + 0x3c, 0x52, 0x34, 0x00, 0x00, 0x48, 0x2c, 0x32, 0x54, 0x10, 0x08, 0x00, + 0x00, 0x08, 0x5c, 0x6a, 0x4a, 0x0c, 0x10, 0x00, 0x00, 0x08, 0x0e, 0x08, + 0x38, 0x4c, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x02, 0x02, 0x0c, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x7c, 0x20, 0x7c, + 0xaa, 0x92, 0x64, 0x00, 0x00, 0x44, 0x42, 0x42, 0x42, 0x40, 0x20, 0x00, + 0x38, 0x00, 0x38, 0x44, 0x04, 0x08, 0x30, 0x00, 0x38, 0x00, 0x7c, 0x08, + 0x10, 0x30, 0x4e, 0x00, 0x12, 0x7d, 0x10, 0x3e, 0x51, 0x51, 0x22, 0x00, + 0x20, 0x22, 0x79, 0x25, 0x24, 0x44, 0x18, 0x00, 0x10, 0x7e, 0x08, 0x7e, + 0x04, 0x40, 0x3c, 0x00, 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, 0x00, + 0x04, 0x44, 0x5e, 0x44, 0x44, 0x44, 0x28, 0x00, 0x3c, 0x02, 0x00, 0x00, + 0x00, 0x40, 0x3e, 0x00, 0x10, 0x7e, 0x08, 0x04, 0x04, 0x80, 0x78, 0x00, + 0x80, 0x80, 0x80, 0x80, 0x84, 0x88, 0x70, 0x00, 0x08, 0xfe, 0x38, 0x48, + 0x38, 0x08, 0x10, 0x00, 0x44, 0x44, 0xfe, 0x44, 0x48, 0x40, 0x3c, 0x00, + 0x44, 0x28, 0xfe, 0x20, 0x40, 0x40, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x50, 0x50, 0x20, 0x00, 0x00, 0x00, + 0x38, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, + 0x08, 0x08, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x7c, 0x04, 0x7c, 0x04, + 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, 0x78, 0x08, 0x30, 0x20, 0x40, 0x00, + 0x00, 0x00, 0x08, 0x10, 0x30, 0x50, 0x10, 0x00, 0x00, 0x10, 0x78, 0x48, + 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, 0x78, 0x10, 0x10, 0x10, 0x78, 0x00, + 0x00, 0x10, 0x78, 0x30, 0x50, 0x50, 0x10, 0x00, 0x00, 0x20, 0x7c, 0x24, + 0x28, 0x20, 0x20, 0x00, 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x7c, 0x00, + 0x00, 0x00, 0x7c, 0x04, 0x7c, 0x04, 0x7c, 0x00, 0x00, 0x00, 0x54, 0x54, + 0x04, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7c, 0x00, 0x00, 0x00, + 0x7c, 0x04, 0x14, 0x18, 0x10, 0x10, 0x20, 0x00, 0x04, 0x08, 0x10, 0x30, + 0x50, 0x10, 0x10, 0x00, 0x10, 0x7c, 0x44, 0x04, 0x04, 0x08, 0x10, 0x00, + 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x7c, 0x00, 0x08, 0x7c, 0x08, 0x18, + 0x28, 0x48, 0x08, 0x00, 0x10, 0x7c, 0x14, 0x14, 0x14, 0x24, 0x44, 0x00, + 0x10, 0x7c, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x00, 0x3c, 0x24, 0x44, 0x04, + 0x04, 0x08, 0x10, 0x00, 0x20, 0x3c, 0x28, 0x48, 0x08, 0x08, 0x10, 0x00, + 0x7c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x7c, 0x00, 0x28, 0x7c, 0x28, 0x28, + 0x08, 0x08, 0x10, 0x00, 0x00, 0x60, 0x04, 0x64, 0x04, 0x08, 0x70, 0x00, + 0x00, 0x7c, 0x04, 0x08, 0x10, 0x28, 0x44, 0x00, 0x20, 0x7c, 0x24, 0x28, + 0x20, 0x20, 0x1c, 0x00, 0x44, 0x44, 0x24, 0x04, 0x08, 0x10, 0x20, 0x00, + 0x3c, 0x24, 0x3c, 0x44, 0x04, 0x08, 0x10, 0x00, 0x08, 0x70, 0x10, 0x7c, + 0x10, 0x10, 0x20, 0x00, 0x54, 0x54, 0x54, 0x04, 0x04, 0x08, 0x10, 0x00, + 0x38, 0x00, 0x7c, 0x10, 0x10, 0x10, 0x20, 0x00, 0x40, 0x40, 0x60, 0x50, + 0x48, 0x40, 0x40, 0x00, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x20, 0x00, + 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x7c, 0x04, 0x68, + 0x10, 0x28, 0x44, 0x00, 0x10, 0x7c, 0x04, 0x18, 0x74, 0x10, 0x10, 0x00, + 0x04, 0x04, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x10, 0x08, 0x24, 0x24, + 0x24, 0x24, 0x44, 0x00, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x40, 0x3c, 0x00, + 0x7c, 0x04, 0x04, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x20, 0x50, 0x08, + 0x04, 0x04, 0x00, 0x00, 0x10, 0x7c, 0x10, 0x10, 0x54, 0x54, 0x10, 0x00, + 0x00, 0x7c, 0x04, 0x04, 0x28, 0x10, 0x08, 0x00, 0x78, 0x00, 0x30, 0x00, + 0x00, 0x78, 0x04, 0x00, 0x08, 0x10, 0x20, 0x40, 0x48, 0x44, 0x7c, 0x00, + 0x04, 0x04, 0x04, 0x28, 0x10, 0x28, 0x40, 0x00, 0x3c, 0x10, 0x7c, 0x10, + 0x10, 0x10, 0x0c, 0x00, 0x20, 0x7c, 0x24, 0x24, 0x28, 0x20, 0x20, 0x00, + 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x00, 0x00, 0x7c, 0x04, 0x7c, + 0x04, 0x04, 0x7c, 0x00, 0x38, 0x00, 0x7c, 0x04, 0x04, 0x08, 0x10, 0x00, + 0x48, 0x48, 0x48, 0x48, 0x48, 0x10, 0x20, 0x00, 0x00, 0x28, 0x28, 0x28, + 0x28, 0x2c, 0x48, 0x00, 0x40, 0x40, 0x40, 0x48, 0x48, 0x50, 0x60, 0x00, + 0x00, 0x7c, 0x44, 0x44, 0x44, 0x44, 0x7c, 0x00, 0x7c, 0x44, 0x44, 0x04, + 0x04, 0x08, 0x10, 0x00, 0x00, 0x60, 0x00, 0x04, 0x04, 0x08, 0x70, 0x00, + 0x48, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x48, 0x30, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0xf8, 0x20, 0x4e, 0x40, 0x90, 0x8e, 0x00, + 0x10, 0xfe, 0x20, 0x78, 0x04, 0x04, 0x78, 0x00, 0x00, 0xfc, 0x02, 0x02, + 0x02, 0x04, 0x18, 0x00, 0xfe, 0x08, 0x10, 0x20, 0x20, 0x20, 0x1c, 0x00, + 0x10, 0x12, 0x1c, 0x30, 0x40, 0x40, 0x3e, 0x00, 0x2c, 0xf2, 0x44, 0x44, + 0x9c, 0x26, 0x1c, 0x00, 0x00, 0x9e, 0x80, 0x80, 0x80, 0x90, 0x4e, 0x00, + 0x48, 0x48, 0x7c, 0xd2, 0xb6, 0xaa, 0x4c, 0x00, 0x40, 0x4c, 0xd2, 0x62, + 0x4e, 0xd2, 0x4e, 0x00, 0x00, 0x38, 0x54, 0x92, 0xa2, 0xa2, 0x44, 0x00, + 0x04, 0x9e, 0x84, 0x84, 0x8c, 0x96, 0x4c, 0x00, 0x10, 0xe4, 0x26, 0x44, + 0x44, 0x48, 0x30, 0x00, 0x20, 0x10, 0x00, 0x20, 0x14, 0x52, 0xb2, 0x00, + 0x00, 0x00, 0x20, 0x50, 0x88, 0x04, 0x02, 0x00, 0x1e, 0x84, 0x9e, 0x84, + 0x8c, 0x96, 0x4c, 0x00, 0x10, 0xfc, 0x10, 0xfc, 0x70, 0x98, 0x74, 0x00, + 0x70, 0x10, 0x14, 0x7e, 0xa4, 0xa4, 0x48, 0x00, 0x20, 0xf4, 0x22, 0x60, + 0xa2, 0x62, 0x1c, 0x00, 0x48, 0x48, 0x7c, 0xaa, 0x92, 0xa2, 0x44, 0x00, + 0x10, 0x7c, 0x10, 0x7c, 0x10, 0x12, 0x0c, 0x00, 0x48, 0x5c, 0x6a, 0xe2, + 0x24, 0x10, 0x10, 0x00, 0x10, 0x9c, 0xb2, 0xd2, 0x92, 0x1c, 0x20, 0x00, + 0x10, 0x1c, 0x10, 0x10, 0x78, 0x94, 0x70, 0x00, 0x60, 0x10, 0x80, 0xb8, + 0xc4, 0x84, 0x38, 0x00, 0x04, 0x82, 0x82, 0x82, 0x42, 0x04, 0x18, 0x00, + 0x3c, 0x08, 0x1c, 0x22, 0x5a, 0x26, 0x1c, 0x00, 0x20, 0x2c, 0xf4, 0x24, + 0x64, 0xa4, 0x26, 0x00, 0x3c, 0x08, 0x10, 0x3c, 0x42, 0x02, 0x1c, 0x00, + 0x40, 0x40, 0xdc, 0x62, 0x42, 0xc2, 0x44, 0x00, 0x10, 0x10, 0x20, 0x20, + 0x60, 0x52, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; +unsigned int MSX_8x8_bin_len = 2048; diff --git a/src/rsrc/font/foenix-st_8x8.bin b/src/rsrc/font/foenix-st_8x8.bin new file mode 100644 index 0000000..5cb2349 Binary files /dev/null and b/src/rsrc/font/foenix-st_8x8.bin differ diff --git a/src/rsrc/font/foenix_st_8_8.h b/src/rsrc/font/foenix_st_8_8.h new file mode 100644 index 0000000..c1bce4c --- /dev/null +++ b/src/rsrc/font/foenix_st_8_8.h @@ -0,0 +1,174 @@ +unsigned char foenix_st_8x8[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, + 0xbd, 0x99, 0x81, 0x7e, 0x3c, 0x7e, 0xdb, 0xff, 0xc3, 0x7e, 0x3c, 0x00, + 0x00, 0xee, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x10, 0x38, 0x7c, 0xfe, + 0x7c, 0x38, 0x10, 0x00, 0x00, 0x3c, 0x18, 0xff, 0xff, 0x08, 0x18, 0x00, + 0x10, 0x38, 0x7c, 0xfe, 0xfe, 0x10, 0x38, 0x00, 0x00, 0x00, 0x18, 0x3c, + 0x18, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe7, 0xc3, 0xe7, 0xff, 0xff, 0xff, + 0x00, 0x3c, 0x42, 0x81, 0x81, 0x42, 0x3c, 0x00, 0xff, 0xc3, 0xbd, 0x7e, + 0x7e, 0xbd, 0xc3, 0xff, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff, + 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x04, 0x06, 0x07, 0x04, + 0x04, 0xfc, 0xf8, 0x00, 0x0c, 0x0a, 0x0d, 0x0b, 0xf9, 0xf9, 0x1f, 0x1f, + 0x00, 0x92, 0x7c, 0x44, 0xc6, 0x7c, 0x92, 0x00, 0x00, 0x00, 0x60, 0x78, + 0x7e, 0x78, 0x60, 0x00, 0x00, 0x00, 0x06, 0x1e, 0x7e, 0x1e, 0x06, 0x00, + 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x00, 0x66, 0x00, 0xff, 0xb6, 0x76, 0x36, 0x36, 0x36, 0x36, 0x00, + 0x7e, 0xc1, 0xdc, 0x22, 0x22, 0x1f, 0x83, 0x7e, 0x00, 0x00, 0x00, 0x7e, + 0x7e, 0x00, 0x00, 0x00, 0x18, 0x7e, 0x18, 0x18, 0x7e, 0x18, 0x00, 0xff, + 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x7e, 0x18, 0x00, 0x00, 0x04, 0x06, 0xff, 0x06, 0x04, 0x00, 0x00, + 0x00, 0x20, 0x60, 0xff, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, + 0xc0, 0xc0, 0xff, 0x00, 0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, + 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00, 0x66, 0x66, 0x66, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0x6c, 0x6c, 0xfe, 0x6c, 0x00, + 0x18, 0x3e, 0x60, 0x3c, 0x06, 0x7c, 0x18, 0x00, 0x00, 0x66, 0x6c, 0x18, + 0x30, 0x66, 0x46, 0x00, 0x38, 0x6c, 0x38, 0x70, 0xde, 0xcc, 0x76, 0x00, + 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x1c, 0x18, 0x18, + 0x18, 0x1c, 0x0e, 0x00, 0x70, 0x38, 0x18, 0x18, 0x18, 0x38, 0x70, 0x00, + 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, + 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x60, + 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x18, 0x18, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x40, 0x00, + 0x3c, 0x66, 0x6e, 0x76, 0x66, 0x66, 0x3c, 0x00, 0x18, 0x38, 0x18, 0x18, + 0x18, 0x18, 0x7e, 0x00, 0x3c, 0x66, 0x06, 0x0c, 0x18, 0x30, 0x7e, 0x00, + 0x7e, 0x0c, 0x18, 0x0c, 0x06, 0x66, 0x3c, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, + 0x7e, 0x0c, 0x0c, 0x00, 0x7e, 0x60, 0x7c, 0x06, 0x06, 0x66, 0x3c, 0x00, + 0x3c, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x3c, 0x00, 0x7e, 0x06, 0x0c, 0x18, + 0x30, 0x30, 0x30, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c, 0x00, + 0x3c, 0x66, 0x66, 0x3e, 0x06, 0x0c, 0x38, 0x00, 0x00, 0x18, 0x18, 0x00, + 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x30, 0x00, + 0x06, 0x0c, 0x18, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x7e, 0x00, + 0x00, 0x7e, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0x00, + 0x3c, 0x66, 0x06, 0x0c, 0x18, 0x00, 0x18, 0x00, 0x3c, 0x66, 0x6e, 0x6a, + 0x6e, 0x60, 0x3e, 0x00, 0x18, 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x00, + 0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x7c, 0x00, 0x3c, 0x66, 0x60, 0x60, + 0x60, 0x66, 0x3c, 0x00, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x6c, 0x78, 0x00, + 0x7e, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x7e, 0x00, 0x7e, 0x60, 0x60, 0x7c, + 0x60, 0x60, 0x60, 0x00, 0x3e, 0x60, 0x60, 0x6e, 0x66, 0x66, 0x3e, 0x00, + 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, 0x3c, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x3c, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, + 0x66, 0x6c, 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00, 0x60, 0x60, 0x60, 0x60, + 0x60, 0x60, 0x7e, 0x00, 0xc6, 0xee, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0x00, + 0x66, 0x76, 0x7e, 0x7e, 0x6e, 0x66, 0x66, 0x00, 0x3c, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x3c, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x00, + 0x3c, 0x66, 0x66, 0x66, 0x76, 0x6c, 0x36, 0x00, 0x7c, 0x66, 0x66, 0x7c, + 0x6c, 0x66, 0x66, 0x00, 0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00, + 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x66, 0x66, 0x66, 0x66, + 0x66, 0x66, 0x3e, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, + 0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0xee, 0xc6, 0x00, 0x66, 0x66, 0x3c, 0x18, + 0x3c, 0x66, 0x66, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x00, + 0x7e, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x7e, 0x00, 0x1e, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x1e, 0x00, 0x40, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02, 0x00, + 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00, 0x10, 0x38, 0x6c, 0xc6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, + 0x00, 0xc0, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x06, + 0x3e, 0x66, 0x3e, 0x00, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x00, + 0x00, 0x00, 0x3c, 0x60, 0x60, 0x60, 0x3c, 0x00, 0x06, 0x06, 0x3e, 0x66, + 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00, + 0x1c, 0x30, 0x7c, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x3e, 0x66, + 0x66, 0x3e, 0x06, 0x7c, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x00, + 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x00, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x70, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0x00, + 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0xec, 0xfe, + 0xd6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x00, + 0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x7c, 0x66, + 0x66, 0x66, 0x7c, 0x60, 0x00, 0x00, 0x3e, 0x66, 0x66, 0x66, 0x3e, 0x06, + 0x00, 0x00, 0x7c, 0x66, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x3e, 0x60, + 0x3c, 0x06, 0x7c, 0x00, 0x00, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x0e, 0x00, + 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x00, 0x00, 0x66, 0x66, + 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xd6, 0x7c, 0x6c, 0x00, + 0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x66, 0x66, + 0x66, 0x3e, 0x06, 0x7c, 0x00, 0x00, 0x7e, 0x0c, 0x18, 0x30, 0x7e, 0x00, + 0x0e, 0x18, 0x18, 0x30, 0x18, 0x18, 0x0e, 0x00, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0c, 0x18, 0x18, 0x70, 0x00, + 0x00, 0x60, 0xf2, 0x9e, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x34, + 0x34, 0x62, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, + 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, + 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, + 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, + 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, + 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, + 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, + 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, + 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, + 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, + 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, + 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, + 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, + 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, + 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, + 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, + 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, + 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, + 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, + 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, + 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, + 0x00, 0x00, 0x00, 0x78, 0x78, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x0c, + 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x70, 0xe0, + 0x60, 0x60, 0x7e, 0x00, 0x81, 0x5a, 0x24, 0x5a, 0x5a, 0x24, 0x5a, 0x81, + 0x6c, 0x64, 0x68, 0x60, 0x60, 0x60, 0x7e, 0x00, 0x0c, 0x3e, 0x60, 0x3c, + 0x06, 0x66, 0x3c, 0x00, 0x0e, 0x1b, 0x3c, 0x66, 0x66, 0x3c, 0xd8, 0x70, + 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x3e, 0x60, 0x3c, + 0x06, 0x66, 0x3c, 0x00, 0x3e, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x08, 0x38, + 0x24, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00, 0x0c, 0x7e, 0x0c, 0x18, + 0x30, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x24, 0x7e, 0x0c, 0x18, 0x30, 0x60, 0x7e, 0x00, 0x08, 0x7e, 0x0c, 0x18, + 0x30, 0x60, 0x7e, 0x00, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0x44, 0x22, 0x44, 0x22, + 0x44, 0x22, 0x44, 0x22, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, + 0x18, 0xf8, 0x18, 0x18, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, + 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0xf8, + 0x18, 0xf8, 0x18, 0x18, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00, 0xfe, + 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, + 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0xf8, + 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x36, 0x36, 0x36, 0x37, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, + 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x00, 0x00, 0x00, 0xff, + 0x00, 0xff, 0x00, 0x00, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, + 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x36, 0x36, 0x36, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, + 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x00, 0x00, 0x00, 0x3f, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, + 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, + 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x18, 0x00, 0x7c, 0x66, 0x60, 0x60, 0x00, + 0x0c, 0x18, 0x00, 0x3c, 0x06, 0x7e, 0x3e, 0x00, 0x18, 0x66, 0x00, 0x3c, + 0x06, 0x7e, 0x3e, 0x00, 0x24, 0x18, 0x00, 0x3c, 0x06, 0x7e, 0x3e, 0x00, + 0x66, 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x3e, 0x00, 0x76, 0x34, 0x30, 0x30, + 0x30, 0x30, 0x78, 0x00, 0x0c, 0x18, 0x00, 0x3c, 0x60, 0x60, 0x3c, 0x00, + 0x00, 0x00, 0x3c, 0x60, 0x60, 0x3c, 0x08, 0x18, 0x24, 0x18, 0x00, 0x3c, + 0x60, 0x60, 0x3c, 0x00, 0x0c, 0x18, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00, + 0x00, 0x00, 0x3c, 0x7e, 0x60, 0x3c, 0x18, 0x0c, 0x66, 0x00, 0x3c, 0x66, + 0x7e, 0x60, 0x3c, 0x00, 0x24, 0x18, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00, + 0x0c, 0x18, 0x00, 0x38, 0x18, 0x18, 0x3c, 0x00, 0x18, 0x24, 0x00, 0x38, + 0x18, 0x18, 0x3c, 0x00, 0x0d, 0x0d, 0x7c, 0xcc, 0xcc, 0xcc, 0x7c, 0x00, + 0x06, 0x1f, 0x06, 0x3e, 0x66, 0x66, 0x3e, 0x00, 0x0c, 0x18, 0x00, 0x7c, + 0x66, 0x66, 0x66, 0x00, 0x24, 0x18, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x00, + 0x0c, 0x18, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x00, 0x18, 0x66, 0x00, 0x3c, + 0x66, 0x66, 0x3c, 0x00, 0x36, 0x6c, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x00, + 0x66, 0x00, 0x00, 0x3c, 0x66, 0x66, 0x3c, 0x00, 0x18, 0x18, 0x00, 0x7e, + 0x00, 0x18, 0x18, 0x00, 0x24, 0x18, 0x00, 0x7c, 0x66, 0x60, 0x60, 0x00, + 0x18, 0x24, 0x18, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x0c, 0x18, 0x00, 0x66, + 0x66, 0x66, 0x3e, 0x00, 0x36, 0x6c, 0x00, 0x66, 0x66, 0x66, 0x3e, 0x00, + 0x66, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3e, 0x00, 0x0c, 0x18, 0x66, 0x66, + 0x66, 0x3e, 0x06, 0x7c, 0x00, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x0e, 0x18, + 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; +unsigned int foenix_st_8x8_bin_len = 2048; diff --git a/src/sys_general.c b/src/sys_general.c new file mode 100644 index 0000000..faf345c --- /dev/null +++ b/src/sys_general.c @@ -0,0 +1,50 @@ +#include "sys_general.h" + +/* + * Fill out a s_sys_info structure with the information about the current system + * + * Inputs: + * info = pointer to a s_sys_info structure to fill out + */ +void sys_get_info(p_sys_info info) { + /* Model, CPU, and the presence of the floppy are set at compile time */ + info->model = MODEL; + info->cpu = CPU; +#if MODEL==SYS_FOENIX_FMX || MODEL==SYS_FOENIX_A2560K || MODEL==SYS_FOENIX_A2560X || MODEL==SYS_FOENIX_GENX + info->has_floppy = 1; +#else + info->has_floppy = 0; +#endif + + info->gabe_rev = 0x0000; /* TODO: get this from GABE */ + + info->vicky_rev = 0x0000; /* TODO: get this from VICKY */ + + info->system_ram_size = 0; /* TODO: compute this by testing RAM */ + + info->has_expansion_card = 0; /* TODO: figure this out by checking with GABE */ + + info->has_hard_drive = 0; /* TODO: figure this out by checking with GABE */ + + /* Set the number of screens and the presence of ethernet based on the model and expansion card */ + switch (info->model) { + case SYS_FOENIX_A2560K: + case SYS_FOENIX_A2560X: + case SYS_FOENIX_GENX: + /* These systems are built with 2 screens and ethernet */ + info->screens = 2; + info->has_ethernet = 1; + break; + + default: + /* Otherwise, we need the correct expansion card */ + info->screens = 1; + info->has_ethernet = 0; + + // if (info->has_expansion_card) { + // /* TODO: detect card and set screen number and/or ethernet accordingly */ + // ; + // } + break; + } +} diff --git a/src/sys_general.h b/src/sys_general.h new file mode 100644 index 0000000..7fcdd71 --- /dev/null +++ b/src/sys_general.h @@ -0,0 +1,55 @@ +/* + * Gather and return information about the system + */ + +#ifndef __SYS_GENERAL_H +#define __SYS_GENERAL_H + +#include "types.h" + +/* IDs for the various Foenix machines supported */ + +#define SYS_FOENIX_FMX 1 +#define SYS_FOENIX_U 2 +#define SYS_FOENIX_U_PLUS 3 +#define SYS_FOENIX_A2560K 4 +#define SYS_FOENIX_A2560U 5 +#define SYS_FOENIX_A2560U_PLUS 6 +#define SYS_FOENIX_A2560X 7 +#define SYS_FOENIX_GENX 8 + +/* IDs for the CPUs supported */ + +#define CPU_WDC65816 0x16 /* CPU code for the Western Design Center 65816 */ +#define CPU_M68000 0x20 /* CPU code for the Motorola 68000 */ +#define CPU_M68010 0x21 /* CPU code for the Motorola 68010 */ +#define CPU_M68020 0x22 /* CPU code for the Motorola 68020 */ +#define CPU_M68030 0x23 /* CPU code for the Motorola 68030 */ +#define CPU_M68040 0x24 /* CPU code for the Motorola 68040 */ +#define CPU_I486DX 0x34 /* CPU code for the Intel 486DX */ + +/* + * Structure to describe the hardware + */ +typedef struct s_sys_info { + unsigned short model; /* Code to say what model of machine this is */ + unsigned short cpu; /* Code to say which CPU is running */ + unsigned short gabe_rev; /* Code for the GABE revision number */ + unsigned short vicky_rev; /* Code for the VICKY revision number */ + int system_ram_size; /* The number of bytes of system RAM on the board */ + bool has_floppy; /* TRUE if the board has a floppy drive installed */ + bool has_hard_drive; /* TRUE if the board has a PATA device installed */ + bool has_expansion_card; /* TRUE if an expansion card is installed on the device */ + bool has_ethernet; /* TRUE if an ethernet port is present */ + unsigned short screens; /* How many screens are on this computer */ +} t_sys_info, *p_sys_info; + +/* + * Fill out a s_sys_info structure with the information about the current system + * + * Inputs: + * info = pointer to a s_sys_info structure to fill out + */ +extern void sys_get_info(p_sys_info info); + +#endif \ No newline at end of file diff --git a/src/text_screen.c b/src/text_screen.c new file mode 100644 index 0000000..3f10b84 --- /dev/null +++ b/src/text_screen.c @@ -0,0 +1,176 @@ +/* + * Driver for VICKY III text screens, both channel A and channel B + */ + +#include "vicky_general.h" +#include "text_screen.h" + +#define MAX_TEXT_CHANNELS 2 + +/* + * Structure to hold pointers to the text channel's registers and memory + */ +typedef struct s_text_channel { + volatile char * text_cells; + volatile uint8_t * color_cells; + volatile uint32_t * cursor_settings; + volatile uint32_t * cursor_position; + + short columns; + short rows; + short x; + short y; + volatile char * text_cursor_ptr; + volatile uint8_t * color_cursor_ptr; + uint8_t current_color; +} t_text_channel, *p_text_channel; + +static t_text_channel text_channel[MAX_TEXT_CHANNELS]; + +/* + * Initialize the text screen driver + */ +int text_init() { + int x; + p_text_channel chan_a = &text_channel[0]; + p_text_channel chan_b = &text_channel[1]; + + /* TODO: initialize everything... only do a screen if it's present */ + + chan_a->text_cells = ScreenText_A; + chan_a->color_cells = ColorText_A; + chan_a->cursor_settings = CursorControlReg_L_A; + chan_a->cursor_position = CursorControlReg_H_A; + text_setsizes(0); + text_set_color(0, 1, 0); + text_clear(0); + text_set_xy(0, 0, 0); + + chan_b->text_cells = ScreenText_B; + chan_b->color_cells = ColorText_B; + chan_b->cursor_settings = CursorControlReg_L_B; + chan_b->cursor_position = CursorControlReg_H_B; + text_setsizes(1); + text_set_color(1, 4, 0); + text_clear(1); + text_set_xy(1, 0, 0); + + return 0; +} + +/* + * Set the cursor properties + * + * Inputs: + * screen = the screen number 0 for channel A, 1 for channel B + * color = the color index for the cursor + * character = the character to display for the cursor + * rate = the rate of blinking (0 = 1 per sec, 1 = 2 per sec, 2 = 4 per sec, 3 = 5 per sec) + * enable = 1 to display the cursor, 0 to disable + */ +void text_set_cursor(short screen, short color, char character, short rate, short enable) { + if (screen < MAX_TEXT_CHANNELS) { + p_text_channel chan = &text_channel[screen]; + *(chan->cursor_settings) = ((color & 0xff) << 24) | (character << 16) | ((rate & 0x02) << 1) | (enable & (0x01)); + } +} + +/* + * Set the position of the cursor on the screen. Adjusts internal pointers used for printing the characters + * + * If the x and y coordinates are out of bounds of the display, the routine will attempt to handle wrapping and + * scrolling accordingly. + * + * Inputs: + * screen = the screen number 0 for channel A, 1 for channel B + * x = the column of the cursor (0 is left most) + * y = the row of the cursor (0 is right most) + */ +void text_set_xy(short screen, unsigned short x, unsigned short y) { + if (screen < MAX_TEXT_CHANNELS) { + /* TODO: add in wrapping and scrolling */ + p_text_channel chan = &text_channel[screen]; + chan->x = x; + chan->y = y; + *(chan->cursor_position) = y << 16 | x; + chan->text_cursor_ptr = &chan->text_cells[y * chan->columns + x]; + chan->color_cursor_ptr = &chan->color_cells[y * chan->columns + x]; + } +} + +/* + * Compute the size information for the text screen based on the current settings in VICKY + * These settings are needed to correctly position text on the screen. + * + * Inputs: + * screen = the screen number 0 for channel A, 1 for channel B + */ +void text_setsizes(short screen) { + if (screen < MAX_TEXT_CHANNELS) { + /* TODO: compute sizes based on master control register settings */ + p_text_channel chan = &text_channel[screen]; + chan->rows = (short)((480 - 32) / 8); + chan->columns = (short)((640 - 32) / 8); + } +} + +/* + * Set the foreground and background color for printing + * + * Inputs: + * screen = the screen number 0 for channel A, 1 for channel B + * foreground = the foreground color number to use (0 - 15) + * background = the background color number to use (0 - 15) + */ +void text_set_color(short screen, short foreground, short background) { + if (screen < MAX_TEXT_CHANNELS) { + p_text_channel chan = &text_channel[screen]; + chan->current_color = ((foreground & 0x0f) << 4) | (background & 0x0f); + } +} + +/* + * Clear the screen of data + * + * Inputs: + * screen = the screen number 0 for channel A, 1 for channel B + */ +void text_clear(short screen) { + if (screen < MAX_TEXT_CHANNELS) { + int i; + p_text_channel chan = &text_channel[screen]; + for (i = 0; i < chan->columns * chan->rows; i++) { + chan->text_cells[i] = ' '; + chan->color_cells[i] = chan->current_color; + } + } +} + +/* + * Send a character to the screen without any escape code interpretation + * + * Inputs: + * screen = the screen number 0 for channel A, 1 for channel B + * c = the character to print + */ +void text_put_raw(short screen, char c) { + if (screen < MAX_TEXT_CHANNELS) { + p_text_channel chan = &text_channel[screen]; + *chan->text_cursor_ptr++ = c; + *chan->color_cursor_ptr++ = chan->current_color; + text_set_xy(screen, chan->x + 1, chan->y); + } +} + +/* + * Send a character to the screen... but handle ANSI escape codes and process accordingly. + * + * Inputs: + * screen = the screen number 0 for channel A, 1 for channel B + * c = the character to print + */ +void text_put_ansi(short screen, char c) { + if (screen < MAX_TEXT_CHANNELS) { + /* TODO: magic! */ + } +} \ No newline at end of file diff --git a/src/text_screen.h b/src/text_screen.h new file mode 100644 index 0000000..e6055e4 --- /dev/null +++ b/src/text_screen.h @@ -0,0 +1,83 @@ +#ifndef __TEXT_SCREEN_H +#define __TEXT_SCREEN_H + +/* + * Driver for VICKY III text screens, both channel A and channel B + */ + +/* + * Initialize the text screen driver + */ +extern int text_init(); + +/* + * Set the cursor properties + * + * Inputs: + * screen = the screen number 0 for channel A, 1 for channel B + * color = the color index for the cursor + * character = the character to display for the cursor + * rate = the rate of blinking (0 = 1 per sec, 1 = 2 per sec, 2 = 4 per sec, 3 = 5 per sec) + * enable = 1 to display the cursor, 0 to disable + */ +extern void text_set_cursor(short screen, short color, char character, short rate, short enable); + +/* + * Set the position of the cursor on the screen. Adjusts internal pointers used for printing the characters + * + * If the x and y coordinates are out of bounds of the display, the routine will attempt to handle wrapping and + * scrolling accordingly. + * + * Inputs: + * screen = the screen number 0 for channel A, 1 for channel B + * x = the column of the cursor (0 is left most) + * y = the row of the cursor (0 is right most) + */ +extern void text_set_xy(short screen, unsigned short x, unsigned short y); + +/* + * Compute the size information for the text screen based on the current settings in VICKY + * These settings are needed to correctly position text on the screen. + * + * Inputs: + * screen = the screen number 0 for channel A, 1 for channel B + */ +extern void text_setsizes(short screen); + +/* + * Send a character to the screen without any escape code interpretation + * + * Inputs: + * screen = the screen number 0 for channel A, 1 for channel B + * c = the character to print + */ +extern void text_put_raw(short screen, char c); + +/* + * Send a character to the screen... but handle ANSI escape codes and process accordingly. + * + * Inputs: + * screen = the screen number 0 for channel A, 1 for channel B + * c = the character to print + */ +void text_put_ansi(short screen, char c); + +/* + * Set the foreground and background color for printing + * + * Inputs: + * screen = the screen number 0 for channel A, 1 for channel B + * foreground = the foreground color number to use (0 - 15) + * background = the background color number to use (0 - 15) + */ +extern void text_set_color(short screen, short foreground, short background); + +/* + * Clear the screen of data + * + * Inputs: + * screen = the screen number 0 for channel A, 1 for channel B + */ +extern void text_clear(short screen); + +#endif diff --git a/upload.bat b/upload.bat new file mode 100644 index 0000000..8c57d97 --- /dev/null +++ b/upload.bat @@ -0,0 +1,8 @@ +@echo off +REM Upload a binary file to the C256 Foenix + +if [%2%]==[] ( + python C256Mgr\c256mgr.py --binary %1 +) ELSE ( + python C256Mgr\c256mgr.py --binary %1 --address %2 +) \ No newline at end of file diff --git a/uploadsrec.bat b/uploadsrec.bat new file mode 100644 index 0000000..4bf494a --- /dev/null +++ b/uploadsrec.bat @@ -0,0 +1,4 @@ +@echo off +REM Upload an SREC file to the C256 Foenix + +python C256Mgr\c256mgr.py --upload-srec %1 diff --git a/vbcc/config/m68k-foenix b/vbcc/config/m68k-foenix index 6722d26..3f63333 100644 --- a/vbcc/config/m68k-foenix +++ b/vbcc/config/m68k-foenix @@ -1,5 +1,5 @@ --cc=vbccm68k -quiet %s -o= %s %s -O=%ld -Ivbcc\targets\m68k-foenix\include --ccv=vbccm68k %s -o= %s %s -O=%ld -Ivbcc\targets\m68k-foenix\include +-cc=vbccm68k -quiet %s -o= %s %s -O=%ld -I..\vbcc\targets\m68k-foenix\include +-ccv=vbccm68k %s -o= %s %s -O=%ld -I..\vbcc\targets\m68k-foenix\include -as=vasmm68k_mot -quiet -Fvobj -nowarn=62 %s -o %s -asv=vasmm68k_mot -Fvobj -nowarn=62 %s -o %s -rm=del %s