Skip to content

Instantly share code, notes, and snippets.

Avatar

Néstor Soriano Konamiman

View GitHub Profile
@Konamiman
Konamiman / CH376 connected to Z80.md
Created Aug 21, 2021
"Recipe" to connect a CH376 to a Z80 via I/O port
View CH376 connected to Z80.md

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
View NestorDevice.ino
/**
* 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 Aug 5, 2020
Nextor v3 driver structure proposal
View Nextor-v3-driver-migration-guide.md

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 Mar 27, 2021
How to build stunnel for Raspberry Pi
View How to build stunnel for Raspberry Pi.md

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 Oct 17, 2021
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
View 0. WiFi for Ethernet-only devices via Raspberry Pi.md

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 Jun 10, 2021
[SDCC] Interfacing with Z80 assembler code
View SDCC_Interfacing_with_assembler_code.md

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 Nov 28, 2017
MSX-BASIC tokenized file parser written in Ruby
View msx-basic-parser.rb
# 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