Skip to content

Instantly share code, notes, and snippets.

View chastitywhiterose's full-sized avatar
😀
Hoping to contribute to an open source project. I have never learned how yet.

Chastity White Rose chastitywhiterose

😀
Hoping to contribute to an open source project. I have never learned how yet.
View GitHub Profile
@chastitywhiterose
chastitywhiterose / main.bas
Created August 13, 2026 08:35
QBASIC chastelib example
DECLARE FUNCTION intstr$ (i AS INTEGER)
DECLARE FUNCTION strint (s AS STRING)
' global variables to define radix and formatting
' for the intstr function
DIM SHARED radix AS INTEGER
DIM SHARED intwidth AS INTEGER
radix = 2
/'
global variables to define radix and formatting
for the intstr function
'/
dim shared as integer radix=2
dim shared as integer int_width=1
/'
translation of intstr function for FreeBASIC
by original C programmer Chastity White Rose
@chastitywhiterose
chastitywhiterose / chastelib.bi
Created August 5, 2026 21:33
This program is my FreeBASIC test suite for my supreme functions intstr and strint These functions originally written in C have been translated into FreeBASIC syntax perfectly and naturally work with the built in print statement for output. This program marks the start of my project of relearning BASIC, which was my first programming language an…
/'
global variables to define radix and formatting
for the intstr function
'/
dim shared as integer radix=2
dim shared as integer int_width=1
/'
translation of intstr function for FreeBASIC
by original C programmer Chastity White Rose
@chastitywhiterose
chastitywhiterose / main.pas
Created July 16, 2026 14:35
Pascal Powers of 2
program pow2;
var
a,b,x,y:integer;
c:array[0..255] of integer;
length:integer=20; //minimum length for digits
begin;
a:=0;
b:=64; //highest exponent we want
@chastitywhiterose
chastitywhiterose / main.zig
Created July 2, 2026 17:24
chastelib functions for zig
const std = @import("std");
var a:usize=0;
var b:usize=0x100;
pub fn main() void
{
putstr("Official test suite for the Zig version of chastelib.\n");
a=0;
while(a<b)
@chastitywhiterose
chastitywhiterose / ELF-64-hello.asm
Created June 25, 2026 14:30
FASM 64-bit ELF Hello World
;Chastity's Source for ELF 64-bit executable creation
;
;All data as defined in this file is based off of the specification of the ELF file format.
;I first looked at the type of file created by FASM's "format ELF executable" directive.
;It is great that FASM can create an executable file automatically. (Thanks Tomasz Grysztar, you are a true warrior!)
;However, I wanted to understand the format for theoretical use in other assemblers like NASM.
;However, the syntax of FASM and NASM is still different enough that this will work only in FASM.
;I do have a NASM version in a separate file in my repository though.
@chastitywhiterose
chastitywhiterose / ELF-32-hello.asm
Last active June 25, 2026 14:32
FASM 32-bit ELF Hello World
;Chastity's Source for ELF 32-bit executable creation
;
;All data as defined in this file is based off of the specification of the ELF file format.
;I first looked at the type of file created by FASM's "format ELF executable" directive.
;It is great that FASM can create an executable file automatically. (Thanks Tomasz Grysztar, you are a true warrior!)
;However, I wanted to understand the format for theoretical use in other assemblers like NASM.
;However, the syntax of FASM and NASM is still different enough that this will work only in FASM.
;I do have a NASM version in a separate file in my repository though.
@chastitywhiterose
chastitywhiterose / chastelib64.asm
Created June 18, 2026 16:28
Linux 64-bit Assembly Source for chastext: a basic text search and replace program
; chastelib assembly header file for 64 bit Linux
; This file is where I keep the source of my most important Assembly functions
; These are my string and integer output and conversion routines.
; To simplify documentation. The Accumulator/Arithmetic register
; (ax,eax,rax) depending on bit size shall be referred to as register A
; for the description of these core functions because the A register
; is treated special both by the Intel company and my code;
; putstring; Prints a zero terminated string from the address pointer to by A register.
@chastitywhiterose
chastitywhiterose / chastelib64.asm
Last active June 15, 2026 15:17
This post is the source of the 64-bit edition of chastecmp, my file comparison tool. Mostly I just have to use different registers and different numbers along with the syscall instruction instead of interrupt 0x80. The calls are standard and part of the Linux kernel.
; chastelib assembly header file for 64 bit Linux
; This file is where I keep the source of my most important Assembly functions
; These are my string and integer output and conversion routines.
; To simplify documentation. The Accumulator/Arithmetic register
; (ax,ebx,rax) depending on bit size shall be referred to as register A
; for the description of these core functions because the A register
; is treated special both by the Intel company and my code;
; putstring; Prints a zero terminated string from the address pointer to by A register.
@chastitywhiterose
chastitywhiterose / main.asm
Created May 21, 2026 15:23
chastelib test suite for RISC-V Assembly in riscemu simulator
# chastelib test suite for RISC-V Assembly in riscemu simulator
# The same library of functions I commonly use in my Intel Assembly code
# have now been translated to RISC-V.
.data
# These variables are used by the intstr function to convert an integer to a string
# and what radix should be used as well as the width (how many leading zeros)