Skip to content

Instantly share code, notes, and snippets.

View simondotm's full-sized avatar
🎯
Focusing

Simon M simondotm

🎯
Focusing
View GitHub Profile
@simondotm
simondotm / SN Bass.md
Last active April 14, 2022 20:26
Enhanced frequencies on SN76489.md

Supporting Enhanced Frequency Ranges on SN76489

Problem

  • The BBC Micro does not support bass frequencies under 122Hz
  • We want to create music that uses low frequencies

Hypothesis

  • We can simulate low frequency square waves by updating the sound chip using software logic on the CPU side
@simondotm
simondotm / Installing Jekyll on Windows 10.md
Created November 13, 2018 12:50
Installing Jekyll on Windows 10

Stick to ruby2.3 or else have to install msys2 version of dev kit and the 750Mb of disk space that monster eats up Jekyll now seems to need to compile some native libs so install is a bit more fiddly than it used to be.

Install chocolatey
Install ruby --version 2.3.3
gem install bundler
choco install ruby2.devkit
cd c:\tools\devkit2
ruby dk.rb init
@simondotm
simondotm / tasks.json
Created April 26, 2018 17:00
Tasks file to build Galaforce from https://github.com/crumbgit/Galaforce using VSC & Beeb VSC extension
{
"version": "0.1.0",
"command": "cmd",
"isShellCommand": true,
"showOutput": "always",
"echoCommand": true,
"suppressTaskName": true,
"args": [
"/C"
],
@simondotm
simondotm / SN76489 tuning.md
Last active January 14, 2021 02:25
Retuning SN76489 chip tune music written for Sega Master System on a BBC Micro

We use Deflemask to author SN76489 chip music, for which support is aimed mainly at NTSC Sega Master System. We export these tunes as VGMs from Deflemask and then to get them working on a BBC Micro we have to do some shenanigans because the BBC version of the SN76489 has two key differences from the SMS:

  1. It is clocked at 4Mhz not 3.58Mhz
  2. It has a 15-bit linear-feedback shift register (LFSR) for noise channel generation (the SMS version has 16-bits).

Because the squarewave output of the sound chip is driven by its clockspeed, to transpose frequencies from NTSC to 4Mhz we have to adjust every pitch value sent to the chip registers. This is done mathematically by converting the NTSC pitch register value to Hz and then calculating the equivalent pitch register value on a 4Mhz clocked chip to deliver the same Hz frequency.

That bit is easy (ish).

The tricky bit is when musicians use the tuned periodic noise function on the chip to create basslines. In this scenario channel 2 pitch controls the pitch of t

@simondotm
simondotm / BBC Pak file.md
Last active March 24, 2018 14:31
Format ideas for a BBC Micro PAK file

BBC Pak file

Objective is to create a simple toolchain that can compile a bunch of code or data assets into a single file.

Advantages

  • compression
  • load time
  • more than 31 files per disk, and no need to load bloaty 512 byte disk catalogs
  • can control disk layout order for optimum seeks
  • toolchain can take a pak-config file as input, and output a TOC file. This can be directly INCBIN'd in the runtime code.