mirror of
https://github.com/nineties/planckforth
synced 2024-12-25 21:58:22 +01:00
change unit size of array of python version
This commit is contained in:
parent
f38e55984f
commit
46c6196c2c
1 changed files with 3 additions and 2 deletions
|
@ -17,7 +17,7 @@ VERSION = "{}:{}".format(RUNTIME_NAME, COPYRIGHT)
|
||||||
|
|
||||||
MEMORY_SIZE = 0x10000
|
MEMORY_SIZE = 0x10000
|
||||||
|
|
||||||
memory = array.array('i', [0]*MEMORY_SIZE)
|
memory = array.array('l', [0]*MEMORY_SIZE)
|
||||||
CELL = memory.itemsize
|
CELL = memory.itemsize
|
||||||
CELLm1 = CELL - 1
|
CELLm1 = CELL - 1
|
||||||
CELL_SHIFT = CELL.bit_length() - 1
|
CELL_SHIFT = CELL.bit_length() - 1
|
||||||
|
@ -41,10 +41,11 @@ def align():
|
||||||
write(HERE_CELL, aligned(read(HERE_CELL)))
|
write(HERE_CELL, aligned(read(HERE_CELL)))
|
||||||
|
|
||||||
def read(addr):
|
def read(addr):
|
||||||
|
print(addr, addr >> CELL_SHIFT)
|
||||||
return memory[addr >> CELL_SHIFT]
|
return memory[addr >> CELL_SHIFT]
|
||||||
|
|
||||||
def write(addr, v):
|
def write(addr, v):
|
||||||
memory[addr >> CELL_SHIFT] = ctypes.c_int(v).value
|
memory[addr >> CELL_SHIFT] = ctypes.c_long(v).value
|
||||||
|
|
||||||
def comma(v):
|
def comma(v):
|
||||||
here = read(HERE_CELL)
|
here = read(HERE_CELL)
|
||||||
|
|
Loading…
Reference in a new issue