load boot.f         \ init code
load serial.f       \ serial port driver
load interpreter.f  \ command interpreter

\ load string.f       \ support for flash buffers
\ load mem.f          \ generic fetch

load prom.f         \ flash programming driver
load route.f        \ support for the 'route' dispatch macro

\ these need to be procedures so they can be overridden by either
\ procedures or macros. (currently macros cannot be overridden by
\ procedures). FIXME: solve redirect inefficiency in asm optimization.

macro
: receive    async.rx> ;
: transmit   async.>tx ;
\ : console-on ;
\ : console-off ;

\ Redefine these when necessary.
    
\ memory
: stack-data    #x80 ;
: stack-control #x90 ;
: allot-ram     #x00 ;
: app-boot      #x200 ;
: allot-flash   #x240 ;  \ reserve 1 erase block for isr code
: read-buffer   #xA0 ;   \ default for terminal.f

: fosc 40 Mhz ;    
: baud 9600 ;
    
: init-all-but-rs
    init-ds         \ data and aux/control stack
    init-xs
    init-chip ;     \ setup outputs and clock
: init-all    
    init-rs           \ setup RS needs to be macro
    init-all-but-rs   \ can be shared for alternative reset vector
    init-serial       \ init serial port RX/TX logic    
    ;

    
forth
