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 / dodgeball_motion.asm
Created July 11, 2016 04:10
Motion code, this should $@%@#$% work, why doesn't it?
;; Table is two nibbles RLDU 0000 (Delay value not used currently.)
DIRECTION_TABLE:
.byte $80,$80,$90,$90,$10,$10,$50,$50,$40,$40,$60,$60,$20,$20,$A0,$A0
;;
;; Change ball directions into velocities
;;
Dir2Veloc:
ldx #$00
@tschak909
tschak909 / slowdown.c
Created July 3, 2018 04:48
Slow-down connection for pokey 8-bit machines - tcp forwarder
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
#include <string.h>
#include <signal.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@tschak909
tschak909 / io_recv.c
Created June 24, 2018 02:23
new io_recv() function with flow control added as a test.
/**
* io_recv_serial() - Receive and interpret serial data.
*/
void io_recv_serial(void)
{
recv_buffer_size=PEEK(0x29B)-PEEK(0x29C)&0xff;
if (recv_buffer_size>175)
{
io_send_byte(XOFF);
xoff_enabled=true;
@tschak909
tschak909 / new_screen_line_draw.c
Created June 20, 2018 01:49
New screen_line_draw
/**
* screen_line_draw(Coord1, Coord2) - Draw a mode 1 line
*/
void screen_line_draw(padPt* Coord1, padPt* Coord2)
{
uint16_t x1=scalex[Coord1->x];
uint16_t x2=scalex[Coord2->x];
uint16_t y1=scaley[Coord1->y];
uint16_t y2=scaley[Coord2->y];
@tschak909
tschak909 / linedraw_test.c
Last active July 3, 2018 18:38
Line draw testing harness for tgi_line()
#include <tgi.h>
/**
* replace tgi_line with this function for slow but accurate line draw
*/
void slow_but_accurate_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
{
int dx, dy;
int stepx, stepy;
@tschak909
tschak909 / plato.c
Created May 8, 2018 23:49
PLATOTerm main (up2400-ser version)
void main(void)
{
int i=0;
struct ser_params params = {
SER_BAUD_2400,
SER_BITS_8,
SER_STOP_1,
SER_PAR_NONE,
SER_HS_NONE
@tschak909
tschak909 / plato.c
Created May 8, 2018 23:44
PLATOTerm main - Kernal version
void main(void)
{
int i=0;
y=511-16;
deltax=8;
deltay=16;
dumb_terminal_active=1;
tgi_install(&c64_hi);
tgi_init();
@tschak909
tschak909 / irata.patch
Created April 2, 2018 15:37
Patch for IST-3, no flow control, and some color changes.
diff --git a/tlp.asm b/tlp.asm
index 30d744c..00b8227 100644
--- a/tlp.asm
+++ b/tlp.asm
@@ -922,7 +922,7 @@ init_graphics:
sta CROSS_Y ; cross-shaped cursor.
sta byte_B5 ; Set priority for screen objects...
sta GPRIOR ; 0000 0001 = Player 0-3, Playfied 0-3, BAK
- lda #$16 ; $10 = rust + $06 luminance
+ lda #$20 ; $10 = rust + $06 luminance
--- mkimage 2017-09-20 19:00:12.475874204 -0700
+++ mkimage-lakka 2017-09-22 21:00:41.202688640 -0700
@@ -32,17 +32,9 @@
exit 1
fi
- if [ "$BOOTLOADER" = "syslinux" ]; then
- DISK_LABEL=gpt
- else
- DISK_LABEL=msdos
@tschak909
tschak909 / wow_player_coll_algo.c
Created September 5, 2017 02:44
The player to playfield collision detection algorithm, run once every frame.
/**
* handle_player_in_field()
* Handle when player is on the playfield
*/
void handle_player_in_field(void)
{
if ((stamps[STAMP_X(i)]==PIXEL_BOX_X(a)) && (stamps[STAMP_Y(i)]==PIXEL_BOX_Y(b)))
{
// We are aligned.
if (PLAYER_PAD_RIGHT(i) && stamps[STAMP_LAST_STATE(i)] != STATE_PLAYER_RIGHT && !BOX_WALL_RIGHT(d))