aforth

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

input.s (662B)


      1 #	Input
      2 
      3 verb	forth	TIB
      4 	scratch	256	#80
      5 	endword
      6 
      7 verb	forth	numtib	"\#TIB"
      8 	variable
      9 	endword
     10 
     11 verb	forth	numin	"\#IN"
     12 	variable
     13 	endword
     14 
     15 verb	code	ACCEPT
     16 	minstk	2
     17 	mov	$0,	CMD
     18 	mov	$0,	ARGA
     19 	mov	(SP),	ARGB
     20 	mov	TOS,	ARGC
     21 	syscall
     22 	mov	CMD,	(SP)
     23 	jmp	_drop
     24 
     25 verb	forth	WORD
     26 	do	pushret
     27 	do	HERE
     28 	const	0
     29 	do	OVER
     30 	do	store
     31 	const	8
     32 	do	plus
     33 1:		get	numin
     34 		get	numtib
     35 		do	gequal
     36 	if	3f
     37 		do	TIB
     38 		get	numin
     39 		do	plus
     40 		do	fetchb
     41 		do	numin
     42 		do	incaddr
     43 		do	DUP
     44 		const	' '
     45 		do	less
     46 		do	OVER
     47 		do	peekret
     48 		do	equal
     49 		do	OR
     50 		if	2f
     51 			do	HERE
     52 			do	incaddr
     53 			do	OVER
     54 			do	storeb
     55 			do	inc
     56 			goto	1b
     57 	2:	do	DROP
     58 3:	do	popret
     59 	do	drop2
     60 	do	HERE
     61 	endword