Thursday, January 16, 2014

68k project: step I - execute some bytes by 68008 taken from AVR - the theory

[original article - ] Getting Reset, AVR (MCU) lowers RESET+HALT of 68008 (CPU) and begins to click clocks in main loop, which leads to the state called Boot Mode, and raises CPU's RESET+HALT some clicks after that.

Getting falling font of DS the MCU's INT0 is accured; while serving INT, main program waits until INT0 finished, so clock does not click, and there is no reason to play DTACK

INT0 feeds next byte of program to the CPU data bus (if CPU reads it), and leaves it there, returning from INT0 hanlder and making the main clock clicks. When main loop detects that DS is not active, it removes data from data bus.

So here it is:

/* Interrupt handling - DS gone low */
void ISR0()
if (RWline is UP) {
/* feed a byte to CPU */
writing_on_bus = 1;
} else {
/* CPU is writing byte */

void main()
bootmode = 1;
reset_CPU(); reset_ticks = RESET_TICKS_VAL;
/* may be some minimal delay, but CPU should be much faster then MCU*/
if (reset_ticks > 0)
if (!(reset_ticks--))
release_reset_CPU(); // reset - up!
if (DS_line_got_high)
if (writing_on_bus) {
writing_on_bus = 0;


While in boot mode, CPU should transfer some initial program to to memory,
then MCU should leave boot mode and send reset. After reset, CPU should execute the
main program already in RAM. It can later switch the clock source to run from a fast quartz.


Note 1. We have serial on ATmega, and you can use MAX232 or whatever you like
to connect it to COM port or USB.

Note 2. It is mentioned that interrups are used to determine /DS signal. Generally,
you do not need that because while CPU is clocked from MCU they are fully syncronized
(and when CPU will be clocked from external source there will be no way to talk with MCU
because it is slow). AVR interrupts are used because the code is clearer.

No comments:

Post a Comment