Skip to content

Instantly share code, notes, and snippets.

View Konamiman's full-sized avatar

Néstor Soriano Konamiman

View GitHub Profile
@Konamiman
Konamiman / .Z80 relocatable file parser.md
Last active January 26, 2023 16:18
Parser for Z80 relocatable files (generated by M80.COM, processed by L80.COM)

This program will parse and print the structure of a relocatable (.REL) Z80 code file generated with the Macro80 assembler (M80.COM) and processable with Link80 (L80.COM). See ParseRel.cs for build instructions.

More information on Macro80/Link80 and the .REL format: http://www.msxarchive.nl/pub/msx/programming/asm/m80l80.txt

@Konamiman
Konamiman / CH376 connected to Z80.md
Created August 21, 2021 16:35
"Recipe" to connect a CH376 to a Z80 via I/O port

How to connect a CH376 to a Z80 via I/O ports 20h and 21h (compatible with Rookie Drive):

Z80 74HC688 CH376
5V 5V 5V
GND GND GND
D7...D0 D7...D0
RD RD
WR WR
A0 A0
/**
* Skeleton for a USB device implementation with a CH372/375/376.
*
* No real device functionality is implemented,
* only the standard USB requests over the control endpoint.
*/
#include "constants.h"
@Konamiman
Konamiman / Nextor-v3-driver-migration-guide.md
Last active August 5, 2020 20:49
Nextor v3 driver structure proposal

Nextor v3 driver migration guide

This guide explains how to migrate a Nextor driver from v2 to v3. The reader is expected to have experience with Nextor v2 driver development.

Only the changes relative to the structure of the driver for v2 are mentioned here. You can see the skeleton for a full v3 driver in the Nextor-v3-driver.asm in this same gist, and the skeleton for a full v2 driver in the Nextor repository.

1. Change the hardcoded flags (DRV_FLAGS, 410Eh)

The driver flags byte needs to be changed to the fixed value 83h. Bit 7 indicates that the driver is a v3 driver, bits 0 and 1 need to be set for consistency with the meaning they had in Nextor v2.

@Konamiman
Konamiman / How to build stunnel for Raspberry Pi.md
Last active March 27, 2021 03:25
How to build stunnel for Raspberry Pi

How to build stunnel for Raspberry Pi

This document explains how to stunnel for the Raspberry Pi (or more precisely, for the ARM architecture). All the information here has been gathered, and adapted where needed, from these blog posts: "Cross compiling for ARM with Ubuntu 16.04 LTS" and "Cross-compile OpenSSL for your Raspberry Pi". I needed to do that in order to be able to use my Raspberry Pi to provide Internet via WiFi for my Ethernet-only MSX. The OS I used as the building host is Linux Mint 18.3.

This is just a concise recipe and I'm not going to explain the details, feel free to take a look at the linked blog posts for more information.

First we are going to create a temporary directory for all the dirty work.

cd ~/
@Konamiman
Konamiman / 0. WiFi for Ethernet-only devices via Raspberry Pi.md
Last active December 10, 2023 13:27
How to use a Raspberry Pi to provide WiFi for Ethernet-only devices, and how to use stunnel as a SOCKS server ro provide indirect TLS support

What's this?

I love MSX computers. I have developed quite a few things for them, including a TCP/IP stack and some networking applications. Some other MSX nerds have developed networking hardware, so boom! Here it is, Internet access from MSX, a 1980s 8 bit machine. How cool is that?

However there are a few issues that prevent us the MSX users to reach the absolute networking happiness:

  1. At the time of this writing, there isn't any solution for wireless Internet for MSX, only Ethernet hardware.
  2. InterNestor Lite, the TCP/IP stack for MSX, doesn't support TLS. It's not that the developer (me!) is too lazy to implement it, it's just that a Z80 can't handle the required encryption algorythms. Trust me, I tried.

So

@Konamiman
Konamiman / SDCC_Interfacing_with_assembler_code.md
Last active February 1, 2024 03:22
[SDCC] Interfacing with Z80 assembler code

SDCC - Interfacing with Z80 assembler code

The basics

When writing code to be compiled with SDCC targetting Z80, assembler code fragments can be inserted in the C functions by enclosing them between the __asm and __endasm; tags:

void DoNotDisturb()
{
  __asm

di

@Konamiman
Konamiman / msx-basic-parser.rb
Last active November 28, 2017 12:01
MSX-BASIC tokenized file parser written in Ruby
# MSX BASIC tokenized file parser written in Ruby
# By Konamiman, http://www.konamiman.com
# This is my first Ruby thing, so improvement suggestions are highly welcome
def main
check_parameters
@file_bytes_enumerator = read_file_bytes.each
@output_file = create_output_file