This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TODO polish this (and tidy!) | |
//Send Modbus request and parses response | |
int modrq( uint8_t priority, uint8_t function, uint8_t addr, uint16_t reg, uint16_t cnt, ... ) | |
{ | |
va_list ap; | |
uint16_t andmask, ormask, regtype; | |
uint8_t waccess; | |
int ec = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xsel --clipboard | sed 's/ //gi' | sed 's/\./ \& /gi' | sed 's/ & $/ \\\\/g' | xclip -i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
opt1="Virtual" | |
opt2="Manage&Decorate" | |
opt3="Manage" | |
opt4="Nothing" | |
mode=$(xmessage -nearmouse -print -buttons $opt1,$opt2,$opt3,$opt4 "Please select Wine graphics mode...") | |
#Abort if no choice has been made | |
if [[ -z $mode ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Renames all files in the current directory containing pattern S..E.. in their names | |
#Extensions remain unchanged but names are simplified to just S..E.. | |
#This routine can be put in .bashrc | |
function serialize( ) { | |
rename 's/.*(S\d\dE\d\d).*\.(.*)/$1.$2/i' *.* | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define HMUL( ans, b1, b2 ) \ | |
asm volatile( \ | |
"mul %1, %2\n\t" \ | |
"mov %0, r1\n\t" \ | |
: "=l"(ans) \ | |
: "d"(b1), "d"(b2) \ | |
); | |
#define HMULS( ans, b1, b2 ) \ | |
asm volatile( \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Toporny, lecz skuteczny interpreter midi | |
void midi( uint8_t byte ) | |
{ | |
//Odpowiednio: numer kanału, 3 bity statusu, limit danych w bajtach, liczba odczytanych bajtów | |
static uint8_t channel = 0, status = 0, dlim = 0, dread = 0; | |
static uint8_t dbuf[16] = {0}; //Bufor na dane | |
if ( byte & ( 1 << 7 ) ) | |
{ | |
//Bajt stanu |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear | |
fcpu = 20000000; | |
prescaler = 1; | |
samplesize = 16; | |
noterange = 1:88; | |
//Calculate timer frequency | |
ftimer = fcpu / prescaler; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
#include <string.h> | |
#include <ctype.h> | |
const char *vowels = "euioay"; | |
const char *consonants = "wrtpsdfghjklzxcvbnm"; | |
int main( int argc, char **argv ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include "fload.h" | |
#define MAX_FILE_COUNT 256 | |
static FILE *files[MAX_FILE_COUNT] = {0}; | |
static int fcount = 0; | |
//Queues specific file for loading |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[org 0x7c00] | |
[bits 16] | |
;Stack setup | |
mov bp, 0xfffe | |
mov sp, bp | |
;Switch into mode 13h | |
mov ah, 0x00 | |
mov al, 0x13 |