Permalink
Browse files

Restructure bootstrap.

  • Loading branch information...
1 parent ac90920 commit 45a692e507325ed69711c72f0c347300237eb882 @danmey committed Jun 9, 2011
Showing with 24 additions and 28 deletions.
  1. +20 −22 bootstrap.4k
  2. +3 −5 demos/plasma.4k
  3. +1 −1 lib/disas.4k
View
@@ -46,8 +46,10 @@ token : (:) token (:) ;
: here@ here @ ;
: begin here@ ; immediate
-: until postpone branch0 here@ - c, ; immediate
+: until postpone branch0 here@ - c, ; immediate
: | begin key 10 = until ; immediate
+| ANS compability
+: \ postpone | ; immediate
| State manipulation
: [ 1 state ! ; immediate
: ] 0 state ! ;
@@ -87,27 +89,41 @@ variable #section
: repeat postpone branch swap here@ - c, dup here@ swap - swap c! ; immediate
| Compile read character
: c: key state @ 0 = if literal then ; immediate
+| Increments, decrements, tests
+: 1+ 1 + ;
+: 1- 1 - ;
+: 0= 0 = ;
+| New line space (does not honor windows)
+: cr 10 emit ;
+: space 32 emit ;
+| Operation on pair of cells
+: 2drop drop drop ;
+: over swap dup >r swap r> ;
+: 2dup over over ;
| Line comments
: ( 1
begin
c: ) key dup rot = if swap 1- dup 0 = if drop drop ;; then swap then
c: ( = if 1+ then
- again ; immediate
+ again ; immediate
| Case statement
: ?dup dup if dup then ;
: case 0 ; immediate
: of postpone over postpone = postpone if postpone drop ; immediate
: endof postpone else ; immediate
: endcase' begin ?dup while postpone then repeat ; immediate
: endcase postpone drop postpone endcase' ; immediate
+| to verbose but will make optimisations later
+| by default we will use byte bytes, as it is meant to be 4kb tool
+: r ( -- r ) postpone r> postpone dup postpone >r ; immediate
+: rdrop ( -- r: v -- ) postpone r> postpone drop ; immediate
| Counted loops
: do
postpone swap postpone >r postpone >r postpone begin
; immediate
: leave postpone r> postpone r> postpone drop postpone drop ; immediate
-: loop
- postpone r>
+: loop postpone r>
postpone dup
postpone 1+
postpone r
@@ -132,19 +148,6 @@ variable #section
postpone swap
postpone >r
; immediate
-| Increments, decrements, tests
-: 1+ 1 + ;
-: 1- 1 - ;
-: 0= 0 = ;
-| New line space (does not honor windows)
-: cr 10 emit ;
-: space 32 emit ;
-| ANS compability
-: \ postpone | ; immediate
-| Operation on pair of cells
-: 2drop drop drop ;
-: over swap dup >r swap r> ;
-: 2dup over over ;
| Increment variable
: inc ( adr -- ) dup @ 1+ swap ! ;
: dec ( adr -- ) dup @ 1- swap ! ;
@@ -172,11 +175,6 @@ comment
: 1-! 1 swap -! ;
: data: here there @ here@ there ! swap ! ;
: data; data: ;
-| to verbose but will make optimisations later
-| by default we will use byte bytes, as it is meant to be 4kb tool
-: r ( -- r ) postpone r> postpone dup postpone >r ; immediate
-: rdrop ( -- r: v -- ) postpone r> postpone drop ; immediate
-
| STRINGS
create #str 1000 allot
View
@@ -150,12 +150,10 @@ height 2 / i>f fconst h/2
: main
load-symbols
init-pallete
- video screen !
- render-loop
+| video screen !
+| render-loop
0 exit
;
| save-image im.4ki
-| main
-
-
+main
View
@@ -61,4 +61,4 @@
c: ; emit
;
-: show: token find show ;
+: show: token find show ;

0 comments on commit 45a692e

Please sign in to comment.