From af61db5e40dbed26adfd2be43a99a4d163739fb0 Mon Sep 17 00:00:00 2001 From: Nero <41307858+nero@users.noreply.github.com> Date: Mon, 28 Oct 2019 10:49:42 +0000 Subject: [PATCH] Improve memory position handling --- Makefile | 7 ++++--- bios/8086.asm | 5 +++-- boot/fat.asm | 9 ++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 9b53c51..0f5045d 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ FLOPPY = 360 -RAM = 0x10000 - +BDOS = 0xF000 BDOSIMG = bdos.bin + +BIOS = 0xF800 BIOSIMG = bios8086.bin PROGRAMS = $(patsubst %.asm,%.com,$(wildcard com/*.asm)) @@ -15,7 +16,7 @@ QEMU_ARGS = $(addprefix --option-rom ,$(ROMS)) NASM = nasm NASM_ARGS = -s -Ilib -Plib/nasmcomp.asm -w-macro-params -NASM_ARGS += -DRAM=$(RAM) +NASM_ARGS += -DBDOS=$(BDOS) -DBIOS=$(BIOS) EMUL = utils/emul diff --git a/bios/8086.asm b/bios/8086.asm index 1c53f79..8bdc82f 100644 --- a/bios/8086.asm +++ b/bios/8086.asm @@ -1,4 +1,4 @@ -ORG (RAM - 0x0800) +ORG BIOS CPU 8086 DISKCX: EQU 0x8 @@ -28,7 +28,8 @@ BOOT: DB "BIOS", 0 WBOOT: - JMP (RAM - 0x1000) + XOR AX, AX + JMP BDOS RET ; CHAR I/O diff --git a/boot/fat.asm b/boot/fat.asm index ccb2cbf..9443bdb 100644 --- a/boot/fat.asm +++ b/boot/fat.asm @@ -1,6 +1,5 @@ %define segment 0x00100 %define self (0x7C00-(segment<<4)) ; 1 sector -%define prog (RAM-0x1000) ; 4K at the end for OS cpu 8086 org self @@ -58,7 +57,7 @@ main: ; Stack grows down from 64k mov ax, cs mov ss, ax - mov sp, prog + mov sp, BDOS mov ds, ax mov es, ax @@ -67,7 +66,7 @@ main: mov ax, 1 mov cx, 8 mov dx, 0 - mov bx, prog + mov bx, BDOS .loop: push ax @@ -106,8 +105,8 @@ main: mov dl, [fdc.drv] - ; jump into kernel - jmp segment:(prog+0x0800) + ; jump into bios cold boot entry point + jmp segment:BIOS error: mov ax, bp