Skip to content

Instantly share code, notes, and snippets.

@mistificator
mistificator / postgresql_foreign_select.sql
Created November 3, 2021 15:19
PostgreSQL select table from foreign server
DROP FOREIGN TABLE IF EXISTS server2_cdg_types;
DROP USER MAPPING IF EXISTS FOR postgres SERVER server2;
DROP SERVER IF EXISTS server2;
DROP EXTENSION IF EXISTS postgres_fdw;
CREATE EXTENSION IF NOT EXISTS postgres_fdw;
CREATE SERVER server2
FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (host '127.0.0.1', port '5432', dbname 'postgres');
@mistificator
mistificator / KEYZX.ASM
Last active July 28, 2022 20:40
KEYZX - keyboard driver for CP/M on ZX Spectrum
; KEYZX.ASM is keyboard driver for CP/M on ZX Spectrum
; (c) 2021, 2022 ZXLDR
;
; [email protected]
; get char routine (wait for key)
Get_Char: ; out: a - char code
ld hl, (0x39)
ld bc, rst_38_routine
@mistificator
mistificator / tape_port.asm
Last active August 16, 2021 13:41
ZX Spectrum tape pulses measure
;
; Tape bit lengths
;
org 0x8000
di
ld sp, stack
@mistificator
mistificator / tape_parse.asm
Last active August 18, 2021 18:31
ZX Spectrum demo tape loader
;
; Demo tape loader by Mist Poryvaev.
;
; Loads two-section tape: e.g. BASIC loader and one code block.
; Look the .TAP file image at location 0x9000.
;
; start in non-contended memory, or tape input latency will be unpredictable
org 0x8000
@mistificator
mistificator / zx_4color.asm
Last active November 23, 2020 18:57
ZX Spectrum - 4 colors at one char position demo
basic48_cls equ 0x0D6B
org 25000
ld a, 00000111b ; PAPER 0, INK 7
ld (iy + 83), a ; ATTR-P
xor a ; BORDER 0
out (0xFE), a
ld (iy + 14), a ; BORDCR
call basic48_cls
@mistificator
mistificator / tap2trd.bas
Created September 1, 2020 19:19
Loader copies one binary block from tape to TR-DOS diskette. Should be saved with autorun from line 100. Address "27000" (in two places of code) and size "38536" should be changed for actual values.
10 CLEAR 24575: RANDOMIZE USR 15619: REM : LOAD "payload1" CODE
20 RANDOMIZE USR 27000
100 CLEAR 24575: LOAD "" CODE
110 RANDOMIZE USR 15619: REM : SAVE "payload1" CODE 27000, 38536
120 RANDOMIZE USR 15619: REM : SAVE "boot" LINE 10
@mistificator
mistificator / Plurk_jQuery_patch.js
Created August 26, 2020 13:09
Plurk jQuery patch
// ==UserScript==
// @name Plurk jQuery patch
// @namespace http://www.plurk.com/
// @include http://www.plurk.com/*
// @include https://www.plurk.com/*
// @version 0.1
// @description Reconnect jQuery for Plurk.com
// @author Mist Poryvaev
// @grant none
// @run-at document-start
@mistificator
mistificator / reboot_tap.asm
Last active December 27, 2019 23:06
ZX Spectrum +3 code that reboots BASIC to start loader screen
.org $5CD2 ; // fixed origin for https://clrhome.org/asm/ TAP generator
di
xor a
ld bc, $7ffd
out (c), a
ld b, $1f
out (c), a
rst $0 ; trick doesn't work when started from ZX Spectrum +3 boot menu right to BASIC48, cause bank switching is blocked forever
@mistificator
mistificator / CmdArgs_PrintChar.asm
Last active December 3, 2019 21:55
CP/M example that prints command line arguments
; CP/M example that prints command line arguments
.org $100 ; standard CP/M offset
ld hl,$0080 ; command line arguments address
ld a, (hl)
or a
ret z
inc hl
Loop:
inc hl
@mistificator
mistificator / CPMto48BASIC.asm
Last active August 7, 2023 10:49
Sample ASM code for ZX Spectrum +3 that loads 48BASIC code from CP/M (and then switch back to CP/M)
; switch to 48BASIC ROM from CP/M (and then switch back)
; to run test from 48BASIC enter "RANDOMIZE USR 32768"
#define CPM_ORG $100
#define LOADER_ORG $C000 - $200 ; RAM bank 2
#define BASIC_ORG $8000 ; RAM bank 2
.org CPM_ORG
Cpm_Start:
ld de, Message_Start_Test
call Print_CPM