commit a476d8b7929fd0646e59b4bcf984e3fc4dffdc2d Author: VinceAle7082 Date: Tue Jul 23 14:06:32 2024 +0200 Uploading this stupid project diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3d6e6d5 --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +ASM=nasm + +SRC_DIR=src +BUILD_DIR=build + +$(BUILD_DIR)/main_floppy.img: $(BUILD_DIR)/main.bin + cp $(BUILD_DIR)/main.bin $(BUILD_DIR)/main_floppy.img + truncate -s 1440k $(BUILD_DIR)/main_floppy.img + +$(BUILD_DIR)/main.bin: $(SRC_DIR)/main.asm + $(ASM) $(SRC_DIR)/main.asm -f bin -o $(BUILD_DIR)/main.bin diff --git a/build/main.bin b/build/main.bin new file mode 100644 index 0000000..85ce440 Binary files /dev/null and b/build/main.bin differ diff --git a/build/main_floppy.img b/build/main_floppy.img new file mode 100644 index 0000000..51012ae Binary files /dev/null and b/build/main_floppy.img differ diff --git a/src/main.asm b/src/main.asm new file mode 100644 index 0000000..0d07405 --- /dev/null +++ b/src/main.asm @@ -0,0 +1,51 @@ +org 0x7C00 +bits 16 + +%define ENDL 0x0D, 0x0A + +start: + jmp main + +puts: + push si + push ax + push bx + +.loop: + lodsb + or al, al + jz .done + + mov ah, 0x0E + mov bh, 0 + int 0x10 + + jmp .loop + +.done: + pop bx + pop ax + pop si + ret + +main: + + mov ax, 0 + mov ds, ax + mov es, ax + + mov ss, ax + mov sp, 0x7C00 + + mov si, msg_hello + call puts + + hlt + +.halt: + jmp .halt + +msg_hello: db 'Hello World!', ENDL, 0 + +times 510-($-$$) db 0 +dw 0AA55h