Tag Archives: electronics

6502 progress

Added second VIA chip. (For hex keyboard)

Skipped the sound setups with simple components or the Yamaha chip. Straight to the commodore SID chip. Added a amplifier and a speaker.

Added ROM functions for line printing. Picture with 2 lines, and my name in Japanese

Now I have to wait for components. I’ve made a simulation for a address decoder.

Rest I’ve put in previous posts as updates.

Meanwhile testing 6502 apps on Android


74 Series logic, Rom, Gal, Pal, FPGA for Address decoding

For accessing the different components in computers you have to use the Address Bus.
In most 8 bits computers there are 16 address lines.

The CPU on a 6502 can access 65536 addresses (16 bit ). But most chips in the circuit have just a few address lines.
So the chip to use has to be selected using a CE (chip Enable) signal.

Old article i found on my fileserver from 1984

74 Series logic

Above example uses A15 combined with A14 to address the 16K ROM
When using a 32k rom in the upper part of the memory, a15 can be used as CE

The 74ALS133 is a widely used decoder due to it’s many inputs.

Sometimes not all address lines are used for decoding, then you will get a repetition of the device in the memory map.

Above 6522 VIA has only 4 address lines RS0-RS3. But 2 chipselect pins (CS).
If you connect the chip as below.

A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00
CS1 CS2  NC  NC  NC  NC  NC  NC  NC  NC  NC  NC CR3 CR2 CR1 CR0
(NC - not connected, and CS2 is inverted!)

The chip would be selected when A15 is 1 and A14 is 0, A13-A04 it would not listen to. So its 4 bits addresses (total 16), would be repeated in a block $8000-$BFFF (10xx xxxx xxxx aaaa) 16384 addresses for 16 addresses on the 6522

ROM

Another simple solution to get a more precise address decoder without using a lot of components is using a ROM.
But this wil only work for low speeds!
A eeprom is relative cheap

Example ROM as chip enable/select

PAL PLA GAL

With these devices you can “program” a schematic which works as above example’s of the 74 series. But now you can do it using only one component.

PALs and PLAs are fuse-programmed, some are erasable like (e)eprom.
Below a example of the code.
Most of the PAL/PLA/GAL are hard to get and obsolete

;PALASM Design Description
;---------------------------------- Declaration Segment ------------
TITLE    pRAM PC_interface Address Decoder
PATTERN  pRAM97A.pds
REVISION H
AUTHOR   Trevor Clarkson
COMPANY  EEE KCL
DATE     30/05/97

CHIP  decode  PALCE20V8

;---------------------------------- PIN Declarations ---------------
PIN  1          AEN                                   COMBINATORIAL ; INPUT
PIN  2          A9                                    COMBINATORIAL ; INPUT
PIN  3          A8                                    COMBINATORIAL ; INPUT
PIN  4          A7                                    COMBINATORIAL ; INPUT
PIN  5          A6                                    COMBINATORIAL ; INPUT
PIN  6          A5                                    COMBINATORIAL ; INPUT
PIN  7          A4                                    COMBINATORIAL ; INPUT
PIN  8          A3                                    COMBINATORIAL ; INPUT
PIN  9          A2                                    COMBINATORIAL ; INPUT
PIN  10         A1                                    COMBINATORIAL ; INPUT
PIN  11         IOW                                   COMBINATORIAL ; INPUT
PIN  12         GND
PIN  13         IOR                                   COMBINATORIAL ; INPUT
PIN  14         ACK_HALT                              COMBINATORIAL ; INPUT
PIN  15         PLS_EN                                COMBINATORIAL ; OUTPUT
PIN  16         BRDW                                  COMBINATORIAL ; OUTPUT
PIN  17         MOD_CTRL                              COMBINATORIAL ; OUTPUT
PIN  18         RAM_ACCESS                            COMBINATORIAL ; OUTPUT
PIN  19         IO_16                                 COMBINATORIAL ; OUTPUT
PIN  20         LATCH_MOD                             COMBINATORIAL ; OUTPUT
PIN  21         LATCH_ADD                             COMBINATORIAL ; OUTPUT
PIN  22         P300                                  COMBINATORIAL ; OUTPUT
PIN  23         P300IN                                COMBINATORIAL ; INPUT
PIN  24         VCC

;PC address decoding functions (not all in this PAL)
;uses latched address to provide low-order address lines to pRAM/RAM
;       A3      A2      A1      R/W     Addr    Function
;       0       0       0       R       300     MFF_0
;                               W               not used
;       0       0       1       R       302     MFF_1
;                               W               not used
;       0       1       0       R       304     MFF_2
;                               W               not used
;       0       1       1       R       306     MFF_3
;                               W               Latch Module Number
;       1       0       0       R       308     PLS_Status  (pRAM status)
;                               W               PLS_Control (pRAM control)
;       1       0       1       R       30A     Weight/Connection-
;                               W                Pointer RAM access
;       1       1       0       R       30C     not used
;                               W               Latched RAM address
;       1       1       1       R       30E     not used
;                               W               pRAM_256 module control
;
; NB. IO_16 must be tri-stated when not in use

;----------------------------------- Boolean Equation Segment ------
EQUATIONS

/P300 = A9*A8*/A7*/A6*/A5*/A4*/IOR + A9*A8*/A7*/A6*/A5*/A4*/IOW

/BRDW = /P300IN * /IOW

/PLS_EN = /P300IN*/A3*/IOR + /P300IN*A3*/A2*/A1

; MOD_CTRL is active HIGH
MOD_CTRL = ACK_HALT * /BRDW * A3 * A2 * A1 * /IOW

; RAM_ACCESS is active HIGH
RAM_ACCESS = ACK_HALT * /P300IN * A3 * /A2 * A1

IO_16 = GND
IO_16.TRST = /P300IN
; enable 16-bit transfers

; LATCH_MOD is active HIGH
LATCH_MOD = /BRDW * /A3 * A2 * A1

; LATCH_ADD is active HIGH
LATCH_ADD = /BRDW * A3 * A2 * /A1

;----------------------------------- Simulation Segment ------------
SIMULATION
TRACE_ON A9 A8 A7 A6 A5 A4 IOR /IOW /BRDW /PLS_EN MOD_CTRL RAM_ACCESS IO_16 LATCH_MOD LATCH_ADD ACK_HALT /P300 /P300IN
SETF /A9 /A8 /A7 /A6 /A5 /A4 /A3 /A2 /A1 IOR IOW /ACK_HALT /P300IN
SETF /IOW ; test P300 doesn't respond
SETF IOW /IOR ; test P300 doesn't respond
SETF IOR
SETF A9 A8 /A7 /A6 /A5 /A4 /IOR /P300IN
SETF A1
SETF A2 /A1
SETF A1 ; read mff0-3
SETF IOR /IOW ; test P300 and BRDW
SETF /A3 A2 A1 ; test Latch Module No
SETF IOW A3 A2 A1 ; MOD-CTRL not active until ACK_HALT
SETF ACK_HALT /IOW
SETF IOW /ACK_HALT
SETF A3 /A2 A1 ; check RAM_ACCESS
SETF ACK_HALT /IOW
SETF /ACK_HALT IOW
SETF ACK_HALT /IOR ; check READ and WRITE to RAM
SETF IOR P300IN
SETF /A3 A2 A1
SETF /ACK_HALT /P300IN
SETF IOW
SETF /A3 A2 A1 /IOW ; check LATCH_MOD 
SETF IOW
SETF A3 A2 /A1
SETF /IOW       ; check LATCH_ADD
SETF /A3 /A2 /A1 ; shouldn't happen normally

TRACE_OFF
;-------------------------------------------------------------------

FPGA

Example FPGA code. A solution which is too fancy for my 6502.
// Verilog code for decoder 
// 5-input AND gate 
module AND_5_input(g,a,b,c,d,e);
  output g;
  input a,b,c,d,e;
  and #(50) and1(f1,a,b,c,d),
            and2(g,f1,e);
endmodule
// fpga4student.com: FPGA projects, Verilog projects, VHDL projects 
// Verilog code for decoder 
// Decoder top level Verilog code using 5-input AND gates 
module dec5to32(Out,Adr);
input [4:0] Adr; // Adr=Address of register
output [31:0] Out;
not #(50) Inv4(Nota, Adr[4]);
not #(50) Inv3(Notb, Adr[3]);
not #(50) Inv2(Notc, Adr[2]);
not #(50) Inv1(Notd, Adr[1]);
not #(50) Inv0(Note, Adr[0]);

AND_5_input a0(Out[0],  Nota,Notb,Notc,Notd,Note); // 00000
AND_5_input a1(Out[1],  Nota,Notb,Notc,Notd,Adr[0]); // 00001
AND_5_input a2(Out[2],  Nota,Notb,Notc,Adr[1],Note); //00010
AND_5_input a3(Out[3],  Nota,Notb,Notc,Adr[1],Adr[0]);
AND_5_input a4(Out[4],  Nota,Notb,Adr[2],Notd,Note);
AND_5_input a5(Out[5],  Nota,Notb,Adr[2],Notd,Adr[0]);
AND_5_input a6(Out[6],  Nota,Notb,Adr[2],Adr[1],Note);
AND_5_input a7(Out[7],  Nota,Notb,Adr[2],Adr[1],Adr[0]);
AND_5_input a8(Out[8],    Nota,Adr[3],Notc,Notd,Note);
AND_5_input a9(Out[9],    Nota,Adr[3],Notc,Notd,Adr[0]);
AND_5_input a10(Out[10],  Nota,Adr[3],Notc,Adr[1],Note);
AND_5_input a11(Out[11],  Nota,Adr[3],Notc,Adr[1],Adr[0]);
AND_5_input a12(Out[12],  Nota,Adr[3],Adr[2],Notd,Note);
AND_5_input a13(Out[13],  Nota,Adr[3],Adr[2],Notd,Adr[0]);
AND_5_input a14(Out[14],  Nota,Adr[3],Adr[2],Adr[1],Note);
AND_5_input a15(Out[15],  Nota,Adr[3],Adr[2],Adr[1],Adr[0]);
AND_5_input a16(Out[16],  Adr[4],Notb,Notc,Notd,Note);
AND_5_input a17(Out[17],  Adr[4],Notb,Notc,Notd,Adr[0]);
AND_5_input a18(Out[18],  Adr[4],Notb,Notc,Adr[1],Note);
AND_5_input a19(Out[19],  Adr[4],Notb,Notc,Adr[1],Adr[0]);
AND_5_input a20(Out[20],  Adr[4],Notb,Adr[2],Notd,Note);
AND_5_input a21(Out[21],  Adr[4],Notb,Adr[2],Notd,Adr[0]);
AND_5_input a22(Out[22],  Adr[4],Notb,Adr[2],Adr[1],Note);
AND_5_input a23(Out[23],  Adr[4],Notb,Adr[2],Adr[1],Adr[0]);
AND_5_input a24(Out[24],  Adr[4],Adr[3],Notc,Notd,Note);
AND_5_input a25(Out[25],  Adr[4],Adr[3],Notc,Notd,Adr[0]);
AND_5_input a26(Out[26],  Adr[4],Adr[3],Notc,Adr[1],Note);
AND_5_input a27(Out[27],  Adr[4],Adr[3],Notc,Adr[1],Adr[0]);
AND_5_input a28(Out[28],  Adr[4],Adr[3],Adr[2],Notd,Note);
AND_5_input a29(Out[29],  Adr[4],Adr[3],Adr[2],Notd,Adr[0]);
AND_5_input a30(Out[30],  Adr[4],Adr[3],Adr[2],Adr[1],Note);
AND_5_input a31(Out[31],  Adr[4],Adr[3],Adr[2],Adr[1],Adr[0]); // 11111
endmodule

Example of Ice studio FPGA programming

Conslusion:

For now i will use the 74 logic. But i definitely will revisit FPGA’s

G1200 Microscope

Another good suggestion by Bigred.

We are all getting older and electronics smaller. It’s hard to see if your soldering blobs are okay!
Those blobs can reflect the light in a way that it’s not visible anymore to check them.

So i took Bigreds advice, and bought a G1200 Microscope.
It’s a cheap but helpfull little gadget.

  • 1-1200 times zoom
  • 7inch screen (720p)
  • SDcard
  • Lipo battery
  • Recording on micro sdcard in 12 mega pixels pictures and 1080P Video.
    (even got a timer)
  • Focus button, and extra lights (There is a light source in de camera head, which can be adjusted by a knob)
  • When connecting to your pc, you get 3 options
    • PC Camera ( … so you can record using your pc with for example OBS)
    • Mass Storage, to read the SDCARD
    • Rec_mode ?!? – No idea yet

Below some examples:

Picture example
Video example

SDCard Access:

Access to the sdcard is a little hard. Connecting via Mass Storage is a solution. But i’ve put a little piece of tape to get the card in or out of the slot.

You can view the recordings on the Microscope itself. So i was wondering, can it play any other movie files?

I placed different MOV files on the sdcard, but the microscope skipped the ones i places on the sdcard myself.

I started to look at the metadata, and saw a Codec ID
“qt 2016.04.21 (qt )”

 mediainfo VID_001.MOV
General
Complete name                            : VID_001.MOV
Format                                   : MPEG-4
Format profile                           : QuickTime
Codec ID                                 : qt   2016.04.21 (qt  )
File size                                : 551 MiB
Duration                                 : 12s 0ms
Overall bit rate                         : 385 Mbps
Encoded date                             : UTC 1904-01-01 00:00:00
Tagged date                              : UTC 1904-01-01 00:00:00

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L4.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 1 frame
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 12s 0ms
Source duration                          : 12s 360ms
Bit rate                                 : 14.5 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.280
Stream size                              : 20.8 MiB (4%)
Source stream size                       : 21.3 MiB (4%)
Language                                 : 33
Encoded date                             : UTC 1904-01-01 00:00:00
Tagged date                              : UTC 1904-01-01 00:00:00
mdhd_Duration                            : 12000

Audio
ID                                       : 2
Format                                   : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                 : sowt
Duration                                 : 12s 0ms
Source duration                          : 12s 288ms
Bit rate mode                            : Constant
Bit rate                                 : 128 Kbps
Channel(s)                               : 1 channel
Channel positions                        : Front: C
Sampling rate                            : 8 000 Hz
Bit depth                                : 16 bits
Stream size                              : 188 KiB (0%)
Source stream size                       : 192 KiB (0%)
Language                                 : 33
Default                                  : Yes
Alternate group                          : 1
Encoded date                             : UTC 1904-01-01 00:00:00
Tagged date                              : UTC 1904-01-01 00:00:00

Tried to change this with ffmpeg, but it would not change the way i want.

ffmpeg -i VID_002.MOV -c copy -map 0 -brand 'qt   2016.04.21 (qt  )' VID_007.MOV

mediainfo VID_007.MOV
General
Complete name                            : VID_007.MOV
Format                                   : MPEG-4
Format profile                           : QuickTime
Codec ID                                 : qt   0000.02 (qt  )  <--------------- nope

Header of the movie clip
maybe i have to look into this … later

00000000  00 00 00 14 66 74 79 70  71 74 20 20 20 16 04 21  |....ftypqt   ..!|
00000010  71 74 20 20 00 00 00 08  77 69 64 65 01 57 c7 e4  |qt  ....wide.W..|
00000020  6d 64 61 74 00 00 01 d8  0c 00 00 00 4a 4b 4c 4a  |mdat........JKLJ|
00000030  19 00 00 00 80 07 00 00  38 04 00 00 01 00 00 00  |........8.......|
00000040  10 00 00 00 40 1f 00 00  00 20 00 00 01 00 00 00  |....@.... ......|
00000050  0c 00 00 00 73 6f 77 74  00 02 00 00 00 00 00 00  |....sowt........|
00000060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

Scavenging parts and schematics

Searching for parts .. from other projects

I want to make a new clock module using a bare ATmega328 running on a 16mhz crystal. This to provide a clock for my 6502 computer.

Using a display and a rotary encoder I want to create a clock module which generates a 50/50 duty cycle clock 1Hz – 1 MHz.

Input module for my 6502 will be 5 buttons. (For now) that’s what’s left on the VIA on port A. (Rest is used by the display). The display i’m going to place directly on the bus. But I already ordered a second VIA.  Matrix keyboard will be next. Then I will use the buttons in the picture for shift/alternate buttons. Because I’ll need about 25 keys. (See other posts) . I’ll probably end up making that one myself.

Wire wrap

The lost ancient art of wire wrapping.

{funny story]
In 2019 i wanted to make a simple probe, which could detect 0 or 1 or a pulse. I wanted to make this on a little print using wirewrap wires and IC sockets. (I still have the tool which i used in the 90s.)
When going to a well-known electronics shop in Den Hague. A great shop to get all kinds of oldskool electronics. But i’m getting ahead of the story.
This shop has a lot of components for all kinds of electronics. New and what it looked like de-soldered component from boards or bought from old going-out-of-business shops or factories. Stuff you needed for 60s equipment.
Well i was at the counter, asking a old guy.
“Do you have wire-wrap wire”
He said: ” No that’s old skool” ….
{/funny story]

The wirewrap tool has a cable stripper. After stripping you would put a short part in the tool, place the tool over a IC pin and turning would wrap the wire on the pins.
You could stack multiple connections on one pin.
Removing could be done by turning the tool counterclockwise.
Sometimes you had to remove the one closest to the print, replacing all wires. (Or cut the wrong/not needed wire and leave it in place … )

I’m thinking of moving my breadboard 6502 to a wirewrapped version.
All my old boards are gone .. before i got a digital camera .. 🙁

Example from a 8031 setup of a friend of mine

6502 progress

UPDATE: 20220815, 20220814, 20220815, 20230202

Flashing ROMs .. (eeproms). It used to be a pain in the *$$.
Burning took a looong time. But clearing one with UV took .. 20 minutes or so. Using one of these:

Altered clock module

  • Changed button press
  • Dipswitches for more speed control (red .. upper left)

Changed Rom/Ram

  • Changed addressing
  • Added RAM
  • ZIF Socket for ROM

VIC 6522

  • Fixed clock
  • Added buttons for interrupt

Display

  • Display works now
  • To test: Create Address logic to access display without VIA
    Can work, but not at high speed clock. Stays behind VIA
  • To buy: st7920 lcd 128×64

Generic improvements

  • Rewired most parts, using color codes
    (Blue data, Yellow Address and so on)
  • Added leds on data and address bus using ULN2803 darlington arrays
  • 100nF Decoupling capacitors on the power rails

To do’s or ‘have to look into’s’

  • For sound i planned to use a General Instrument AY-3-8910, it is somewhere in my Lab, i know it is.
    I saved this chip and a SID for my Amiga addon soundcard.
    Where are my plans for the simple v1 setup? (FOUND IT)

  • I have to start writing rom functions for display usage. Like
    JSR $ff00 – Clear screen subroutine .. etc
  • I’m scraping information from websites, to get started on my clock controller.
    ATmega328 with ssd1306 display and rotary encoder/dip switches

Notes about the movie:
Left side is Arduino IDE monitor reading Addressbus and Databus.
(I’m going to try to rewrite this to realtime disassemble)
Resetting system.
Stepping CPU with manual clock pulses.
Start vector being read at $FFFC/$FFFD.
Program being run from $8000.
Set clock on automatic ( ~ about 150 Hz )
Last opcodes you see a JMP loop 4C 2F 80, that is JMP $802F
Display enlarged on video, was not visible on movie i took on mobile.
(Wrong angle?)

Breadboard overview

Clock moduleReset module + Crystal
CPU + nmi/int buttonsRAM and ROM
Address decode + Bus divideAddres/Data bus leds
6522 VIA + Display2nd via + Buttons
?(sound board)

TIL: 6502 can run without ram only rom,expect when using JSR … which uses a program stack in RAM

TODO:

  • Make Clock module and 1Mhz Crystal switchable
  • NMI and INT debounce maken
  • Software buttons
  • Buy new darlingtons, for controlbus!
    • r/w, int, chip enables, etc
  • Labels on chips/breadboards

Altair 8800

After a whole day soldering yesterday, ending up with a wire mess.
Which didn’t work at the end…

Starting measuring some things, and create some test sketches (led blinky tests)
I found out that the main problem was not having the red switches connected to GND.
Blue switches where upside down, this was a easy fix. Because these are ON-ON switches, and where already connected to a common line.
Then a mixup between D0 and D6 (wires crossed)
And it is working! Made some lines and lettering on the frontplate after some playing around.

Weird to input stuff in octal (group of 3 bits)

Altair 8800

The Altair 8800 is a microcomputer designed in 1974 by MITS and based on the Intel 8080CPU. Interest grew quickly after it was featured on the cover of the January 1975 issue of Popular Electronics and was sold by mail order through advertisements there, in Radio-Electronics, and in other hobbyist magazines.

(picture from wikipedia)

UPDATE: 20220804 – Added Octal sheet

I alway loved the simple setup of this computer.
There was no screen and no keyboard.
Only later additions to the machine provided these.

One explanation of the Altair name, is that the name was inspired by Star Trek episode “Amok Time“, where the Enterprise crew went to Altair (Six).

There are only a few differences between the used 8080 CPU and the 8085 CPU of a machine i learned machinecode on.

See : https://www.henriaanstoot.nl/1989/01/01/8085-machinecode-at-school/

So for a really long time i wanted to have a Altair alike machine. There are do it yourself kits for sale. Which look like perfect relica’s and there are virtual machines and emulators. But i wanted to have the feeling of throwing the switches.
You can find a emulator here (https://s2js.com/altair/)

So i bought the components, a poker case which can hold the machine. And started building today.

The backend is a arduino based emulator, but with real leds and switches!
(https://create.arduino.cc/projecthub/david-hansel/arduino-altair-8800-simulator-3594a6)

Next to do:

  • Fix plate into case
  • Solder a LOT of wires and components!
    • Shall i get rid off the transitors and use darlington arrays?
  • Put lettering on the aluminium plate : Functions and Bus information.
  • Build a power connector in the case

And then … programming 🙂

UPDATE: 20220804 – Added Octal sheet

The Altair is a octal based machine, but i couldn’t find a opcode list in Octal. So i generated one.
When entering a MOV D,M instruction for example, you have to enter
x 0 1 0 1 0 1 1 0 using the switches
Thats 126 in octal but most tables are in hex ( MOV D,M is 56, which is 0101 0110 but not that clear on the switches)

Opcode (oct)InstructionfunctionsizeflagsOpcode
000NOP10x00
001LXI B,D16B <- byte 3, C <- byte 230x01
002STAX B(BC) <- A10x02
003INX BBC <- BC+110x03
004INR BB <- B+11Z, S, P, AC0x04
005DCR BB <- B-11Z, S, P, AC0x05
006MVI B, D8B <- byte 220x06
007RLCA = A << 1; bit 0 = prev bit 7; CY = prev bit 71CY0x07
0100x08
011DAD BHL = HL + BC1CY0x09
012LDAX BA <- (BC)10x0a
013DCX BBC = BC-110x0b
014INR CC <- C+11Z, S, P, AC0x0c
015DCR CC <-C-11Z, S, P, AC0x0d
016MVI C,D8C <- byte 220x0e
017RRCA = A >> 1; bit 7 = prev bit 0; CY = prev bit 01CY0x0f
0200x10
021LXI D,D16D <- byte 3, E <- byte 230x11
022STAX D(DE) <- A10x12
023INX DDE <- DE + 110x13
024INR DD <- D+11Z, S, P, AC0x14
025DCR DD <- D-11Z, S, P, AC0x15
026MVI D, D8D <- byte 220x16
027RALA = A << 1; bit 0 = prev CY; CY = prev bit 71CY0x17
0300x18
031DAD DHL = HL + DE1CY0x19
032LDAX DA <- (DE)10x1a
033DCX DDE = DE-110x1b
034INR EE <-E+11Z, S, P, AC0x1c
035DCR EE <- E-11Z, S, P, AC0x1d
036MVI E,D8E <- byte 220x1e
037RARA = A >> 1; bit 7 = prev bit 7; CY = prev bit 01CY0x1f
0400x20
041LXI H,D16H <- byte 3, L <- byte 230x21
042SHLD adr(adr) <-L; (adr+1)<-H30x22
043INX HHL <- HL + 110x23
044INR HH <- H+11Z, S, P, AC0x24
045DCR HH <- H-11Z, S, P, AC0x25
046MVI H,D8H <- byte 220x26
047DAAspecial10x27
0500x28
051DAD HHL = HL + HI1CY0x29
052LHLD adrL <- (adr); H<-(adr+1)30x2a
053DCX HHL = HL-110x2b
054INR LL <- L+11Z, S, P, AC0x2c
055DCR LL <- L-11Z, S, P, AC0x2d
056MVI L, D8L <- byte 220x2e
057CMAA <- !A10x2f
0600x30
061LXI SP, D16SP.hi <- byte 3, SP.lo <- byte 230x31
062STA adr(adr) <- A30x32
063INX SPSP = SP + 110x33
064INR M(HL) <- (HL)+11Z, S, P, AC0x34
065DCR M(HL) <- (HL)-11Z, S, P, AC0x35
066MVI M,D8(HL) <- byte 220x36
067STCCY = 11CY0x37
0700x38
071DAD SPHL = HL + SP1CY0x39
072LDA adrA <- (adr)30x3a
073DCX SPSP = SP-110x3b
074INR AA <- A+11Z, S, P, AC0x3c
075DCR AA <- A-11Z, S, P, AC0x3d
076MVI A,D8A <- byte 220x3e
077CMCCY=!CY1CY0x3f
100MOV B,BB <- B10x40
101MOV B,CB <- C10x41
102MOV B,DB <- D10x42
103MOV B,EB <- E10x43
104MOV B,HB <- H10x44
105MOV B,LB <- L10x45
106MOV B,MB <- (HL)10x46
107MOV B,AB <- A10x47
110MOV C,BC <- B10x48
111MOV C,CC <- C10x49
112MOV C,DC <- D10x4a
113MOV C,EC <- E10x4b
114MOV C,HC <- H10x4c
115MOV C,LC <- L10x4d
116MOV C,MC <- (HL)10x4e
117MOV C,AC <- A10x4f
120MOV D,BD <- B10x50
121MOV D,CD <- C10x51
122MOV D,DD <- D10x52
123MOV D,ED <- E10x53
124MOV D,HD <- H10x54
125MOV D,LD <- L10x55
126MOV D,MD <- (HL)10x56
127MOV D,AD <- A10x57
130MOV E,BE <- B10x58
131MOV E,CE <- C10x59
132MOV E,DE <- D10x5a
133MOV E,EE <- E10x5b
134MOV E,HE <- H10x5c
135MOV E,LE <- L10x5d
136MOV E,ME <- (HL)10x5e
137MOV E,AE <- A10x5f
140MOV H,BH <- B10x60
141MOV H,CH <- C10x61
142MOV H,DH <- D10x62
143MOV H,EH <- E10x63
144MOV H,HH <- H10x64
145MOV H,LH <- L10x65
146MOV H,MH <- (HL)10x66
147MOV H,AH <- A10x67
150MOV L,BL <- B10x68
151MOV L,CL <- C10x69
152MOV L,DL <- D10x6a
153MOV L,EL <- E10x6b
154MOV L,HL <- H10x6c
155MOV L,LL <- L10x6d
156MOV L,ML <- (HL)10x6e
157MOV L,AL <- A10x6f
160MOV M,B(HL) <- B10x70
161MOV M,C(HL) <- C10x71
162MOV M,D(HL) <- D10x72
163MOV M,E(HL) <- E10x73
164MOV M,H(HL) <- H10x74
165MOV M,L(HL) <- L10x75
166HLTspecial10x76
167MOV M,A(HL) <- A10x77
170MOV A,BA <- B10x78
171MOV A,CA <- C10x79
172MOV A,DA <- D10x7a
173MOV A,EA <- E10x7b
174MOV A,HA <- H10x7c
175MOV A,LA <- L10x7d
176MOV A,MA <- (HL)10x7e
177MOV A,AA <- A10x7f
200ADD BA <- A + B1Z, S, P, CY, AC0x80
201ADD CA <- A + C1Z, S, P, CY, AC0x81
202ADD DA <- A + D1Z, S, P, CY, AC0x82
203ADD EA <- A + E1Z, S, P, CY, AC0x83
204ADD HA <- A + H1Z, S, P, CY, AC0x84
205ADD LA <- A + L1Z, S, P, CY, AC0x85
206ADD MA <- A + (HL)1Z, S, P, CY, AC0x86
207ADD AA <- A + A1Z, S, P, CY, AC0x87
210ADC BA <- A + B + CY1Z, S, P, CY, AC0x88
211ADC CA <- A + C + CY1Z, S, P, CY, AC0x89
212ADC DA <- A + D + CY1Z, S, P, CY, AC0x8a
213ADC EA <- A + E + CY1Z, S, P, CY, AC0x8b
214ADC HA <- A + H + CY1Z, S, P, CY, AC0x8c
215ADC LA <- A + L + CY1Z, S, P, CY, AC0x8d
216ADC MA <- A + (HL) + CY1Z, S, P, CY, AC0x8e
217ADC AA <- A + A + CY1Z, S, P, CY, AC0x8f
220SUB BA <- A – B1Z, S, P, CY, AC0x90
221SUB CA <- A – C1Z, S, P, CY, AC0x91
222SUB DA <- A + D1Z, S, P, CY, AC0x92
223SUB EA <- A – E1Z, S, P, CY, AC0x93
224SUB HA <- A + H1Z, S, P, CY, AC0x94
225SUB LA <- A – L1Z, S, P, CY, AC0x95
226SUB MA <- A + (HL)1Z, S, P, CY, AC0x96
227SUB AA <- A – A1Z, S, P, CY, AC0x97
230SBB BA <- A – B – CY1Z, S, P, CY, AC0x98
231SBB CA <- A – C – CY1Z, S, P, CY, AC0x99
232SBB DA <- A – D – CY1Z, S, P, CY, AC0x9a
233SBB EA <- A – E – CY1Z, S, P, CY, AC0x9b
234SBB HA <- A – H – CY1Z, S, P, CY, AC0x9c
235SBB LA <- A – L – CY1Z, S, P, CY, AC0x9d
236SBB MA <- A – (HL) – CY1Z, S, P, CY, AC0x9e
237SBB AA <- A – A – CY1Z, S, P, CY, AC0x9f
240ANA BA <- A & B1Z, S, P, CY, AC0xa0
241ANA CA <- A & C1Z, S, P, CY, AC0xa1
242ANA DA <- A & D1Z, S, P, CY, AC0xa2
243ANA EA <- A & E1Z, S, P, CY, AC0xa3
244ANA HA <- A & H1Z, S, P, CY, AC0xa4
245ANA LA <- A & L1Z, S, P, CY, AC0xa5
246ANA MA <- A & (HL)1Z, S, P, CY, AC0xa6
247ANA AA <- A & A1Z, S, P, CY, AC0xa7
250XRA BA <- A ^ B1Z, S, P, CY, AC0xa8
251XRA CA <- A ^ C1Z, S, P, CY, AC0xa9
252XRA DA <- A ^ D1Z, S, P, CY, AC0xaa
253XRA EA <- A ^ E1Z, S, P, CY, AC0xab
254XRA HA <- A ^ H1Z, S, P, CY, AC0xac
255XRA LA <- A ^ L1Z, S, P, CY, AC0xad
256XRA MA <- A ^ (HL)1Z, S, P, CY, AC0xae
257XRA AA <- A ^ A1Z, S, P, CY, AC0xaf
260ORA BA <- A | B1Z, S, P, CY, AC0xb0
261ORA CA <- A | C1Z, S, P, CY, AC0xb1
262ORA DA <- A | D1Z, S, P, CY, AC0xb2
263ORA EA <- A | E1Z, S, P, CY, AC0xb3
264ORA HA <- A | H1Z, S, P, CY, AC0xb4
265ORA LA <- A | L1Z, S, P, CY, AC0xb5
266ORA MA <- A | (HL)1Z, S, P, CY, AC0xb6
267ORA AA <- A | A1Z, S, P, CY, AC0xb7
270CMP BA – B1Z, S, P, CY, AC0xb8
271CMP CA – C1Z, S, P, CY, AC0xb9
272CMP DA – D1Z, S, P, CY, AC0xba
273CMP EA – E1Z, S, P, CY, AC0xbb
274CMP HA – H1Z, S, P, CY, AC0xbc
275CMP LA – L1Z, S, P, CY, AC0xbd
276CMP MA – (HL)1Z, S, P, CY, AC0xbe
277CMP AA – A1Z, S, P, CY, AC0xbf
300RNZif NZ, RET10xc0
301POP BC <- (sp); B <- (sp+1); sp <- sp+210xc1
302JNZ adrif NZ, PC <- adr30xc2
303JMP adrPC <= adr30xc3
304CNZ adrif NZ, CALL adr30xc4
305PUSH B(sp-2)<-C; (sp-1)<-B; sp <- sp – 210xc5
306ADI D8A <- A + byte2Z, S, P, CY, AC0xc6
307RST 0CALL $010xc7
310RZif Z, RET10xc8
311RETPC.lo <- (sp); PC.hi<-(sp+1); SP <- SP+210xc9
312JZ adrif Z, PC <- adr30xca
3130xcb
314CZ adrif Z, CALL adr30xcc
315CALL adr(SP-1)<-PC.hi;(SP-2)<-PC.lo;SP<-SP-2;PC=adr30xcd
316ACI D8A <- A + data + CY2Z, S, P, CY, AC0xce
317RST 1CALL $810xcf
320RNCif NCY, RET10xd0
321POP DE <- (sp); D <- (sp+1); sp <- sp+210xd1
322JNC adrif NCY, PC<-adr30xd2
323OUT D8special20xd3
324CNC adrif NCY, CALL adr30xd4
325PUSH D(sp-2)<-E; (sp-1)<-D; sp <- sp – 210xd5
326SUI D8A <- A – data2Z, S, P, CY, AC0xd6
327RST 2CALL $1010xd7
330RCif CY, RET10xd8
3310xd9
332JC adrif CY, PC<-adr30xda
333IN D8special20xdb
334CC adrif CY, CALL adr30xdc
3350xdd
336SBI D8A <- A – data – CY2Z, S, P, CY, AC0xde
337RST 3CALL $1810xdf
340RPOif PO, RET10xe0
341POP HL <- (sp); H <- (sp+1); sp <- sp+210xe1
342JPO adrif PO, PC <- adr30xe2
343XTHLL <-> (SP); H <-> (SP+1)10xe3
344CPO adrif PO, CALL adr30xe4
345PUSH H(sp-2)<-L; (sp-1)<-H; sp <- sp – 210xe5
346ANI D8A <- A & data2Z, S, P, CY, AC0xe6
347RST 4CALL $2010xe7
350RPEif PE, RET10xe8
351PCHLPC.hi <- H; PC.lo <- L10xe9
352JPE adrif PE, PC <- adr30xea
353XCHGH <-> D; L <-> E10xeb
354CPE adrif PE, CALL adr30xec
3550xed
356XRI D8A <- A ^ data2Z, S, P, CY, AC0xee
357RST 5CALL $2810xef
360RPif P, RET10xf0
361POP PSWflags <- (sp); A <- (sp+1); sp <- sp+210xf1
362JP adrif P=1 PC <- adr30xf2
363DIspecial10xf3
364CP adrif P, PC <- adr30xf4
365PUSH PSW(sp-2)<-flags; (sp-1)<-A; sp <- sp – 210xf5
366ORI D8A <- A | data2Z, S, P, CY, AC0xf6
367RST 6CALL $3010xf7
370RMif M, RET10xf8
371SPHLSP=HL10xf9
372JM adrif M, PC <- adr30xfa
373EIspecial10xfb
374CM adrif M, CALL adr30xfc
3750xfd
376CPI D8A – data2Z, S, P, CY, AC0xfe
377RST 7CALL $3810xff

Kicad – Power-on-reset

UPDATE: 20220728 Added POC

The workshop at MCH2022 gave me the idea to make my next PCB not at home, but professionally.

I’m planning to make my 6502 on modular PCB’s when i’ve got the base part working.
( I probably will only make THT (Though Hole Technology) boards instead of smd )
So i’ll probably end up making a few boards, namely:

  • Power on reset
  • Clock module
  • Interconnect with arduino
  • CPU, memory and ROM
  • Display
  • 6522 Via
  • SID chip
  • Hex keyboard

This power-on reset is based on the original C64 part to reset the CPU when you power the machine on. With my 6502 i have to manually push reset to start booting.
(The CPU starts in a unknown state when you power it up, it needs a reset)

Schematic
PCB design
Rendering

Working POC

MCH 2022

Back from the hackers event “May Contain Hackers”

MCH2022 is a nonprofit outdoor hacker camp taking place in Zeewolde, the Netherlands, July 22 to 26 2022. The event is organized for and by volunteers from the worldwide hacker community.

Knowledge sharing, technological advancement, experimentation, connecting with your hacker peers and hacking are some of the core values of this event.

MCH2022 is the successor of a string of similar events happening every four years since 1989.
These are GHPHEUHIPHALWTHHAROHM and SHA.

I’ve bin to several of these big events. Besides these big events are many different smaller events (wannull, ne2000 etc).

First one i’ve been was HIP97. I went with Bigred at that time.
I had to get the tickets at that time, he didn’t had a handle at that time. It was Monique who came up with his new nick.

After HIP97 there was HAL2001 WTH2005 and OHM2013 which i was present.
HAL2001 the whole ICEcrew was present, WTH a part of them, OHM a few and i was with a few PRUTS friends.

Now i was with my girlfriend, AND with Bigred again!
Loads of fun and memories. Had not seen Bigred since a inbetween hacker party at my place.
So ’97 and now ’22 .. jeez 25 years!

So MCH, it was great again.
Loads of stuff to do and to see.
Weather was … okay. Two days where really hot, one day some light rain but a load of wind. Our neighbours tent collapsed, beer tents where reenforced.
First campsite with a supermarket!
Music stage was awesome, lasers and fire!

I went to a lot of talks, even my girlfriend found some she was interested in.

This was the last time i’ve brought my “Windows free zone tape”
This big roll of tape was used on many occasions.
I got this roll somewhere < 2000, I did a search but couldn’t find anything mentioning it on the web. Maybe some archive.org entry?

  • Starting a Home Computer Museum (which i almost did in the past)
  • streaming 360 video (going to try this with my Vuze XR Camera)
  • Non-Euclidean Doom: what happens to a game when pi is not 3.14159…
    (Really enjoyed this one)
  • Hacking the genome: how does it work, and should we?
  • And more

Besides the talks i’ve done some workshops:

  • Micropython on the badge (see my other post)
  • Kicad – PCB designing

Meanwhile we where looking at all the villages and hackerspaces. Loads of interesting people to meet. Like our neighbour two tents futher, he was also a home-brewer, and he brought a minifridge with beer taps connected to it.

When back at our tent or Bigreds Campervan, we talked about differences now and then. New technology, what we’ve been upto in the last years and tinkering, loads of tinkering.

I’ve brough a big plastic container with .. ehh “things to do ….”

  • My 6502, bigred helped me debugging the 16*2 display.
    (Luckily his campervan was packed with electronics!)
    We cannibalized one of his projects for a display, and re-flashed his eeprom programming arduino to test my display. ( The arduino i had to reflash later to program a rom he had given me for my 6502. )
    Other toys he gave me: Print for the programmer, and a C64 Cartridge print for Exrom and Game.
  • Mini C64 with a little screen and raspberry zero.
  • 5050 ledstrip (didn’t had time to reprogram this for our mood-light)
  • Handheld gamehat: Bigred found some old games he played when he was young
  • Mikrotik router, because i wanted to make a dmz for my girlfriends laptop. (MS)
  • Playing around with my Vuze XR camera
  • Huskycam, which i’m planning to use on a racetrack
  • DVB-T DAB FM Stick, got some hints and tips from Bigred.
    (Note to myself … fix the antenna!)
  • My Arduino touch bagpipe player with i2c
  • The wifi deauther, which has a display which i wanted to use to make a programmable clock for my 6502. Using a rotary encoder and the display to control the speed in Hz.
  • I spend many hours playing with the Badge and Kicad

Wrote some 6502 assembly, arduino sketches, php, bash and micropython.

While playing around with the badge i got some things working easily.
Spinning logo and blinky leds.
Next goal to achieve was, to get the gyroscope to control the angle of spinning.
Most of the code worked, but the gyro values stayed zero!
(After many hours …. you have to start/enable the chip/measurements on the bno055 first! .. duh! )

I didn’t had my dev directory from my main battlestation synced in my nextcloud, so changing things for the 6502 was a b*tch.
Used vasm and acme to generate a bin file to use to fill the rom.
Didn’t like the eeprom programmer program, because i could not easily check the rom contents.
Have to look into that later on.

While learning to use Kicad, which i only had been using to draw schematics (besides fritzing) , i learned to create a pcb.
Which gave me the idea to make a print for the power-on-reset for the 6502. Which is going to be the first PCB by ordering, instead of the old skool messing around with DIY print making. (see next post)

….. Oh, why my display was not working?
I even connected my 8bit logic analyzer to the pins of the display.

Everything was correct.
But i didn’t use a variable resistor for the contrast. Just a simple resistor i could find. Luckily … bigreds stash.
All those hours debugging, all for one resistor!
(I have to mention, we had a suspicion halfway. But it was too hot and we where too lazy to go to Bigred’s campervan, to get a potentiometer. )

Goodies from Bigred