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 <stdint.h> | |
constexpr uintptr_t spi1_addr = 0x40013000; | |
enum class spi_reg : uintptr_t { | |
cr2 = 0x04 | |
}; | |
template <uintptr_t Base, auto Reg> | |
struct periph_reg_addr { |
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
constexpr size_t bytes_per_line = 16; | |
void buffer_pretty_print(const void *buf, size_t size) { | |
uintptr_t addr = reinterpret_cast<uintptr_t>(buf); | |
for (size_t i = 0; i < (size + bytes_per_line - 1) / bytes_per_line; i++) { | |
uint8_t buf[bytes_per_line]; | |
auto off = i * bytes_per_line; | |
size_t n = std::min(bytes_per_line, size - off); | |
std::memcpy( |
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 <iostream> | |
#include <tuple> | |
#include <array> | |
namespace details { | |
template<typename... Ts> | |
struct concat_size; | |
template<typename... Ts> | |
inline constexpr size_t concat_size_v = concat_size<Ts...>::value; |
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 <iostream> | |
#include <tuple> | |
#include <array> | |
namespace details { | |
template<typename... Ts> | |
struct concat_size; | |
template<typename... Ts> | |
inline constexpr size_t concat_size_v = concat_size<Ts...>::value; |
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 <iostream> | |
#include <tuple> | |
#include <array> | |
struct RecvBuffer{}; | |
struct SendBuffer{}; | |
struct ImbueCredentials{}; | |
struct ExtractCredentials{}; | |
struct RecvInline{}; | |
struct Offer{}; |
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
#!/usr/bin/env python3 | |
def gen_primes(): | |
D = {} | |
q = 2 | |
while True: | |
if q not in D: | |
yield q | |
D[q * q] = [q] |
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
x86_64-managarm-g++ -std=gnu++11 -fsigned-char -DHAVE_CONFIG_H -I../include -I/home/qookie/code/managarm/build/../src/ports/mednafen/include -I../intl -fno-fast-math -fno-unsafe-math-optimizations -fno-aggressive-loop-optimizations -fno-ipa-icf -fno-printf-return-value -fomit-frame-pointer -fstrict-aliasing -Wall -Wshadow -Wempty-body -Wignored-qualifiers -Wvla -Wvariadic-macros -Wdisabled-optimization -Werror=write-strings -fno-pic -fno-pie -fno-PIC -fno-PIE -no-pie -fwrapv -fjump-tables -mfunction-return=keep -mindirect-branch=keep -mno-indirect-branch-register -mcmodel=small -fexceptions -g -O2 -MT cdrom/crc32.o -MD -MP -MF $depbase.Tpo -c -o cdrom/crc32.o /home/qookie/code/managarm/build/../src/ports/mednafen/src/cdrom/crc32.cpp &&\ | |
mv -f $depbase.Tpo $depbase.Po | |
/home/qookie/code/managarm/build/../src/ports/mednafen/src/mthreading/MThreading_POSIX.cpp: In function ‘bool Mednafen::MThreading::Sem_Wait(Mednafen::MThreading::Sem*)’: | |
/home/qookie/code/managarm/build/../src/ports/mednafen/src/mthreadi |
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
; compile with: nasm -fbin bootqwrd.asm -o bootqwrd.com | |
; note: the DOS extender nasm uses causes this to triple fault | |
; when ran right after assembling | |
; usage: put a flat binary to be loaded at 1MB called QWORD.BIN in | |
; the current directory and run bootqwrd.com | |
; tested in qemu with DOS 6.22 | |
org 0x100 | |
bits 16 | |
start: |
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 <epoxy/gl.h> // replace with proper include | |
void gl_debug_callback(GLenum source, GLenum type, GLuint id, | |
GLenum severity, GLsizei length, | |
const char *message, const void *) { | |
const char *sev = ""; | |
switch (severity) { | |
case GL_DEBUG_SEVERITY_HIGH: sev = "\e[91m"; break; | |
case GL_DEBUG_SEVERITY_MEDIUM: sev = "\e[93m"; break; |
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
sf::Keyboard::Key translate_key_name(const std::string &name) { | |
if (name == "a") return sf::Keyboard::A; | |
if (name == "b") return sf::Keyboard::B; | |
if (name == "c") return sf::Keyboard::C; | |
if (name == "d") return sf::Keyboard::D; | |
if (name == "e") return sf::Keyboard::E; | |
if (name == "f") return sf::Keyboard::F; | |
if (name == "g") return sf::Keyboard::G; | |
if (name == "h") return sf::Keyboard::H; | |
if (name == "i") return sf::Keyboard::I; |