Merge branch 'hotfix/broken-encoding'

fix: исправлена ошибка кодировки при чтении файл
This commit is contained in:
ElectronixTM
2025-04-12 19:34:27 +03:00
3 changed files with 100 additions and 2 deletions

98
src/dp32proto/dbg.json Normal file
View File

@ -0,0 +1,98 @@
{
"labels": {
"_start": 0,
"_start_return": 9,
"f_fibo": 11,
"f_fibo_loop": 14,
"return": 27,
"result": 28,
"end": 29
},
"instructions": {
"0": {
"length": 1,
"srcline": 6
},
"1": {
"length": 1,
"srcline": 7
},
"2": {
"length": 2,
"srcline": 8
},
"4": {
"length": 2,
"srcline": 9
},
"6": {
"length": 2,
"srcline": 10
},
"8": {
"length": 1,
"srcline": 11
},
"9": {
"length": 2,
"srcline": 13
},
"11": {
"length": 1,
"srcline": 16
},
"12": {
"length": 1,
"srcline": 17
},
"13": {
"length": 1,
"srcline": 18
},
"14": {
"length": 1,
"srcline": 20
},
"15": {
"length": 1,
"srcline": 21
},
"16": {
"length": 1,
"srcline": 22
},
"17": {
"length": 1,
"srcline": 23
},
"18": {
"length": 1,
"srcline": 24
},
"19": {
"length": 2,
"srcline": 25
},
"21": {
"length": 2,
"srcline": 27
},
"23": {
"length": 2,
"srcline": 28
},
"25": {
"length": 2,
"srcline": 29
},
"27": {
"length": 1,
"srcline": 31
},
"28": {
"length": 1,
"srcline": 32
}
},
"src": "C:\\Users\\etdia\\code\\dp32-proto\\src\\test.dasm"
}

View File

@ -51,7 +51,7 @@ def main():
dbg_dict: DbgDict = parse_dbg(json.load(f))
dbg = Debugger(mem, dbg_dict)
with open (dbg_dict["src"], 'r') as f:
with open (dbg_dict["src"], 'r', encoding="utf8") as f:
src = f.read()
dbg_tui.run_tui(dbg, src)

View File

@ -55,7 +55,7 @@ class Debugger:
}
def __init__(self, mem: bytearray, dbg_dict: DbgDict):
with open(dbg_dict["src"], 'r') as f:
with open(dbg_dict["src"], 'r', encoding="utf8") as f:
self._source_lines = f.readlines()
self._vm = VM(mem)
self._dbg_dict = dbg_dict