Quellcode durchsuchen

Move core's readln to xcomp core (high)

pull/102/head
Virgil Dupras vor 4 Jahren
Ursprung
Commit
d956386e9b
11 geänderte Dateien mit 60 neuen und 61 gelöschten Zeilen
  1. +1
    -1
      blk/420
  2. +10
    -12
      blk/426
  3. +16
    -16
      blk/427
  4. +0
    -0
      blk/428
  5. +0
    -0
      blk/429
  6. +3
    -3
      blk/430
  7. +14
    -0
      blk/431
  8. +16
    -0
      blk/432
  9. +0
    -13
      blk/447
  10. +0
    -16
      blk/448
  11. BIN
      emul/forth.bin

+ 1
- 1
blk/420 Datei anzeigen

@@ -1 +1 @@
1 7 LOADR+ ( xcomp core high )
1 12 LOADR+ ( xcomp core high )

+ 10
- 12
blk/426 Datei anzeigen

@@ -1,14 +1,12 @@
( LITN has to be defined after the last immediate usage of
it to avoid bootstrapping issues )
: LITN 32 , , ( 32 == NUMBER ) ;
: RDLNMEM+ 0x57 RAM+ @ + ;
( current position in INBUF )
: IN> 0 RDLNMEM+ ;
( points to INBUF )
: IN( 2 RDLNMEM+ ;
( points to INBUF's end )
: IN) 0x40 ( buffer size ) 2+ RDLNMEM+ ;

: IMMED? 1- C@ 0x80 AND ;

( ';' can't have its name right away because, when created, it
is not an IMMEDIATE yet and will not be treated properly by
xcomp. )
: _
['] EXIT ,
R> DROP ( exit : )
; IMMEDIATE
( flush input buffer )
( set IN> to IN( and set IN> @ to null )
: (infl) 0 IN( DUP IN> ! ! ;


+ 16
- 16
blk/427 Datei anzeigen

@@ -1,16 +1,16 @@
XCURRENT @ ( to PSP )
: :
(entry)
( We cannot use LITN as IMMEDIATE because of bootstrapping
issues. Same thing for ",".
32 == NUMBER 14 == compiledWord )
[ 32 H@ ! 2 ALLOT 14 H@ ! 2 ALLOT ] C,
BEGIN
WORD
(find)
( is word )
IF DUP IMMED? IF EXECUTE ELSE , THEN
( maybe number )
ELSE (parse) LITN THEN
AGAIN ;
( from PSP ) ';' SWAP 4 - C!
( handle backspace: go back one char in IN>, if possible, then
emit SPC + BS )
: (inbs)
( already at IN( ? )
IN> @ IN( = IF EXIT THEN
IN> @ 1- IN> !
SPC BS
;
: KEY
85 RAM+ @ ( (key) override )
DUP IF EXECUTE ELSE DROP (key) THEN ;
( cont.: read one char into input buffer and returns whether we
should continue, that is, whether CR was not met. )

blk/449 → blk/428 Datei anzeigen


blk/450 → blk/429 Datei anzeigen


blk/451 → blk/430 Datei anzeigen

@@ -2,11 +2,11 @@
: RDLN$
( 57 == rdln's memory )
H@ 0x57 RAM+ !
( 2 for IN>, plus 2 for extra bytes after buffer: 1 for
( plus 2 for extra bytes after buffer: 1 for
the last typed 0x0a and one for the following NULL. )
INBUFSZ 4 + ALLOT
IN) IN> - 2+ ALLOT
(infl)
['] RDLN< 0x0c RAM+ !
LIT< RDLN< (find) DROP 0x0c RAM+ !
1 0x06 RAM+ ! ( 06 == C<? )
;


+ 14
- 0
blk/431 Datei anzeigen

@@ -0,0 +1,14 @@
( LITN has to be defined after the last immediate usage of
it to avoid bootstrapping issues )
: LITN 32 , , ( 32 == NUMBER ) ;

: IMMED? 1- C@ 0x80 AND ;

( ';' can't have its name right away because, when created, it
is not an IMMEDIATE yet and will not be treated properly by
xcomp. )
: _
['] EXIT ,
R> DROP ( exit : )
; IMMEDIATE


+ 16
- 0
blk/432 Datei anzeigen

@@ -0,0 +1,16 @@
XCURRENT @ ( to PSP )
: :
(entry)
( We cannot use LITN as IMMEDIATE because of bootstrapping
issues. Same thing for ",".
32 == NUMBER 14 == compiledWord )
[ 32 H@ ! 2 ALLOT 14 H@ ! 2 ALLOT ] C,
BEGIN
WORD
(find)
( is word )
IF DUP IMMED? IF EXECUTE ELSE , THEN
( maybe number )
ELSE (parse) LITN THEN
AGAIN ;
( from PSP ) ';' SWAP 4 - C!

+ 0
- 13
blk/447 Datei anzeigen

@@ -1,13 +0,0 @@
64 CONSTANT INBUFSZ
: RDLNMEM+ 0x57 RAM+ @ + ;
( current position in INBUF )
: IN> 0 RDLNMEM+ ;
( points to INBUF )
: IN( 2 RDLNMEM+ ;
( points to INBUF's end )
: IN) INBUFSZ 2+ RDLNMEM+ ;

( flush input buffer )
( set IN> to IN( and set IN> @ to null )
: (infl) 0 IN( DUP IN> ! ! ;


+ 0
- 16
blk/448 Datei anzeigen

@@ -1,16 +0,0 @@
( handle backspace: go back one char in IN>, if possible, then
emit SPC + BS )
: (inbs)
( already at IN( ? )
IN> @ IN( = IF EXIT THEN
IN> @ 1- IN> !
SPC BS
;

: KEY
85 RAM+ @ ( (key) override )
DUP IF EXECUTE ELSE DROP (key) THEN ;


( cont.: read one char into input buffer and returns whether we
should continue, that is, whether CR was not met. )

BIN
emul/forth.bin Datei anzeigen


Laden…
Abbrechen
Speichern