aforth

FORTH for Linux x86-64, written in assembly.
git clone git://henryandlizzy.uk/aforth
Log | Files | Refs | README

boolean.s (456B)


      1 #	Logic
      2 
      3 verb	code	TRUE
      4 	_dup
      5 	movq	$-1,	TOS
      6 	jmp	next
      7 
      8 verb	code	FALSE	"0"
      9 	_dup
     10 	xor	TOS,	TOS
     11 	jmp	next
     12 
     13 verb	code	lshift	"<<"
     14 	minstk	1
     15 	shl	TOS
     16 	jmp	next
     17 
     18 verb	code	rshift	">>"
     19 	minstk	1
     20 	shr	TOS
     21 	jmp	next
     22 
     23 verb	code	halve	"2/"
     24 	minstk	1
     25 	sar	TOS
     26 	jmp	next
     27 
     28 verb	code	NOT
     29 	minstk	1
     30 	not	TOS
     31 	jmp	next
     32 
     33 verb	code	AND
     34 	minstk	2
     35 	and	TOS,	(SP)
     36 	jmp	_drop
     37 
     38 verb	code	OR
     39 	minstk	2
     40 	or	TOS,	(SP)
     41 	jmp	_drop
     42 
     43 verb	code	XOR
     44 	minstk	2
     45 	xor	TOS,	(SP)
     46 	jmp	_drop