Skip to content

Instantly share code, notes, and snippets.

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

Yoji Suzuki suzukiplan

🏠
Working from home
View GitHub Profile
@suzukiplan
suzukiplan / PSGlib.inc
Last active March 12, 2024 10:15
PSGlib.inc for z88dk-z80asm
; PSGlib.inc を z88dk-z80asm 向けに変更したものです
; copied from https://github.com/sverx/PSGlib/blob/c21bb78d3e02c47fac9f669c9d33b4d668799170/src/PSGlib.inc
;================================================================
; PSGlib - Programmable Sound Generator audio library - by sverx
; https://github.com/sverx/PSGlib
;================================================================
; NOTE: this uses a WLA-DX 'ramsection' at slot 3
; If you want to change or remove that,
@suzukiplan
suzukiplan / pmd_extractor.c
Created October 10, 2023 00:08
PMD Extractor
/* PMD extractor */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc,char* argv[])
{
char fn[16];
int ret=-1;
FILE* fp=NULL;
@suzukiplan
suzukiplan / FT6336U.hpp
Created October 2, 2023 05:53
FT6336U Capacitive touch panel driver for RP2040 (RaspberryPi Pico)
/**
* FT6336U Capacitive touch panel driver for RP2040 (RaspberryPi Pico)
*
* Copyright (c) 2023 Yoji Suzuki.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
$ bin/vgsrun examples/hello/hello.rom
$8000: LDA #$00 (a=$00, x=$00, y=$00, s=$00, p=$02)
$8002: STA $5404 (a=$00, x=$00, y=$00, s=$00, p=$02)
$8005: LDX #$00 (a=$00, x=$00, y=$00, s=$00, p=$02)
$8007: LDA $8018, X (a=$48, x=$00, y=$00, s=$00, p=$00)
$800A: STA $63C7, X (a=$48, x=$00, y=$00, s=$00, p=$00)
$800D: INX (a=$48, x=$01, y=$00, s=$00, p=$00)
$800E: CPX #$12 (a=$48, x=$01, y=$00, s=$00, p=$80)
$8010: BNE $F5 (a=$48, x=$01, y=$00, s=$00, p=$80)
$8007: LDA $8018, X (a=$65, x=$01, y=$00, s=$00, p=$00)
@suzukiplan
suzukiplan / callback_on_c.c
Created August 30, 2018 06:11
Callback example for C
#include <stdio.h>
void functionWithCallback(void(*callback)(int, int)) {
callback(1234, 5678);
}
void callback(int a, int b) {
printf("a=%d, b=%d\n", a, b);
}
@suzukiplan
suzukiplan / gist:a7729b7a7dca3ee30824590ef192bc2b
Created August 27, 2016 16:07
git で commitした回数, 追加した行数, 削除した行数 を 表示するシェル
#!/bin/sh
echo commits: `git log --since=1971-01-01 --until=2035-12-31 --oneline --no-merges | wc -l`
echo added: `git log --since=1971-01-01 --until=2035-12-31 --oneline --numstat --no-merges --pretty=format:"" | cut -f1 | awk 'BEGIN {sum=0} {sum+=$1} END {print sum}'`
echo deleted: `git log --since=1971-01-01 --until=2035-12-31 --oneline --numstat --no-merges --pretty=format:"" | cut -f2 | awk 'BEGIN {sum=0} {sum+=$1} END {print sum}'`
@suzukiplan
suzukiplan / vgs-spu-example.c
Created February 13, 2016 14:39
Example of the VGS-SPU
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
#include <stdio.h>
#include "vgsspu.h"
#ifdef _WIN32
static void usleep(int usec)
@suzukiplan
suzukiplan / nestone.c
Created July 17, 2015 04:59
ファミコンの音程($4002-$4003)に設定する値を算出する
/* ファミコンの音程 ($4002-$4003 に設定すべき値) */
#include <stdio.h>
#define S 44100.00
#define B 1.0594631
#define PI 3.1415926535897932
#define PI2 6.2831853071795864
#define CPU 1790000
@suzukiplan
suzukiplan / gethwnd.c
Created July 3, 2015 11:05
get console hwnd
#include <Windows.h>
#include <stdio.h>
HWND GetConsoleHwnd(void)
{
#define MY_BUFSIZE 1024
HWND hwndFound;
char pszNewWindowTitle[MY_BUFSIZE];
char pszOldWindowTitle[MY_BUFSIZE];
GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
@suzukiplan
suzukiplan / playsample.sh
Last active January 31, 2016 00:11
play touhou BGM mml files on VGS in Mac / Linux
#!/bin/sh
# VGSのセットアップ
cd ~/
git clone https://github.com/suzukiplan/vgs2.git vgs2
cd vgs2/bin_src
make
export VGS2_HOME=~/vgs2
export PATH=$PATH:$VGS2_HOME/bin
# 次回起動時に環境変数の設定を省略するための手順