aboutsummaryrefslogtreecommitdiffstats
path: root/asm
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2023-04-07 19:49:53 +0000
committerGravatar Peter McGoron 2023-04-07 19:49:53 +0000
commit56c6523e15176ecb5eadeda803d7e54c165d69ca (patch)
tree72e0432d8574cfa21f64e51af7ebfaecd7b4a50b /asm
parentadd adc and dac switch (diff)
rerun test suite
Diffstat (limited to 'asm')
-rw-r--r--asm/ffi.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/asm/ffi.py b/asm/ffi.py
index e7903af..11c6f39 100644
--- a/asm/ffi.py
+++ b/asm/ffi.py
@@ -60,7 +60,7 @@ class Reader:
class CEnv(Structure):
_fields_ = [
- ("dats", POINTER(POINTER(c_ubyte))),
+ ("dats", POINTER(CReader)),
("datlen", c_size_t),
("reg", POINTER(c_uint)),
("reglen", c_size_t),
@@ -68,7 +68,8 @@ class CEnv(Structure):
("stkptr", c_size_t),
("stklen", c_size_t),
("r_current", CReader),
- ("r_start", CReader)
+ ("r_start", CReader),
+ ("fd", c_int)
]
class RegisterOverflowError(Exception):
@@ -116,13 +117,7 @@ class Environment:
def getdat(self, n):
if n >= self.cenv.datlen or n < 0:
raise DataOverflowError(n)
- rdr = CReader()
- rdr.p = self.cenv.dats[n]
- # Python does not allow for direct pointer arithmetic
- rdr_p_v = addressof(rdr.p.contents)
- r_start_p_v = addressof(self.cenv.r_start.p)
-
- rdr.left = self.cenv.r_start.left - (rdr_p_v - r_start_p_v)
+ rdr = self.cenv.dats[n]
l = []
w = CWord()
@@ -143,7 +138,7 @@ class Environment:
def __init__(self, prog=None, reglen=32, datlen=32, stklen=4096, prglen=4096):
cenv = CEnv()
- cenv.dats = (POINTER(c_ubyte) * datlen)()
+ cenv.dats = (CReader * datlen)()
cenv.datlen = datlen
cenv.reglen = reglen