tag:blogger.com,1999:blog-50853881325580727312024-03-13T13:25:05.973-03:00telmomoyaGoing from 8-bit to 32-bit... and backtelmomoyahttp://www.blogger.com/profile/03309406444758171765noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-5085388132558072731.post-82426383896035821902017-02-24T01:39:00.000-03:002017-02-24T01:57:09.047-03:00AMP with Raspberry Pi: 6502 emulationThis is an example of "<a href="http://telmomoya.blogspot.com.ar/2016/10/asymmetric-multi-processing-amp-with.html">Asymmetric Multi Processing (AMP) with Raspberry Pi</a>"<br />
Previous steps involved are datiled in the series of articles<br />
"<a href="http://telmomoya.blogspot.com.ar/2016/10/amp-with-raspberry-pi-cookbook.html">AMP with Raspberry Pi: Cookbook</a>".<br />
<br />
Based on <a href="http://telmomoya.blogspot.com.ar/2016/06/c64-powered-by-arm-running-6502-emulator.html">previous work</a> with 6502 emulation an AMP example app was developed:<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-5x35zciYRoM/V_8CjVYlZhI/AAAAAAAACOc/dj3X7obAPak_bYvbmixfYtqVMu-xKnfygCLcB/s1600/AMP-6502-Raspbian.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="180" src="https://3.bp.blogspot.com/-5x35zciYRoM/V_8CjVYlZhI/AAAAAAAACOc/dj3X7obAPak_bYvbmixfYtqVMu-xKnfygCLcB/s320/AMP-6502-Raspbian.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">AMP on Linux GUI (Raspbian)</td></tr>
</tbody></table>
A remote process (bare-metal) runs a 6502 emulator (<a href="http://rubbermallet.org/fake6502.c">fake6502</a>) with a Basic Interpreter (<a href="https://github.com/jefftranter/6502/tree/master/asm/ehbasic">EhBASIC</a>), using two (shared) memory locations for data exchange, one as (keyboard) input for basic interpreter and one for (monitor) output.<br />
One local process (Linux) send keystrokes to a shared memory location (remote keyboard)<br />
Second local process (Linux) show Ascii data comming to the other shared memory location (remote monitor)<br />
The process run asyncronously and the IPC (inter process comunication) is imperfect, as no signaling was implemented.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-nXlztqQYK60/WAqfWAZSVXI/AAAAAAAACPQ/ujQ1ST-L8-wsutx8mD7n72z9hN-SS1_WgCLcB/s1600/6502_emu_amp_blocks.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="84" src="https://3.bp.blogspot.com/-nXlztqQYK60/WAqfWAZSVXI/AAAAAAAACPQ/ujQ1ST-L8-wsutx8mD7n72z9hN-SS1_WgCLcB/s400/6502_emu_amp_blocks.png" width="400" /></a></div>
<br />
<br />
In order to get the example working you need:<br />
AMP framework: (the same as previous posts) Linux on Cores 0,1,2 using lower RAM and Bare Metal on Core 3 using upper RAM (above 0x20000000). See <a href="http://telmomoya.blogspot.com.ar/2016/10/amp-with-raspberry-pi-booting-linux.html">Step 1 </a>for details.<br />
<br />
Get example files from git:<br />
git clone https://github.com/telmomoya/AMP<br />
<br />
Enough Linux privileges<br />
<br />
In a Linux terminal do<br />
cd /bare-metal<br />
./start-metal.sh<br />
cd ..<br />
./monitor6510-char 0x20002ed1<br />
<br />
This will start the bare-metal process and the Linux process for monitor basic output.<br />
<br />
Keep that terminal open and in another one type:<br />
./keyboard6510-char 0x200058d4<br />
<br />
Test the EhBASIC interpeter (answer only "enter" for Memory size)<br />
<br />
You can stop emulator with<br />
./stop-metal.sh<br />
<br />
And restart it ( again with ./start-metal.sh) so you have LCM.<br />
If you start ehbasic with Warm option you can list your previous "sesion" basic program, as it remained in memory.<br />
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-W-c7ToS3JSI/V_781nMwHKI/AAAAAAAACOM/DtBYGCgdUNwQhqbAR5LsNoLWD51HlBNKQCLcB/s1600/AMP-6502-minibian.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="223" src="https://1.bp.blogspot.com/-W-c7ToS3JSI/V_781nMwHKI/AAAAAAAACOM/DtBYGCgdUNwQhqbAR5LsNoLWD51HlBNKQCLcB/s400/AMP-6502-minibian.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Using bare-metal app via ssh</td></tr>
</tbody></table>
<br />
<b><br /></b>
<u><b>Under the hood</b></u><br />
<br />
In bare-metal folder you will find 3 scripts:<br />
<br />
<u>start-metal.sh</u><br />
This script can be used for load the img file (up-metal-6510.img) at 0x2000000 (upper 512Mb) and point Core3 Mailbox3 to that address to start it's execution.<br />
<br />
<u>stop-metal.sh</u><br />
This script stops bare-metal execution<br />
<br />
<u>build-up-metal.sh</u><br />
Used for bare-metal compilation & linking (uses rpi.x linker script)<br />
<div>
<br /></div>
<div>
In root folder you have two files for local (Linux) run.</div>
<div>
<br /></div>
<div>
<u>keyboard6510-char</u></div>
<div>
Waits one text line and sends characters to remote process (bare-metal)</div>
<div>
<br /></div>
<div>
<u>monitor6510-char</u></div>
<div>
Looks to mailbox variable physical address and print if value changes (no signaling implemented, must be improved)</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<u><b>Life control managment</b></u></div>
<div>
When Linux boots puts all unused cores in a loop, looking for their mailbox 3. When that mailbox is no 0 the core jumps to the address contained there.</div>
<div>
The linker script used sets at execution start the code contained in the startup assembler file armc-08-start.S (file listing and comments in <a href="http://telmomoya.blogspot.com.ar/2016/10/amp-with-raspberry-pi-life-control.html">this pos</a>t).<br />
That file prepare the environment (stack and variables initialization) and junps to C code kernel_main function, located at 6510.c in this case.<br />
When kernel_main returns to assembler startup (armc-08-start.S) encounters a loop, similar to Linux one, looking for mailbox3.<br />
So, the restart procedure is identical to initial start: write address execution in mailbox 3.<br />
<br />
Now let's see how the stop process was implemented. Take a look to kernel_main function, included at 6510.c<br />
<br />
volatile char live=0x1;<span class="Apple-tab-span" style="white-space: pre;"> </span>//LCM flag<br />
volatile char mailbox=0x20;<span class="Apple-tab-span" style="white-space: pre;"> </span>//Emulator OUT (Monitor)<br />
volatile char mailbox2=0x0;<span class="Apple-tab-span" style="white-space: pre;"> </span>//Emulator IN(Keyboard)<br />
<br />
#include <stdint.h><br />
#include <string.h><br />
#include <stdio.h><br />
#include <stdlib.h><br />
#include "6502/6502.h"<br />
#include "io/gpios.h"<br />
<br />
<br />
void kernel_main( unsigned int r0, unsigned int r1, unsigned int atags )<br />
{<br />
reset6502();<br />
while(live){<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>step6502();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
}<br />
<div>
<br /></div>
<div>
Please note: live and mailbox definitions as volatile, in order to avoid compiler optimizations, ensuring variables in memory, accesible for Linux process.</div>
<div>
<div>
<br /></div>
</div>
<div>
You can see that kernel_main execution depends on "live" value. The idea here is make live=0 from Linux to stop execution (really return Core 3 to the loop looking to mailbox 3 in armc-08-start.S).</div>
In order to determine the physical address for "live" variable we can lists symbols from object file:<br />
<br />
nm up-metal-6510.elf | grep live<br />
<br />
In that way the provided script stop-metal.sh does:<br />
<br />
lcm_control=0x$(nm up-metal-6510.elf | grep 'D live' | awk '{print $1}')<br />
./devmem $lcm_control b 0x00<br />
<br />
First obtain physical address for "live" variable and the writes 0 to it.<br />
<br />
<br />
<u><b>IPC</b></u><br />
Inter Process Comunication is implemented using shared memory, specifically locations used by mailbox and mailbox2 variables (volatile). Lets list mailbox symbols:<br />
<br />
nm up-metal-6510.elf | grep mailbox<br />
20002ed1 D mailbox<br />
<br />
200058d4 B mailbox2</div>
<div>
<br /></div>
<div>
On linux you can call</div>
<div>
<div>
./monitor6510-char 0x20002ed1</div>
</div>
<div>
<br /></div>
<div>
that prints on terminal any change to that physicall address, that is mailbox bare-metal variable.</div>
<div>
<br /></div>
<div>
And in another terminal </div>
<div>
./keyboard6510-char 0x200058d4</div>
<div>
<br /></div>
<div>
Sends to mailbox2 the typed chars.</div>
<div>
<br /></div>
<div>
-------------------------------------------------------------</div>
<div>
If you want to compile provided sourcefiles do:</div>
<div>
<br /></div>
<div>
<div>
Linux keyboard and monitor apps:</div>
<div>
cd linux</div>
<div>
gcc -o monitor6510-char monitor6510-char.c</div>
<div>
gcc -o keyboard6510-char keyboard6510-char.c</div>
<div>
<br /></div>
<div>
Bare-metal emulator:</div>
<div>
cd bare-metal</div>
<div>
build-up-metal.sh</div>
</div>
<div>
<br /></div>
telmomoyahttp://www.blogger.com/profile/03309406444758171765noreply@blogger.com1tag:blogger.com,1999:blog-5085388132558072731.post-80574271628264319142017-01-31T20:29:00.000-03:002017-02-12T11:14:56.052-03:00A multicore solution for a ZX Spectrum Emulator<br />
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/v_a6dzCKRAI/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/v_a6dzCKRAI?feature=player_embedded" style="clear: right; float: right;" width="320"></iframe>I made a multicore baremetal ZX Spectrum Emulator app for a dual core ARM microcontroller (Cortex M4 & M0 Cores). All this work is part of my programming training with EduCIAA, an educational version of the (first) "<a href="http://www.proyecto-ciaa.com.ar/devwiki/doku.php?id=en:start">Argentinian Open Industrial Computer (CIAA)</a>" board.<br />
<div>
Initially I used a low cost TFT as output device and later VGA screen. As no video hardware support is available, software signals generation was needed for componentless VGA.</div>
<br />
I developed a multicore solution, runnnig emulator on M4 core and generating VGA signals with M0 core (Asymmetric Multi Processing).<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/hwXYv7hyJBY/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/hwXYv7hyJBY?feature=player_embedded" style="clear: right; float: right;" width="320"></iframe></div>
This technique can be useful for other projects since critical timings involved in VGA generation remains isolated from emulation or any task running on other core.<br />
<br />
This project invloved many issues, like componentless COLOR VGA generation (with GPIO DMA), Inter Process Comunication and bus sharing.<br />
In this post you may find descriptions for each topic resolved and <a href="https://github.com/telmomoya/educiaa-bm/tree/master/speecy_amp">link to source code</a>, enjoy.<br />
<br />
<div style="text-decoration: underline;">
</div>
<u></u><br />
<u></u>
<u>EduCIAA Board</u><br />
<div>
<div>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="http://proyecto-ciaa.com.ar/devwiki/lib/exe/fetch.php?media=desarrollo:edu-ciaa:edu-ciaa-nxp.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="91" src="https://proyecto-ciaa.com.ar/devwiki/lib/exe/fetch.php?media=desarrollo:edu-ciaa:edu-ciaa-nxp.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">EduCIAA Board - NXP LPC4337</td></tr>
</tbody></table>
I used the EduCIAA NXP version, an Argentinan designed microcontroller board, based on NXP LPC4337, a Dual Core (M4 & M0) 32bit microcontroller.<br />
The CIAA Project was born in the year 2013 as a group initiative between argentinian academic and industrial sector, CIAA firmware is available <a href="https://github.com/ciaa/Firmware">here</a>, with the work of people much more expert than I.</div>
</div>
<div style="text-decoration: underline;">
<u><br /></u></div>
<u>Emulator</u><br />
<div>
I found <a href="http://aspectrum.sourceforge.net/index.en.html">Aspectrum</a>, an open source C coded Spectrum Emulator for Windows and Linux and adapted it for this project. The CIAA Firmware gives support for the emulator in a bare metal environment.</div>
<div>
<u><br /></u></div>
<div>
<u>SPI Display</u></div>
<div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/HmpSOArobkA/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/HmpSOArobkA?feature=player_embedded" style="clear: right; float: right;" width="320"></iframe></div>
SPI TFT displays are slower than parallel ones, so obtaining a playable system (with aceptable fps) was a challange. First code tests, using complete screen redrawing for each emulated frame resulted in too low fps, even without color.<br />
<br />
The key here was to implement a diferential drawing routine, that only redraw modified pixels.<br />
In order to do this the emulator retain a copy of last frame (Spectrum screen area) and compares with the new frame (resulting after 69888 cycles of Z80 emulation). And then only differences are updated to TFT RAM via SPI comand/data.<br />
The result for non-scroll games is very good and system becomes playable.<br />
<br />
<u>ILI9341</u><br />
I adapted a <a href="https://stm32f4-discovery.net/2014/04/library-08-ili9341-lcd-on-stm32f429-discovery-board/">great ILI9341 library written by Tilen Majerle for STM32F </a>to EduCIAA (only trivial changes was needed, like GPIO pins selection and initialization).<br />
<br />
<u>VGA</u><br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-qBzIfzO8rCI/WKBsfWJYuZI/AAAAAAAAFLU/47eFlzvuCSEN5-rESSWaSASTM7G7AgIPgCKgB/s1600/IMG_20161221_191320389.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="112" src="https://1.bp.blogspot.com/-qBzIfzO8rCI/WKBsfWJYuZI/AAAAAAAAFLU/47eFlzvuCSEN5-rESSWaSASTM7G7AgIPgCKgB/s200/IMG_20161221_191320389.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Componentless VGA</td></tr>
</tbody></table>
For VGA signals generation I used the remaining M0 core, while emulator runs on M4.<br />
M0 Core trigger a DMA transfer from IPC RAM in order to display a video line and uses timers for syncs generation.<br />
Timmings correspond to 640x480 VGA resolution and image size is fixed, based on ZXSpectrum resolution and DMA frequency.<br />
The code is not optimized, so signals generation and involved timmings are very explicit.<br />
<br />
<br />
<u>IPC (Inter Porcess Comunication)</u><br />
A shared memory IPC was implemented: the emulator, running on M4 Core, writes screen data to a RAM area and the VGA routines, running on M0 Core, uses that memory data for each video line drawed. As cores run asynchronously access conflicts appears, and are quite frequent because they are at bus level. The bus used to access the IPC RAM is also used to access many peripherals.<br />
That access conflicts generates delays for IPC RAM reading and are noticeable on the screen (a dot becomes wider).<br />
I reduced conflicts reducing IPC RAM write accesses: using the same diferential drawing routine used for the TFT screen. A more serious solution would be to keep the bus during IPC RAM reading.<br />
<div>
<br /></div>
<br />
<u>DMA</u><br />
As is know ARM Cortex M aren't realtime oriented (no deterministic). Take a look to screen result for a C loop that turns on and off the green signal. I spected dots, but you can see heterogeneous lines, as pipelining and cache makes system no deterministic.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-btm9GPY4r3Y/WJEOOW6LRiI/AAAAAAAAE_A/CWTqNc3rgSE4uOxQlbcXP6GLlLKyBp_5QCKgB/s1600/IMG_20161214_103039916.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="110" src="https://2.bp.blogspot.com/-btm9GPY4r3Y/WJEOOW6LRiI/AAAAAAAAE_A/CWTqNc3rgSE4uOxQlbcXP6GLlLKyBp_5QCKgB/s200/IMG_20161214_103039916.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 12.8px; text-align: center;">CPU switching G signal; dots expected</td></tr>
</tbody></table>
The key for VGA generation was the use of DMA transfers.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-G-u9cUdqNGY/WJESsriVgzI/AAAAAAAAE_g/q3R6EI_tguAvSBLjl6riB2FEy46MxzF9ACKgB/s1600/IMG_20161218_013239955.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="112" src="https://3.bp.blogspot.com/-G-u9cUdqNGY/WJESsriVgzI/AAAAAAAAE_g/q3R6EI_tguAvSBLjl6riB2FEy46MxzF9ACKgB/s200/IMG_20161218_013239955.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">DMA VGA generation</td></tr>
</tbody></table>
<u>Color:</u><br />
A very simple color scheme was implemented. Each color signal (R,G&B) is driven by an individual GPIO pin, that gives 8 possible colors (similar to ZX Spectrum without bright info).<br />
But DMA transfers take complete bytes (or words), meaning that only 3 bits from the 8 bits transfers are color data, and the remaining 5 bits are discarded.<br />
As each video line (196 pixels) involves a 196 bytes DMA transfer a (very inefficient) frame buffer is needed, it looks like this:<br />
<br />
<div style="text-align: center;">
XXXXXRGB XXXXXRGB ... XXXXXRGB XXXXXRGB<br />
.<br />
.<br />
.<br />
XXXXXRGB XXXXXRGB ... XXXXXRGB XXXXXRGB</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
As the selected GPIO pins are on the same port, they are accessed with one register (memoy mapped). Using 8bit, Memory to Memory DMA transfers form the (inefficient) buffer (in incremental mode) to the (memory mapped) GPIO register (in no incremental mode) each video line is drawed.</div>
<br />
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-5I5Sq8O4XCk/WJESwsJA7mI/AAAAAAAAE_k/Md04DyoVL4QScL1PsWkWy5dvwhsFIE4GwCKgB/s1600/IMG_20161218_023725135.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="111" src="https://3.bp.blogspot.com/-5I5Sq8O4XCk/WJESwsJA7mI/AAAAAAAAE_k/Md04DyoVL4QScL1PsWkWy5dvwhsFIE4GwCKgB/s200/IMG_20161218_023725135.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">First ZX Spectrum Monochromatic VGA image obtained</td></tr>
</tbody></table>
<br />
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-UtNzh4hqsZU/WJES3AGTqBI/AAAAAAAAE_o/rwjEcsU5yC8s8b00nLfrU0-yreePzUG6gCKgB/s1600/IMG_20161218_033729940_HDR.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="112" src="https://4.bp.blogspot.com/-UtNzh4hqsZU/WJES3AGTqBI/AAAAAAAAE_o/rwjEcsU5yC8s8b00nLfrU0-yreePzUG6gCKgB/s200/IMG_20161218_033729940_HDR.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">First ZX Spectrum Color image</td></tr>
</tbody></table>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-vFewd1DtZ5Y/WJETLyIQkDI/AAAAAAAAE_w/l6OkjaqmwJs_Hx1rn-hTVKcaWYK68vnFwCKgB/s1600/IMG_20161220_111136484.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="112" src="https://2.bp.blogspot.com/-vFewd1DtZ5Y/WJETLyIQkDI/AAAAAAAAE_w/l6OkjaqmwJs_Hx1rn-hTVKcaWYK68vnFwCKgB/s200/IMG_20161220_111136484.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">First Emulator generated video </td></tr>
</tbody></table>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br /></div>
telmomoyahttp://www.blogger.com/profile/03309406444758171765noreply@blogger.com0tag:blogger.com,1999:blog-5085388132558072731.post-78353232926888430832016-10-12T20:18:00.000-03:002017-02-24T01:53:58.124-03:00AMP with Raspberry Pi: CookbookIn order to boot Linux on a RaspBerry Pi 2 or 3 with 3 cores and reserve half ram for bare-metal apps you must use U-boot, no the default RasPi bootloader.<br />
<br />
Prepare a SD card with <a href="https://minibianpi.wordpress.com/">Minibian</a> or <a href="https://www.raspbian.org/">Raspbian</a><br />
Get boot files and examples with<br />
<span style="font-family: "courier new" , "courier" , monospace;">git clone https://github.com/telmomoya/AMP</span><br />
<br />
Copy to SD boot folder (fat's root) the files provided in repository boot folder:<br />
<span style="font-family: "courier new" , "courier" , monospace;">boot.scr</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">u-boot.bin</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">uboot.env</span><br />
<div>
<br /></div>
<div>
(More details on this files <a href="http://telmomoya.blogspot.com.ar/2016/10/amp-with-raspberry-pi-booting-linux.html">here</a>)</div>
<div>
<br /></div>
<div>
Add to config.txt a line with:<br />
<span style="font-family: "courier new" , "courier" , monospace;">kernel=u-boot.bin</span><br />
<div>
<br />
Boot your Linux (look during boot only 3 berries= 3 cores)</div>
</div>
<div>
Login and go to examples foders</div>
<div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br /></div>
<div>
<a href="https://1.bp.blogspot.com/-d9xBfh7i_yM/WAvehRFqwQI/AAAAAAAACPk/ewIAeMZWIWcOVpf0Iefm4T32nbJ3ZQ46gCLcB/s1600/raspi-led.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="193" src="https://1.bp.blogspot.com/-d9xBfh7i_yM/WAvehRFqwQI/AAAAAAAACPk/ewIAeMZWIWcOVpf0Iefm4T32nbJ3ZQ46gCLcB/s200/raspi-led.jpg" width="200" /></a>Blinking Led</div>
<div>
This file will blink a led connected to GPIO16.</div>
<div>
In amp-test folder you can find source and binary files for this first example. </div>
<div>
Test it with enough privileges (root or sudo):<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">cd amp-test</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">./loadmetal up-metal.bin</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">./devmem 0x400000bc w 0x20000000</span></div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
You can change blink timming with:<br />
<span style="font-family: "courier new" , "courier" , monospace;">./devmem 0x200000a0 b 0x0a</span><br />
<div>
<br /></div>
0x200000a0 is the physical address for a "delay" variable, so writing from Linux to that address changes the value for the remote (bare-metal) process: IPC!.<br />
<div>
<br /></div>
<div>
View other posts for detailed info about each step:</div>
<div>
<br /></div>
<div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<li style="background-color: #eeeeee; border: none; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14.85px; margin: 0px 0px 0.25em; padding: 0px;"><a href="http://telmomoya.blogspot.com.ar/2016/10/amp-with-raspberry-pi-booting-linux.html" style="color: #6699cc; text-decoration: none;">Booting RasPi Linux with 3 cores and partial RAM</a></li>
<li style="background-color: #eeeeee; border: none; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14.85px; margin: 0px 0px 0.25em; padding: 0px;"><a href="http://telmomoya.blogspot.com.ar/2016/10/bare-metal-coding-following-brians.html" style="color: #6699cc; text-decoration: none;">Compiling, Linking and Loading from Linux the bare-metal executables (locables in upper memory)</a></li>
<li style="background-color: #eeeeee; border: none; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14.85px; margin: 0px 0px 0.25em; padding: 0px;"><a href="http://telmomoya.blogspot.com.ar/2016/10/amp-with-raspberry-pi-step-3-life.html">Start and stop bare-metal execution with Core 3 (LCM: Life Control Mangement in AMP terminology)</a></li>
<li style="background-color: #eeeeee; border: none; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14.85px; margin: 0px 0px 0.25em; padding: 0px;"><a href="http://telmomoya.blogspot.com.ar/2016/10/amp-with-raspberry-pi-4-shared-memory.html" style="color: #6699cc; text-decoration: none;">Share some memory areas for send and receive data between Linux and the bare-metal app (remote process)</a></li>
<li style="background-color: #eeeeee; border: none; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14.85px; margin: 0px 0px 0.25em; padding: 0px;"><a href="http://telmomoya.blogspot.com.ar/2017/02/amp-with-raspberry-pi-6502-emulation.html">Example</a></li>
</div>
telmomoyahttp://www.blogger.com/profile/03309406444758171765noreply@blogger.com0tag:blogger.com,1999:blog-5085388132558072731.post-1472949337465353862016-10-12T11:31:00.000-03:002016-10-27T10:04:18.082-03:00AMP with Raspberry Pi: Step 4 - Shared memory for Inter-Process CommunicationTo establish a simple IPC I will write from Linux to a memory address used by bare-metal app.<br />
+Linux mmap() can access beyond the assigned memory (lower 512Mb imposed by boot args) and <a href="http://free-electrons.com/pub/mirror/devmem2.c">devmem</a> is mmap() based, so I'll use it.<br />
<br />
First, create a variable in the bare-metal app:<br />
Edit armc-03.c and add a global variable:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">volatile char delay=0x54;</span><br />
<br />
also change the delay loops in order to use it:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">for(tim = 0; tim < delay * 10000; tim++)</span><br />
<br />
Compile armc-03.c and link (upper 512MB starts from 0x20000000)<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">gcc -c armc-03.c -o arm-03.o</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">ld -Ttext 0x20000000 arm-03.o -o up-metal2.elf</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">objcopy up-metal2.elf -O binary up-metal2.img</span><br />
<br />
Place the obtained binary in memory (0x20000000)<br />
<span style="font-family: "courier new" , "courier" , monospace;">root@minibian:~/code#./loadmetal up-metal2.img</span><br />
<br />
Write to Core 3 mailbox 3 the start address (0x20000000)<br />
<span style="font-family: "courier new" , "courier" , monospace;">./devmem 0x400000bc w 0x20000000</span><br />
<br />
<a href="https://4.bp.blogspot.com/-d9xBfh7i_yM/WAvehRFqwQI/AAAAAAAACPk/Xgbq1EzfTBMDqdopOx7hSsxUpaSy3KtDACEw/s1600/raspi-led.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="193" src="https://4.bp.blogspot.com/-d9xBfh7i_yM/WAvehRFqwQI/AAAAAAAACPk/Xgbq1EzfTBMDqdopOx7hSsxUpaSy3KtDACEw/s200/raspi-led.jpg" width="200" /></a>Blink starts, with blink speed managed by the "delay" variable.<br />
<br />
To determine "delay" memory address look at elf symbol table:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">nm up-metal2.elf</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">200000ac B __bss_end__</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">200000ac B _bss_end__</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">200000a1 D __bss_start</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">200000a1 D __bss_start__</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">200000a0 D __data_start</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">200000a0 D delay</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">200000a1 D _edata</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">200000ac B _end</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">200000ac B __end__</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">200000a8 B gpio</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">20000000 T main</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">00080000 N _stack</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> U _start</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">200000a4 B tim</span><br />
<br />
The global (volatile) "delay" variable is located at 0x200000a0<br />
If we read it we get the coded value (0x54)<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">./devmem 0x200000a0 b</span><br />
<br />
Or we can change it in order to change blink speed:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">./devmem 0x200000a0 b 0x0a</span><br />
<br />
<br />
+ volatile is needed to avoid compiler optimizations (our program never changes "delay" value, so a posible optimization is to make it a constant).telmomoyahttp://www.blogger.com/profile/03309406444758171765noreply@blogger.com0tag:blogger.com,1999:blog-5085388132558072731.post-55974380007868188692016-10-12T11:17:00.005-03:002017-02-24T01:41:13.592-03:00AMP with Raspberry Pi: Step 3 - Life Control Mangement for remote process<u>Running Bare Metal App</u><br />
When Linux kernel boots all non asigned cpus (here Core 3) remain in a loop looking it's mailbox 3 for non-zero value, with an address where to jump (read more <a href="https://github.com/raspberrypi/linux/blob/rpi-4.1.y/arch/arm/mach-bcm2709/bcm2709.c#L1248">here</a>). Writting to that mailbox (Core3_MBOX3_SET register = 0x400000BC) the value 0x20000000 makes Core 3 to jump to the executable that we loaded at that possition.<br />
For physical memory read/write from Linux I used devmem, so get it from http://free-electrons.com/pub/mirror/devmem2.c<br />
<br />
Now start the loaded blinking app writing 0x20000000 to Core 3 MailBox3:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">./devmem 0x400000bc w 0x20000000</span><br />
<br />
Connect a LED to GPIO16.<br />
<br />
<br />
<b><u>LCM</u></b><br />
Brian's tutorials include an C-startup assembler file "armc-0x-start.S" that is the first code to be executed.<br />
<br />
For that armc-0x-start.S include this label:<br />
<span style="font-family: "courier new" , "courier" , monospace;">.section ".text.startup"</span><br />
That label is the first in the used linker script: rpi.x<br />
<br />
In that examples we loose control over execution, as the used C-startup funcion start.S branches to kernel_main function and never return.<br />
<br />
In order to have control over bare-metal execution the some changes were made to armc-0x-start.S:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">.section ".text.startup"</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">.global _start</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">.global _get_stack_pointer</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">_start:</span><br />
<b><span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// Clear CORE3_MBOX3</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> ldr r1,=0x400000FC</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> ldr r3,=0xffffffff</span></b><br />
<b><span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> str r3, [r1]</span></b><br />
<span class="Apple-tab-span" style="font-family: "courier new" , "courier" , monospace; font-size: x-small; white-space: pre;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> // Set the stack pointer, which progresses downwards through memory</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> // Set it at 64MB which we know our application will not crash into</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> // and we also know will be available to the ARM CPU. No matter what</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> // settings we use to split the memory between the GPU and ARM CPU</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> <b> ldr sp, =(768 * 1024 * 1024)<span class="Apple-tab-span" style="white-space: pre;"> </span>//SP to 0x3000000</b></span><br />
<span class="Apple-tab-span" style="font-family: "courier new" , "courier" , monospace; font-size: x-small; white-space: pre;"> </span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> // Run the c startup function - should not return and will call kernel_main</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> bl _cstartup</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><b> bl kernel_main </b> //changed from b to bl</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// Check CORE3_MBOX3 for jump address (not zero)</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">_check_loop:</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span><b>ldr r1,=0x400000FC</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> ldr r1, [r1]</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>mov r3, #0</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>cmp r1, r3</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>beq<span class="Apple-tab-span" style="white-space: pre;"> </span>_check_loop</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><b>bx r1</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span><span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">_get_stack_pointer:</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> // Return the stack pointer value</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> str sp, [sp]</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> ldr r0, [sp]</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> // Return from the function</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;"> mov pc, lr</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<br />
Replacing the "b" kernel_main branch with "bl" (branch with link) kernel_main can return.<br />
When kernel_main returns the core loops (_check_loop) looking for a non-zero value in mailbox 3.<br />
Previously (when this code start) mailbox 3 is cleared.<br />
<br />
For a tentative LCM implementation see <a href="http://telmomoya.blogspot.com.ar/2017/02/amp-with-raspberry-pi-6502-emulation.html">this example</a>.<br />
<br />
A serious LCM requires interrups or any exception mechanism in order to take the control.<br />
<br />
<br />telmomoyahttp://www.blogger.com/profile/03309406444758171765noreply@blogger.com0tag:blogger.com,1999:blog-5085388132558072731.post-45822046564152950132016-10-12T10:53:00.000-03:002017-02-24T01:53:16.797-03:00AMP with Raspberry Pi: Step 2 - Compiling, Linking and Loading a Bare Metal App<u><b>Bare Metal Coding</b></u><br />
<br />
Following <a href="http://www.valvers.com/open-software/raspberry-pi/step01-bare-metal-programming-in-cpt1/">Brian´s excellent bare metal tutorials</a> I obtained a binary image for a blinking led code.<br />
+Source files for this step from <a href="https://github.com/BrianSidebotham/arm-tutorial-rpi">Brian's github repository</a>.<br />
Compile armc-03.c with linker options to relocate the binary to upper 512Mb, that is 0x20000000<br />
<span style="font-size: x-small;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">gcc -c armc-03.c -o armc-03.o</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">ld -Ttext 0x20000000 -nostartfiles -g -Wl,-verbose -Wl,-T,rpi.x armc-03.o -o up-metal.elf</span><br />
<span style="font-family: "courier new" , "courier" , monospace; font-size: x-small;">objcopy up-metal2.elf -O binary up-metal.img</span><br />
<br />
The rpi.x linker script file is included from armc-06<br />
<br />
Check obtained img filesize, must be 152 bytes (afterall it only blinks a led).<br />
<br />
<u>Loader</u><br />
To place (from Linux) the bare-metal executable at 0x20000000 I wrote a simple mmap() based loader, invoke it with binary filename as parameter.<br />
<br />
<u>loadmetal src code</u><br />
<div>
<br /></div>
<div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <stdio.h></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <stdlib.h></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <fcntl.h></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">#include <sys/mman.h></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">int main (int argc, char * argv [])</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">{</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">int fd_mem;</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">void *load_address;</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">unsigned long fileLen;</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">FILE *file;</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">printf ("Opening %s\n",argv[1]);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">file=fopen(argv[1],"rb");</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">//Get file length</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">fseek(file, 0, SEEK_END);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">fileLen=ftell(file);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">fseek(file, 0, SEEK_SET);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">printf ("File lenght %d\n",fileLen);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">/* Map Physical address of RAM to virtual address segment with Read/Write Access */</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">printf ("Opening Mem %x\n",0x20000000);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">fd_mem = open("/dev/mem", O_RDWR);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">load_address = mmap(NULL, fileLen,PROT_READ|PROT_WRITE, MAP_SHARED, fd_mem, 0x20000000);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">// Read file contents</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> <span class="Apple-tab-span" style="white-space: pre;"> </span>fread(load_address, fileLen, 1, file);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>fclose(file);</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">}</span><br />
<br />
<a href="http://telmomoya.blogspot.com.ar/2016/10/amp-with-raspberry-pi-step-3-life.html">Now go to Step 3 for Life Control Mangement</a></div>
</div>
telmomoyahttp://www.blogger.com/profile/03309406444758171765noreply@blogger.com0tag:blogger.com,1999:blog-5085388132558072731.post-60902996166697722512016-10-12T10:40:00.001-03:002016-10-27T10:15:06.269-03:00AMP with Raspberry Pi: Step 1 - Booting Linux with 3 coresAll this work was done on a Raspberry Pi 3, that´s a 1.2 GHz 64-bit quad-core ARMv8 CPU and later on a Raspberry Pi 2.<br />
I used the Raspberry as development platform, but you can cross-compile if you want.<br />
<br />
Operative System:<br />
I used Minibian, a reduced Debian Linux (no GUI), in order to get it visit https://minibianpi.wordpress.com/<br />
<br />
To get an AMP environment we need to boot Linux with at most three cores and reserve one for bare-metal. Also RAM needs to be separated, i.e. lower 512 MB for OS and upper 512Mb for bare-metal.<br />
Linux kernel accepts boot time parameters that can be used to force kernel to override the default hardware using.<br />
<br />
With "maxcpus" and "mem" boot parms we will get the job done, but.... standard Raspberry Pi boot process involves GPU bootloader, ARM bootloader, and a config.txt with some possible configuration options (not really full compilant linux boot parameters). Setting maxcpus=3 and mem=512 in config.txt result in a system boot with 3 active cores, but very inestable, even it crash with ethernet cable connected. And the "mem" parameter has no effect (Linux gets all RAM).<br />
Here comes U-Boot to help us,<br />
<br />
<b><u>Bootloader:</u></b><br />
Following step is based on Tim's post about <a href="https://blog.night-shade.org.uk/2015/05/booting-a-raspberry-pi2-with-u-boot-and-hyp-enabled/">"Booting a Raspberry Pi2, with u-boot and HYP enabled"</a><br />
<br />
<u>NOTE</u>; Last updates are mandatory for Raspberry Pi 3!! Be sure to do:<br />
<span style="font-family: "courier new" , "courier" , monospace;">apt-get install rpi-update</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">rpi-update</span><br />
<br />
U-boot is a flexible bootloader intended for embedded systems. Clone and compile it:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">git clone git://git.denx.de/u-boot.git</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">cd u-boot</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">make rpi_2_defconfig</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">make all</span><br />
<br />
Copy u-boot.bin to your SD and change config.txt to read:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">kernel=u-boot.bin</span><br />
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-Zbt5mZeoo8g/WAvkrUZhI9I/AAAAAAAACP4/Z-ikF8kpurEAC83rvDwbVSC96UcPvBd8QCLcB/s1600/raspi-serial-adapter.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="120" src="https://3.bp.blogspot.com/-Zbt5mZeoo8g/WAvkrUZhI9I/AAAAAAAACP4/Z-ikF8kpurEAC83rvDwbVSC96UcPvBd8QCLcB/s200/raspi-serial-adapter.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Using CH340 from ex-arduino nano</td></tr>
</tbody></table>
Now you need a serial console to boot and (press any key) to get U-boot prompt to set and save environment vars:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">setenv machid 0x00000c42</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">setenv bootargs= earlyprintk console=tty0 console=ttyAM0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait noinitrd mem=512M maxcpus=3</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">saveenv</span><br />
<br />
Create a boot.sc.source file containing:<br />
<span style="font-family: "courier new" , "courier" , monospace;">fatload mmc 0:1 ${fdt_addr_r} bcm2710-rpi-3-b.dtb</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">fatload mmc 0:1 ${kernel_addr_r} kernel7.img</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">bootz ${kernel_addr_r} - ${fdt_addr_r}</span><br />
<br />
And do:<br />
<span style="font-family: "courier new" , "courier" , monospace;">mkimage -A arm -O linux -T script -C none -n boot.scr -d boot.scr.source boot.scr</span><br />
<br />
Move the obtained boot.scr file to SD root.<br />
+If you don't have a serial adapter you can get example files in the boot folder at the <a href="https://github.com/telmomoya/AMP">repository</a><br />
<br />
Now Linux boots with 3 cores (draws only 3 berries during boot) and half memory (512Mb)<br />
Test it with<br />
<span style="font-family: "courier new" , "courier" , monospace;">free</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">cat /proc/cpuinfo</span><br />
<br />
We have remaining hardware resources for simultaneous baremetal app run: AMP!<br />
<br />
<a href="http://telmomoya.blogspot.com.ar/2016/10/bare-metal-coding-following-brians.html">Read Step 2 for Bare Metal Coding</a><br />
<br />
<br />
+If you have experience obtaining a Raspberry Pi uboot.env file from Linux with fw_setenv please let me know. This will avoid the serial adapter for succeeding bootargs mods.telmomoyahttp://www.blogger.com/profile/03309406444758171765noreply@blogger.com1tag:blogger.com,1999:blog-5085388132558072731.post-59743633172777006762016-10-12T10:36:00.002-03:002017-02-24T01:51:53.138-03:00Asymmetric Multi Processing (AMP) with Raspberry Pi<div>
<u><b>AMP for the masses</b></u><br />
<u><b><br /></b></u>
Looking for a performance upgrade for my "<a href="http://telmomoya.blogspot.com.ar/2016/06/c64-software-cored.html">ARM based 6510 ICE</a>" I decided to use a Raspberry Pi bare metal app. I started reading excellent <a href="http://www.valvers.com/open-software/raspberry-pi/step01-bare-metal-programming-in-cpt1/">Brian's tutorials</a> and making some tests. But SD card swaping between PC and RASPi did not suit me for a development process. Searching for a bootloader I found <a href="https://github.com/dwelch67/raspberrypi">David's one</a> and tested it with a homemade serial level adapter (using CH340 from a dead Arduino Nano board). That was a better development mechanism, but also tedious.<br />
Thinking about a better option, AMP comes to my mind: If RasPi has 4 ARM cores why not use only one core for bare metal and remainings for development.<br />
The idea was to boot Linux with Cores 0,1,2 and half RAM (lower 512Mb), leaving Core 3 and upper 512Mb for bare-metal. Compilation and linking will be done in Linux (no more cross compiling!) and a loader app (also Linux) will put the binary image in the upper memory used by bare-metal core. Then Core 3 must start the execution of that binary.<br />
In <a href="http://telmomoya.blogspot.com.ar/2016/10/amp-with-raspberry-pi-cookbook.html">this post </a>you have simple instructions to obtain a working AMP system.<br />
<br />
Read the following posts for details about each step involved:<br />
<ul>
<li><a href="http://telmomoya.blogspot.com.ar/2016/10/amp-with-raspberry-pi-booting-linux.html">Step 1: Booting RasPi Linux with 3 cores and partial RAM</a></li>
<li><a href="http://telmomoya.blogspot.com.ar/2016/10/bare-metal-coding-following-brians.html">Step 2: Compiling, Linking and Loading from Linux the bare-metal executables (locables in upper memory)</a></li>
<li><a href="http://telmomoya.blogspot.com.ar/2016/10/amp-with-raspberry-pi-step-3-life.html">Step 3:Start and stop bare-metal execution with Core 3 (LCM: Life Control Mangement in AMP terminology)</a></li>
<li><a href="http://telmomoya.blogspot.com.ar/2016/10/amp-with-raspberry-pi-4-shared-memory.html">Step 4: Share some memory areas for send and receive data between Linux and the bare-metal app (remote process)</a></li>
<li><a href="http://telmomoya.blogspot.com.ar/2017/02/amp-with-raspberry-pi-6502-emulation.html">Example</a></li>
</ul>
<br />
<br />
<u><b>About AMP</b></u><br />
<br />
<div style="text-align: justify;">
Asymmetric Multi Processing (AMP) refers to heterogeneous cores, heterogeneous software for each core or both. A Multi Core system has multiple CPUs, each of which may be a different architecture (heterogeneous multicore) or can be the same (homogeneous multicore).</div>
<div style="text-align: justify;">
Also, each core in a multicore system can run the same or different software. If cores are different (heterogeneous) software will be different too, resulting in Asymmetric Multi Processing (AMP).</div>
<div style="text-align: justify;">
Most homogeneous systems use an Symmetric Multi Processing (SMP) software architecture, where a single operating system instance treats all processors equally, but an AMP architecture is also possible using heterogeneous software.</div>
In many cases an AMP system is dessirable to get a real time (deterministic) operation without losing the benefits of an OS, for example: bare-metal or RTOS apps running on same cores and remainig cores running Linux.</div>
<div>
<br />
An AMP system involves:</div>
<div>
<ul>
<li><span style="text-align: justify;">Multicore system (homogeneous or </span><span style="text-align: justify;">heterogeneous)</span></li>
<li>Heterogeneous software</li>
<li>Separate address space (program and data)</li>
<li>Communication facility between the CPUs</li>
</ul>
</div>
<div>
<div>
Read more about Asymmetric Multi Processing (AMP):</div>
<div>
<a href="https://en.wikipedia.org/wiki/Asymmetric_multiprocessing">https://en.wikipedia.org/wiki/Asymmetric_multiprocessing</a></div>
<div>
OpenAMP</div>
<div>
<a href="http://www.multicore-association.org/workgroup/oamp.php">http://www.multicore-association.org/workgroup/oamp.php</a><br />
<br />
<br />
<b><u>ToDo</u></b><br />
<br />
In an AMP system shared resources are bottlenecks, in my examples bare-metal apps only use a GPIO port and Linux all other reources, avoiding access conflicts. In more complex aplications a beter resource access must be implemented.<br />
Look at <a href="http://www.multicore-association.org/workgroup/oamp.php">OpenAMP</a> for an standard framework for LCM, IPC and resource sharing.<br />
<br />
Life Cycle Management for bare metal must be improved, an idea is to use a no returning interrupt like reset. It needs MMU management in order to remap individual Core exception vectors.<br />
<br />
Cross debug is also desirable, like to use OpenOCD from Linux to contact a remote gdb stub on bare-metal. May use <a href="https://github.com/turboscrew/rpi_stub">rpi_stub</a>, replacing UART comms with mailboxes or shared memory IPC.</div>
</div>
telmomoyahttp://www.blogger.com/profile/03309406444758171765noreply@blogger.com0tag:blogger.com,1999:blog-5085388132558072731.post-90358139342765690302016-07-04T13:50:00.000-03:002016-10-12T19:36:28.075-03:00C64: CP/M & SID PlayingHi, today I'm pressenting a new video about the <a href="http://telmomoya.blogspot.com.ar/2016/06/c64-software-cored.html">ARM powered C64</a> in <a href="https://telmomoya.blogspot.com.ar/2016/06/dual-core-c64.html">Dual Core</a> mode (6510 & Z80) playing a SID file. That is, while Z80 executes CP/M, 6510 executes irq-based SID player.<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
Border color denotes:<br />
Yellow: irq<br />
Light blue: 6510 instruction<br />
Red: Z80 instruction<br />
<br />
<a href="http://csdb.dk/release/?id=139559" target="_blank">Great sid tune</a> comes from <a href="http://uctumi.ml/" target="_blank">Uctumi of PVM</a>, sorry for dirty irq, nasty timmings and Lo-fi.<br />
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i9.ytimg.com/vi/InNp8ddqElk/default.jpg?sqp=CNCG6rsF&rs=AOn4CLCsfjkzlXOZOfh8XqaN_bwpBsGGeA" frameborder="0" height="266" src="https://www.youtube.com/embed/InNp8ddqElk?feature=player_embedded" width="320"></iframe></div>
<div>
<br /></div>
<div>
<br /></div>
<u>Tools used</u>:<br />
<a href="http://csdb.dk/release/?id=109000" target="_blank">sidreloc</a> to relocate sid player&data from $1000 to $6000 avoiding CP/M overlappings<br />
<a href="http://psid64.sourceforge.net/" target="_blank">PSID64</a> for prg generation (-n: no interface)<br />
<a href="https://sourceforge.net/projects/bin2header/" target="_blank">bin2hex</a> for .h header file generation to include from C code<br />
<br />
Also, some 6502/10 asm code for SID player initializing and irq vector redirecting:<br />
<br />
SRC Code:<br />
<span style="font-family: "courier new" , "courier" , monospace;">* = $5FE7</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">INIT LDA #$00</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> JSR $6000</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> RTS</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">REDIR SEI</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> LDA #<VECTOR</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> LDX #>VECTOR</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> STA $0314</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> STX $0315</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> CLI</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> RTS</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">VECTOR JSR $6003</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> JMP $EA31</span><br />
<br />
<br />
OBJ Code:<br />
<span style="font-family: "courier new" , "courier" , monospace;">A9 00 20 00 60 60 78 A9</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">FA A2 5F 8D 14 03 8E 15</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">03 58 60 20 03 60 4C 31</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">EA</span><br />
<br />
Start the thing with:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">SYS 24551 </span><span style="font-family: "courier new" , "courier" , monospace;">$5FE7 (INIT)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">SYS 24557 $5FE7 (REDIR)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">SYS 2176 CP/M Start</span>telmomoyahttp://www.blogger.com/profile/03309406444758171765noreply@blogger.com2tag:blogger.com,1999:blog-5085388132558072731.post-14087745642643136462016-06-27T20:57:00.000-03:002016-10-12T19:36:02.882-03:00Dual Core C64<a href="https://i.giphy.com/oYk2hVAMHsUo0.gif" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="112" src="https://i.giphy.com/oYk2hVAMHsUo0.gif" width="200" /></a>Exploring reconfigurability of the <a href="http://telmomoya.blogspot.com.ar/2016/06/c64-software-cored.html">ARM-powered C64</a> I added a Z80 emulator to the existing 6510 emulator. And for dynamic testing what better than cartridgeless C64 CP/M.<br />
So, heterogeneous multi-software-core C64 is obtained. Of course non-parallel concurrency is obtained, as only one hardware core (ARM) is available.<br />
<br />
For photos and videos, a very visual (and retro) effect was included, setting screen border color according to working core (Light Blue: 6510, Red:Z80)<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i9.ytimg.com/vi/Aew8i2cxcZk/default.jpg?sqp=COTKxrsF&rs=AOn4CLArWKkXm-wQPE4lUaYFzMAzTYUfig" frameborder="0" height="266" src="https://www.youtube.com/embed/Aew8i2cxcZk?feature=player_embedded" width="320"></iframe><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/GVKdCtnC054/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/GVKdCtnC054?feature=player_embedded" width="320"></iframe></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://telmomoya.blogspot.com.ar/2016/06/c64-software-cored.html">To read about ARM powered C64 visit previous post</a></div>
<br />
<br />
<br />
<br />
<u>C64 CP/M Background</u><br />
<a href="https://3.bp.blogspot.com/-JircGs0BL_c/V3Gt8i6C4uI/AAAAAAAACAU/RRkRYCI_MY8suumJl1VX3ZcH_qsa9E2wgCLcB/s1600/c64cpm-cart-800x800.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="200" src="https://3.bp.blogspot.com/-JircGs0BL_c/V3Gt8i6C4uI/AAAAAAAACAU/RRkRYCI_MY8suumJl1VX3ZcH_qsa9E2wgCLcB/s200/c64cpm-cart-800x800.jpg" width="200" /></a>In 80's Commodore developed a CP/M-cartridge that contained a Z80 to benefit C64 of software<br />
available for CP/M. See more about this at <a href="http://www.baltissen.org/newhtm/c64_cpm.htm" target="_blank">Ruud Baltissen's site</a>.<br />
<br />
As the original cartridge shares buses between 6510 and Z80 (and also VIC), not allowing simultaneous processors operation, the presented ARM based, non-parallel dual core, is enough for C64 CP/M execution.<br />
Some CP/M BIOS portions, like disk access take advantage of C64 kernal (ROM) and were written for 6510, and CP/M core, running on Z80, calls them continually (as border colors in the video).<br />
<br />
<a href="https://3.bp.blogspot.com/-YAkmOp9iJGo/V3GCgERhwbI/AAAAAAAAB_w/6iTXMuQQbiIxbJlM-jhEhSRC6-gjiyptQCKgB/s1600/CPM_Border1.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="130" src="https://3.bp.blogspot.com/-YAkmOp9iJGo/V3GCgERhwbI/AAAAAAAAB_w/6iTXMuQQbiIxbJlM-jhEhSRC6-gjiyptQCKgB/s200/CPM_Border1.png" width="200" /></a><u>6510 core:</u><br />
<a href="http://telmomoya.blogspot.com.ar/2016/06/c64-software-cored.html">In previous post an ARM based C64 was presented, with a C coded 6502 emulator modified for 6510-like operation</a>. It's based on the great <a href="http://rubbermallet.org/fake6502.c" target="_blank">Mike Chambers fake6502 emulator</a>.<br />
<u><br /></u>
<u>Z80 emulator</u><br />
Looking for free portable Z80 C coded emulator I found <a href="http://www.komkon.org/~dekogel/misc.html" target="_blank">Marcel de Kogel's Z80emu</a>: "written in pure C, which can be used on just about every 32+ bit system". It was easyly integrated to the existing project IDE: a bare-metal LPC1769 Eclipse workspace.<br />
For ARM compilation "low-endian CPU" option must be declared in Z80.h at "Machine dependent definitions" section.<br />
Z80 use in the C64 cartridge is limited, as IORQ and interrupts are not used, only memory access must be implemented.<br />
<br />
<u>Z80 memory access</u><br />
User must provide Z80emu with the Z80_RDMEM() and Z80_WRMEM() functions. As buses are shared with 6510 CPU, the same memory access C functions used by 6510 emulator are used by Z80 emulator: externalread() and externalwrite()<br />
<br />
/****************************************************************************/<br />
/* Read a byte from given memory location */<br />
/****************************************************************************/<br />
unsigned Z80_RDMEM(dword A){<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return(externalread((A&0xffff)+0x1000););<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
/****************************************************************************/<br />
/* Write a byte to given memory location */<br />
/****************************************************************************/<br />
void Z80_WRMEM(dword A,byte V){<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>externalwrite(((A&0xffff)+0x1000), V&0xff);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<br />
<a href="https://2.bp.blogspot.com/-tDUYxOLWKYA/V3GuRaySOoI/AAAAAAAACAc/op0AWYlpGO0unz4VoKVbXN1GQF9Ls1Y2ACLcB/s1600/cpmz80c64.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="165" src="https://2.bp.blogspot.com/-tDUYxOLWKYA/V3GuRaySOoI/AAAAAAAACAc/op0AWYlpGO0unz4VoKVbXN1GQF9Ls1Y2ACLcB/s200/cpmz80c64.jpg" width="200" /></a>Note the 0x1000 term added to adresses, recreating the 74LS283 adder included in the CP/M <br />
cartridge for address-space shift. This is so because of the conflict betwheen 6510's I/O port and Z80's reset vector, both located at 0x0000.<br />
<br />
<u>Core switching</u><br />
Without a core scheduler, the C64 CP/M cartridge, implementes a simple scheme. The Z80 is enabled or dissabled writing a byte to an address in the range $DE00/$DEFF with LSB = 0 or 1.<br />
So, core switch is entrusted to software, look how CP/M does it:<br />
<i><u><br /></u></i>
<i style="text-decoration: underline;">6510 assembler code, part of C64 CP/M Bios</i>: <a href="http://www.z80.eu/c64/BIOS65.ASM">http://www.z80.eu/c64/BIOS65.ASM</a><br />
<br />
MODESW<span class="Apple-tab-span" style="white-space: pre;"> </span>=<span class="Apple-tab-span" style="white-space: pre;"> </span>$DE00<span class="Apple-tab-span" style="white-space: pre;"> </span>1 = Z80 OFF, 0 = Z80 ON<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>LDA<span class="Apple-tab-span" style="white-space: pre;"> </span>#0<span class="Apple-tab-span" style="white-space: pre;"> </span>turn Z80 back on<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>STA<span class="Apple-tab-span" style="white-space: pre;"> </span>MODESW<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>NOP<span class="Apple-tab-span" style="white-space: pre;"> </span>delay only<br />
<br />
<br />
<i><u>Z80 assembler code, part of Z80 bootstrap routine for the C64</u></i>: <a href="http://www.z80.eu/c64/C64BOOT.ASM">http://www.z80.eu/c64/C64BOOT.ASM</a><br />
OFF<span class="Apple-tab-span" style="white-space: pre;"> </span>EQU<span class="Apple-tab-span" style="white-space: pre;"> </span>01H<br />
MODESW<span class="Apple-tab-span" style="white-space: pre;"> </span>EQU<span class="Apple-tab-span" style="white-space: pre;"> </span>0CE00H<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>MVI<span class="Apple-tab-span" style="white-space: pre;"> </span>A,OFF<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>STA<span class="Apple-tab-span" style="white-space: pre;"> </span>MODESW<span class="Apple-tab-span" style="white-space: pre;"> </span>;TURN OFF SELF<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>NOP<br />
<br />
Note MODESW definitios due to address shift.<br />
<a href="https://2.bp.blogspot.com/-vtZg9obhBKg/V3GENyqlUmI/AAAAAAAAB_4/xOOr9muRd9gykW6t2houEaeBt6SKeBYhwCLcB/s1600/CPM_Border2.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="120" src="https://2.bp.blogspot.com/-vtZg9obhBKg/V3GENyqlUmI/AAAAAAAAB_4/xOOr9muRd9gykW6t2houEaeBt6SKeBYhwCLcB/s200/CPM_Border2.png" width="200" /></a><br />
This functionality was implemented as follows:<br />
A catch in externalwrite() function enables changes the value of a "processor flag" variable (like the Flip Flop in the cartridge )<br />
In main loop, according to "processor flag" variable, one of the following action is performed:<br />
<br />
<ul>
<li>Z80 instruction execution</li>
<li>6510 instruction execution and 6510 interrupt treatment</li>
</ul>
<br />
<i>Recently I found Kernal64, a Scala Commodore 64 emulator supporting CP/M.</i><br />
<i><a href="https://github.com/abbruzze/kernal64/blob/master/Kernal64/src/ucesoft/c64/expansion/cpm/CPMCartridge.scala" target="_blank">Its autor resolved this, long before, in a very simmilar way.</a></i><br />
<br />
<u>CP/M loading</u><br />
For previous C64 IEC testing the Uno2IEC was used, but this simple Arduno based drive emulator does not support sector read and write needed by CP/M disk access.<br />
Not having available a disk drive or highly compatible device (SD2IEC, uIEC, etc.) another solution is necessary, described on its own post: Software-core C64 diskless CP/M boot<br />
<br />
<u>More photos</u><br />
<u><br /></u>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-7S1mdYK3JKo/V3G6WGrk2vI/AAAAAAAACBk/4knuN17V148rumvEvludVfi_GTEoR_pOwCLcB/s1600/foto_003.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://1.bp.blogspot.com/-7S1mdYK3JKo/V3G6WGrk2vI/AAAAAAAACBk/4knuN17V148rumvEvludVfi_GTEoR_pOwCLcB/s200/foto_003.jpg" width="200" /></a><a href="https://4.bp.blogspot.com/-JR_fIBmnto0/V3G6V9SLJgI/AAAAAAAACBY/xppYPRKL-QkDOea3-0pKBQYz8hE_1Lt9ACLcB/s1600/foto_002.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://4.bp.blogspot.com/-JR_fIBmnto0/V3G6V9SLJgI/AAAAAAAACBY/xppYPRKL-QkDOea3-0pKBQYz8hE_1Lt9ACLcB/s200/foto_002.jpg" width="200" /></a></div>
<br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-G-FeASx2x1w/V3G6Xosn8GI/AAAAAAAACB0/70q_iZ9taJgksOuG_JIsDSMImFBkkri4gCLcB/s1600/foto_005.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://2.bp.blogspot.com/-G-FeASx2x1w/V3G6Xosn8GI/AAAAAAAACB0/70q_iZ9taJgksOuG_JIsDSMImFBkkri4gCLcB/s200/foto_005.jpg" width="200" /></a><a href="https://3.bp.blogspot.com/-6n2wrlX_RVc/V3G6YFHRkWI/AAAAAAAACB8/7rqDbv2Hg5MT3L_ikskZQ7oZRlU-S4Z5QCLcB/s1600/foto_006.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://3.bp.blogspot.com/-6n2wrlX_RVc/V3G6YFHRkWI/AAAAAAAACB8/7rqDbv2Hg5MT3L_ikskZQ7oZRlU-S4Z5QCLcB/s200/foto_006.jpg" width="200" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-LRnUa8Z-WfQ/V3G6a4oiSFI/AAAAAAAACCM/uW5ByAxLROcUXyslK9ykurNFPJoBDi6JACLcB/s1600/foto_007.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://4.bp.blogspot.com/-LRnUa8Z-WfQ/V3G6a4oiSFI/AAAAAAAACCM/uW5ByAxLROcUXyslK9ykurNFPJoBDi6JACLcB/s200/foto_007.jpg" width="200" /></a><a href="https://2.bp.blogspot.com/-jaN94TFSFgQ/V3G6YbcVUsI/AAAAAAAACCE/Zx9T1GJXXpIgSust9b9dw3eXmQHDZus_ACLcB/s1600/foto_008.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://2.bp.blogspot.com/-jaN94TFSFgQ/V3G6YbcVUsI/AAAAAAAACCE/Zx9T1GJXXpIgSust9b9dw3eXmQHDZus_ACLcB/s200/foto_008.jpg" width="200" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-OdEl3xksrKw/V3G6Ts8UD1I/AAAAAAAACBM/9VxPyMQSBKYH8gCHVF-n9aGmwIfax1JJACLcB/s1600/Game_IEC_Run.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://1.bp.blogspot.com/-OdEl3xksrKw/V3G6Ts8UD1I/AAAAAAAACBM/9VxPyMQSBKYH8gCHVF-n9aGmwIfax1JJACLcB/s200/Game_IEC_Run.jpg" width="200" /></a><a href="https://4.bp.blogspot.com/-LzCYO3BhS3E/V3G6USupkMI/AAAAAAAACBI/yiHQYPxPy7wMag1QkEfa9xV4sKXdta0twCLcB/s1600/Interface_mounted.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://4.bp.blogspot.com/-LzCYO3BhS3E/V3G6USupkMI/AAAAAAAACBI/yiHQYPxPy7wMag1QkEfa9xV4sKXdta0twCLcB/s200/Interface_mounted.jpg" width="200" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-V-FIwyMlM5Y/V3G6Vz-FtzI/AAAAAAAACBg/Z3q7g0fmUoEezg29hfSWvu_DJT5sW6FoQCLcB/s1600/Interface_up.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://2.bp.blogspot.com/-V-FIwyMlM5Y/V3G6Vz-FtzI/AAAAAAAACBg/Z3q7g0fmUoEezg29hfSWvu_DJT5sW6FoQCLcB/s200/Interface_up.jpg" width="200" /></a><a href="https://4.bp.blogspot.com/-MR49QRrvjJc/V3G6TPzH0dI/AAAAAAAACBA/9Cm7yLhT7XoqIz8HghTaKjE5L56U-1qkgCLcB/s1600/Interface_Run.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://4.bp.blogspot.com/-MR49QRrvjJc/V3G6TPzH0dI/AAAAAAAACBA/9Cm7yLhT7XoqIz8HghTaKjE5L56U-1qkgCLcB/s200/Interface_Run.jpg" width="200" /></a></div>
<br />
<br />
<u><br /></u>telmomoyahttp://www.blogger.com/profile/03309406444758171765noreply@blogger.com4tag:blogger.com,1999:blog-5085388132558072731.post-3422584027522978252016-06-24T11:55:00.003-03:002016-10-12T20:29:59.108-03:00C64 powered by ARM running 6502 emulator<div style="text-align: justify;">
<br />
<a href="https://3.bp.blogspot.com/-G-FeASx2x1w/V3G6Xosn8GI/AAAAAAAACCU/ir4Ov6ZB8qo97zAtU8yIDtBjp3Y1bp_zQCKgB/s1600/foto_005.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="150" src="https://3.bp.blogspot.com/-G-FeASx2x1w/V3G6Xosn8GI/AAAAAAAACCU/ir4Ov6ZB8qo97zAtU8yIDtBjp3Y1bp_zQCKgB/s200/foto_005.jpg" width="200" /></a><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px;">A software core for the C</span></span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">64 it's possible. Unlike other implementations based on programmable logic (FPGA) and soft-cores, this is a 32-bit microcontroller running a 6510 emulator. So I call it software-core, no soft-core.</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px;"><span style="font-size: 14.6667px;">For easy </span></span></span><span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;">reconfigurability, a </span></span><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px;"><span style="font-size: 14.6667px;">portable </span></span></span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">C programed </span><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px;"><span style="font-size: 14.6667px;">microprocessor emulator is used resulting in a</span></span></span><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px;"> "</span></span><span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;">High-Level Languaje In-Circuit Emulator</span></span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">".</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">This is a spacetime emulator use, space because in-circuit, and time because real-time operation (software running </span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">synchronized to </span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">an extrernal clock).</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px;">Watch the videos about a C64 with the 6510 microprocessor replaced with a </span></span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">32-bit microcontroller: </span><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px;">ARM </span></span><span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;">Cortex M3 LPC1769</span></span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">. There are running games and IEC operation (via Uno2IEC).</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/RAxy8g-mCT0/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/RAxy8g-mCT0?feature=player_embedded" style="clear: right; float: right;" width="320"></iframe><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/GVKdCtnC054/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/GVKdCtnC054?feature=player_embedded" width="320"></iframe></div>
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<br />
<div style="line-height: 22.08px;">
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">As you can see, emulation it's not limited to 6510 processor only. Why not implement another CPU emulators for an </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; white-space: pre-wrap;">heterogeneous multi-core C64. In this next post view 6510 and Z80 emulators on ARM for cartridgeless C64 CP/M: <a href="http://telmomoya.blogspot.com.ar/2016/06/dual-core-c64.html"><b>Dual Core C64</b></a></span></div>
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-EGkS6okvN1M/V26crjsrZPI/AAAAAAAAB58/R093U05eao8_ZL0U9S8yt_6SPEN_OUFGQCLcB/s1600/arduino-ehbasic.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="250" src="https://1.bp.blogspot.com/-EGkS6okvN1M/V26crjsrZPI/AAAAAAAAB58/R093U05eao8_ZL0U9S8yt_6SPEN_OUFGQCLcB/s400/arduino-ehbasic.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">miker00lz's EhBasic@Arduino</td></tr>
</tbody></table>
<u>Inspiration:</u><br />
<br />
<span id="docs-internal-guid-11136344-82e6-a69f-43f8-ef8490999382"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">On Sept 2015 I saw </span></span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">miker00lz’s post at Arduino forum about runnig his </span><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">6502 emulator (</span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><a href="http://rubbermallet.org/fake6502.c" target="_blank">fake6502</a></span><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">) on Arduino (</span><a href="https://forum.arduino.cc/index.php?topic=193216.0" style="text-decoration: none;" target="_blank"><span style="color: #1155cc; font-family: "arial"; font-size: 14.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">https://forum.arduino.cc/index.php?topic=193216.0</span></a><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">).</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">That was interesting but I thought it would be better if the microcontroller handle </span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">external SRAM, CIA or SID</span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">.</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;"><br /></span></span><br />
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;"><br /></span></span>
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;"><br /></span></span>
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;"><br /></span></span>
<br />
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;"></span></span><br />
<u><br /></u>
<u><br /></u>
<u>ARM:</u><br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-tcUTtx4ftxQ/V26cPySHYoI/AAAAAAAAB50/HPyb_PU1TMQFyK5IllzgGgyClcxW3It5gCLcB/s1600/EhBasic_Debug_Capture.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="247" src="https://2.bp.blogspot.com/-tcUTtx4ftxQ/V26cPySHYoI/AAAAAAAAB50/HPyb_PU1TMQFyK5IllzgGgyClcxW3It5gCLcB/s400/EhBasic_Debug_Capture.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">EhBasic@LPC1769 debug console</td></tr>
</tbody></table>
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;"><br /></span></span>
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;"></span></span>
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;">Thinking that at some point Arduino would limit performance I choose a more powerfull platform: an NXP <a href="http://www.nxp.com/documents/user_manual/UM10360.pdf" target="_blank">LPC1769</a>, ARM Cortex 3. The LPC also has </span></span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">5V tolerant GPIO pins needed by MOS chips. </span><br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">First test was with a 32k x 8 SRAM (<a href="http://web.mit.edu/6.115/www/document/62256.pdf" target="_blank">HM62256</a>) and fake6502 running <a href="https://github.com/jefftranter/6502/tree/master/asm/ehbasic" target="_blank">EhBasic</a>.</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"></span><br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"></span>
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"></span>
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"></span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="color: black; font-family: "arial"; font-size: 14.6667px; line-height: 1.38; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">Then GPIO pins were </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; text-align: justify; white-space: pre-wrap;">connected </span><span style="color: black; font-family: "arial"; font-size: 14.6667px; line-height: 1.38; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">to SRAM as 6502 buses, really an incomplete </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; text-align: justify; white-space: pre-wrap;">address bus (</span><span style="font-family: "courier new" , "courier" , monospace; line-height: 22.08px; text-align: justify; white-space: pre-wrap;">A0 to A13</span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; text-align: justify; white-space: pre-wrap;">) beause</span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; text-align: justify; white-space: pre-wrap;"> only 14 contiguous </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; text-align: justify; white-space: pre-wrap;">GPIO pins available: </span><span style="font-family: "courier new" , "courier" , monospace; line-height: 22.08px; text-align: justify; white-space: pre-wrap;"> P1.18 to P1.31</span><span style="font-size: 14.6667px; line-height: 20.24px; text-align: justify; white-space: pre-wrap;"><span style="font-family: "arial";">.</span></span><br />
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span>
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-vilQuC9DO2U/V29BgVWPlaI/AAAAAAAAB_I/K8DRwYrUWyoKdDBXwrdvb9ZDOj9wU2sfgCLcB/s1600/lpcxpresso_pinout.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="217" src="https://4.bp.blogspot.com/-vilQuC9DO2U/V29BgVWPlaI/AAAAAAAAB_I/K8DRwYrUWyoKdDBXwrdvb9ZDOj9wU2sfgCLcB/s320/lpcxpresso_pinout.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: 12.8px;">LPCXpresso 1769 Pinout</span></td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-G7W_A_VXIlc/V26UxUNH0JI/AAAAAAAAB5g/zGcbeKaaFqUQk9k--WrpzE6CBK4GmIAWACKgB/s1600/sram_pinout.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://4.bp.blogspot.com/-G7W_A_VXIlc/V26UxUNH0JI/AAAAAAAAB5g/zGcbeKaaFqUQk9k--WrpzE6CBK4GmIAWACKgB/s200/sram_pinout.png" width="195" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">62256 (32K x 8) SRAM Pinout</td></tr>
</tbody></table>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">And memory read and write functions for fake6502 were written to manage the GPIO pins connected as address, data and control buses. </span></div>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">//MEMORY READ</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">uint8_t read6502(uint16_t address){</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2SET</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">|= (1 << 10);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Pone en H RW* (p2.10) Lectura</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2PINH= address << 2;</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Escribe la dirección A0 a A13 en P1.18 a P1.31 (bus de direcciones)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2SET</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">|= (1 << 11);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Pone en H CS (p2.11)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">value = FIO2PIN0;</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Lee bus de datos (P2.0 a P2.7)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2CLR</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">|= (1 << 11);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Pone en L CS (p2.11)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">RETURN (value);</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">}</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><b id="docs-internal-guid-11136344-82e8-0d09-1a55-1228c005b598" style="font-weight: normal;"><br /></b></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">//MEMORY WRITE</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">void write6502(uint16_t address, uint8_t value){</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2PINH= address << 2;</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Escribe la dirección A0 a A13 en P1.18 a P1.31 (bus de direcciones)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2PIN0= value;</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Escribe bus de datos (P2.0 a P2.7)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2CLR</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">|= (1 << 10);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Pone en L RW* (p2.10) Escritura</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2SET</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">|= (1 << 11);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Pone en H CS (p2.11)</span></span></div>
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="vertical-align: baseline;">FIO2CLR</span><span style="vertical-align: baseline;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="vertical-align: baseline;">|= (1 << 11);</span><span style="vertical-align: baseline;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="vertical-align: baseline;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="vertical-align: baseline;">// Pone en L CS (p2.11)</span></span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="vertical-align: baseline;"><span id="docs-internal-guid-11136344-82e9-d4f4-825b-669675902e57"><span style="font-family: "courier new" , "courier" , monospace; vertical-align: baseline;">}</span></span></span></span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"><br /></span></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"><br /></span></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"><span id="docs-internal-guid-11136344-82ea-14e6-5337-d46436009cfd"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;">The pins connection was direct and the emulator ran asynchronously, EhBasic code was, like on the Arduino, contained as a C constant array in the microcontroller flash program memory.</span></span></span></span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"><span id="docs-internal-guid-11136344-82ea-328c-d20a-36db169f1583"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"></span></span></span></span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span></span>
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-zmzsS-jOl-0/V26vOdDJukI/AAAAAAAAB6o/db3eSHhtu-w17473pRGm-CmPrgJbrD1iwCKgB/s1600/ROM_Read_Capture.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="247" src="https://2.bp.blogspot.com/-zmzsS-jOl-0/V26vOdDJukI/AAAAAAAAB6o/db3eSHhtu-w17473pRGm-CmPrgJbrD1iwCKgB/s400/ROM_Read_Capture.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Comparing ROM Dump with ROM Read</td></tr>
</tbody></table>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><u style="font-family: 'Times New Roman'; font-size: medium; line-height: normal; white-space: normal;">C64:</u></span></span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Then I wanted to reproduce 6502 operation reading program from a ROM, that is an external stored program, external to the microcontroller. One first option was to write EhBasic to a 29FXXX DIP Flash but I prefered to use C64 ROMs, so I retired from a C64 a socketed 901225 Characters ROM chip, connected it like the SRAM to the microcontroller and readed it.</span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">And then, one more step, what about connecting the microcontroller to the C64 replacing the original 6510 and test ROM, CIAs and SID with address decoding provided by the original PLA.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">It seems trivial but presents several difficulties because in the C64 the 6510 microprocessor shares the buses with the VIC video chip, the system RAM is DRAM refreshed by the VIC chip and we need to emulate 6510’s I/O port.</span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"><b id="docs-internal-guid-11136344-82ea-76c6-7d16-53d652dff52b" style="font-weight: normal;"><br /></b></span></span>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">6510’s I/O port is mapped at $0001 address and, in C64, bits 0,1 and 2 connected to LORAM, HIRAM and CHAREN signals. PLA use this signals for switching between ROM and RAM for $A000-$BFFF, $D000-$DFFF and $E000-$FFFF </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; white-space: pre-wrap;">memory areas.</span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"></span></span><br /></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">This operation was implemented with 3 GPIO pins and catchs at write function:</span></div>
<div style="line-height: 1.38;">
<span style="line-height: 22.08px;"><br /></span>
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;">// 6510 I/O Port</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;">if (address==0x1) {</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> if ((value & 0x1)==0){</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> FIO2CLR = (1 << 11); // Pone en L LORAM</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> }</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> else</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> {</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> FIO2SET = (1 << 11); // Pone en H LORAM</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> }</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> if ((value & 0x2)==0){</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"><br /></span></span>
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> FIO2CLR = (1 << 12); // Pone en L HIRAM</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;">}</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> else</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> {</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> FIO2SET = (1 << 12); // Pone en H HIRAM</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> }</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> if ((value & 0x4)==0){</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> FIO2CLR = (1 << 13);</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> }</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> else</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> {</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> FIO2SET = (1 << 13); // Pone en H CHAREN</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> }</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> }</span></span></div>
<div style="line-height: 1.38;">
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-FmcJllLfkbQ/V26xEceB_7I/AAAAAAAAB7M/KL-1wsYCBvMFuuAIPrgweOFjZjdk7d1gACKgB/s1600/6510_no_Vic.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="150" src="https://4.bp.blogspot.com/-FmcJllLfkbQ/V26xEceB_7I/AAAAAAAAB7M/KL-1wsYCBvMFuuAIPrgweOFjZjdk7d1gACKgB/s200/6510_no_Vic.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">VIC Out</td></tr>
</tbody></table>
<span id="docs-internal-guid-d8419f50-87ca-7dec-d39d-3b85ff503df4"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">For first tests I removed the VIC chip from the board, but that left me without CPU Clock and without refresh for DRAM, so emulator must use microcontroller RAM. With catchs on memory write function I redirected RAM writes to screen area ($0400-$7fff) to microcontroller debug console and received the C64 startup message. </span></span><span style="color: black; font-size: 14.6667px; line-height: 20.24px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial";">Also pending address lines <span style="font-family: "courier new" , "courier" , monospace; font-size: small; line-height: 22.08px;">A14 and A15 </span></span></span></span></span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; white-space: pre-wrap;">were implemented with two aditional GPIOs: </span><span style="font-family: "courier new" , "courier" , monospace; line-height: 22.08px; white-space: pre-wrap;">P4.28 and P4.29</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div>
<div style="line-height: 1.38;">
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-sxjnfgo53wk/V26xNdqFMqI/AAAAAAAAB7M/eYKK8A3JQy4Ty-7vzUD1fweVhvxoyA9zQCKgB/s1600/C64_ROM_read_time.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="198" src="https://2.bp.blogspot.com/-sxjnfgo53wk/V26xNdqFMqI/AAAAAAAAB7M/eYKK8A3JQy4Ty-7vzUD1fweVhvxoyA9zQCKgB/s320/C64_ROM_read_time.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">ROM Read</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-1TyHhTsKblI/V26xusdVlrI/AAAAAAAAB7Y/CvDZ-0jBlFUSru4BguKCuZP5NCxIj71MACKgB/s1600/C64_boot_console.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="196" src="https://1.bp.blogspot.com/-1TyHhTsKblI/V26xusdVlrI/AAAAAAAAB7Y/CvDZ-0jBlFUSru4BguKCuZP5NCxIj71MACKgB/s320/C64_boot_console.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">C64 Boot</td></tr>
</tbody></table>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span id="docs-internal-guid-11136344-82ed-15a4-65fc-7c3bb6380b06"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"></span></span></span></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"></span></span></span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"></span></span></span></div>
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="vertical-align: baseline;"><span style="vertical-align: baseline;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="line-height: 22.08px;"></span></span></span></span></span><u>VIC:</u><br />
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="vertical-align: baseline;"><span style="vertical-align: baseline;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="line-height: 22.08px;"></span></span></span></span></span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;">As VIC provides CLK for CPU up to here the emulator runs </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; white-space: pre-wrap;"> asynchronously. </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;">In order to place the VIC on the board and share buses the emulator needs third state capability and synchronization to system clock.</span><br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In the C64 bus access is driven by VIC with it’s BA signal connected to 6510’s AEC pin. All microprocessor read and write operations take place when AEC=1 and must be enabled by the RDY signal too. When AEC=0 VIC uses the buses and microprocessor pins must go to third state.</span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">For more datails please see: <a href="http://www.zimmers.net/cbmpics/cbm/c64/vic-ii.txt">http://www.zimmers.net/cbmpics/cbm/c64/vic-ii.txt</a></span></div>
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="vertical-align: baseline;"><span style="vertical-align: baseline;"><span id="docs-internal-guid-d8419f50-88d8-10de-7a27-c43edbb3eb0b"></span></span></span></span><br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><u style="font-family: 'Times New Roman'; font-size: medium; line-height: normal; white-space: normal;">Interface:</u></span><br />
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;">That operation was implemented using a custom interface adapter using discrete logic: 3 x 74HC245 Octal 3−State Noninverting Bus Transceivers for address and data bus and a 74HC00 for R/W. Two remaining 74HC00 gates were used to accommodate required delay between in and out 6510 clock signals.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-GlRB26Tw7FY/V265hicOa_I/AAAAAAAAB8w/wnEKEdwth4EbqL8XCBvrAB6OjX34-b3GgCKgB/s1600/Interface_up.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://2.bp.blogspot.com/-GlRB26Tw7FY/V265hicOa_I/AAAAAAAAB8w/wnEKEdwth4EbqL8XCBvrAB6OjX34-b3GgCKgB/s320/Interface_up.jpg" width="320" /></a><a href="https://2.bp.blogspot.com/-1lyIoXh70KY/V265fkPoRSI/AAAAAAAAB80/T-IwBkOsZHMoNO2bWGkO4xtJR8XzagksACKgB/s1600/Interface_Down.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://2.bp.blogspot.com/-1lyIoXh70KY/V265fkPoRSI/AAAAAAAAB80/T-IwBkOsZHMoNO2bWGkO4xtJR8XzagksACKgB/s320/Interface_Down.jpg" width="320" /></a></div>
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-A-3kh1MI1WQ/V265gD_c_NI/AAAAAAAAB8w/Jse5VxDpYsMl6ch9UJ-ZsNcRS7lQixESACKgB/s1600/Interface_Det.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://3.bp.blogspot.com/-A-3kh1MI1WQ/V265gD_c_NI/AAAAAAAAB8w/Jse5VxDpYsMl6ch9UJ-ZsNcRS7lQixESACKgB/s320/Interface_Det.jpg" width="320" /></a><a href="https://1.bp.blogspot.com/-uU4GnJ74Ou8/V265hFL3KqI/AAAAAAAAB8w/ppE7LWo16ig9MIi0VT4tDSOwqY3Gs1OwwCKgB/s1600/Interface_mounted.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="179" src="https://1.bp.blogspot.com/-uU4GnJ74Ou8/V265hFL3KqI/AAAAAAAAB8w/ppE7LWo16ig9MIi0VT4tDSOwqY3Gs1OwwCKgB/s320/Interface_mounted.jpg" width="320" /></a></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<br /></div>
<a href="https://3.bp.blogspot.com/-YR-qDTvHPD8/V27YuaVbT3I/AAAAAAAAB-Q/fEchoKPLPHIE6WDHgQr2HxNxpauyNy-KACLcB/s1600/RW_AEC_RDY.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="165" src="https://3.bp.blogspot.com/-YR-qDTvHPD8/V27YuaVbT3I/AAAAAAAAB-Q/fEchoKPLPHIE6WDHgQr2HxNxpauyNy-KACLcB/s200/RW_AEC_RDY.png" width="200" /></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.6667px; font-style: normal; font-variant: normal; font-weight: 400; line-height: 1.38; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><span id="docs-internal-guid-d8419f50-87ce-0aa7-173c-4761c7597570"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;">Also read and write functions were rewritten in order to take into account AEC and RDY states.</span></span></span></span></span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.6667px; font-style: normal; font-variant: normal; font-weight: 400; line-height: 1.38; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span></span></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.6667px; font-style: normal; font-variant: normal; font-weight: 400; line-height: 1.38; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;">As 6510 only can access buses when AEC=HIGH all read and write operations are synchronized to that signal and not to Clk (Fi2).</span></span></span></span><br />
<div style="line-height: 1.38;">
<br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial";"><br /></span></span></span></span>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">//MEMORY READ (SHARED BUS)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">uint8_t externalread(uint16_t address) {</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">uint8_t value;</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==0) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=0 -> Fi0(P2.8)=0</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==1) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=1 -> Fi0(P2.8)=1</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO1PINH =(address << 2);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Escribe la dirección A0 a A13 en P1.18 a P1.31 (bus de direcciones)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO4PINH= (address >> 2);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// A14 y A15 en P4.28 y P4.29</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO0PIN3&16)==0){};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Si RDY=0 (P0.28) espero aquí</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==0) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=0 -> Fi0(P2.8)=0</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==1) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=1 -> Fi0(P2.8)=1</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">value = FIO2PIN0; </span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Lee bus de datos (P2.0 a P2.7)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">//</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">DEBUGOUT ("<> %x %x\n",address,value);</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return(value);</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">}</span></span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="vertical-align: baseline;"><span style="font-family: "courier new" , "courier" , monospace; vertical-align: baseline;"><b id="docs-internal-guid-d8419f50-87ce-54bb-8f9e-32b31f1a3878" style="font-weight: normal;"><br /></b></span></span></span>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">//</span></span><span style="font-family: "courier new" , "courier" , monospace; line-height: 22.08px; white-space: pre-wrap;">MEMORY WRITE (SHARED BUS)</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">void externalwrite(uint16_t address, uint8_t value) {</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==0) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=0 -> Fi0(P2.8)=0</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2PIN0 = value; </span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Escribe bus de datos (P2.0 a P2.7)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==1) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=1 -> Fi0(P2.8)=1</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">////////////////////FLANCO DESCENDENTE////////////////////</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO1PINH =(address << 2);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Escribe la dirección A0 a A13 en P1.18 a P1.31 (bus de direcciones)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO4PINH= (address >> 2);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// A14 y A15 en P4.28 y P4.29</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2SET</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">= (1 << 10);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Pone en H W (P2.10) Escritura</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> FIO2DIR0 = 0xff; </span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> // Bus de datos como Salida</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==0) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=0 -> Fi0(P2.8)=0</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==1) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=1 -> Fi0(P2.8)=1</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">////////////////////FLANCO DESCENDENTE////////////////////</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2PIN0 = value; </span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Escribe bus de datos (P2.0 a P2.7)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2DIR0 = 0x00;</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Bus de datos como Entrada</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2CLR</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">= (1 << 10);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Pone en L W (P2.10) Lectura</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">}</span></span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-size: 14.6667px; vertical-align: baseline;"><br /></span></span></span>
<span style="background-color: transparent; color: black; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-size: 14.6667px; vertical-align: baseline;"><br /></span></span></span>
<br />
<span style="background-color: transparent; color: black; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-size: 14.6667px; vertical-align: baseline;"><u style="font-size: medium; line-height: normal; white-space: normal;">Timmings:</u></span></span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<a href="https://1.bp.blogspot.com/-Mnjyx1-GYZc/V265hm5g77I/AAAAAAAAB8w/xonufoCl8pEIaPenDX-JHAv0v3myypsXwCKgB/s1600/oscilloscope_one.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="150" src="https://1.bp.blogspot.com/-Mnjyx1-GYZc/V265hm5g77I/AAAAAAAAB8w/xonufoCl8pEIaPenDX-JHAv0v3myypsXwCKgB/s200/oscilloscope_one.jpg" width="200" /></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">VIC chip was connected to the board and several time adjustments were made to read/write routines.</span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Incorrect timmings produced DRAM corruption during VIC refresh and access.</span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-size: 14.6667px; vertical-align: baseline;"><b id="docs-internal-guid-d8419f50-87ce-f9c4-d54c-07d53706bb05" style="font-weight: normal;"><br /></b></span></span></span>
</div>
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-xikUdOW4jy8/V266HHkKdZI/AAAAAAAAB9M/j6oezl2CptE3X9XqqCYzHSDoE8ovX9HUQCKgB/s1600/Screen_Bad.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="228" src="https://4.bp.blogspot.com/-xikUdOW4jy8/V266HHkKdZI/AAAAAAAAB9M/j6oezl2CptE3X9XqqCYzHSDoE8ovX9HUQCKgB/s320/Screen_Bad.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Ram Corruption</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-20TiChoxVeY/V266G_UeOFI/AAAAAAAAB9M/JGITWChY3RoVXnCj4syQ0PqeBxTEKvUhwCKgB/s1600/Screen_Better.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="219" src="https://3.bp.blogspot.com/-20TiChoxVeY/V266G_UeOFI/AAAAAAAAB9M/JGITWChY3RoVXnCj4syQ0PqeBxTEKvUhwCKgB/s320/Screen_Better.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Error: 38911./909 Bytes Free</td></tr>
</tbody></table>
<div style="line-height: 1.38;">
<br /></div>
<div style="line-height: 1.38;">
<br /></div>
<div class="separator" style="clear: both; line-height: 1.38; text-align: center;">
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; text-align: justify; white-space: pre-wrap;"><b>Finally I got the system running, a C64 with a software-emulated microprocessor!</b></span></div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; line-height: 1.38; text-align: center;">
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; text-align: justify; white-space: pre-wrap;"><br /></span></div>
<div class="separator" style="clear: both; line-height: 1.38; text-align: center;">
<a href="https://2.bp.blogspot.com/-I2AHJasAuzg/V265gnbr8TI/AAAAAAAAB8w/r5IvBnVMOdgXU20otpleLlrOh0cs_nlAwCKgB/s1600/Interface_Run.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="356" src="https://2.bp.blogspot.com/-I2AHJasAuzg/V265gnbr8TI/AAAAAAAAB8w/r5IvBnVMOdgXU20otpleLlrOh0cs_nlAwCKgB/s640/Interface_Run.jpg" width="640" /></a></div>
<div class="separator" style="clear: both; line-height: 1.38; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; line-height: 1.38; text-align: left;">
<u style="line-height: normal; text-align: justify;"><br /></u></div>
<div class="separator" style="clear: both; line-height: 1.38; text-align: left;">
<u style="line-height: normal; text-align: justify;">Testing;</u></div>
<div style="line-height: 1.38;">
</div>
<div style="line-height: 1.38;">
<span style="line-height: 1.38;"> </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;">The shared bus access works fine even with the lower performance obtained, about 60%, respect to the original 1MHz 6510.</span></div>
<div style="line-height: 1.38;">
<a href="https://4.bp.blogspot.com/-oGYxA5MMddg/V27TYnDMJLI/AAAAAAAAB94/gqzKgOoLlbgWmaZeXz2nSTF5k5MBjI3MgCLcB/s1600/Game_IEC_Run.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em; text-align: right;"><br /></a><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"></span>
<span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span></span>
<span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span></span>
<span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">Games and default IEC bus was tested using <a href="https://github.com/Larswad/uno2iec" target="_blank">Uno2IEC</a>, a 1541 IEC interface emulator using Arduino.</span></div>
<div style="line-height: 1.38;">
<a href="https://4.bp.blogspot.com/-oGYxA5MMddg/V27TYnDMJLI/AAAAAAAAB94/gqzKgOoLlbgWmaZeXz2nSTF5k5MBjI3MgCLcB/s1600/Game_IEC_Run.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em; text-align: right;"><img border="0" height="112" src="https://4.bp.blogspot.com/-oGYxA5MMddg/V27TYnDMJLI/AAAAAAAAB94/gqzKgOoLlbgWmaZeXz2nSTF5k5MBjI3MgCLcB/s200/Game_IEC_Run.jpg" width="200" /></a><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
</div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><b style="font-weight: normal;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;">Of course better performance can be achieved using an assembly emulator, like a6502 (</span><a href="https://github.com/BigEd/a6502" style="font-family: 'Times New Roman'; font-size: medium; line-height: 1.38; text-decoration: none; white-space: normal;"><span style="color: #1155cc; font-family: "arial"; font-size: 14.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">https://github.com/BigEd/a6502</span></a><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;">), but the idea is a </span></b></span></span></span><span style="font-family: "arial"; font-size: 14.6667px; line-height: normal; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="font-family: "arial"; line-height: normal;"><span style="font-size: 14.6667px; white-space: pre-wrap;">High-Level Languaje In-Circuit Emulator"</span></span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;">.</span></span><br />
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span>
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span>
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span>
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span>
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span>
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span>
<br />
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><u>More photos</u></span></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-4ovz5UC7fck/V3G70qfTgNI/AAAAAAAACC8/d_j1G8B8dAISqXqjeM-Cvdjk6JCgt9irgCLcB/s1600/foto_016.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://4.bp.blogspot.com/-4ovz5UC7fck/V3G70qfTgNI/AAAAAAAACC8/d_j1G8B8dAISqXqjeM-Cvdjk6JCgt9irgCLcB/s200/foto_016.jpg" width="200" /></a><a href="https://2.bp.blogspot.com/-JR_fIBmnto0/V3G6V9SLJgI/AAAAAAAACCU/M69gTcHv3p4ZaAVOAWrpPD6gkxjW9xe0QCKgB/s1600/foto_002.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://2.bp.blogspot.com/-JR_fIBmnto0/V3G6V9SLJgI/AAAAAAAACCU/M69gTcHv3p4ZaAVOAWrpPD6gkxjW9xe0QCKgB/s200/foto_002.jpg" width="200" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-6n2wrlX_RVc/V3G6YFHRkWI/AAAAAAAACCU/eTU35FPtTrYG4GuIK_9CGkrmKaKOTldpACKgB/s1600/foto_006.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://2.bp.blogspot.com/-6n2wrlX_RVc/V3G6YFHRkWI/AAAAAAAACCU/eTU35FPtTrYG4GuIK_9CGkrmKaKOTldpACKgB/s200/foto_006.jpg" width="200" /></a><a href="https://3.bp.blogspot.com/-OdEl3xksrKw/V3G6Ts8UD1I/AAAAAAAACCU/0nv0tHaJdOASqpT3O05rR1k-BTkVuFSlwCKgB/s1600/Game_IEC_Run.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://3.bp.blogspot.com/-OdEl3xksrKw/V3G6Ts8UD1I/AAAAAAAACCU/0nv0tHaJdOASqpT3O05rR1k-BTkVuFSlwCKgB/s200/Game_IEC_Run.jpg" width="200" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-VbSoUg3YKAk/V3G7zN4r3ZI/AAAAAAAACCk/CL9tDOjntEofNmA-vYTM9DOwnS9kXxk1ACLcB/s1600/foto_001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="138" src="https://3.bp.blogspot.com/-VbSoUg3YKAk/V3G7zN4r3ZI/AAAAAAAACCk/CL9tDOjntEofNmA-vYTM9DOwnS9kXxk1ACLcB/s200/foto_001.jpg" width="200" /></a><a href="https://4.bp.blogspot.com/-uL1HOukU-kg/V3G7zFgfDVI/AAAAAAAACCo/khNjQ1B0VG4TnIWqhg7jLb558WZ9aof8ACLcB/s1600/foto_010.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://4.bp.blogspot.com/-uL1HOukU-kg/V3G7zFgfDVI/AAAAAAAACCo/khNjQ1B0VG4TnIWqhg7jLb558WZ9aof8ACLcB/s200/foto_010.jpg" width="200" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-LRnUa8Z-WfQ/V3G6a4oiSFI/AAAAAAAACCM/1VbGAabYhW8CxxqJJEYzyaQSqMBU2BOaACKgB/s1600/foto_007.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://1.bp.blogspot.com/-LRnUa8Z-WfQ/V3G6a4oiSFI/AAAAAAAACCM/1VbGAabYhW8CxxqJJEYzyaQSqMBU2BOaACKgB/s200/foto_007.jpg" width="200" /></a><a href="https://3.bp.blogspot.com/-G-FeASx2x1w/V3G6Xosn8GI/AAAAAAAACCU/ir4Ov6ZB8qo97zAtU8yIDtBjp3Y1bp_zQCKgB/s1600/foto_005.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://3.bp.blogspot.com/-G-FeASx2x1w/V3G6Xosn8GI/AAAAAAAACCU/ir4Ov6ZB8qo97zAtU8yIDtBjp3Y1bp_zQCKgB/s200/foto_005.jpg" width="200" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-9gLdSskQdQ8/V3G70byHk6I/AAAAAAAACC0/ro_rCyykFdUTm6rmSxx_SGku28wFrSLnACLcB/s1600/foto_015.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://3.bp.blogspot.com/-9gLdSskQdQ8/V3G70byHk6I/AAAAAAAACC0/ro_rCyykFdUTm6rmSxx_SGku28wFrSLnACLcB/s200/foto_015.jpg" width="150" /></a><a href="https://3.bp.blogspot.com/-Yi_ONzAR5Ew/V3G7zEe-s9I/AAAAAAAACCs/2OJSMFV58P88dC3CYpTYI7E1Nxp2MycSwCLcB/s1600/foto_014.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://3.bp.blogspot.com/-Yi_ONzAR5Ew/V3G7zEe-s9I/AAAAAAAACCs/2OJSMFV58P88dC3CYpTYI7E1Nxp2MycSwCLcB/s200/foto_014.jpg" width="200" /></a></div>
<br />
<br />
<br />
<br />
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><u><br /></u></span></span></div>
</div>
</div>
<span id="docs-internal-guid-11136344-82e7-17ea-262b-8a3a3885f2c0"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"></span></span>telmomoyahttp://www.blogger.com/profile/03309406444758171765noreply@blogger.com0Salta, Salta, Argentina-24.7821269 -65.42319759999998-25.0127624 -65.745921099999975 -24.551491400000003 -65.100474099999985tag:blogger.com,1999:blog-5085388132558072731.post-87111958756375835032016-06-24T11:55:00.002-03:002016-10-12T19:28:13.743-03:00C64 powered by ARM running 6502 emulator<div style="text-align: justify;">
<br />
<a href="https://3.bp.blogspot.com/-G-FeASx2x1w/V3G6Xosn8GI/AAAAAAAACCU/ir4Ov6ZB8qo97zAtU8yIDtBjp3Y1bp_zQCKgB/s1600/foto_005.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="150" src="https://3.bp.blogspot.com/-G-FeASx2x1w/V3G6Xosn8GI/AAAAAAAACCU/ir4Ov6ZB8qo97zAtU8yIDtBjp3Y1bp_zQCKgB/s200/foto_005.jpg" width="200" /></a><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px;">A software core for the C</span></span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">64 it's possible. Unlike other implementations based on programmable logic (FPGA) and soft-cores, this is a 32-bit microcontroller running a 6510 emulator. So I call it software-core, no soft-core.</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px;"><span style="font-size: 14.6667px;">For easy </span></span></span><span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;">reconfigurability, a </span></span><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px;"><span style="font-size: 14.6667px;">portable </span></span></span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">C programed </span><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px;"><span style="font-size: 14.6667px;">microprocessor emulator is used resulting in a</span></span></span><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px;"> "</span></span><span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;">High-Level Languaje In-Circuit Emulator</span></span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">".</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">This is a spacetime emulator use, space because in-circuit, and time because real-time operation (software running </span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">synchronized to </span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">an extrernal clock).</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px;">Watch the videos about a C64 with the 6510 microprocessor replaced with a </span></span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">32-bit microcontroller: </span><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px;">ARM </span></span><span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;">Cortex M3 LPC1769</span></span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">. There are running games and IEC operation (via Uno2IEC).</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/RAxy8g-mCT0/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/RAxy8g-mCT0?feature=player_embedded" style="clear: right; float: right;" width="320"></iframe><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/GVKdCtnC054/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/GVKdCtnC054?feature=player_embedded" width="320"></iframe></div>
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<br />
<div style="line-height: 22.08px;">
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">As you can see, emulation it's not limited to 6510 processor only. Why not implement another CPU emulators for an </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; white-space: pre-wrap;">heterogeneous multi-core C64. In this next post view 6510 and Z80 emulators on ARM for cartridgeless C64 CP/M: <a href="http://telmomoya.blogspot.com.ar/2016/06/dual-core-c64.html"><b>Dual Core C64</b></a></span></div>
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-EGkS6okvN1M/V26crjsrZPI/AAAAAAAAB58/R093U05eao8_ZL0U9S8yt_6SPEN_OUFGQCLcB/s1600/arduino-ehbasic.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="250" src="https://1.bp.blogspot.com/-EGkS6okvN1M/V26crjsrZPI/AAAAAAAAB58/R093U05eao8_ZL0U9S8yt_6SPEN_OUFGQCLcB/s400/arduino-ehbasic.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">miker00lz's EhBasic@Arduino</td></tr>
</tbody></table>
<u><br /></u>
<u><br /></u>
<u>Inspiration:</u><br />
<br />
<span id="docs-internal-guid-11136344-82e6-a69f-43f8-ef8490999382"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">On Sept 2015 I saw </span></span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">miker00lz’s post at Arduino forum about runnig his </span><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">6502 emulator (</span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><a href="http://rubbermallet.org/fake6502.c" target="_blank">fake6502</a></span><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">) on Arduino (</span><a href="https://forum.arduino.cc/index.php?topic=193216.0" style="text-decoration: none;" target="_blank"><span style="color: #1155cc; font-family: "arial"; font-size: 14.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">https://forum.arduino.cc/index.php?topic=193216.0</span></a><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">).</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">That was interesting but I thought it would be better if the microcontroller handle </span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">external SRAM, CIA or SID</span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">.</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;"><br /></span></span><br />
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;"><br /></span></span>
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;"><br /></span></span>
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;"><br /></span></span>
<br />
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;"></span></span><br />
<u><br /></u>
<u><br /></u>
<u><br /></u><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-tcUTtx4ftxQ/V26cPySHYoI/AAAAAAAAB50/HPyb_PU1TMQFyK5IllzgGgyClcxW3It5gCLcB/s1600/EhBasic_Debug_Capture.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="247" src="https://2.bp.blogspot.com/-tcUTtx4ftxQ/V26cPySHYoI/AAAAAAAAB50/HPyb_PU1TMQFyK5IllzgGgyClcxW3It5gCLcB/s400/EhBasic_Debug_Capture.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><br />
EhBasic@LPC1769 debug console</td></tr>
</tbody></table>
<br />
<u style="font-family: arial; font-size: 14.6667px; white-space: pre-wrap;">ARM:</u><br />
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;"><br /></span></span>
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;"></span></span>
<span style="font-family: "arial";"><span style="font-size: 14.6667px; white-space: pre-wrap;">Thinking that at some point Arduino would limit performance I choose a more powerfull platform: an NXP <a href="http://www.nxp.com/documents/user_manual/UM10360.pdf" target="_blank">LPC1769</a>, ARM Cortex 3. The LPC also has </span></span><span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">5V tolerant GPIO pins needed by MOS chips. </span><br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">First test was with a 32k x 8 SRAM (<a href="http://web.mit.edu/6.115/www/document/62256.pdf" target="_blank">HM62256</a>) and fake6502 running <a href="https://github.com/jefftranter/6502/tree/master/asm/ehbasic" target="_blank">EhBasic</a>.</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"></span><br />
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"></span>
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"></span>
<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;"></span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="color: black; font-family: "arial"; font-size: 14.6667px; line-height: 1.38; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">Then GPIO pins were </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; text-align: justify; white-space: pre-wrap;">connected </span><span style="color: black; font-family: "arial"; font-size: 14.6667px; line-height: 1.38; text-align: justify; vertical-align: baseline; white-space: pre-wrap;">to SRAM as 6502 buses, really an incomplete </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; text-align: justify; white-space: pre-wrap;">address bus (</span><span style="font-family: "courier new" , "courier" , monospace; line-height: 22.08px; text-align: justify; white-space: pre-wrap;">A0 to A13</span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; text-align: justify; white-space: pre-wrap;">) beause</span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; text-align: justify; white-space: pre-wrap;"> only 14 contiguous </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; text-align: justify; white-space: pre-wrap;">GPIO pins available: </span><span style="font-family: "courier new" , "courier" , monospace; line-height: 22.08px; text-align: justify; white-space: pre-wrap;"> P1.18 to P1.31</span><span style="font-size: 14.6667px; line-height: 20.24px; text-align: justify; white-space: pre-wrap;"><span style="font-family: "arial";">.</span></span><br />
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span>
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-vilQuC9DO2U/V29BgVWPlaI/AAAAAAAAB_I/K8DRwYrUWyoKdDBXwrdvb9ZDOj9wU2sfgCLcB/s1600/lpcxpresso_pinout.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="217" src="https://4.bp.blogspot.com/-vilQuC9DO2U/V29BgVWPlaI/AAAAAAAAB_I/K8DRwYrUWyoKdDBXwrdvb9ZDOj9wU2sfgCLcB/s320/lpcxpresso_pinout.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-size: 12.8px;">LPCXpresso 1769 Pinout</span></td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-G7W_A_VXIlc/V26UxUNH0JI/AAAAAAAAB5g/zGcbeKaaFqUQk9k--WrpzE6CBK4GmIAWACKgB/s1600/sram_pinout.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="200" src="https://4.bp.blogspot.com/-G7W_A_VXIlc/V26UxUNH0JI/AAAAAAAAB5g/zGcbeKaaFqUQk9k--WrpzE6CBK4GmIAWACKgB/s200/sram_pinout.png" width="195" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><br />
<span style="font-size: 12.8px;">62256 (32K x 8) SRAM Pinout</span></td></tr>
</tbody></table>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">And memory read and write functions for fake6502 were written to manage the GPIO pins connected as address, data and control buses. </span></div>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">//MEMORY READ</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">uint8_t read6502(uint16_t address){</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2SET</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">|= (1 << 10);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Pone en H RW* (p2.10) Lectura</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2PINH= address << 2;</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Escribe la dirección A0 a A13 en P1.18 a P1.31 (bus de direcciones)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2SET</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">|= (1 << 11);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Pone en H CS (p2.11)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">value = FIO2PIN0;</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Lee bus de datos (P2.0 a P2.7)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2CLR</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">|= (1 << 11);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Pone en L CS (p2.11)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">RETURN (value);</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">}</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><b id="docs-internal-guid-11136344-82e8-0d09-1a55-1228c005b598" style="font-weight: normal;"><br /></b></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">//MEMORY WRITE</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">void write6502(uint16_t address, uint8_t value){</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2PINH= address << 2;</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Escribe la dirección A0 a A13 en P1.18 a P1.31 (bus de direcciones)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2PIN0= value;</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Escribe bus de datos (P2.0 a P2.7)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2CLR</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">|= (1 << 10);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Pone en L RW* (p2.10) Escritura</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2SET</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">|= (1 << 11);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Pone en H CS (p2.11)</span></span></div>
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "courier new" , "courier" , monospace; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="vertical-align: baseline;">FIO2CLR</span><span style="vertical-align: baseline;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="vertical-align: baseline;">|= (1 << 11);</span><span style="vertical-align: baseline;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="vertical-align: baseline;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="vertical-align: baseline;">// Pone en L CS (p2.11)</span></span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="vertical-align: baseline;"><span id="docs-internal-guid-11136344-82e9-d4f4-825b-669675902e57"><span style="font-family: "courier new" , "courier" , monospace; vertical-align: baseline;">}</span></span></span></span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"><br /></span></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"><br /></span></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"><span id="docs-internal-guid-11136344-82ea-14e6-5337-d46436009cfd"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;">The pins connection was direct and the emulator ran asynchronously, EhBasic code was, like on the Arduino, contained as a C constant array in the microcontroller flash program memory.</span></span></span></span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"><span id="docs-internal-guid-11136344-82ea-328c-d20a-36db169f1583"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"></span></span></span></span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span></span>
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-zmzsS-jOl-0/V26vOdDJukI/AAAAAAAAB6o/db3eSHhtu-w17473pRGm-CmPrgJbrD1iwCKgB/s1600/ROM_Read_Capture.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="247" src="https://2.bp.blogspot.com/-zmzsS-jOl-0/V26vOdDJukI/AAAAAAAAB6o/db3eSHhtu-w17473pRGm-CmPrgJbrD1iwCKgB/s400/ROM_Read_Capture.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Comparing ROM Dump with ROM Read</td></tr>
</tbody></table>
<u style="font-family: "times new roman"; line-height: normal;">C64:</u></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Then I wanted to reproduce 6502 operation reading program from a ROM, that is an external stored program, external to the microcontroller. One first option was to write EhBasic to a 29FXXX DIP Flash but I prefered to use C64 ROMs, so I retired from a C64 a socketed 901225 Characters ROM chip, connected it like the SRAM to the microcontroller and readed it.</span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">And then, one more step, what about connecting the microcontroller to the C64 replacing the original 6510 and test ROM, CIAs and SID with address decoding provided by the original PLA.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">It seems trivial but presents several difficulties because in the C64 the 6510 microprocessor shares the buses with the VIC video chip, the system RAM is DRAM refreshed by the VIC chip and we need to emulate 6510’s I/O port.</span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"><b id="docs-internal-guid-11136344-82ea-76c6-7d16-53d652dff52b" style="font-weight: normal;"><br /></b></span></span>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">6510’s I/O port is mapped at $0001 address and, in C64, bits 0,1 and 2 connected to LORAM, HIRAM and CHAREN signals. PLA use this signals for switching between ROM and RAM for $A000-$BFFF, $D000-$DFFF and $E000-$FFFF </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; white-space: pre-wrap;">memory areas.</span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 8px; vertical-align: baseline;"></span></span><br /></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">This operation was implemented with 3 GPIO pins and catchs at write function:</span></div>
<div style="line-height: 1.38;">
<span style="line-height: 22.08px;"><br /></span>
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;">// 6510 I/O Port</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;">if (address==0x1) {</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> if ((value & 0x1)==0){</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> FIO2CLR = (1 << 11); // Pone en L LORAM</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> }</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> else</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> {</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> FIO2SET = (1 << 11); // Pone en H LORAM</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> }</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> if ((value & 0x2)==0){</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"><br /></span></span>
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> FIO2CLR = (1 << 12); // Pone en L HIRAM</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;">}</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> else</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> {</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> FIO2SET = (1 << 12); // Pone en H HIRAM</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> }</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> if ((value & 0x4)==0){</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> FIO2CLR = (1 << 13);</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> }</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> else</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> {</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> FIO2SET = (1 << 13); // Pone en H CHAREN</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> }</span></span><br />
<span style="line-height: 22.08px;"><span style="font-family: "courier new" , "courier" , monospace;"> }</span></span></div>
<div style="line-height: 1.38;">
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-FmcJllLfkbQ/V26xEceB_7I/AAAAAAAAB7M/KL-1wsYCBvMFuuAIPrgweOFjZjdk7d1gACKgB/s1600/6510_no_Vic.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="150" src="https://4.bp.blogspot.com/-FmcJllLfkbQ/V26xEceB_7I/AAAAAAAAB7M/KL-1wsYCBvMFuuAIPrgweOFjZjdk7d1gACKgB/s200/6510_no_Vic.jpg" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">VIC is out</td></tr>
</tbody></table>
<span id="docs-internal-guid-d8419f50-87ca-7dec-d39d-3b85ff503df4"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">For first tests I removed the VIC chip from the board, but that left me without CPU Clock and without refresh for DRAM, so emulator must use microcontroller RAM. With catchs on memory write function I redirected RAM writes to screen area ($0400-$7fff) to microcontroller debug console and received the C64 startup message. </span></span><span style="color: black; font-size: 14.6667px; line-height: 20.24px; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial";">Also pending address lines <span style="font-family: "courier new" , "courier" , monospace; font-size: small; line-height: 22.08px;">A14 and A15 </span></span></span></span></span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; white-space: pre-wrap;">were implemented with two aditional GPIOs: </span><span style="font-family: "courier new" , "courier" , monospace; line-height: 22.08px; white-space: pre-wrap;">P4.28 and P4.29</span><br />
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div>
<div style="line-height: 1.38;">
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://2.bp.blogspot.com/-sxjnfgo53wk/V26xNdqFMqI/AAAAAAAAB7M/eYKK8A3JQy4Ty-7vzUD1fweVhvxoyA9zQCKgB/s1600/C64_ROM_read_time.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="122" src="https://2.bp.blogspot.com/-sxjnfgo53wk/V26xNdqFMqI/AAAAAAAAB7M/eYKK8A3JQy4Ty-7vzUD1fweVhvxoyA9zQCKgB/s200/C64_ROM_read_time.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">ROM Read</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-1TyHhTsKblI/V26xusdVlrI/AAAAAAAAB7Y/CvDZ-0jBlFUSru4BguKCuZP5NCxIj71MACKgB/s1600/C64_boot_console.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="121" src="https://1.bp.blogspot.com/-1TyHhTsKblI/V26xusdVlrI/AAAAAAAAB7Y/CvDZ-0jBlFUSru4BguKCuZP5NCxIj71MACKgB/s200/C64_boot_console.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Booting C64 ROM</td></tr>
</tbody></table>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span id="docs-internal-guid-11136344-82ed-15a4-65fc-7c3bb6380b06"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"></span></span></span></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"></span></span></span><br /><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"></span></span></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"></span></span></span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"></span></span></span></div>
<u>VIC:</u><br />
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="vertical-align: baseline;"><span style="vertical-align: baseline;"><span style="font-family: "courier new" , "courier" , monospace;"><span style="line-height: 22.08px;"></span></span></span></span></span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;">As VIC provides CLK for CPU up to here the emulator runs </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; white-space: pre-wrap;"> asynchronously. </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;">In order to place the VIC on the board and share buses the emulator needs third state capability and synchronization to system clock.</span><br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">In the C64 bus access is driven by VIC with it’s BA signal connected to 6510’s AEC pin. All microprocessor read and write operations take place when AEC=1 and must be enabled by the RDY signal too. When AEC=0 VIC uses the buses and microprocessor pins must go to third state.</span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">For more datails please see: <a href="http://www.zimmers.net/cbmpics/cbm/c64/vic-ii.txt">http://www.zimmers.net/cbmpics/cbm/c64/vic-ii.txt</a></span></div>
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="vertical-align: baseline;"><span style="vertical-align: baseline;"><span id="docs-internal-guid-d8419f50-88d8-10de-7a27-c43edbb3eb0b"></span></span></span></span><br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><br /></span>
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><u style="font-family: 'Times New Roman'; font-size: medium; line-height: normal; white-space: normal;">Interface:</u></span><br />
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;">That operation was implemented using a custom interface adapter using discrete logic: 3 x 74HC245 Octal 3−State Noninverting Bus Transceivers for address and data bus and a 74HC00 for R/W. Two remaining 74HC00 gates were used to accommodate required delay between in and out 6510 clock signals.</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-GlRB26Tw7FY/V265hicOa_I/AAAAAAAAB8w/wnEKEdwth4EbqL8XCBvrAB6OjX34-b3GgCKgB/s1600/Interface_up.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://2.bp.blogspot.com/-GlRB26Tw7FY/V265hicOa_I/AAAAAAAAB8w/wnEKEdwth4EbqL8XCBvrAB6OjX34-b3GgCKgB/s200/Interface_up.jpg" width="200" /></a><a href="https://2.bp.blogspot.com/-1lyIoXh70KY/V265fkPoRSI/AAAAAAAAB80/T-IwBkOsZHMoNO2bWGkO4xtJR8XzagksACKgB/s1600/Interface_Down.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://2.bp.blogspot.com/-1lyIoXh70KY/V265fkPoRSI/AAAAAAAAB80/T-IwBkOsZHMoNO2bWGkO4xtJR8XzagksACKgB/s200/Interface_Down.jpg" width="200" /></a><a href="https://3.bp.blogspot.com/-A-3kh1MI1WQ/V265gD_c_NI/AAAAAAAAB8w/Jse5VxDpYsMl6ch9UJ-ZsNcRS7lQixESACKgB/s1600/Interface_Det.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="111" src="https://3.bp.blogspot.com/-A-3kh1MI1WQ/V265gD_c_NI/AAAAAAAAB8w/Jse5VxDpYsMl6ch9UJ-ZsNcRS7lQixESACKgB/s200/Interface_Det.jpg" width="200" /></a></div>
</div>
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-uU4GnJ74Ou8/V265hFL3KqI/AAAAAAAAB8w/ppE7LWo16ig9MIi0VT4tDSOwqY3Gs1OwwCKgB/s1600/Interface_mounted.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="222" src="https://1.bp.blogspot.com/-uU4GnJ74Ou8/V265hFL3KqI/AAAAAAAAB8w/ppE7LWo16ig9MIi0VT4tDSOwqY3Gs1OwwCKgB/s400/Interface_mounted.jpg" width="400" /></a></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<br /></div>
<a href="https://3.bp.blogspot.com/-YR-qDTvHPD8/V27YuaVbT3I/AAAAAAAAB-Q/fEchoKPLPHIE6WDHgQr2HxNxpauyNy-KACLcB/s1600/RW_AEC_RDY.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="165" src="https://3.bp.blogspot.com/-YR-qDTvHPD8/V27YuaVbT3I/AAAAAAAAB-Q/fEchoKPLPHIE6WDHgQr2HxNxpauyNy-KACLcB/s200/RW_AEC_RDY.png" width="200" /></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.6667px; font-style: normal; font-variant: normal; font-weight: 400; line-height: 1.38; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><span id="docs-internal-guid-d8419f50-87ce-0aa7-173c-4761c7597570"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;">Also read and write functions were rewritten in order to take into account AEC and RDY states.</span></span></span></span></span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.6667px; font-style: normal; font-variant: normal; font-weight: 400; line-height: 1.38; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span></span></span>
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.6667px; font-style: normal; font-variant: normal; font-weight: 400; line-height: 1.38; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;">As 6510 only can access buses when AEC=HIGH all read and write operations are synchronized to that signal and not to Clk (Fi2).</span></span></span></span><br />
<div style="line-height: 1.38;">
<br />
<br />
<br />
<br />
<br />
<br />
<br /></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial";"><br /></span></span></span></span>
</div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">//MEMORY READ (SHARED BUS)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">uint8_t externalread(uint16_t address) {</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">uint8_t value;</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==0) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=0 -> Fi0(P2.8)=0</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==1) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=1 -> Fi0(P2.8)=1</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO1PINH =(address << 2);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Escribe la dirección A0 a A13 en P1.18 a P1.31 (bus de direcciones)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO4PINH= (address >> 2);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// A14 y A15 en P4.28 y P4.29</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO0PIN3&16)==0){};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Si RDY=0 (P0.28) espero aquí</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==0) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=0 -> Fi0(P2.8)=0</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==1) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=1 -> Fi0(P2.8)=1</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">value = FIO2PIN0; </span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Lee bus de datos (P2.0 a P2.7)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">//</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">DEBUGOUT ("<> %x %x\n",address,value);</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">return(value);</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">}</span></span></div>
<div style="line-height: 1.38;">
<span style="font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="vertical-align: baseline;"><span style="font-family: "courier new" , "courier" , monospace; vertical-align: baseline;"><b id="docs-internal-guid-d8419f50-87ce-54bb-8f9e-32b31f1a3878" style="font-weight: normal;"><br /></b></span></span></span>
</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">//</span></span><span style="font-family: "courier new" , "courier" , monospace; line-height: 22.08px; white-space: pre-wrap;">MEMORY WRITE (SHARED BUS)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">void externalwrite(uint16_t address, uint8_t value) {</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==0) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=0 -> Fi0(P2.8)=0</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2PIN0 = value; </span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Escribe bus de datos (P2.0 a P2.7)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==1) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=1 -> Fi0(P2.8)=1</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">////////////////////FLANCO DESCENDENTE////////////////////</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO1PINH =(address << 2);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Escribe la dirección A0 a A13 en P1.18 a P1.31 (bus de direcciones)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO4PINH= (address >> 2);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// A14 y A15 en P4.28 y P4.29</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2SET</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">= (1 << 10);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Pone en H W (P2.10) Escritura</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify; text-indent: 36pt;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> FIO2DIR0 = 0xff; </span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> // Bus de datos como Salida</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==0) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=0 -> Fi0(P2.8)=0</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">while ((FIO2PIN1&1)==1) {};</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Espera mientras AEC=1 -> Fi0(P2.8)=1</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">////////////////////FLANCO DESCENDENTE////////////////////</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2PIN0 = value; </span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Escribe bus de datos (P2.0 a P2.7)</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2DIR0 = 0x00;</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Bus de datos como Entrada</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;"><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">FIO2CLR</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">= (1 << 10);</span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">// Pone en L W (P2.10) Lectura</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="background-color: transparent; color: black; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace; font-size: xx-small;">}</span></span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-size: 14.6667px; vertical-align: baseline;"><br /></span></span></span>
<span style="background-color: transparent; color: black; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-size: 14.6667px; vertical-align: baseline;"><br /></span></span></span>
<br />
<span style="background-color: transparent; color: black; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-size: 14.6667px; vertical-align: baseline;"><u style="font-size: medium; line-height: normal; white-space: normal;">Timmings:</u></span></span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<a href="https://1.bp.blogspot.com/-Mnjyx1-GYZc/V265hm5g77I/AAAAAAAAB8w/xonufoCl8pEIaPenDX-JHAv0v3myypsXwCKgB/s1600/oscilloscope_one.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="150" src="https://1.bp.blogspot.com/-Mnjyx1-GYZc/V265hm5g77I/AAAAAAAAB8w/xonufoCl8pEIaPenDX-JHAv0v3myypsXwCKgB/s200/oscilloscope_one.jpg" width="200" /></a><span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">VIC chip was connected to the board and several time adjustments were made to read/write routines.</span><br />
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Incorrect timmings produced DRAM corruption during VIC refresh and access.</span></div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-size: 14.6667px; vertical-align: baseline;"><b id="docs-internal-guid-d8419f50-87ce-f9c4-d54c-07d53706bb05" style="font-weight: normal;"><br /></b></span></span></span>
</div>
<div dir="ltr" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-xikUdOW4jy8/V266HHkKdZI/AAAAAAAAB9M/j6oezl2CptE3X9XqqCYzHSDoE8ovX9HUQCKgB/s1600/Screen_Bad.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="228" src="https://4.bp.blogspot.com/-xikUdOW4jy8/V266HHkKdZI/AAAAAAAAB9M/j6oezl2CptE3X9XqqCYzHSDoE8ovX9HUQCKgB/s320/Screen_Bad.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Ram Corruption</td></tr>
</tbody></table>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-20TiChoxVeY/V266G_UeOFI/AAAAAAAAB9M/JGITWChY3RoVXnCj4syQ0PqeBxTEKvUhwCKgB/s1600/Screen_Better.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="219" src="https://3.bp.blogspot.com/-20TiChoxVeY/V266G_UeOFI/AAAAAAAAB9M/JGITWChY3RoVXnCj4syQ0PqeBxTEKvUhwCKgB/s320/Screen_Better.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Error: 38911./909 Bytes Free</td></tr>
</tbody></table>
<div style="line-height: 1.38;">
<br /></div>
<div style="line-height: 1.38;">
<br /></div>
<div class="separator" style="clear: both; line-height: 1.38; text-align: center;">
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; text-align: justify; white-space: pre-wrap;"><b>Finally I got the system running, a C64 with a software-emulated microprocessor!</b></span></div>
<div class="separator" style="clear: both; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; line-height: 1.38; text-align: center;">
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 20.24px; text-align: justify; white-space: pre-wrap;"><br /></span></div>
<div class="separator" style="clear: both; line-height: 1.38; text-align: center;">
<a href="https://2.bp.blogspot.com/-I2AHJasAuzg/V265gnbr8TI/AAAAAAAAB8w/r5IvBnVMOdgXU20otpleLlrOh0cs_nlAwCKgB/s1600/Interface_Run.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="356" src="https://2.bp.blogspot.com/-I2AHJasAuzg/V265gnbr8TI/AAAAAAAAB8w/r5IvBnVMOdgXU20otpleLlrOh0cs_nlAwCKgB/s640/Interface_Run.jpg" width="640" /></a></div>
<div class="separator" style="clear: both; line-height: 1.38; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; line-height: 1.38; text-align: left;">
<u style="line-height: normal; text-align: justify;"><br /></u></div>
<div class="separator" style="clear: both; line-height: 1.38; text-align: left;">
<u style="line-height: normal; text-align: justify;">Testing;</u></div>
<div style="line-height: 1.38;">
</div>
<div style="line-height: 1.38;">
<span style="line-height: 1.38;"> </span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;">The shared bus access works fine even with the lower performance obtained, about 60%, respect to the original 1MHz 6510.</span></div>
<div style="line-height: 1.38;">
<a href="https://4.bp.blogspot.com/-oGYxA5MMddg/V27TYnDMJLI/AAAAAAAAB94/gqzKgOoLlbgWmaZeXz2nSTF5k5MBjI3MgCLcB/s1600/Game_IEC_Run.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em; text-align: right;"><br /></a><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"></span>
<span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span></span>
<span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span></span>
<span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">Games and default IEC bus was tested using <a href="https://github.com/Larswad/uno2iec" target="_blank">Uno2IEC</a>, a 1541 IEC interface emulator using Arduino.</span></div>
<div style="line-height: 1.38;">
<a href="https://4.bp.blogspot.com/-oGYxA5MMddg/V27TYnDMJLI/AAAAAAAAB94/gqzKgOoLlbgWmaZeXz2nSTF5k5MBjI3MgCLcB/s1600/Game_IEC_Run.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em; text-align: right;"><img border="0" height="112" src="https://4.bp.blogspot.com/-oGYxA5MMddg/V27TYnDMJLI/AAAAAAAAB94/gqzKgOoLlbgWmaZeXz2nSTF5k5MBjI3MgCLcB/s200/Game_IEC_Run.jpg" width="200" /></a><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"> </span></div>
</div>
<div style="line-height: 1.38;">
<span style="background-color: transparent; color: black; font-family: "arial"; font-size: 14.666666666666666px; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span style="font-size: 14.6667px; vertical-align: baseline;"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><b style="font-weight: normal;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;">Of course better performance can be achieved using an assembly emulator, like a6502 (</span><a href="https://github.com/BigEd/a6502" style="font-family: 'Times New Roman'; font-size: medium; line-height: 1.38; text-decoration: none; white-space: normal;"><span style="color: #1155cc; font-family: "arial"; font-size: 14.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">https://github.com/BigEd/a6502</span></a><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;">), but the idea is a </span></b></span></span></span><span style="font-family: "arial"; font-size: 14.6667px; line-height: normal; vertical-align: baseline; white-space: pre-wrap;">"</span><span style="font-family: "arial"; line-height: normal;"><span style="font-size: 14.6667px; white-space: pre-wrap;">High-Level Languaje In-Circuit Emulator"</span></span><span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;">.</span></span><br />
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span>
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span>
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span>
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span>
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span>
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><br /></span></span>
<br />
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><u>More photos</u></span></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-4ovz5UC7fck/V3G70qfTgNI/AAAAAAAACC8/d_j1G8B8dAISqXqjeM-Cvdjk6JCgt9irgCLcB/s1600/foto_016.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://4.bp.blogspot.com/-4ovz5UC7fck/V3G70qfTgNI/AAAAAAAACC8/d_j1G8B8dAISqXqjeM-Cvdjk6JCgt9irgCLcB/s200/foto_016.jpg" width="200" /></a><a href="https://2.bp.blogspot.com/-JR_fIBmnto0/V3G6V9SLJgI/AAAAAAAACCU/M69gTcHv3p4ZaAVOAWrpPD6gkxjW9xe0QCKgB/s1600/foto_002.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://2.bp.blogspot.com/-JR_fIBmnto0/V3G6V9SLJgI/AAAAAAAACCU/M69gTcHv3p4ZaAVOAWrpPD6gkxjW9xe0QCKgB/s200/foto_002.jpg" width="200" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-6n2wrlX_RVc/V3G6YFHRkWI/AAAAAAAACCU/eTU35FPtTrYG4GuIK_9CGkrmKaKOTldpACKgB/s1600/foto_006.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://2.bp.blogspot.com/-6n2wrlX_RVc/V3G6YFHRkWI/AAAAAAAACCU/eTU35FPtTrYG4GuIK_9CGkrmKaKOTldpACKgB/s200/foto_006.jpg" width="200" /></a><a href="https://3.bp.blogspot.com/-OdEl3xksrKw/V3G6Ts8UD1I/AAAAAAAACCU/0nv0tHaJdOASqpT3O05rR1k-BTkVuFSlwCKgB/s1600/Game_IEC_Run.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://3.bp.blogspot.com/-OdEl3xksrKw/V3G6Ts8UD1I/AAAAAAAACCU/0nv0tHaJdOASqpT3O05rR1k-BTkVuFSlwCKgB/s200/Game_IEC_Run.jpg" width="200" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-VbSoUg3YKAk/V3G7zN4r3ZI/AAAAAAAACCk/CL9tDOjntEofNmA-vYTM9DOwnS9kXxk1ACLcB/s1600/foto_001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="138" src="https://3.bp.blogspot.com/-VbSoUg3YKAk/V3G7zN4r3ZI/AAAAAAAACCk/CL9tDOjntEofNmA-vYTM9DOwnS9kXxk1ACLcB/s200/foto_001.jpg" width="200" /></a><a href="https://4.bp.blogspot.com/-uL1HOukU-kg/V3G7zFgfDVI/AAAAAAAACCo/khNjQ1B0VG4TnIWqhg7jLb558WZ9aof8ACLcB/s1600/foto_010.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://4.bp.blogspot.com/-uL1HOukU-kg/V3G7zFgfDVI/AAAAAAAACCo/khNjQ1B0VG4TnIWqhg7jLb558WZ9aof8ACLcB/s200/foto_010.jpg" width="200" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-LRnUa8Z-WfQ/V3G6a4oiSFI/AAAAAAAACCM/1VbGAabYhW8CxxqJJEYzyaQSqMBU2BOaACKgB/s1600/foto_007.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://1.bp.blogspot.com/-LRnUa8Z-WfQ/V3G6a4oiSFI/AAAAAAAACCM/1VbGAabYhW8CxxqJJEYzyaQSqMBU2BOaACKgB/s200/foto_007.jpg" width="200" /></a><a href="https://3.bp.blogspot.com/-G-FeASx2x1w/V3G6Xosn8GI/AAAAAAAACCU/ir4Ov6ZB8qo97zAtU8yIDtBjp3Y1bp_zQCKgB/s1600/foto_005.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="150" src="https://3.bp.blogspot.com/-G-FeASx2x1w/V3G6Xosn8GI/AAAAAAAACCU/ir4Ov6ZB8qo97zAtU8yIDtBjp3Y1bp_zQCKgB/s200/foto_005.jpg" width="200" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-9gLdSskQdQ8/V3G70byHk6I/AAAAAAAACC0/ro_rCyykFdUTm6rmSxx_SGku28wFrSLnACLcB/s1600/foto_015.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="https://3.bp.blogspot.com/-9gLdSskQdQ8/V3G70byHk6I/AAAAAAAACC0/ro_rCyykFdUTm6rmSxx_SGku28wFrSLnACLcB/s200/foto_015.jpg" width="150" /></a><a href="https://3.bp.blogspot.com/-Yi_ONzAR5Ew/V3G7zEe-s9I/AAAAAAAACCs/2OJSMFV58P88dC3CYpTYI7E1Nxp2MycSwCLcB/s1600/foto_014.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="112" src="https://3.bp.blogspot.com/-Yi_ONzAR5Ew/V3G7zEe-s9I/AAAAAAAACCs/2OJSMFV58P88dC3CYpTYI7E1Nxp2MycSwCLcB/s200/foto_014.jpg" width="200" /></a></div>
<br />
<br />
<br />
<br />
<span style="font-family: "arial"; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><span style="color: black; font-family: "arial"; font-size: 14.6667px; vertical-align: baseline;"><u><br /></u></span></span></div>
</div>
</div>
<span id="docs-internal-guid-11136344-82e7-17ea-262b-8a3a3885f2c0"><span style="font-family: "arial"; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"></span></span>telmomoyahttp://www.blogger.com/profile/03309406444758171765noreply@blogger.com3Salta, Salta, Argentina-24.7821269 -65.42319759999998-25.0127624 -65.745921099999975 -24.551491400000003 -65.100474099999985