From df5dcdc34de47f6a6bbc1705149e142fb5b16d25 Mon Sep 17 00:00:00 2001 From: VinceAle7082 Date: Mon, 30 Dec 2024 18:48:37 +0100 Subject: [PATCH] I'M BACK Modified some things in CONTRIBUTING and in the Makefile. Started coding some things for the FAT12 filesystem. --- CONTRIBUTING.md | 18 +++--- Makefile | 6 +- src/bootloader/stage2/disk.h | 14 +++++ src/bootloader/stage2/x86.asm | 102 ++++++++++++++++++++++++++++++++++ src/bootloader/stage2/x86.h | 4 +- 5 files changed, 131 insertions(+), 13 deletions(-) create mode 100644 src/bootloader/stage2/disk.h diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4b39692..7e041f8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,8 +9,8 @@ This project isn't nothing serius, just a hobby project. ## Violate the license -XanvicOS has a license, the GPLv3 license. If has been chosen by the author of something, it has been chosen for a reason. If you violate it you don't respect the idea of the creator about his code. -So, in respec of the author, don't violate it. +XanvicOS has a license, the GPLv3 license. If has been chosen by the author, it has been chosen for a reason. If you violate it you don't respect the idea of the creator about his code. +So, to respect of the author, don't violate it. ## Violate the Code of Conduct @@ -18,11 +18,15 @@ Pretty much for the same reason as the license: it exist, it has been chosen, pl ## Hurt and/or harass someone -If you don't understand why, we DON'T need more people like you. As I already wrote in "What we want", we need to respect each other, so let's do it, no? +As I already wrote in "What we want", we need to respect each other, so let's do it, no? ## Do something stupid -"Doing something stupid" means a lot, by don't knowing what you are doing, to commit crimes. But it doesn't mean you can't make some errors here and there, we are humans after all. +"Doing something stupid" means a lot, from not knowing what you are doing, to commiting crimes. + +## Troll (too much) + +You can make some trolls, but you can't do something like creating 100 pull request about deleting all the code. # Here is what you need to do @@ -30,10 +34,6 @@ If you don't understand why, we DON'T need more people like you. As I already wr As I already said, this project is built off the idea of respecting each other while contributing. Without respect nothing can be done. -## Don't troll (too much) - -You can make some trolls, but you can't make like 100 pull request about deleting all the code and call it "modernize the code" - ## Think before doing -Self-explenatory, before doing something, think about what can be done better. If you can't think of anything better, then do it +Self-explenatory, before doing something, think about what can be done better. If you can't think of anything better, do it diff --git a/Makefile b/Makefile index 55e3575..43ed747 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ LD16=/usr/bin/watcom/binl/wlink SRC_DIR=src BUILD_DIR=build -.PHONY: all immagine_floppy kernel bootloader clean always +.PHONY: all immagine_floppy kernel bootloader always clean #Immagine floppy @@ -54,6 +54,6 @@ always: #Clean clean: - rm -rf $(BUILD_DIR)/* + rm $(BUILD_DIR)/* -rf -#Strumenti \ No newline at end of file +#Strumenti diff --git a/src/bootloader/stage2/disk.h b/src/bootloader/stage2/disk.h new file mode 100644 index 0000000..91e7160 --- /dev/null +++ b/src/bootloader/stage2/disk.h @@ -0,0 +1,14 @@ +#pragma once +#include "stdint.h" +#include +#include + +typedef struct { + uint8_t id; + uint16_t cilindri; + uint16_t settori; + uint16_t testine; +} DISCO; + +bool InizializzaDisco(DISCO* disco, uint8_t numeroDisco); +bool leggiSettoriDisco(DISCO* disco, uint32_t lba, uint8_t settori, uint8_t far* dataOut); diff --git a/src/bootloader/stage2/x86.asm b/src/bootloader/stage2/x86.asm index 3bab9da..3e74dcf 100644 --- a/src/bootloader/stage2/x86.asm +++ b/src/bootloader/stage2/x86.asm @@ -46,3 +46,105 @@ _x86_div64_32: pop bp ret + +global _x86_ResettaDisco + +_x86_ResettaDisco: + push bp + mov bp, sp + + mov ah, 0 + mov dl, [bp + 4] + stc + int 13h + + mov ax, 1 + sbb ax, 0 + + mov sp, bp + pop bp + + ret + +global _x86_LeggiDisco + +_x86_LeggiDisco: + push bp + mov bp, sp + + mov dl, [bp + 4] + mov ch, [bp + 6] + mov cl, [bp + 7] + shl cl, 6 + mov dh, [bp + 8] + mov al, [bp + 10] + and al, 3Fh + or cl, al + mov al, [bp + 12] + mov bx, [bp + 16] + mov es, bx + mov bx, [bp + 14] + + mov ah, 02h + stc + int 13h + + mov ax, 1 + sbb ax, 0 + + pop es + pop bx + + mov sp, bp + pop bp + + ret + +global _x86_OttieniParametriDisco + +_x86_OttieniParametriDisco: + push bp + mov bp, sp + + push es + push bx + push si + push di + + mov dl, [bp + 4] + mov ah, 08h + mov di, 0 + mov es, di + stc + int 13h + + mov ax, 1 + sbb ax, 0 + + mov si, [bp + 6] + mov [si], bl + + mov bl, ch + mov bh, cl + shr bh, 6 + mov si, [bp + 8] + mov [si], bx + + xor ch, ch + and cl, 3Fh + mov si, [bp + 10] + mov [si], cx + + mov cl, dh + mov si, [bp + 12] + mov [si], cx + + pop es + pop bx + pop si + pop di + + mov sp, bp + pop bp + + ret diff --git a/src/bootloader/stage2/x86.h b/src/bootloader/stage2/x86.h index 06622db..627f9df 100644 --- a/src/bootloader/stage2/x86.h +++ b/src/bootloader/stage2/x86.h @@ -2,5 +2,7 @@ #include "stdint.h" void _cdecl x86_div64_32(uint64_t dividend, uint32_t divisor, uint64_t* quotientOut, uint32_t* remainderOut); - void _cdecl x86_Video_WriteCharTeletype(char c, uint8_t page); +void _cdecl x86_ResettaDisco(uint8_t drive); +void _cdecl x86_LeggiDisco(uint8_t drive, uint16_t cilindro, uint16_t testina, uint16_t settore, uint8_t numeroSettore, uint8_t far * dataOut); +void _cdecl X86_OttieniParametriDisco(uint8_t drive, uint16_t tipoDriveOut, uint16_t cilindriOut, uint16_t settoriOut, uint16_t testineOut);