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.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)
@chastitywhiterose
chastitywhiterose / main.asm
Created May 21, 2026 10:24
Chastity's putstring function for RISC-V Assembly in riscemu
# Chastity's putstring function for RISC-V Assembly in riscemu
.data
string0: .asciiz "I am Chastity White Rose\n"
.text
addi s0, zero, string0
jal putstring
@chastitywhiterose
chastitywhiterose / ELF-64-hello.asm
Last active June 25, 2026 14:20
NASM 64-bit ELF Hello World with no linker
;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.
;Therefore, what you see here is a complete Hello World program that should work within NASM
;to create an executable file without using a linker. It worked perfectly on my machine running Debian Linux and NASM version 2.16.01.
@chastitywhiterose
chastitywhiterose / ELF-32-hello.asm
Last active June 25, 2026 14:24
NASM 32-bit ELF Hello World with no linker
;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.
;Therefore, what you see here is a complete Hello World program that should work within NASM
;to create an executable file without using a linker. It worked perfectly on my machine running Debian Linux and NASM version 2.16.01.