Skip to content

Instantly share code, notes, and snippets.

@rgiot
rgiot / player.sh
Created January 11, 2018 23:08
Music player for CPC with M4
#!/bin/bash
CPCIP=${CPCIP:-192.168.1.22}
DB=${DB:-DSK}
shopt -s nocaseglob
function playdsk {
# Get the exact filename
local dsk="$1"
; Need to specify the stack (otherwhise it is in 0xc000 memory space)
ld sp, $ ; XXX use your own value !
; Need to go back to a standard memory configuration
ld bc, 0x7fc0
out (c), c
; Interrupt handler
ld hl, 0xc9fb
ld (0x38), hl
;;
; Template code to use in order to jump to the demosystem at the
; end of your part.
;
; LIMITATIONS:
; - code must placed in main memory
; - code accessible in a memory zone different than 0x4000-0x7ffff
;
; We cut the interruption to avoid issues with the stack and interruptions
@rgiot
rgiot / gist:22eda35c7807996bfaa1
Created June 3, 2014 08:46
Call the heartbeat
; Depends on your code
ld bc, 0x7fc7
out (c), c
call 0x6009
; 1rl+13us (stable)
;
; IN : -
@rgiot
rgiot / part_leave.asm
Created November 19, 2013 09:48
Template for CRTC transition when entering a part in the CPC MegaDemo.
;;
; CRTC R7 transition sample to leave a part
; From R7=0 to standard R7=30
; Krusty/Benediction November 2013
org &8000
run $
leave_part_transition
call secure_vsync
@rgiot
rgiot / crtc_transition_enter_part.asm
Last active December 28, 2015 18:19
Template for CRTC transition when entering a part in the CPC MegaDemo.
;;
; CRTC R7 transition sample
; From standard R7=30 to R7=0
; Krusty/Benediction November 2013
org &4000
run $
killsys
@rgiot
rgiot / punchcard.py
Created February 13, 2013 10:57
Simple way to build punchard with matplotlib
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
# Discussion http://stackoverflow.com/questions/14849815/matplotlib-how-to-remove-the-vertical-space-when-displaying-circles-on-a-grid
def draw_punchcard(infos,
ax1=range(7),
@rgiot
rgiot / .ctags
Created February 7, 2013 12:47
.ctags configuration to extract informations from z80 source files
--langdef=z80
--langmap=z80:.asm
--regex-z80=/^([a-zA-Z][a-zA-Z0-9_]*)/\1/l,label/
--regex-z80=/^([a-zA-Z][a-zA-Z0-9_]*)[[:space:]]+[eE][qQ][uU][[:space:]]/\1/d,define/
--regex-z80=/[[:space:]]*macro[[:space:]]+([a-zA-Z_0-9]*)[[:space:]]*/\1/m,macro/
@rgiot
rgiot / google_citation_export.py
Last active October 10, 2015 12:37
Python script allowing to extract some metrics from a google citation page
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Python script to extract citations numbers from google citation pages
Extract informations from google citation (number of citations, h-index, i10 index).
The main program outputs LaTeX definition in order to automatically use the result
in a LaTeX document (ie. academic cv)
"""