# Debugger working with Assembly Files

Programming the board with the init_q.asm code.
This code will copy the ROM to RAM, relocate the ROM to a different address and switch execution to RAM. Then it will wait for the user to press key '0' and jump to address $00001800 once it detects the key being pressed.

Rewriting the Flash-ROM with an Assembly-Program:

    cd \robot\68332\asm
    asm init_q.asm
    bind init_q new_init
    p2hex new_init -r $0000-$ffff +5
    copy new_init.hex ..\bdm
    cd ..\bdm
    bd32

Together with the information on assembling / compiling a ".hex" file, you should be able to create your own on-board operating system.

Now switch on the board and enter 'stop' in the debugger, then press the RESET button on the board

    do mapcs
    flash 11111111 new_init.hex 0

After this procedure, you can download ".hex" programs directly in to RAM (you only have to program the F-ROM once)

Start Debuger and switch on EyeBot

    bd32
    stop
    press RESET button on EyeBot

Now the board should have stopped (see bottom line of PC screen). Enter the following command sequence:

    restart
    go
    stop

The ROM has now been copied to RAM and relocated. Load the S-record file into EyeBot's memory:

    lo <program>.hex
    go
    press key EyeBot's rightmost key to start the program

If you run into problems and have to restart the program, you should not use the RESET button since that would repeat the copy routine and overwrite the RAM with the contents of the F-ROM. Try the following sequence first:

    stop
    go $1800

If this fails, use RESET and load the program again. The program has to be assembled to start at address $1800 (I usually put a JMP $<address> in as the first command) by setting the right options in the source code file and using the 'p2hex' command the following way:

    p2hex <prg> $1800-$ffff +5

If your program is longer than 64 KB (unlikely), you have to use the right address instead of $ffff.