\ 
\ Last_change: KS 18.03.2013 18:20:57
\
\ MicroCore load screen for testing the debug umbilical during simulation
\ It produces a VHDL-file that models the program memory.
\
Only Forth also definitions hex

[IFDEF] empty unpatch empty [ENDIF] Marker empty

include gforth-config.fs        \ Some System word (re)definitions for a more sympathetic environment
include vhdl.fs                 \ simple VHDL interpreter for constants
include ../uCore/constants.vhd
include microcore.fs            \ the cross-compiler
include images.fs               \ object code output files
include disasm.fs               \ the disassembler
include constants.fs            \ MicroCore Register addresses and bits

new Target                      \ reset target compiler and go into target compilation mode

3 trap-addr code-origin
          0 data-origin

: boot ( -- )  -1 debug_reg !
   debug_reg 2 FOR  ld st  NEXT
   version_reg @ BEGIN REPEAT
;

#reset USR: rst    ( -- ) ['] boot             nop BRANCH ;USR  \ compile branch to TEST at reset vector location
#isr   USR: isr    ( -- ) ints@ drop                 IRET ;USR
#esr   USR: esr    ( -- ) r> 1- BRANCH                    ;USR  \ retry instruction

end

Boot-file ..\uCore\boot_rom.VHD  .( sim_debug.fs written to boot_rom.vhd )
VHDL-file ..\uCore\program.VHD   .( sim_debug.fs written to program.vhd )