From 9143073dd351f806e8f793e19fa80fc32f12e279 Mon Sep 17 00:00:00 2001 From: mykola2312 <49044616+mykola2312@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:19:52 +0300 Subject: [PATCH] begin working on test bios disk reading subroutine --- Makefile | 2 +- src/test_disk_read.s | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/test_disk_read.s diff --git a/Makefile b/Makefile index 3b0dfad..b827810 100644 --- a/Makefile +++ b/Makefile @@ -97,7 +97,7 @@ $(OBJ_DIR)/%.o: $(SRC_DIR)/%.s $(AS) $(ASFLAGS) -o $@ $< $(OBJCOPY) --remove-section .note.gnu.property $@ -MBR_TEST_OBJ = obj/mbr_test.o obj/serial.o obj/itoa.o obj/util.o obj/test_disk_params.o +MBR_TEST_OBJ = obj/mbr_test.o obj/serial.o obj/itoa.o obj/util.o obj/test_disk_target.o mbr_test: $(MBR_TEST_OBJ) $(DISK) $(LD) -T src/mbr_test.ld -o $(BIN_DIR)/mbr_test.bin $(MBR_TEST_OBJ) diff --git a/src/test_disk_read.s b/src/test_disk_read.s new file mode 100644 index 0000000..cb75fc1 --- /dev/null +++ b/src/test_disk_read.s @@ -0,0 +1,24 @@ +.section .text +.code16 + +.globl test_disk_read + +# eax - LBA address +# cx - number of sectors +# es:di - destination +test_disk_read: + # here we need to convert LBA into CHS + ret + +# ds:si - sector +test_disk_taste_sector: + # test pattern partition - each sector has 32 bit integer in beginning + # so we read this integer and output it, it must increment as well as LBA address + lodsd # load 32 bit into eax + mov $str_taste, %si + call prints_number + + ret + +.section .rodata +str_taste: .asciz "Sector test pattern: "