Skip to content

Instantly share code, notes, and snippets.

View Lucretia's full-sized avatar
😥

Luke A. Guest Lucretia

😥
  • Leeds, UK (for now), want to escape Toryland
View GitHub Profile
pragma Ada_95;
pragma Restrictions (No_Exception_Propagation);
with System;
package ada_main is
pragma Warnings (Off);
GNAT_Version : constant String :=
"GNAT Version: 4.9.3" & ASCII.NUL;
pragma Export (C, GNAT_Version, "__gnat_version");
pragma Ada_95;
pragma Source_File_Name (ada_main, Spec_File_Name => "b~led_shifter.ads");
pragma Source_File_Name (ada_main, Body_File_Name => "b~led_shifter.adb");
package body ada_main is
pragma Warnings (Off);
E18 : Short_Integer; pragma Import (Ada, E18, "avr__real_time__clock_E");
E20 : Short_Integer; pragma Import (Ada, E20, "avr__real_time__clock_impl_E");
pragma Ada_95;
pragma Source_File_Name (ada_main, Spec_File_Name => "b~bare_bones.ads");
pragma Source_File_Name (ada_main, Body_File_Name => "b~bare_bones.adb");
package body ada_main is
pragma Warnings (Off);
E09 : Short_Integer; pragma Import (Ada, E09, "system__secondary_stack_E");
E19 : Short_Integer; pragma Import (Ada, E19, "vga_console_E");
E03 : Short_Integer; pragma Import (Ada, E03, "crash_E");
-- Blit_Scaled
--
-- Self : The destination surface to blit onto.
-- Self_Area : The coordinates and size of the area to blit into.
-- Source : The surface to blit onto Self.
-- Source_Area : The coordinates and size of the area to blit from.
procedure Blit_Scaled (Self : in out Surface;
Self_Area : in out Rectangles.Rectangle;
Source : in Surface;
Source_Area : in Rectangles.Rectangle := Rectangles.Null_Rectangle) is
@Lucretia
Lucretia / xor_alg.adb
Created August 13, 2019 10:21
Testing no + operator add and swap
-- Ported to Ada from https://www.geeksforgeeks.org/add-two-numbers-without-using-arithmetic-operators/
with Ada.Text_IO; use Ada.Text_IO;
with Interfaces; use Interfaces;
procedure XOR_Alg is
type Unsigned_Integer is mod 2 ** Integer'Size;
function "xor" (Left, Right: Integer) return Integer is
begin

Notes

A new language which mixes in ideas from Ada, Oberon and others.

What I want to explore

  • Unicode throughout

  • Enforce coding style? Go's annoys me with switches and case labels being at the same level when they are nested, but I can define this how I like.

  • Snake_Case / snake_case vs CamelCase / camelCase
@Lucretia
Lucretia / fizz_buzz.s
Created August 30, 2019 13:00
Fizz buss asm - no optimisation
.file "fizz_buzz.adb"
.text
.section .rodata
.LC2:
.ascii " - Fizz Buzz"
.LC3:
.ascii " - Fizz"
.LC4:
.ascii " - Buzz"
.align 8
@Lucretia
Lucretia / fizz_buzz.s
Last active August 30, 2019 13:02
Fizz buzz - -O3
.file "fizz_buzz.adb"
.text
.section .rodata
.LC2:
.ascii " - Fizz Buzz"
.LC3:
.ascii " - Fizz"
.LC4:
.ascii " - Buzz"
.align 8
@Lucretia
Lucretia / fizz_buzz_2.s
Created August 30, 2019 13:03
Fizz buzz 2 - table based - no optimisation
.file "fizz_buzz_2.adb"
.text
.align 2
.globl _ada_fizz_buzz_2
.type _ada_fizz_buzz_2, @function
_ada_fizz_buzz_2:
.LFB1:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
@Lucretia
Lucretia / fizz_buzz_2.s
Created August 30, 2019 13:04
Fizz buzz 2 - table based - -O3
.file "fizz_buzz_2.adb"
.text
.align 2
.p2align 4,,15
.globl _ada_fizz_buzz_2
.type _ada_fizz_buzz_2, @function
_ada_fizz_buzz_2:
.LFB1:
.cfi_startproc
pushq %r12