Skip to content

Instantly share code, notes, and snippets.

View remy's full-sized avatar
🐹
Always hacking

Remy Sharp remy

🐹
Always hacking
View GitHub Profile
#autoline 10
RUN AT 3
LAYER 2,1: CLS
LOAD "pal-test.spr" BANK 13: ; spritesheet
LOAD "pal-test.map" BANK 14: ; tile map
LOAD "pal-test.pal" BANK 15: ; palette
TILE BANK 13: ; point tilemap to spritesheet
TILE DIM 14,0,16,16: ; using tile bank 14, offset 0, tile 16 wide, tile size 16
TILE 16,12: ; print tile for 16x12
@remy
remy / sfx.bas
Created July 20, 2020 16:28
Example of using OUT with AY chips in NextBASIC - main setup code by Dave Clarke
#autoline 10
RUN AT 3
PROC sfxsetup()
%i=0
DIM S$(4,20)
S$(1)="cccBccccCB"
S$(2)="baBA"
S$(3)="aAaAbBbBbB"

Assuming you're using VS Code to generate the NextBASIC files, you'll need:

  • bank-demo.bas.txt: "Export to binary BAS"
  • b12.bas.txt: "Export to BANK"

bank-demo is expecting to find the file named "b12.bas" - but you can change it as you please, the name is purely asthetic.

I've use autoline just because I can't be bothered with line numbers, but the line numbers in b12.bas can be anything (from what I understand) between 1-9999 and can overlap with line numbers in other banked code or your main NextBASIC file.

@remy
remy / _README.md
Created June 1, 2020 14:26
See readme for usage

For use with: https://github.com/kounch/knloader

Written for the mac, though I'm sure it can be adjusted to work on linux and WSL.

Make sure to change SD_CARD and GAMES to the root of your SD Card and the games/rom folder on the card - this last variable GAMES is needed in the knloader.bdt database.

Then run as:

sh knloader-db-maker.sh > knloader.bdt
@remy
remy / keys.bas
Created April 11, 2020 13:22
keyboard press testing for NextBASIC
10 ;
11 ; Keypress combination example
12 ; Note that I am using the bit shift to allow
13 ; the INVERSE command to work.
14 ; If you're testing for a single keypress, then use:
15 ; IF %(IN $FBFE & 0b0010)=0 THEN ...
16 ; See page 272 of NextBASIC manual for ports
17 ;
100 PRINT AT 0,0; INVERSE %( IN $fbfe >> 0 & 1 ^ 1);"q"
101 PRINT AT 0,1; INVERSE %( IN $fbfe >> 1 & 1 ^ 1);"w"
@remy
remy / README.md
Created March 28, 2020 14:50
A Karabiner-Elements key config to let me use the esc key with cspect.

In breif, this config lets me use the escape key to bring up the ZX Spectrum Next menu when running under CSpect on the mac.

The escape key will send: F10, shift+1, F10.

Using any modifier key and escape will exit CSpect (sending a real esc key to CSpect).

This config is used with Karabiner-Elements

@remy
remy / help.md
Created March 19, 2020 18:51
Rusty Pixel TileEditor.nex help

TileEditor

Common controls

CAPS+1 Map edit mode
CAPS+2 Block edit mode
CAPS+3 Palette edit mode
SYM+CAPS+L Load Set
@remy
remy / loader.bas
Created March 15, 2020 20:25
Loads screen$ and keeps it on screen (BASIC for ZX Spectrum)
10 CLS
20 LOAD "" SCREEN$
30 PAUSE 0
/* eslint-env browser */
/* global jq: true */
const escaped = new Map([['<', '&lt;'], ['>', '&gt;']]);
const $$ = s => Array.from(document.querySelectorAll(s));
const $ = s => document.querySelector(s);
let jqLoaded = false;
const scrollPositions = [];
@remy
remy / README.md
Created July 31, 2019 18:44
Workshop directions

This will configure your setup ready for the Next workshop:

  1. Create a working directory: mkdir next-workshop
  2. Go into the directory: cd next-workshop
  3. Save the package.json file (included in this gist) to the working directory and save it as "package.json"
  4. Assuming you've installed Node and also have npm, run npm install