diff --git a/j1a/nandland-go/shell.py b/j1a/nandland-go/shell.py index 343b68b..2c0336a 100644 --- a/j1a/nandland-go/shell.py +++ b/j1a/nandland-go/shell.py @@ -58,7 +58,7 @@ def serialize(self): for l in lines: l = l.split() s += [int(b, 16) for b in l[1:17]] - s = array.array('B', s).tostring().ljust(8192, chr(0xff)) + s = array.array('B', s).tobytes().ljust(8192, bytes([0xFF])) return array.array('H', s) if __name__ == '__main__': diff --git a/j1a/shell.py b/j1a/shell.py index 97e6576..6ca95a6 100644 --- a/j1a/shell.py +++ b/j1a/shell.py @@ -65,7 +65,7 @@ def serialize(self): for l in lines: l = l.split() s += [int(b, 16) for b in l[1:17]] - s = array.array('B', s).tostring().ljust(8192, chr(0xff)) + s = array.array('B', s).tobytes().ljust(8192, bytes([0xFF])) return array.array('H', s) if __name__ == '__main__': diff --git a/j1a/verilator/shell.py b/j1a/verilator/shell.py index 40527ff..7cf8487 100644 --- a/j1a/verilator/shell.py +++ b/j1a/verilator/shell.py @@ -46,7 +46,7 @@ def serialize(self): for l in lines: l = l.split() s += [int(b, 16) for b in l[1:17]] - s = array.array('B', s).tostring().ljust(8192, chr(0xff)) + s = array.array('B', s).tobytes().ljust(8192, bytes([0xFF])) return array.array('H', s) if __name__ == '__main__': diff --git a/j1a/verilator/simshell4.py b/j1a/verilator/simshell4.py index 16d1bab..d6b9141 100644 --- a/j1a/verilator/simshell4.py +++ b/j1a/verilator/simshell4.py @@ -46,7 +46,7 @@ def serialize(self): for l in lines: l = l.split() s += [int(b, 16) for b in l[1:17]] - s = array.array('B', s).tostring().ljust(8192, chr(0xff)) + s = array.array('B', s).tobytes().ljust(8192, bytes([0xFF])) return array.array('H', s) if __name__ == '__main__': diff --git a/j1b/shell.py b/j1b/shell.py index 4109043..a6b5269 100644 --- a/j1b/shell.py +++ b/j1b/shell.py @@ -54,7 +54,7 @@ def serialize(self): for l in lines: l = l.split() s += [int(b, 16) for b in l[1:17]] - s = array.array('B', s).tostring().ljust(32768, chr(0xff)) + s = array.array('B', s).tobytes().ljust(8192, bytes([0xFF])) return array.array('i', s) if __name__ == '__main__': diff --git a/shell/swapforth.py b/shell/swapforth.py index 0bb0f6b..4aa03ef 100755 --- a/shell/swapforth.py +++ b/shell/swapforth.py @@ -200,12 +200,12 @@ def shellcmd(self, cmd): if dest.endswith('.hex'): open(dest, "w").write("".join(["%08x\n" % (x & 0xffffffff) for x in d])) else: - open(dest, "wb").write(array.array("i", d).tostring()) + open(dest, "wb").write(array.array("i", d).tobytes()) else: if dest.endswith('.hex'): open(dest, "w").write("".join(["%04x\n" % (x & 0xffff) for x in d])) else: - open(dest, "wb").write(array.array("h", d).tostring()) + open(dest, "wb").write(array.array("H", d).tobytes()) elif cmd.startswith('#setclock'): n = datetime.utcnow() cmd = "decimal %d %d %d %d %d %d >time&date" % (n.second, n.minute, n.hour, n.day, n.month, n.year)