forth

A WIP implementation of Forth targeting UEFI x86-64.
git clone git://git.christianermann.dev/forth
Log | Files | Refs

base.forth (512B)


      1 
      2 : [COMPILE] IMMEDIATE
      3     WORD FIND
      4     >CFA ,
      5 ;
      6 
      7 : CODE
      8     WORD CREATE
      9     LATEST @ >CFA 8 + ,
     10     LATEST @ HIDDEN
     11     ]
     12 ;
     13 
     14 : NEXT IMMEDIATE
     15     48 C,
     16     AD C,
     17     FF C,
     18     20 C,
     19 ;
     20 
     21 : ;CODE IMMEDIATE
     22     [COMPILE] NEXT
     23     ALIGN
     24     LATEST @ HIDDEN
     25     [COMPILE] [
     26 ;
     27 
     28 : RAX IMMEDIATE 0 ;
     29 : RCX IMMEDIATE 1 ;
     30 : RDX IMMEDIATE 3 ;
     31 : RBX IMMEDIATE 4 ;
     32 : R8  IMMEDIATE 41 C, 0 ;
     33 : R9  IMMEDIATE 41 C, 1 ;
     34 
     35 : PUSH IMMEDIATE 50 + C, ;
     36 : POP  IMMEDIATE 58 + C, ;
     37 
     38 : CALL-INDIRECT IMMEDIATE
     39     FF C,
     40     10 + C,
     41 ;
     42