Skip to content
Snippets Groups Projects
Commit a1a16289 authored by Jakob Kirsch's avatar Jakob Kirsch
Browse files

add org detection

parent cf6b9c36
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@ max_entries: equ sector_size/entry_size
; on the assembly location (osbase) because these
; are running at boot location (boot).
;
org osbase
org 0x7a00 ; osbase
start:
xor ax,ax ; Set all segments to zero
mov ds,ax
......
import os
content = ""
org = 0
with open("os.asm", "r") as file:
for line in file.readlines():
if ";" in line:
line = line.split(";")[0]
for char in "\t\n[]() ":
if char in line:
line = line.replace(char, "")
if line == "":
continue
if line.startswith("org"):
try:
org = eval(line.replace("org", ""))
break
except:
pass
with open("os.asm", "r") as file:
for line in file.readlines():
if line.startswith("%"):
......@@ -34,7 +50,7 @@ with open("sysmap.txt", "r") as file:
if line[0] == "":
continue
try:
content += "%define " + line[0] + " " + hex(0x7a00 + int(line[1])) + "\n"
content += "%define " + line[0] + " " + hex(org + int(line[1])) + "\n"
except:
pass
with open("sysmap.inc", "w") as file:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment