Skip to content

Instantly share code, notes, and snippets.

View alex-robert-fr's full-sized avatar

0x7c00 alex-robert-fr

  • 0x7c00
  • Angoulême
  • 12:36 (UTC +02:00)
View GitHub Profile
@alex-robert-fr
alex-robert-fr / inline_asm.c
Created October 31, 2022 13:25
Test inline asm
#include <stdio.h>
int sum(int a, int b);
int main(void)
{
int a = 1;
int b = 3;
printf("1 + 3 = %i\n", sum(a, b));
return (0);
@alex-robert-fr
alex-robert-fr / singleton.c
Created November 4, 2022 16:28
Singleton in C
// Header
#define MAX_FLAG 0xe
typedef struct s_printf t_printf;
struct s_printf
{
const char flag;
int (*cb)(const char *, int);
};
@alex-robert-fr
alex-robert-fr / boot.asm
Created November 25, 2022 11:08
asm micro boot
jmp $
times 510-($-$$) db 0
dw 0xaa55
@alex-robert-fr
alex-robert-fr / condition.asm
Last active November 27, 2022 13:45
Simple condition in ASM
; if (bx <= 4)
; mov al, 'A'
; else if (bx < 40)
; mov al, 'B'
; else
; mov al, 'C'
mov bx, 40
cmp bx, 4
@alex-robert-fr
alex-robert-fr / p_function.asm
Last active November 28, 2022 15:29
Function with parameter in asm
;main.asm
[org 0x7c00]
global _start
_start:
mov bx, HELLO_MSG
call print
mov ah, 0x0e
mov al, bl
int 0x10
@alex-robert-fr
alex-robert-fr / template.c
Created April 13, 2023 12:31
Template in C
#include<stdio.h>
#define TLIST(T,L) \
struct _List##L { \
struct _List##L * _next; \
struct _List##L * _prev; \
T _data; \
} L = {&(L), &(L)}
#define TOTO(T, L) T L