Skip to content

Instantly share code, notes, and snippets.

View tschak909's full-sized avatar
🏠
Working from home

Thomas Cherryhomes tschak909

🏠
Working from home
View GitHub Profile
@tschak909
tschak909 / blt.c
Created August 4, 2019 20:18
BLT COPY Example
/**
* BLT Copy example
*
* Author: Thomas Cherryhomes <thom.cherryhomes@gmail.com>
*/
#include <conio.h>
#include <i86.h>
#include <stdlib.h>
#include <string.h>
@tschak909
tschak909 / tincan.txt
Created July 28, 2019 22:40
draft of tincan terminal protocol for spectrum BBSes
tincan terminal protocol.
Dirt simple
escape 0x1b = command
0x1b 0x00 clear with current ink/paper
0x1b 0x01 YY XX set position
0x1b 0x02 BC Set Border
0x1b 0x03 II Set Ink
@tschak909
tschak909 / mem.c
Created July 25, 2019 23:32
z88dk heap example.
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#define BUFFER_SIZE 4096
long heap; // heap pointer will be defined in the binary.
int main(int argc,char* argv[])
{
@tschak909
tschak909 / plato.map
Created March 29, 2019 17:14
PLATOTerm Map file for 1.1 cart version.
$ cat plato.map
Modules list:
-------------
touch_base.o:
CODE Offs=000000 Size=0000C9 Align=00001 Fill=0000
BSS Offs=000000 Size=00000A Align=00001 Fill=0000
DATA Offs=000000 Size=000003 Align=00001 Fill=0000
plato.o:
CODE Offs=0000C9 Size=000026 Align=00001 Fill=0000
DATA Offs=000003 Size=000001 Align=00001 Fill=0000
@tschak909
tschak909 / game_do_collisions.c
Created March 19, 2019 00:05
debugging a rectangle calculation grrr...
/**
* Given two rectangles (global vars):
* lx - Left X (left)
* ly - Left Y (top)
* lw - Left Width
* lh - Left Height
* rx - Right X (left)
* ry - Right Y (left)
* rw - Right Width
* rh - Right Height
@tschak909
tschak909 / utils_rect_intersect.c
Created March 17, 2019 16:39
Determine if two rectangles intersect
/**
* Given two rectangles (global vars):
* lx - Left X (left)
* ly - Left Y (top)
* lw - Left Width
* lh - Left Height
* rx - Right X (left)
* ry - Right Y (left)
* rw - Right Width
* rh - Right Height
@tschak909
tschak909 / bm_clearpixel.c
Created February 7, 2019 21:40
Clear pixel on 9918
void bm_clearpixel(unsigned int x, unsigned int y) {
unsigned int addr = (8 * (x/8)) + (256 * (y/8)) + (y%8);
VDP_SET_ADDRESS(addr);
unsigned char bits = VDPRD;
bits = bits & (0xff - (0x80 >> (x%8)));
VDP_SET_ADDRESS_WRITE(addr);
VDPWD = bits;
}
@tschak909
tschak909 / coco_splash.h
Created February 7, 2019 06:28
Splash screen for PLATOTerm coco
padByte splash[]={
0x1b,
0x02,
0x1b,
0x0c,
0x1b,
0x12,
0x1b,
0xd1,
0xc0,
@tschak909
tschak909 / screen.c
Created January 29, 2019 23:46
Tried to add offscreen buffering to PLATOTerm, with disasterous results.. This segfaults. WHY?
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <Quickdraw.h>
#include <MacMemory.h>
#include <Sound.h>
#include <Events.h>
#include <Fonts.h>
#include <NumberFormatting.h>
#include <Devices.h>
@tschak909
tschak909 / PLATOTERM.r
Last active January 29, 2019 04:27
Rez format PLATOTerm resources.
#include "Processes.r"
#include "Menus.r"
#include "Windows.r"
#include "MacTypes.r"
#include "Finder.r"
type 'PLTO' as 'STR ';
resource 'PLTO' (0, purgeable) {
"PLATOTerm 0.1"
};