Skip to content

Instantly share code, notes, and snippets.

View nsadisha's full-sized avatar
🎯
Focusing

Sadisha Nimsara nsadisha

🎯
Focusing
View GitHub Profile
@nsadisha
nsadisha / solid_principles_summary.md
Created October 20, 2024 15:40
This is a summary of SOLID principles.
Principle Description
Single Responsibility Principle (SRP) A class should have only one reason to change, or in other words, it should have a single responsibility.
Open-Closed Principle (OCP) Software entities should be open for extension, but closed for modification.
Liskov's Substitution Principle (LSP) An object of super class can be replaced with an object of a sub class without altering the correctness of the program.
Interface Segregation Principle (ISP) Using Many task specific interfaces is better than one general purpose interface
Dependency Inversion Principle (DIP) High-level modules should not depend on low-level modules. Both should depend on abstraction. Abstraction should not depend on details. Details should depend on abstraction.
OBJECTS = loader.o kmain.o
CC = gcc
CFLAGS = -m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector \
-nostartfiles -nodefaultlibs -Wall -Wextra -Werror -c
LDFLAGS = -T link.ld -melf_i386
AS = nasm
ASFLAGS = -f elf
all: kernel.elf
@nsadisha
nsadisha / loader.s
Created July 21, 2021 08:26
second article gists
global loader ; the entry symbol for ELF
extern sum_of_three
MAGIC_NUMBER equ 0x1BADB002 ; define the magic number constant
FLAGS equ 0x0 ; multiboot flags
CHECKSUM equ -MAGIC_NUMBER ; calculate the checksum
; (magic number + checksum + flags should equal 0)
section .text: ; start of the text (code) section
align 4 ; the code must be 4 byte aligned
megs: 32
display_library: sdl
romimage: file=/usr/share/bochs/BIOS-bochs-latest
vgaromimage: file=/usr/share/bochs/VGABIOS-lgpl-latest
ata0-master: type=cdrom, path=os.iso, status=inserted
boot: cdrom
log: bochslog.txt
clock: sync=realtime, time0=local
cpu: count=1, ips=1000000
default=0
timeout=0
title os
kernel /boot/kernel.elf
@nsadisha
nsadisha / link.ld
Created July 11, 2021 09:58
Blog article preview codes
@nsadisha
nsadisha / loader.s
Last active July 11, 2021 09:58
blog article preview codes
global loader ; the entry symbol for ELF
MAGIC_NUMBER equ 0x1BADB002 ; define the magic number constant
FLAGS equ 0x0 ; multiboot flags
CHECKSUM equ -MAGIC_NUMBER ; calculate the checksum
; (magic number + checksum + flags should equal 0)
section .text: ; start of the text (code) section
align 4 ; the code must be 4 byte aligned
dd MAGIC_NUMBER ; write the magic number to the machine code,