Friday, June 17, 2022

Pi Pico and other Boards

 Got a new Pi Pico and it looks very promising. Want to use Oled display with it. 

Sunday, August 23, 2020

Two Nano version finished on breadboard

 The breadboard version pretty much finished. Want to document where I got to.

Here's the screen that shows the bottom nano running an 1802 program and disassembling it in real time.

The program on the left is just a default dummy program loaded in when system starts up. The 1802 "thinks" ROM starts at $0 in dumb IC but's just fetching from lower nano. 

The breadboard setup is pictured bellow.


LHS is CDP1802, Top nano does address bus work. Bottom nano outputs instructions to 1802 and links with PC via terminal.

The program in the lower Nano is spi0SlaveN.ino and is in pastebin https://pastebin.com/tYEcYJPX

The program in the upper nano is spiMaster8.ino, https://pastebin.com/zZv02c6v

The little embedded 1802 program that comes with the lower nano is nano2E.lst https://pastebin.com/qwVtupjv 

The final thing to do is to insert a longer program via terminal that goes into nano's memory at $4000. This can be done via avrdude as outlined in previous post. 

Friday, July 3, 2020

Two nano version of CDP1802 board started

The breadboard version of the CDP1802 2 Nano system is starting.
And the schematic for the breadboard is below. But only some of the breadboard is complete. Just wanted to get to stage where hardware derived nops force addresses to increment. The address is picked up by the top nano via blue wires from MA0 to MA7 and timed by yellow TPA,TPB wires.
This address is sent via SPI on white wires to the lower bottom nano,Nb, and sent to serial terminal screen.
The clock only goes at about 1.5 Hz from D3 of Nb. The LEDs are attached to MA0 and MA1 to indicate the 1802 address is cycling. The 1802 data bus, BUS0..BUS7 is hard wired to Vcc and GND rails via 10K resistors corresponding with code $C4, ie nop. So all the 1802 does is continuous nops but increments its address every three cycles of 7 clocks at about 600ms for each clock cycle.

The code for the two nanos. Slave is: https://pastebin.com/EC7UL3T8
and the master is: https://pastebin.com/AT99nVvK. Neither are finsihed but the addresses are being transferred slowly and reliably from cycling nop 1802 to top nano Nt, to bottom nano Nb.

Tuesday, June 9, 2020

Arduino Mega 2560 board + 1802 PCB design completed

JUst completed Mega 2650 board shield with 1802 on it. Used EasyEDA and sent design to JLPCB.
Here's Schematic:
and here's the planned finished product.

and here's the PCB top side:
and here's the underside:

and all from this breadboard "design" 


The most recent arduino file that worked OK,I think, is:
C:\Users\Dell\Documents\Arduino\PB_Sketches_May20\CDP1802f03\CDP1802f03.ino

Which is in pastebin here: https://pastebin.com/xHTkrFR3

While waiting for PCB's to arrive, will plan two Nano version of Cosmacuino.

Wednesday, May 20, 2020

Disassmbler now in flash PROGMEM

Running out of nano memory in RAM, only 2K bytes so rewrote 1802 disassembler so that all the disassembly information is in flash ROM.
Here's the side-program that disassembles 1802 hex codes;
https://pastebin.com/nVu7iVYz

New lines used look like this:
const char flashHiNib3[] PROGMEM = {"[00idl.][01ldn.L[10inc.L[20dec.L[30br.N[31bq.N[32bz.N[33bdf.N[34b1.N[35b2.N[36b3.N[37b4.N[38skp.][39bnq.N[3Abnz.N[3Bbnf.N[3Cbn1.N[3Dbn2.N[3Ebn3.N[3Fbn4.N[40lda.L[50str.L [60irx.L[61out.L[69inp.L[70ret.]abcd[71dis.][72ldxa.][73stxd][74adc.][75sdb.][76shrc.][77smb.][78sav.][79mark.][7Aseq.][7Breq.][7Caddi.N[7Dsdbi.N[7Eshlc.][7Fsmbi.N[80glo.L[90ghi.L[A0plo.L[B0phi.L[C0lbr.T[C1lbq.T[C2lbz.T[C3lbdf.T[C4nop.][C5lsnq.][C6lsnz.][C7lsnf.][C8lskp.][C9lbnq.T[CAlbnz.T[CBlbnf.T[CClsie.][CDlsq.][CElsz.][CFlsdf.][D0sep.L[E0sex.L[F0ldx.][F1or.][F2and.][F3xor.][F4add.][F5sd.][F6shr.][F7sm.][F8ldi.N[F9ori.N[FAani.N[FBxri.N[FCadi.N[FDsdi.N[FEshl.][FFsmi.N"}; //};

and..

 Serial.println(F("All ready? "));

Got whole disassembler plus a few helper routines and sample data down to about 209 bytes.

Friday, May 8, 2020

Cosmacuino works with embedded 1802 code in high flash

Managed to get a short 1802 program going that starts off in mega's RAM and carries on above avr program in flash. PLan is to have RAM as just a place to leap up to$4000 and above on the 32K m328p, as well as a stack and short buffer place.

This program:
C:\Users\Dell\Documents\Arduino\PB_SketchApril12\CDP1802e93\CDP1802e93.ino

acts as ROM and RAM for 1802. Delivers instructions. Problem is there's not enough ram on Arduino nano, 2k, where this program is eventually going to live so I've just used a ram buffer called vRAM[] to start things off then hand over to program above $4000. Currently, on the mega which has 8K of static ram, a buffer of 1024 called vRAM[1024] holds temporary 1802 code.

This is the report from avrdude:
Sketch uses 13118 bytes (5%) of program storage space. Maximum is 253952 bytes.
Global variables use 3077 bytes (37%) of dynamic memory, leaving 5115 bytes for local variables. Maximum is 8192 bytes.
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.33.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avrdude -CC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.33.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM15 -b115200 -D -Uflash:w:C:\ardtemp/CDP1802e93.ino.hex:i

The .ino file above is actually extended up to $4000 where main 1802 code is burned in. In the gap between the last byte of the arduino code viz. $333E=13118, and $4000, filler bytes are inserted. Currently zeros.

The file that cuts up the 1802 bin

....not sure where this post was going so will leave it as is then publish it ..

Combined file seems to work on Mega

Wanted system where big arduino program that talks to CDP1802 can be surrounded by 1802 code that can be fed, slowly, into real 1802. Had problems feeding arduino program eg CDP1802e93.hex that talks to 1802 and the 1802 asm program eg tackOn0.hex both into avrdude burning. Tried various ways as it seemed to work ok, at least for blink.hex type programs on arduino nano.
Finally wrote a c program that takes two hex files and combines them into one combined hex file and then that gets burned into arduino mega. Seems to work.

C program https://pastebin.com/w6y0RjyC C:\TinyC\MyFiles9May20\combine6.c
Mega program: https://pastebin.com/mxUWzfzD  C:\Users\Dell\Documents\Arduino\PB_SketchApril12\CDP1802e93\CDP1802e93.ino

1802 program: https://pastebin.com/JewvwYKZ  C:\TinyC\MyFiles9May20\tackOn0.asm

The avrdude line that burned in the combinedFilo.hex was:

Dell@DESKTOP-FGA8Q4U C:\TinyC\MyFiles9May20
$ \tinyc\avrdude -C \tinyc\avrdude.conf -v -patmega2560 -cwiring -PCOM14 -b115200 -D -Uflash:w:combinedFile0.bin:r

C program invoked like this:
Dell@DESKTOP-FGA8Q4U C:\TinyC\MyFiles9May20
$ combine6.exe CDP1802e93.ino.bin tackOn0.bin

Note it was the bin files that get combined.

Hex files were changed to bin like this:
Dell@DESKTOP-FGA8Q4U C:\TinyC\MyFiles9May20
$ ..\hex2bin.exe CDP1802e93.ino.hex

Picture of some of the above:


Added this few days later. Look at this Bray++ logfile:
Terminal log file
Date: 12/05/2020 - 11:20:51 AM
-----------------------------------------------
[[[Adr1 000d : nop ]
[[[Adr1 000e : lbr 400]
[[[Adr1 4000 : ldi 01]
[[Adr1 4002 : phi 7]
[[Adr1 4003 : lbr 0c]
[[[Adr1 000c : nop ]
[[[Adr1 000d : nop ]
[[[Adr1 000e : lbr 400]
[[[Adr1 4000 : ldi 01]
[[Adr1 4002 : phi 7]
[[Adr1 4003 : lbr 0c]
[[[Adr1 000c : nop ]
[[[Adr1 000d : nop ]
[[[Adr1 000e : lbr 400]
[[[Adr1 4000 : ldi 01]
[[Adr1 4002 : phi 7]
[[Adr1 4003 : lbr 0c]
[[[Adr1 000c : nop ]
[[[Adr1 000d : nop ]
[[[Adr1 000e : lbr 400]

-----------------------------------------------
Date: 12/05/2020 - 11:21:19 AM
End log file

There is a jump from low memory, around, $000e, to high memory $4000 then back again.
This is the tackon file that's split into two parts. One part goes into vRAM[] and the high part is birned up in $4000 by invoking avrdude the combined file with the normal arduino part CDP1802e93.hex with tackOn0.hex.
When the mega starts up it runs a default little loop of 1802.asm commands that start off in vRAM[] declaration. To get it to use above code you press M2 in terminal that asks for a block of 1802 bytes. Chose low1802.bin that gets sliced off bottom of tackOn0.bin automatically by combine6.exe. Once this low little program gets installed it does a reset and then joins up with rest of tackOn but jumping up to $4000 and back down again. We do this to jump over arduino code.

Pi Pico and other Boards

 Got a new Pi Pico and it looks very promising. Want to use Oled display with it.