mirror of
https://github.com/nineties/planckforth
synced 2024-12-25 21:58:22 +01:00
Add uless to python version
This commit is contained in:
parent
50661ee3f3
commit
0de757b72c
1 changed files with 8 additions and 1 deletions
|
@ -6,6 +6,8 @@
|
|||
import os
|
||||
import sys
|
||||
import operator
|
||||
import array
|
||||
import ctypes
|
||||
|
||||
IMPLEMENTATION = "Python 3.x"
|
||||
MEMORY_SIZE = 0x20000
|
||||
|
@ -14,7 +16,7 @@ RSTACK_SIZE = 0x400
|
|||
HERE_CELL = 0
|
||||
LATEST_CELL = 4
|
||||
|
||||
memory = [0]*(MEMORY_SIZE>>2)
|
||||
memory = array.array('l', [0]*(MEMORY_SIZE>>2))
|
||||
|
||||
sp = MEMORY_SIZE>>2
|
||||
rp = (MEMORY_SIZE - STACK_SIZE)>>2
|
||||
|
@ -224,6 +226,11 @@ add_binary_operator('|', operator.or_)
|
|||
add_binary_operator('^', operator.xor)
|
||||
add_binary_operator('<', operator.lt)
|
||||
add_binary_operator('=', operator.eq)
|
||||
def uless():
|
||||
b = ctypes.c_ulong(pop()).value
|
||||
a = ctypes.c_ulong(pop()).value
|
||||
push(a < b)
|
||||
add_simple_operator('u', uless)
|
||||
def argv():
|
||||
push(ARGV_ADDR)
|
||||
push(len(sys.argv))
|
||||
|
|
Loading…
Reference in a new issue