\ int-tether.fs

0 [if]
Copyright (C) 2005-2006 by Charles Shattuck.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

For LGPL information:   http://www.gnu.org/copyleft/lesser.txt
For application information:   http://www.amresearch.com

[then]
10 constant start-serial-buffer
$20 constant end-serial-buffer
] \ Target Forth
$23 interrupt : serial-interrupt
   1 .SCON if.  1 .SCON clr  5 .PSW clr  reti  then
   [ T push  PSW push  1 push  8 1 mov ]  SBUF #!  0 .SCON clr
   [ 1 inc  1 T mov ]  end-serial-buffer # <if
       start-serial-buffer # 1 #!
   then
   [ 1 8 mov  1 pop  PSW pop  T pop  reti ]
: emit begin 1 .SCON until. 1 .SCON clr SBUF #! ;
: key begin 0 .SCON until. 0 .SCON clr SBUF #@ ;
: ok 7 # emit ;
: number ok key ;
: execute swap push push ;
\ : quit key emit key key execute ok quit ;
: quit  begin 65 emit again
