Changeset 3125a52331ae6d7a6bb77d0ce92a95ddc2580547
Commiter: Charles Childers
Author: Charles Childers
Parent: fc349e2cf1
(2010/03/11 01:13) Almost 2 years ago
Merge branch 'master' of git.assembla.com:retro
Commiter: Charles Childers
Author: Charles Childers
Parent: fc349e2cf1
(2010/03/11 01:13) Almost 2 years ago
Merge branch 'master' of git.assembla.com:retro
: >line ( - ) repeat dict @ here fread drop: >line ( - ) repeat dict @ fread 10 =if ;then again ;here @ 10 =if ;then again ;: readline ( - ) dict-word repeat dict @ over fread! dropinclude source/meta.retroinclude source/core.retroinclude source/stage2.retroinclude source/vocabs.retro: fread ( hc-f ) -2 file.io ;: fread ( h-f ) -2 file.io ;: fsize ( h-n ) -7 file.io ;: fsize ( h-n ) -7 file.io ;{{{{: .colon getxt @ TRUE =if getxt off ;then m, ;: save ( - ) 1 4 out 0 0 out wait [ 99 ,: save ( - ) 1 4 out 0 0 out wait -9 5 out wait ;: boot-new ( - ) relocate [ 8 , 0 , ] ;here IMAGE-SIZE zallot target ! target @ origin !-1 constant TRUE ( -f )0 constant FALSE ( -f ): if ( f- ) FALSE literal, ` !if ; compile-only: if ( f- ) 0 literal, ` !if ; compile-only: = ( xy-f ) =if TRUE ;then FALSE ;: = ( xy-f ) =if -1 ;then 0 ;: <> ( xy-f ) !if TRUE ;then FALSE ;: <> ( xy-f ) !if -1 ;then 0 ;: > ( xy-f ) >if TRUE ;then FALSE ;: > ( xy-f ) >if -1 ;then 0 ;: < ( xy-f ) <if TRUE ;then FALSE ;: < ( xy-f ) <if -1 ;then 0 ;: :find ( a-af ) last repeat @ 2dup =if drop @ TRUE ;then dup 0; drop again ;: :find ( a-af ) last repeat @ 2dup =if drop @ -1 ;then dup 0; drop again ;expose FALSE expose TRUE( 6.2.1485 FALSE ) ( Supported by Retro )( 6.2.1485 FALSE ) 0 constant FALSE( 6.2.2298 TRUE ) ( Supported by Retro )( 6.2.2298 TRUE ) -1 constant TRUE: < ( xy-f ) >if FALSE ;then TRUE ;: < ( xy-f ) >if 0 ;then -1 ;: > ( xy-f ) <if FALSE ;then TRUE ;: > ( xy-f ) <if 0 ;then -1 ;swap repeat 2dup fread not if 0 swap ! fclose drop ;then 1+ againswap repeat 2dup fread! 0 =if 0 swap ! fclose drop ;then 1+ againdefault: clean retroImage@make -C imageretroImage:int file_readc(VM *vm) {int file_readc(VM *vm) {int cell = TOS; DROP;vm->image[cell] = c;if ( c == EOF ) {if ( c == EOF ) {} else {} else {return -1;return c;if (vm->ports[4] == -2) {if (vm->ports[4] == -2) {int cell = acc; DROP;vm->image[cell] = c;if ( c == EOF ) vm->ports[4] = 0;if ( c == EOF ) vm->ports[4] = 0;else vm->ports[4] = c;else vm->ports[4] = -1;if (vm.ports[4] == -2) {if (vm.ports[4] == -2) {int cell = TOS; DROP;vm.image[cell] = c;if ( c == EOF ) vm.ports[4] = 0;if ( c == EOF ) vm.ports[4] = 0;else vm.ports[4] = c;else vm.ports[4] = -1;