Improve memory position handling

This commit is contained in:
Nero 2019-10-28 10:49:42 +00:00
parent 47630b2c03
commit af61db5e40
3 changed files with 11 additions and 10 deletions

View File

@ -1,8 +1,9 @@
FLOPPY = 360 FLOPPY = 360
RAM = 0x10000 BDOS = 0xF000
BDOSIMG = bdos.bin BDOSIMG = bdos.bin
BIOS = 0xF800
BIOSIMG = bios8086.bin BIOSIMG = bios8086.bin
PROGRAMS = $(patsubst %.asm,%.com,$(wildcard com/*.asm)) PROGRAMS = $(patsubst %.asm,%.com,$(wildcard com/*.asm))
@ -15,7 +16,7 @@ QEMU_ARGS = $(addprefix --option-rom ,$(ROMS))
NASM = nasm NASM = nasm
NASM_ARGS = -s -Ilib -Plib/nasmcomp.asm -w-macro-params NASM_ARGS = -s -Ilib -Plib/nasmcomp.asm -w-macro-params
NASM_ARGS += -DRAM=$(RAM) NASM_ARGS += -DBDOS=$(BDOS) -DBIOS=$(BIOS)
EMUL = utils/emul EMUL = utils/emul

View File

@ -1,4 +1,4 @@
ORG (RAM - 0x0800) ORG BIOS
CPU 8086 CPU 8086
DISKCX: EQU 0x8 DISKCX: EQU 0x8
@ -28,7 +28,8 @@ BOOT:
DB "BIOS", 0 DB "BIOS", 0
WBOOT: WBOOT:
JMP (RAM - 0x1000) XOR AX, AX
JMP BDOS
RET RET
; CHAR I/O ; CHAR I/O

View File

@ -1,6 +1,5 @@
%define segment 0x00100 %define segment 0x00100
%define self (0x7C00-(segment<<4)) ; 1 sector %define self (0x7C00-(segment<<4)) ; 1 sector
%define prog (RAM-0x1000) ; 4K at the end for OS
cpu 8086 cpu 8086
org self org self
@ -58,7 +57,7 @@ main:
; Stack grows down from 64k ; Stack grows down from 64k
mov ax, cs mov ax, cs
mov ss, ax mov ss, ax
mov sp, prog mov sp, BDOS
mov ds, ax mov ds, ax
mov es, ax mov es, ax
@ -67,7 +66,7 @@ main:
mov ax, 1 mov ax, 1
mov cx, 8 mov cx, 8
mov dx, 0 mov dx, 0
mov bx, prog mov bx, BDOS
.loop: .loop:
push ax push ax
@ -106,8 +105,8 @@ main:
mov dl, [fdc.drv] mov dl, [fdc.drv]
; jump into kernel ; jump into bios cold boot entry point
jmp segment:(prog+0x0800) jmp segment:BIOS
error: error:
mov ax, bp mov ax, bp