Skip to content

Instantly share code, notes, and snippets.

@00mjk
00mjk / mISA.txt
Created December 4, 2022 23:33 — forked from BasedUser/mISA.txt
The Mindustry Instruction Set Architecture (revision 2)
The Mindustry Logic ISA (mISA, "miss-uh") Manual
Revision 2 (2021/II/12)
This document describes an ISA capable of being translated into mlog interpretable code. This will also be a good target architecture for any compilers, and a decent ISA for message block (blocks containing up to 220 characters) outputs.
As I (router) am unable to describe the hardware's exact requirements to run such code due to lack of experience with hardware engineering, I will define the minimum criteria for interpreting mISA here.
----------------

Miho’s tech test

First of all...

Well done on completing the bootcamp! I'm proud of you & glad you had a great time.

The project looks pretty good for a first tech test ;) You should be proud of yourself too!

Hopefully below feedback is useful... happy to jump on a call to discuss if you want too :)

@00mjk
00mjk / endianness.c
Created June 15, 2022 15:49 — forked from alexpirine/endianness.c
Endianness conversions with positive integers
// converts 32-bits positive integer to 4-bytes little endian
void to4li(unsigned long int const value, char * const buffer)
{
buffer[0] = value >> 8 * 0;
buffer[1] = value >> 8 * 1;
buffer[2] = value >> 8 * 2;
buffer[3] = value >> 8 * 3;
}
// converts 16-bits positive integer to 2-bytes little endian
@00mjk
00mjk / BE LE.h
Created June 15, 2022 15:48 — forked from shangdawei/BE LE.h
Big Endian and Little Endian Convert
#if BYTE_ORDER == __ORDER_BIG_ENDIAN__
//Host byte order to network byte order (at compile time)
#define HTONS(value) (value)
#define HTONL(value) (value)
//Network byte order to host byte order (at compile time)
#define NTOHS(value) (value)
#define NTOHL(value) (value)
@00mjk
00mjk / clang.diff
Created June 12, 2022 23:32 — forked from DopefishJustin/clang.diff
Clang fixes for MAME
diff --git a/src/emu/device.h b/src/emu/device.h
index df101d9..a20d341 100644
--- a/src/emu/device.h
+++ b/src/emu/device.h
@@ -377,9 +377,10 @@ protected:
virtual ~shared_ptr_finder() { if (m_allocated) global_free(m_target); }
// operators to make use transparent
- operator _PointerType *() { return m_target; }
operator _PointerType *() const { return m_target; }
Run on (32 X 2500 MHz CPU s)
CPU Caches:
L1 Data 32K (x32)
L1 Instruction 32K (x32)
L2 Unified 256K (x32)
L3 Unified 25600K (x32)
--------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
--------------------------------------------------------------------------------------------------------------
MicroBenchmarkBasicFixture/BM_InsertEmptyTableWithConstraint/1/1 182574332 ns 182573160 ns 4
@00mjk
00mjk / disassemble.md
Created June 12, 2022 21:25 — forked from jarun/disassemble.md
Guide to disassemble

prerequisites

  • Compile the program in gcc with debug symbols enabled (-g)
  • Do NOT strip the binary
  • To generate assembly code using gcc use the -S option: gcc -S hello.c

utilities

objdump

@00mjk
00mjk / Binary Decimal Conversion
Created June 11, 2022 21:52 — forked from cynx/Binary Decimal Conversion
C program to covert 'Decimal to Binary' and 'Binary to Decimal'
/* C programming source code to convert either binary to decimal or decimal to binary according to data entered by user. */
/* From http://www.programiz.com/ */
#include <stdio.h>
#include <math.h>
int binary_decimal(int n);
int decimal_binary(int n);
int main()
{
int n;
@00mjk
00mjk / gaps_channel_setup.c
Created June 10, 2022 15:22 — forked from protoben/gaps_channel_setup.c
Simple setup implementation
#include <libpirate/primitives.h>
#include <linux/limits.h>
#include <stdlib.h>
#include <string.h>
#include "gaps_resources.h"
// ^ declares resource and resource_parameter structs, as well as communication
// functions gaps_request_resource() and gaps_signal_failure()
extern struct gaps_resource *__gaps_channel_gaps_resources;
@00mjk
00mjk / s2e-qemu-build-failure.txt
Created June 10, 2022 15:21 — forked from protoben/s2e-qemu-build-failure.txt
s2e qemu build failure with GCC 5.4.0 on Xenial
CXX i386-s2e-softmmu/tcg/tcg-llvm.o
In file included from /home/hamlinb/netrecon/s2e/s2e/qemu/tcg/tcg-llvm.cpp:72:
In file included from /home/hamlinb/netrecon/s2e/build/llvm-3.2.src/include/llvm/DerivedTypes.h:21:
In file included from /home/hamlinb/netrecon/s2e/build/llvm-3.2.src/include/llvm/Type.h:18:
In file included from /home/hamlinb/netrecon/s2e/build/llvm-3.2.src/include/llvm/Support/Casting.h:18:
In file included from /home/hamlinb/netrecon/s2e/build/llvm-3.2.src/include/llvm/Support/type_traits.h:20:
In file included from /home/hamlinb/netrecon/s2e/build/llvm-release/include/llvm/Support/DataTypes.h:37:
In file included from /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/cmath:40:
/usr/include/bits/c++config.h:218:10: error: expected unqualified-id
inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { }