File:  [gforth] / gforth / arch / shboom / sh.p
Revision 1.1: download - view: text, annotated - select for diffs
Sat May 2 21:34:00 1998 UTC (23 years, 5 months ago) by pazsan
Branches: MAIN
CVS tags: v0-6-2, v0-6-1, v0-6-0, v0-5-0, v0-4-0, HEAD
Mega-Patch; added directories


fpath= ./|../gec/
s" arch/shboom/mach.fs"
Create mach-file here over 1+ allot place
include ec/builttag.fs
include cross.fs
include ec/shex.fs

\ load compiler extentions
unlock >CROSS
include arch/shboom/compiler.fs

$180 $8000 over - ( start len ) region dictionary
setup-target

>ENVIRON

false SetValue compiler
true SetValue interpreter

lock

prims-include

: cell M 24 ;

: branch  ( -- ) 
 r> dup @ + >r ;   

: ?branch  ( f -- )
 0= dup     \ !f !f
 r> dup @   \ !f !f IP branchoffset
 rot and +  \ !f IP|IP+branchoffset
 swap 0= cell and + \ IP''
 >r ;
 
: skip1
  r> cell+ noop noop noop >r ; 

: (emit)
  $A0300014
  .quad4 dup @ M 90 M 20
  and M 17 M FF M FF
  drop $A0300000 ! ;

\ : (emit) $A0300014 BEGIN dup @ $20 and UNTIL drop $A0300000 ! ;

: (type)
  BEGIN dup  WHILE
        >r dup c@ (emit) 1+ r> 1-
  REPEAT 2drop ;

: (key)
  $A0300014
  .quad4 dup @ M 90 M 01
  and M 17 M FF M FF
  drop $A0300000 @ $7f and ;

: key? $A0300014 @ 01 and 0= 0= ;

\ noninline versions:
\ : :dovar   ( '2 (emit ) r> cell+ ; isdoer
\ : :docon ( '( (emit ) noop noop r> cell+ @ ; isdoer
\ : :douser  ( '5 (emit ) noop r> cell+ @ up@ + ; isdoer

: :dovar _inline 7 add_pc, ; isdoer
: :docon _inline 7 add_pc, @ ; isdoer
: :douser _inline 7 add_pc, @ up@ + ; isdoer

: :dodoes  ( '4 (emit ) r> dup cell+ swap @ execute ; isdoer
\ .quad3 push.l up@ +
: :dodefer ( '6 (emit ) noop r> cell+ @ execute ; isdoer


'1 constant #1
include ec/dotx.fs

1 [IF]      
undef-words
include kernel/prim.fs
all-words
include kernel/vars.fs
include kernel/basics.fs
include kernel/io.fs
include kernel/nio.fs
[THEN]

variable test2
create ctest 'A c, 'B c, 'C c, 'D c,
create test$ ," Hallo dies ist ein Test!"

\ : c@ @ $ff and ;

\ : test  '* $A0000000 ! ;
: looptest '9 .quad4 BEGIN dup (emit) 1- dup '0 = UNTIL (emit) '; (emit) ;
: looptest3 BEGIN looptest AGAIN ;
: looptest2 	'A (emit) 'B (emit)
		'0 skip1 1+ noop noop noop 1+ noop noop noop 1+ noop noop noop
  		1+ noop noop noop (emit) 
  		'1 1 xor (emit) '3 $fe and (emit) '4 $01 or (emit)
  		'5 0 0= + (emit) '6 1 0= + (emit)
  		'0 '0 = dup 'Y and swap 0= 'N and or (emit) 
  		'0 1237 = dup 'Y and swap 0= 'N and or (emit) 
  		'; dup (emit) (emit) 
  		;

has? interpreter 0= [IF]
: boot  \ '. (emit) (emit) (emit)
        '. (emit)
        test$ count (type)
\        ." Hallo dies ist ein Test!!!" cr cr 
        ." Hallo" cr
	$5123 .x $9831 .x
	looptest test$ count (type)
	'. dup (emit) (emit)
	BEGIN test$ count (type) AGAIN
\  	'1 (emit) '2 (emit) 
\	ctest dup c@ (emit) 1+ dup c@ (emit) 1+ dup c@ (emit) 1+ c@ (emit)
\ 	test2 test$ test$ 1+ dup c@ (emit) 1+ dup c@ (emit) 
\	test$ count (type) ;
	;
[THEN]

has? interpreter [IF]
include kernel/saccept.fs
include kernel/errore.fs
\ include kernel/interp.fs
include kernel/int.fs
has? compiler [IF]
include kernel/comp.fs
include kernel/cond-old.fs    \ load IF and co w/o locals
include kernel/toolsext.fs
[THEN]
include kernel/doers.fs
include kernel/version.fs
include kernel/tools.fs               \ load tools ( .s dump )

[THEN]

\ include /devel/src/forth/bench/8queens.fs
include arch/misc/tt.fs
include fib.fs
include ../jeans/ec/bench/benchrd.fs

: test1 10 0 DO I . I 5 = IF LEAVE THEN LOOP ;

create tibbuf 100 allot

include arch/shboom/dis2.fs

include kernel/special.fs

: boot
\D 1 'B (emit)
  main-task up!
  rp@ rp0 !
  sp@ sp0 !
  tibbuf dup >tib ! tibstack ! #tib off >in off
  BEGIN
        ['] cold catch DoError
  AGAIN ;
[THEN]

\ Initialization

>ram
here normal-dp !
unlock tudp @
lock
udp !

unlock tlast @
lock
1 cells - dup forth-wordlist ! last !

' boot cpu-start

$180 here $180 - save-region-shex sh.s3

unlock >MINIMAL
: l 	s" cat sh.s3 >/dev/cua6" system ;
: g	s" echo G >/dev/cua6" system ;
lock

.unresolved
unlock
.regions

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>