Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!willett!ForthNet From: ForthNet@willett.UUCP (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: Advanced Beginners Message-ID: <592.UUL1.3#5129@willett.UUCP> Date: 2 Mar 90 03:56:12 GMT Organization: Latest link in the ForthNet chain. (Pgh, PA) Lines: 60 Date: 02-28-90 (07:39) Number: 1612 (Echo) To: NICK JANOW Refer#: 1610 From: IAN GREEN Read: NO Subj: ADVANCED BEGINNERS Status: PUBLIC MESSAGE OK, thanks. In the RTX docs I have, it mentions that I have a FOR-NEXT loop construct, so I will use that as it seems to be vaguely usable from my limited understanding of Forth. A code fragment that I was given examplifies what I am aspiring to: HEX CONSTANT UART-BASE 2F8 ; ( com2 ) : CLEAR8250 ( a word to reset a UART ) 6 FOR ( 6 registers ) 0 ( the goose egg ) UART-BASE ( push the base address ) I ( fetch up the loop index ) + ( compute address ) ! ( barf because of I/O mapping ) NEXT ; Now from what I understand the following is also kosher, but highly wasteful of CPU cycles: : CLEAR8250-2 ( mark 2 ) 3 FOR ( outer loop ) 2 FOR ( inner loop ) 0 ( the goose egg again ) UART-BASE ( the invisible UART ) I ( fetch up the outer loop index ) J ( don't forget the inner loop ) + ( compute ) + ( rediculus isn't it ) ! ( finally ) NEXT NEXT ; From what I understand of the syntax of this basic control structure, I can implement 'nested' loops to handle rasters and arrays etc. One idea I have is to try to translate my fractal program into Forth as an exercise. It does require floating point but as I recall, the F83 program has floats internally so that I should be OK. As for data containers I assume I can simply declare a variable as follows: VARIABLE CONTAINER ; or is my syntax bogus? Ian Green NET/Mail : British Columbia Forth Board - Burnaby BC - (604)434-5886 ----- This message came from GEnie via willett through a semi-automated process. Report problems to: 'uunet!willett!dwp' or 'willett!dwp@gateway.sei.cmu.edu'