Benutzer-Werkzeuge

Webseiten-Werkzeuge


papierkorb:sample2.blk

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

papierkorb:sample2.blk [2025-08-16 17:50] – ↷ Seite von projects:sample2.blk nach papierkorb:sample2.blk verschoben mkapapierkorb:sample2.blk [Unbekanntes Datum] (aktuell) – gelöscht - Externe Bearbeitung (Unbekanntes Datum) 127.0.0.1
Zeile 1: Zeile 1:
-=== EXAMPLES FOR LECTURE #2 === 
  
-<code> 
-Screen 0 not modified      
- 0 \ EXAMPLES FOR LECTURE #2                      17:42JWB09/21/85  
- 1 \ Last change:   Screen  019                   09:57JWB01/17/86  
-                                                                  
-                                                                  
-                                                                  
-                                                                  
-                                                                  
-                                                                  
-                                                                  
-                                                                  
-10                                                                  
-11                                                                  
-12                                                                  
-13                                                                  
-14                                                                  
-15                                                                  
- 
- 
-Screen 1 not modified      
- 0 \ REVIEW - 1                                   17:56JWB09/21/85  
-     FORTH83 B:<name>.BLK     ( Start F83  with VEDIT .)          
-     F83      <name>.BLK     ( Start original F83    )            
-     BYE                     ( Exit FORTH, return to DOS.)        
-     WORDS                   ( List all words in dictionary.)     
-     FORGET  <name>          ( Remove <name> and all following )  
-                             ( words from the dictionary.)        
-     EMPTY                   ( Remove all new words added since ) 
-                             ( this session was started.)         
-     : <name> .... ;         ( Create new word  <name> .)         
-10     ."   <string>        ( Compile the  <string> into the )   
-11                             ( dictionary. <string> will be   )   
-12                             ( printed when word is executed. )   
-13                             ( Do not use outside a colon def.)   
-14     .(   <string> )         ( Print string to terminal. Use  )   
-15                             ( outside a colon definition.    )   
- 
- 
-Screen 2 not modified      
- 0 \ REVIEW - 2                                   18:15JWB09/21/85  
-   last first   DO  ...  LOOP    ( Use within a colon def to )    
-                                 ( loop from first to last.  )    
-   last first  ?DO  ...  LOOP    ( Same as above except loop )    
-                                 ( 0 times if   first=last      
-     BEGIN  ....  AGAIN          ( Use within a colon def to )    
-                                 ( create an infinite loop.  )    
-     SPACE       ( --   -- )     ( Send a space to the display.)  
-     SPACES      ( n    -- )     ( Send n spaces to display. )    
-     CR          ( --   -- )     ( Start a new line on display.)  
-10     EMIT        ( n    -- )     ( Display ASCII character n .)   
-11               ( n    -- )     ( Send top of stack to display.) 
-12             ( m n   sum )     ( Leave sum:  sum = m + n      ) 
-13             ( m n   dif )     ( Leave difference: dif = m - n) 
-14             ( m n   prod )    ( Leave product: prod = m * n  ) 
-15     .S          ( --   -- )     ( Non destructive stack print. ) 
- 
- 
-Screen 3 not modified      
- 0 \ REVIEW - 3                                   18:34JWB09/21/85  
-     MAX         ( m n   max )   ( Leave larger  of m and n )     
-     MIN         ( m n   min )   ( Leave smaller of m and n )     
-     DEPTH       ( --    n     ( Leave count of stack items.)   
-                               ( Comment to end of line       
-      this is a comment  )                                      
-     A:          ( --   -- )     ( Make the current drive A )     
-     B:          ( --   -- )     ( Make the current drive B )     
-     DIR         ( --   -- )     ( List current drive directory.) 
-     LIST        ( n    -- )     ( List screen or block n .)      
-10     LOAD        ( n    -- )     ( Compile screen n .)            
-11     INDEX       ( m n  -- )     ( Index screens m through n .)   
-12               ( --   -- )     ( List the current screen. )     
-13     N L         ( --   -- )     ( List the next  screen. )       
-14     B L         ( --   -- )     ( List the previous screen.)     
-15                                                                  
- 
- 
-Screen 4 not modified      
- 0 \ REVIEW - 4                                   18:49JWB09/21/85  
-     FILE?       ( --   -- )     ( Display current screen file.)  
-     DEFAULT     ( --   -- )     ( Revert to default screen file) 
-                                 ( used when FORTH was started.)  
-     OPEN  <name>.BLK            ( Open an existing screen file.) 
- 5 \  Create a new screen file  <name>.BLK  with n blank screens.)  
-     CREATE-FILE <name>.BLK  ( n   -- )                           
-     MORE        ( n    -- )    ( Add n blank screens to the    ) 
-                                ( end of the current screen file) 
-     QUERY       ( --   -- )    ( Fetch a line of text from user) 
-10     INTERPRET   ( --   -- )    ( Interpret the text line word by 
-11                                ( word.)                          
-12     VEDIT       ( n    -- )    ( Begin editing screen n )        
-13     VED         ( --   -- )    ( Begin editing current screen )  
-14     CAPACITY    ( --    )    ( Leave number of screens in the  
-15                                ( current screen file.)           
- 
- 
-Screen 5 not modified      
- 0 \ EXAMPLES -1                                  09:55JWB01/17/86  
- 1 \ Clear the data (or parameter stack).                           
- 2 : CLEAR  ( ??   empty )                                          
-         DEPTH 0 ?DO  DROP  LOOP ;                                
-                                                                  
- 5 \ Count  from 0 to n .                                           
- 6 : COUNT_UP  ( n   -- )                                           
-         0 ?DO CR         \ Advance to new line.                  
-                        \ Fetch current value of loop counter.  
-                        \ Display it.                           
-10            LOOP  ;   EXIT                                        
-11                                                                  
-12                                                                  
-13                                                                  
-14                                                                  
-15                                                                  
- 
- 
-Screen 6 not modified      
- 0 \ DEBUGGER                                     09:54JWB01/17/86  
- 1 The debugger is designed to let the user single step through     
- 2 the execution sequence of a high level definition. This process  
- 3 is also called tracing.  To activate the debugger type:          
-                                                                  
-         DEBUG   <name>                                           
-                                                                  
- 7 where <name> is the word to be debugged or traced.  When the     
- 8 word <name> is next executed you will get a single step trace    
- 9 showing the next word to be executed and the contents of the     
-10 data stack. Press any key except C F or Q for the next step.     
-11            Quit debugging process.                           
-12            Continue without pausing between steps.           
-13            Return to FORTH to execute other commands.        
-14              You must type  RESUME to continue debugging.      
-15      UNBUG  -  Disconect the debugger or you may crash and burn. 
- 
- 
-Screen 7 not modified      
- 0 \ NEW  WORDS                                   09:55JWB01/17/86  
- 1 \ You add the stack comments and descriptions.                   
-                                                                  
-         DROP                                                     
-         SWAP                                                     
-         DUP                                                      
-         OVER                                                     
-         ROT                                                      
-        -ROT                                                      
-                                                                  
-10         2DROP                                                    
-11         2SWAP                                                    
-12         2DUP                                                     
-13         2OVER                                                    
-14                                                                  
-15                                                                  
- 
- 
-Screen 8 not modified      
- 0 \ EXAMPLE - 2  Volume of a tank.               09:56JWB01/17/86  
-                                                                  
- 2 : TANK_VOLUME   ( l w h   -- )                                   
-         CR ROT DUP  ." Length " .  ." feet"                      
-         CR ROT DUP  ." Width  " .  ." feet"                      
-         CR ROT DUP  ." Height " .  ." feet"                      
-         CR *      ." Volume " .  ." cubic feet." ;             
-                                                                  
- 8 \  Explain  FACTORING .                                          
- 9 \  Show the effect of an incomplete definition.                  
-10 \  More New Words Below.                                         
-11 \  HIDE   ( --   -- )  Mark last word so it cannot be found.     
-12 \  REVEAL ( --   -- )  Mark last word so it can be found.        
-13 \  [                   Stop compiling and resume interpretation. 
-14 \  ]                   Stop interpreting and resume compilation. 
-15                                                                  
- 
- 
-Screen 9 not modified      
- 0 \ EXAMPLE - 3  Volume of a tank factored.      22:32jwb09/21/85  
-                                                                  
- 2 : .ECHO   ( a b c   b c a )                                      
-         ROT DUP . ;                                              
-                                                                  
- 5 : .FT   ( --   -- )                                              
-         ."  feet." CR ;                                          
-                                                                  
- 8 : TANK_VOLUME   ( l w h   -- )                                   
-         CR  ." Length " .ECHO .FT                                
-10             ." Width  " .ECHO .FT                                
-11             ." Height " .ECHO .FT                                
-12    *      ." Volume " .  ." cubic" .FT   ;                     
-13                                                                  
-14                                                                  
-15                                                                  
- 
- 
-Screen 10 not modified      
- 0 \ EXAMPLE - 4  Surface area of closed tank     09:56JWB01/17/86  
- 1 \ New Words                           I made up the ones below   
- 2 \       PICK                          all by myself!!            
- 3 \       ROLL                                                     
- 4 \       NIP                           SPIN  ( a b c  c b a )     
- 5 \       TUCK                          HATCH ( a b c  a b b c )   
- 6 \       3DUP                          SHOVE ( a b c  c a b c )   
-                                                                  
- 8 : TANK_AREA  ( l w h   -- )  \ add stack comments for each line  
-         3DUP            (                                      
-10         5 ROLL *  2 *                                        
-11         -ROT    2 *                                        
-12                                                            
-13         -ROT *  2 *                                          
-14                                                            
-15     CR  ." Surface area of tank is " .  ." square" .FT ;         
- 
- 
-Screen 11 not modified      
- 0 \ PROBLEM - 1   Rectangle area & perimeter     09:56JWB01/17/86  
-                                                                  
- 2 a) Write a word called  .LW  that takes two stack items, a       
-    length and a width and echos the values on separate lines     
-    with identifiers.  Note .LW should leave stack empty.**       
- 5 b) Write a word called AREA that takes two stack items, a        
-    length and a width, and computes and displays the area of a   
-    rectangle.  Note  AREA  should leave the stack empty.**       
- 8 c) Write a word call PERIMETER that takes two stack items, a     
-    length and a width, and computes and displays the perimeter   
-10    of a rectangle.  Note  PERIMETER should leave stack empty.**  
-11 d) Write a word called RECTANGLE that takes two stack items, a   
-12    length and a width, and performs the functions of a b & c .   
-13    Did you use the   .LW , AREA , and PERIMETER in your          
-14    definition of RECTANGLE?                                      
-15 **  It would be better to say: it consumes its stack parameters. 
- 
- 
-Screen 12 not modified      
- 0 \ PROBLEW-2 Tank volume and surface area       09:56JWB01/17/86  
-                                                                  
-   Write words  .LWH   VOLUME   and  AREA  along the lines        
-   of the previous problem except that they take 3 stack items,   
-   length, width, and height.  VOLUME computes the volume of the  
-   tank. AREA computes the surface area of the tank.  Combine     
-   these into a single word   TANK  which performs the function   
-   of all three as in PROBLEM - 1.                                
-                                                                  
-                                                                  
-10                                                                  
-11                                                                  
-12                                                                  
-13                                                                  
-14                                                                  
-15                                                                  
- 
- 
-Screen 13 not modified      
- 0 \ PROBLEM - 3   Rectangle  again.              09:56JWB01/17/86  
-   The area and perimeter of a rectangle       -----------(X2,Y2) 
-   can be determined from the coordinates      |                
-   of either pair of opposite corners.                        
-   A = ( X2 - X1 )*( Y2 - Y1)                  |                
-   P = 2*(( X2 - X1 )+( Y2 - Y1))              -----------        
-                                            (X1,Y1)               
-   Write words to find the length, width, area, and perimeter     
-   and then combine them into one one word as in problem 1.       
-   Can any of the work from problem 1 be used here?               
-10   Do your words work if you feed them upper left and lower       
-11   right coordinates?                                             
-12                                                                  
-13                                                                  
-14                                                                  
-15                                                                  
- 
- 
-Screen 14 not modified      
- 0 \  PROBLEM - 4  Falling objects.               09:56JWB01/17/86  
-   The height of a falling object above the ground at time t      
-   seconds is given by                                            
-            height =  h0 - v0*t - 16*t*t                          
-   where h0 is the initial height in feet                         
-   and v0 is the initial velocity in feet per second.             
-   Write a word called   HEIGHT that takes initial height         
-   initial velocity and a time from the stack and produces the    
-   following output.                                              
-                                                                  
-10   You type:     1000 100 3  HEIGHT     ( return )                
-11   And see :     Initial height is 1000 feet.                     
-12                 Initial velocity is 100 feet per second.         
-13                 Height after  3  seconds is 412  feet.           
-14   Does your solution consist of one long definition?             
-15   ( the 412 above may be wong!! )                                
- 
- 
-Screen 15 not modified      
- 0 \ DIVISION   A real can of worms.              09:56JWB01/17/86  
-      /                                                           
-      MOD                                                         
-      /MOD                                                        
-                                                                  
-                                                                  
-                                                                  
-                                                                  
-                                                                  
-  : TRIANGLE.AREA  ( b h   -- )                                   
-10         * 2 / ;                                                  
-11                                                                  
-12                                                                  
-13                                                                  
-14                                                                  
-15                                                                  
- 
- 
-Screen 16 not modified      
- 0 \ EASY WORDS                                   09:56JWB01/17/86  
-                                                                  
-         1+                                                       
-         2+                                                       
-         1-                                                       
-         2-                                                       
-         2*                                                       
-         2/                                                       
-                                                                  
-         ABS                                                      
-10                                                                  
-11         NEGATE                                                   
-12                                                                  
-13                                                                  
-14                                                                  
-15                                                                  
- 
- 
-Screen 17 not modified      
- 0 \  DISPLAYING A TABLE    contains error!!!     09:57JWB01/17/86  
- 1 \   New word:    .R   ( n w   -- )                               
- 2 \   Print  n  right justified in a field  w  wide.               
- 3 : .ONE  ( n   -- )                                               
-         12 SPACES               \ Indent table entry.            
-         DUP 8 .R                \ Print number.                  
-         DUP DUP *  8 .R         \ Print square of number.        
-     DUP DUP DUP  * *  8 .R ;    \ Print cube of number.          
- 8 : .HEADING  ( --   -- )                                          
-        CR CR CR 14 SPACES                                        
-10        ." NUMBER  SQUARE    CUBE" ;                              
-11 : .TABLE  ( first last   -- )                                    
-12         .HEADING              ?ENOUGH   explain it.            
-13         1+ SWAP                                                  
-14         ?DO CR I .ONE LOOP                                       
-15         CR CR ;                                                  
- 
- 
-Screen 18 not modified      
- 0 \ PROBLEM - 5   Tables for Tanks.              09:57JWB01/17/86  
- 1 a)Modify the previous example so that it gives a table of        
-   volumes and surface areas of cubical tanks.                    
-   The new heading should have the form:                          
-         SIDE    SURFACE AREA     VOLUME                          
-         feet    square feet    cubic feet                        
-         ====    ============   ==========                        
-   Entries should be neatly centered under the table headings!!   
-                                                                  
- 9 b)Repeat the above problem for spherical tanks.  Heading         
-10   should read:  RADIUS    SURFACE AREA     VOLUME   etc.         
-11   For a sphere   V = 4 pi R*R*R/                               
-12                  S = 4 pi R*R                                    
-13                 pi = 3.1416                                      
-14   Hint:  to multiply by pi see Brodie page 122 or use -          
-15 : *PI  ( n   n*pi )   355 113  */  ;                             
- 
- 
-Screen 19 not modified      
- 0 \  ASCII TABLE                                 09:57JWB01/17/86  
- 1 : .ONE  ( n   -- )                                               
-         12 SPACES DUP EMIT DUP 4 .R                              
-         HEX 4 .R DECIMAL ;                                       
- 4 : .HEADING  ( --   -- )                                          
-        CR CR CR 9 SPACES ." CHAR DEC HEX"  ;                     
- 6 : ATABLE  ( first last   -- )                                    
-         .HEADING                                                 
-         1+ 256 MIN                                               
-         SWAP  0 MAX                                              
-10         ?DO CR I .ONE LOOP ;                                     
-11 : .TABLE  ( --   -- )                                            
-12         16 0 DO  I 16 * DUP 15 +                                 
-13                  ATABLE  KEY  DROP                               
-14              LOOP ;                                              
-15                                                                  
- 
- 
-Screen 20 not modified      
- 0 \ Notes on Starting Forth. 1                   17:12JWB09/22/85  
- 1 \ P 50    Replace 'S with SP@ or define  : '  SP@ ;            
- 2 \         Replace S0 with SP0 or define  : S0   SP0 ;            
- 3 \  Because FORTH83 loops work differently you should use:        
-         : .S CR  SP@ SP0 @ 2DUP <>                               
-              IF   2- DO I  @ . -2 +LOOP                          
-              ELSE 2DROP ." EMPTY" THEN   ;                       
- 7 \ Or  just use .S  that is already part of your system.          
-                                                                  
- 9 \ P 66-72  Use:    n  VEDIT     to edit screen n .               
-10 \ The original F83.COM fill supports the STARTING FORTH style    
-11 \ editor.   Go back to DOS and type  F83  <name>.BLK  to try it. 
-12 \ P 83  See notes for P 50 above.  Also VIEW  .S  to see how     
-13 \        the F83 version is implemented.                         
-14                                                                  
-15                                                                  
- 
- 
-Screen 21 not modified      
- 0 \ Notes on Starting Forth. 2                   17:12JWB09/22/85  
- 1 \ P 110 In F83 I J and K are used only within loops to fetch     
- 2 \       the current values of the loop counters.  Use  R@        
- 3 \       instead of I to fetch a copy of the top of the return    
- 4 \       stack to the parameter stack without changing the        
- 5 \       return stack.                                            
- 6 \       Use the sequence:  R> R@ SWAP >R  within a definition    
- 7 \       instead of I' to fetch  a copy of the second item on     
- 8 \       the return stack.  Or use the definition:                
- 9 : 2R@   R> R> R@ -ROT >R >R ;                                    
-10 \       Use 2R@  for I' .   I' is a poor name!!                  
-11 \       WARNING!  It is dangerous to mess with the return stack. 
-12 \ P112  Use  R@  instead of I  ,  also a dot  .  was ommited     
-13 \       from the definition of QUADRATIC.   See below.           
-14 : QUADRATIC     ( a b c x   n )                                  
-15         >R SWAP ROT R@ * + R> * + .  ;                           
- 
- 
-Screen 22 not modified      
- 0 \ Notes on Starting Forth. 3                   17:13JWB09/22/85  
- 1 \ P 119 Error in footnote!                                       
- 2 : R%  50 */ 1+ 2/ ;                                              
- 3 \ P 123 I I' and J  see comments for page 110.                   
- 4 \ P 131 For COMPOUND to display as in text  insert a   CR        
- 5 \       before  SWAP .  ie  : COMPOUND  CR SWAP 21 0 DO  etc     
- 6 \ P 135 There is an error in TEST -  should be 10 10 DO  but     
- 7 \       even so . .   the FORTH83  DO .. LOOP is not like        
- 8 \       the one in Starting FORTH !!!!   Try the following       
- 9 : -TEST  DO I . ?KEY ?LEAVE ( any key exit ) -1 +LOOP ;          
-10 : +TEST  DO I . ?KEY ?LEAVE ( any key exit )  1 +LOOP ;          
-11 \  9 10 +TEST   loops 65534 times.  9 10 -TEST gives   10 9      
-12 \ 10 10 +TEST   loops 65535 times. 10 10 -TEST gives   10        
-13 \ 11 10 +TEST  gives  10           11 10 -TEST loops 65535 times 
-14 \ If you try any of the longer loops above press any key to      
-15 \ abort!!                                                        
- 
- 
-Screen 23 not modified      
- 0 \ Notes on Starting Forth. 4                   17:13JWB09/22/85  
- 1 \ P 137 XX will clear the stack as indicated but our definition  
- 2 \       : CLEAR  DEPTH 0 ?DO DROP LOOP ;  will do it without     
- 3 \       the error message.  An alternate definition of CLEAR is: 
- 4 : CLEAR  SP0 @ SP! ;                                             
- 5 \ P 140 In FORTH83  LEAVE causes an immediate exit from the      
- 6 \       DO ... LOOP  !!  Thus any words between LEAVE and LOOP   
- 7 \       will not be executed if the condition for leaving is     
- 8 \       is satisfied.  Try the following and note that  HELLO    
- 9 \       is not printed the last time.                            
-10 : HELLOS  10 1 DO CR I . I 5 = IF LEAVE THEN ." HELLO" LOOP ;    
-11 \       Note: ?LEAVE can replace the phrase  IF LEAVE THEN       
-12 \ P 142-143  Use CLEAR-SCREEN definition below instead of PAGE   
-13 : CLEAR-SCREEN  0 0 0 2 [ EDITOR ] VIDEO-IO 2DROP 2DROP ; FORTH  
-14                                                                  
-15                                                                  
- 
- 
-Screen 24 not modified      
- 0 \ Notes on Starting Forth. 5                   17:13JWB09/22/85  
- 1 \ P 161 In FORTH83  UM*     is the name for U*                   
- 2 \       and         UM/MOD  is the name for U/MOD                
- 3 \       In FORTH83  all loops are relative, use +LOOP for /LOOP  
- 4 \ P 164 Double number punctuation is  .  only!  not  ,           
- 5 \ P 166 Use the     for the  ,  in the double numbers!!!       
- 6 \ P 169 FORTH83   SIGN  uses the first number on the stack!!     
- 7 \       Whenever Brodie uses  SIGN  replace it with  ROT SIGN    
- 8 \ P 170 Replace   SIGN   with   ROT  SIGN                        
- 9 \       VIEW  D.  to see how F83  formats numbers.               
-10 \ P 172 Replace   SIGN   with   ROT  SIGN                        
-11 \ P 174 Use the definitions below:                               
-12 : M+    S>D D+ ;     : M/    M/MOD  NIP ;                        
-13 : M*/   2DUP XOR SWAP ABS >R SWAP ABS >R OVER XOR -ROT           
-14         DABS SWAP R@ UM* ROT R> UM* ROT 0 D+ R@ UM/MOD           
-15         -ROT R> UM/MOD NIP SWAP ROT ?DNEGATE ;                   
- 
- 
-Screen 25 not modified      
- 0 \ Notes on Starting Forth. 6                   17:28JWB09/22/85  
- 1 \ P 177 In FORTH83  use   UM*  for  U* and UM/MOD for U/MOD      
- 2 \       In FORTH83  use  +LOOP for /LOOP                         
- 3 \ P 178 Use  ROT SIGN where ever Brodie uses SIGN  !!            
- 4 \ P 202 Use CLEAR-SCREEN definition given earlier for  PAGE      
- 5 \ P 204 Use +LOOP  for /LOOP                                     
- 6 \ P 215 Type  VIEW  INTERPRET  for definition of our INTERPRET   
- 7 \ P 217 In F83  DEFER   is used for execution vectors.           
- 8 \ P 233 In F83  the variable H is called  DP                     
- 9 \ P 235-237  : ' SP@ ;                                         
-10 \ P 240 Use DP  instead of H  ;  No OFFSET in this system.       
-11 \ P 242 F83 Uses the ONLY vocabulary structure. See the FORTH-83 
-12 \       standard or wait till we discuss it in class.            
-13 \ P 247 Use DP  instead of H  .                                  
-14                                                                  
-15                                                                  
- 
- 
-Screen 26 not modified      
- 0 \ BYTE                                         21:51JWB09/22/85  
- 1 - the smallest piece of data that can be accessed by most modern 
-   micro-computers.                                               
- 3 - consists of a cell of 8 binary bits:  01110101 <= see the byte 
- 4 - the low order bit is number  0.       76543210 <= bit number   
- 5 - the high order bit is number 7.                                
- 6 - the bit pattern in a byte can represent an unsigned integer:   
-          0 -      255 decimal                                    
-   00000000 - 11111111 binary                                     
-         00 -       FF hexadecimal                                
-10 - the data structure often represented by bytes is the ASCII     
-11   character.                                                     
-12       20  control characters.                                  
-13    21  127  common symbols, digits, letters.                     
-14   128  255  in the IBM-PC  the extended character set.           
-15                                                                  
- 
- 
-Screen 27 not modified      
- 0 \ WORD                                         22:14JWB09/22/85  
- 1 - a word consists of two bytes or 16 binary bits.                
- 2 - most easily represented by four hexadecimal digits.            
- 3 - examples:  A123   FEED  DEAD                                   
- 4 - the bit pattern in a word can represent an unsigned integer:   
-         0 - 65535  decimal    0000 - FFFF  hexadecimal           
- 6 - micro computers can access 65,535 memory cells (bytes) using   
-   the word as an address pointer.                                
- 8 - the bit pattern in a word can also represent signed integers:  
-      -32768 - 32767  decimal   -8000 - 7FFF  hexadecimal         
-10 - In FORTH each data stack number is represented by a word.      
-11 - In FORTH address are represented by words or unsigned integers 
-12   thus FORTH can address or access 65535 bytes of memory.        
-13                                                                  
-14                                                                  
-15                                                                  
- 
- 
-Screen 28 not modified      
-                                                                  
-                                                                  
- 2 ONLY FORTH ALSO ALSO DEFINITIONS                                 
-                                                                  
- 4 CODE  SPLIT                                                      
-         AX  POP         \ Get number from stack                  
-      BH BH  SUB         \ Clear high bits of BX                  
-      AL BL  MOV                                                
-         BX  PUSH                                                 
-      AH BL  MOV                                                  
-10         BX  PUSH                                                 
-11             NEXT                                                 
-12         END-CODE                                                 
-13                                                                  
-14                                                                  
-15                                                                  
-</code> 
papierkorb/sample2.blk.1755359401.txt.gz · Zuletzt geändert: 2025-08-16 17:50 von mka