This file contains 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
import pygame | |
import random | |
import math | |
# Initialize Pygame | |
pygame.init() | |
# Set up the screen | |
WIDTH, HEIGHT = 600, 600 | |
screen = pygame.display.set_mode((WIDTH, HEIGHT)) |
This file contains 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
def pi_digits(): | |
q, r, t, k, n, l = 1, 0, 1, 1, 3, 3 | |
decimal = [] | |
for _ in range(100): | |
if 4 * q + r - t < n * t: | |
decimal.append(n) | |
print (n) | |
time.sleep(1) | |
q, r, t, k, n, l = ( |
This file contains 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
static volatile SYSVAR *sv; | |
int main() | |
{ | |
sv = vdp_vdu_init(); | |
if (vdp_key_init() == -1) | |
return 1; | |
xUART uart = { | |
.baudRate = 115200, |
This file contains 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
- sensor: | |
- name: "House Battery Runtime" | |
state: > | |
{% set runtime = states('sensor.house_battery_runtime_raw') %} | |
{% set hours = runtime | float %} | |
{% set minutes = ((hours % 1) * 60) | int %} | |
{% set hours = (hours - (hours % 1)) | int %} | |
{{ 'Remaining Time: %02i:%02i'%(hours, minutes) }} | |
- name: "House Battery Runtime Raw" | |
unit_of_measurement: "hours" |
This file contains 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
# ---------------------------- | |
# Makefile Options | |
# ---------------------------- | |
NAME = DEMO | |
DESCRIPTION = "Ag C Toolchain Demo" | |
COMPRESSED = NO | |
CFLAGS = -Wall -Wextra -Oz | |
CXXFLAGS = -Wall -Wextra -Oz |
This file contains 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
// R3G3B2 | |
void clearLayer2Screen(unsigned char colour) | |
{ | |
unsigned char zero = colour; | |
IO_123B = 0x03; // Top | |
// WR0 | |
IO_6B = 0x79; | |
IO_6B = 0x00; IO_6B = 0x00; // A Start | |
IO_6B = 0x00; IO_6B = 0x40; // 16k |
This file contains 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
inline void plot(unsigned char x, unsigned char y, unsigned char colour) | |
{ | |
unsigned char newy = y; | |
// Work out which bit of screen we need | |
if (y >= 128) { | |
IO_123B = 0x83; // Bottom | |
newy -= 128; | |
} else if (y >= 64) { | |
IO_123B = 0x43; // Middle | |
newy -= 64; |
This file contains 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
//R3G3B2 | |
#define RGB2COLOUR(r,g,b) \ | |
(unsigned char)( \ | |
( \ | |
(r & 0x7) << 5 \ | |
) | \ | |
( \ | |
(g & 0x7) << 2 \ | |
) | \ | |
(b & 0x3) \ |
This file contains 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
OUTPUT joytest.z80 | |
ORG $8000 | |
ld de,starttxt | |
call print | |
loop: | |
in a,($1) ; read port 1 | |
ld (button),a ; copy the byte read | |
fire: |