Skip to content

Instantly share code, notes, and snippets.

View NunoLava1998's full-sized avatar

NunoLava1998 NunoLava1998

View GitHub Profile
.section .multiboot
.align 4
.long 0x1BADB002 # The "magic number", needed for the ELF file to load.
.long (1<<0 | 1<<1) # The FLAGS variable, needed for multiboot.
.long -(0x1BADB002 + (1<<0 | 1<<1)) # The checksum of the above, so we can prove that we are multiboot-capable.
# The multiboot standard does not define the value of the stack pointer register called the following:
# %rsp in 64bit mode, %esp in 32bit mode and %sp in 16bit mode.
# It is up to the kernel to provide a stack, so basic languages like C and C++ can run.
# Our stack will have an ELF symbol at the bottom, and then 16 KiB of free space. There is a symbol at the top
.section .text
.global enter_v86
.global v86_int_
enter_v86:
mov %esp, %ebp
pushl [ebp+4]
pushl [ebp+8]
pushfd
#include "../stdtyp.h" // Include types (like uint16_t, int32_t, etc.)
#include "../stdio.h"
uint8_t x = 0;
uint8_t y = 0;
uint16_t* vptr = (uint16_t*)0xB8000;
const int vga_height = 25;
const int vga_width = 80;
const int vga_h_minus_one = 24;
@NunoLava1998
NunoLava1998 / stdio.c
Created March 25, 2017 16:08
the stdio file
#include "../stdtyp.h" // Include types (like uint16_t, int32_t, etc.)
uint8_t x = 0;
uint8_t y = 0;
uint16_t* vptr = (uint16_t*)0xB8000;
const int vga_height = 25;
const int vga_width = 80;
const int vga_h_minus_one = (vga_height - 1);
const int vga_w_minus_one = (vga_width - 1);
void scroll(void) {
// For viewers: I'm using x_coord and y_coord beacuse x and y are global variables.
unsigned short int *vga_address = (unsigned short int *)0xB8000;
for (unsigned short int y_coord = 0; y_coord < (25 - 1); y_coord++) {
for (unsigned short int x_coord = 0; x_coord < 80; x_coord++) {
vga_address[y_coord * 80 + x_coord] = vga_address[(y_coord + 1) * 80 + x_coord];
}
}
// For viewers: vptr is already defined. putc puts the character wherever vptr is and increments this by 1.
vptr = (unsigned short int *)0xB8000 + (24 * 80 + 0);
86os.elf: file format elf32-i386
Disassembly of section .text:
00100000 <_start-0xc>:
100000: 02 b0 ad 1b 03 00 add 0x31bad(%eax),%dh
100006: 00 00 add %al,(%eax)
100008: fb sti
unsigned short int* buf = (unsigned short int *)0xB8000;
for (int y_format = 0; y_format < 25; y_format++) {
for (int x_format = 0; x_format < 80; x_format++) {
buf[y_format * 80 + x_format] = buf[(y_format + 1) * 80 + x_format];
}
}
y = 24;
x = 0;
update_vptr(x, y);
#inclde #hackersoft.com;
const char* x = "north korean nukes";
(x[size_t(5]>>2<<2>>2<<2) & 0xFFFFGFDFFDFG = 0[9]; // seting Data Data T's nul register (rxa)
(x[sizeof(sizeof(sizeof(sizeof(sizeof(switch(c){case 2: 2 else {2+2=4}}))))))); = 0xC // setting the IDT's sizeof registra (rbbx)
(x-- = 5); = sizeof((x<<2)); // settign 2+2 of the GDT register
// Now i am gunna get paswrd of hackrs
cabbage(); // gettinjg hck softwr dune
QUALITY.c:9:1: error: unknown type name 'uint16t_'
uint16t_ // This is a 61 byte integer
^
QUALITY.c: In function 'print_hello_wit_red_text':
QUALITY.c:27:1: warning: implicit declaration of function 'sys_redtext_set_text_terminal_vga_color_to_red' [-Wimplicit-function-declaration]
sys_redtext_set_text_terminal_vga_color_to_red(); // sys/redtext.h set text terminal vga color to erd
^
QUALITY.c:28:1: warning: implicit declaration of function 'print_hello' [-Wimplicit-function-declaration]
print_hello(0xFFFFFFFFFFFF); // everyone use 0xFFFGFFFFF, so i say why not? :DD
^
#ifndef STANDARD_VARIABLE_DEFINE_LIBRARY
#define STANDARD_VARIABLE_DEFINE_LIBRARY
typedef char int8_t;
typedef unsigned char uint8_t;
typedef int int16_t;
typedef unsigned int uint16_t;
typedef long int int32_t;
typedef unsigned long int uint32_t;