;;; Logic words WORD p_and, 'AND',fasm ;; ( x1 x2 -- x3 ) ;; x3 is the bit-by-bit logical "and" of x1 with x2. pop rax and qword [rsp], rax next WORD p_or, 'OR',fasm ;; ( x1 x2 -- x3 ) ;; x3 is the bit-by-bit inclusive-or of x1 with x2. pop rax or qword [rsp],rax next WORD p_xor, 'XOR',fasm ;; ( x1 x2 -- x3 ) ;; x3 is the bit-by-bit exclusive-or of x1 with x2. pop rax xor qword [rsp],rax next WORD p_not, 'NOT',fasm ;; ( x -- v ) ;; v = 0 if x is non-zero and -1 otherwise not qword [rsp] next WORD p_false, 'FALSE',fasm ;; ( -- 0 ) ;; Push a false flag, 0. push qword 0 next WORD p_true, 'TRUE',fasm ;; ( -- true ) ;; Return a true flag, -1. (non-zero) push qword -1 next WORD p_within, 'WITHIN',fasm ;; ( n1 n2 n3 -- flag ) ;; Push true if n2 <= n1 and n1 < n3 and false otherwise. xor rcx,rcx pop rax pop rbx cmp qword [rsp],rbx jl p_within_not cmp qword [rsp],rax jge p_within_not not rcx p_within_not: next WORD p_0less, '0<',fasm ;; ( n -- flag ) ;; flag is true (non-zero) if and only if n is less than zero. xor rax,rax cmp qword [rsp],0 jge p_0less.lt not rax p_0less.lt: next WORD p_0equal, '0=',fasm ;; ( x -- flag ) ;; flag is true if x is equal to zero otherwise false. xor rax,rax cmp qword [rsp],0 jne p_0equal.ne not rax p_0equal.ne: next WORD p_lessthan, '<',fasm ;; ( n1 n2 -- flag ) ;; flag is true if and only if n1 is less than n2. xor rax,rax pop rbx cmp qword [rsp], rbx jge p_lessthan.ge not rax p_lessthan.ge: mov qword [rsp], rax next WORD p_equal, '=',fasm ;; ( x1 x2 -- flag ) ;; flag is true if and only if x1 is bit-for-bit the same as ;; x2. xor rax,rax pop rbx cmp qword [rsp], rbx jne p_equal.ne not rax p_equal.ne: mov qword [rsp], rax next WORD p_greaterthan, '>',fasm ;; ( n1 n2 -- flag ) ;; flag is true if and only if n1 is greater than n2. xor rax,rax pop rbx cmp qword [rsp], rbx jle p_greaterthan.le not rax p_greaterthan.le: mov qword [rsp], rax next