Tag Archives: programming

Programming ATF22V10 PLD – 7 Segment with Linux

The ATF22V10 is a Programmable Logic Device. This means you can program the logic in the chip.

Internally it looks like a big matrix of connections which you can program to connect/disconnect from certain logic.

It has just a bunch of inputs/outputs

So if we want to have a 7 Segment decoder (you can easily buy a BCD decoder .. but these only work for displaying 0-9 and not 0-9A-F for displaying HEX numbers)

7 Segment display
Binary IN7 Segment decodedDisplays
D C B AA B C D E F G
0 0 0 01 1 1 1 1 1 00
0 0 0 10 1 1 0 0 0 0 1
0 0 1 0 1 1 0 1 1 0 12
0 0 1 11 1 1 1 0 0 13
0 1 0 00 1 1 0 0 1 14
0 1 0 11 0 1 1 0 1 15
0 1 1 0 1 0 1 1 1 1 16
0 1 1 1 1 1 1 0 0 0 0 7
1 0 0 01 1 1 1 1 1 18
1 0 0 11 1 1 1 0 1 19
1 0 1 01 1 1 0 1 1 1A
1 0 1 10 0 1 1 1 1 1B
1 1 0 0 1 0 0 1 1 1 0C
1 1 0 10 1 1 1 1 0 1D
1 1 1 01 0 0 1 1 1 1E
1 1 1 11 0 0 0 1 1 1F

Now we see that segment A is 1 in the case of (0,2,3,5,6,7,8,9,A,C,E,F)

When programming the PLD we can write that as: (note / means inverted a plus is OR, and * is AND)
So A is 0 in case of input being (1,4,B,D)

/QA = /D1 * /C1 * /B1 * A1
    + /D1 * C1 * /B1 * /A1
    + D1 * /C1 * B1 * A1
    + D1 * C1 * /B1 * A1

Complete code for galasm

Compiling and burning

GAL22V10
7SEGMENT

Clock   D1   C1   B1   A1    D2   C2    B2    A2    NC  NC   GND
/OE   NC    NC  NC  QG    QF    QE    QD   QC    QB   QA   VCC


/QA =   /D1 * /C1 * /B1 * A1
        + /D1 * C1 * /B1 * /A1
        + D1 * /C1 * B1 * A1
        + D1 * C1 * /B1 * A1

/QB=    /D1 * C1 * /B1 * A1
        + /D1 * C1 * B1 * /A1
        + D1 * /C1 * B1 * A1
        + D1 * C1 * /B1 * /A1
        + D1 * C1 * B1 * /A1
        + D1 * C1 * B1 * A1

/QC =   /D1 * /C1 * B1 * /A1
        + D1 * C1 * /B1 * /A1
        + D1 * C1 * B1 * /A1
        + D1 * C1 * B1 * A1


/QD=      /D1 * /C1* /B1 * A1
        + /D1 * C1 * /B1 * /A1
        + /D1 * C1 * B1 * A1
        + D1 * /C1 * B1 * /A1
        + D1 * C1 * B1 * A1

/QE =     /D1 * /C1 * /B1 * A1
        + /D1 * /C1 * B1 * A1
        + /D1 * C1 * /B1 * /A1
        + /D1 * C1 * /B1 * A1
        + /D1 * C1 * B1 * A1
        + D1 * /C1 * /B1 * A1

/QF =     /D1 * /C1 * /B1 * A1
        + /D1 * /C1 * B1 * /A1
        + /D1 * /C1 * B1 * A1
        + /D1 * C1 * B1 * A1
        + D1 * C1 * /B1 * A1

/QG =     /D1 * /C1 * /B1 * /A1
        + /D1 * /C1 * /B1 * A1
        + /D1 * C1 * B1 * A1
        + D1 * C1 * /B1 * /A1

DESCRIPTION
A 7 segment hex decoder

galasm 7seghex.gal

minipro -p ATF22V10CQZ -w 7seghex.jed

minipro -p ATF22V10CQZ -w 7seghex.jed
Found TL866II+ 04.2.129 (0x281)
Warning: Firmware is newer than expected.
  Expected  04.2.128 (0x280)
  Found     04.2.129 (0x281)

VPP=12V
Warning! JED file doesn't match the selected device!

Declared fuse checksum: 0x98D5 Calculated: 0x98D5 ... OK
Declared file checksum: 0x40B3 Calculated: 0x41A8 ... Mismatch!
JED file parsed OK

Use -P to skip write protect

Erasing... 0.33Sec OK
Writing jedec file...  5.01Sec  OK
Reading device...  0.32Sec  OK
Writing lock bit... 0.35Sec OK
Verification failed at address 0x16C6: File=0x01, Device=0x00 < ------------------ Gives error, but burning seems okay

henri@zspot:~/projects/galasm$ minipro -p ATF22V10CQZ -r 7seghex.out
Found TL866II+ 04.2.129 (0x281)
Warning: Firmware is newer than expected.
  Expected  04.2.128 (0x280)
  Found     04.2.129 (0x281)
Reading device...  0.32Sec  OK

Gives all zeros as output, but device works!

Programming languages

I’ve used a lot of programming languages, and besides that a few scripting languages.

Scripting is used to automate stuff, but probably use other tools under the hood. A programming language can probably do this by itself. Most of the time a programming language needs compiling into a executable form. Whereas a script is directly intepreted at runtime.

I’m not good at programming, but i understand the syntax and can read most of it.
My programming is mostly by example/copy-paste.
Below a list of programming languages and a table below that some scripting languages.

Sooo .. what do i like, still use and why?

Bash is my swiss army knife.
Making Web stuff? – PHP
Iot – C and Javascript
Advanced programming/Longer programs or Machine Learning – Python

And because of recent projects … i have to mention 6502 machinecode!

Programming languages i’ve used

BasicThe first programming language i learned. There are many dialects for many different systems.
PascalI learned to program in school.
Generic pascal and later Turbo Pascal
PLM/86This is relatively unknown programming language. Written for intel processors. It used a lot of ms-dos subroutines. Like dsso which stands for dos-standard-string-out.
dsso(@(‘Print this text’,eos));
And called a dos routine like below
(assembly example)
mov dx,(messageaddress)
mov ah,09h
int 21h
AssemblyStarted with 6502 assemby on my little home computer (a vic-20).
After that i learned to program 8085 assembly in school.
Also learned a little Z80 programming.
When i got a amiga i started with 68000 assembly.
And getting the hang of it, some friends and me started programming 80×86.
CFor a project I needed C programming to control a parallel port, for example for my controllable webcam.
Also recently the microcontrollers like the Arduino’s are programmed in C/C++
PerlPerl was also a interesting language, i bought myself a book and started with the examples.
One of my friends was a Perl wizard, but i could never get the hang of it. Even with his help.
Tcl/TKTCL stands for Tool Command Language, i used the TK extension. So Tcl/TK i used for creating GUI tools in linux. But like what i later used zenity and yad, i think these are more scripting languages.
PHPPHP i used extensively, one of my first big projects was a tunesearch engine with a mysql database.
PythonThe last years i’ve been using python more and more. Python has become the de facto standard for IT.
HaskellWell .. it is a programming language but i only use it to configure my Xmonad desktop.
JavascriptI’ve made a lot of webbased nonsence. PHP/CGI scripts/flash but i also used javascript.
Now i’m primarily using javascript for NodeRed

Scripting languages i’ve used

batDos batch files is a kind of scripting language
KshKorn Shell, i did a workshop ksh because i was a AIX admin.
Didn’t use this much, because you could install the linux toolkit, and could use bash after that.
BashI write a lot of things in bash, this is my preferred tool for fast and easy automation.
When it’s web based i use PHP
LuaI had to write some plugins for my Flightsim Setup

What about Sql, Dbase, Sed, Puredata and blocky those are all on the Programming Lanuages page of Wikipedia???
Well those i find more of a application markup language.
Then you can say abc-music and bmw (bagpipe music writer) are languages also!??

Some call Ansible a programming language, but this is incorrect. It is driven by python scripts and yaml config files.

Below some code part examples of different CPU assembly code

#6502 
    PUSH CX
    PUSH DI
    PUSH SI
    MOV AX,cry
    MOV BX,(2*40)
    MUL BX
    MOV DI,AX
    ADD DI,(2*31)
    MOV SI,adr1
    SUB SI,8       
    MOV CX,8

Z80
    LD H,00H
    LD B,01H
    LD A,(IX+00)
    OUT (01H),A
    LD A,(IY+00)
    OUT (02H),A
    DJNZ LUS3
    LD B,01H
    LD A,(IX+07)
    OUT (01H),A
    LD A,(IY+07)
    OUT (02H),A

#8085
    LDA 2050
    MOV H, A
    LDA 2051
    ADD H
    MOV L, A
    MVI A 00
    ADC A
    MOV H, A
    SHLD 3050
    HLT

#68000
    bsr send
    bsr delay2
    move.w #$38,d0
    bsr send
    bsr delay2
    move.w #$38,d0
    bsr send
    bsr delay2
    move.w #$01,d0
    bsr send
    bsr delay2
    move.w #$0c,d0
    bsr send
    move.w #$06,d0
    bsr send
    rts

#80x68
    mov bx,split
    and bx,1111111111b
    mov dx,3d4h
    mov al,18h
    mov ah,bl
    out dx,ax
    mov bl,bh
    xor bh,bh
    shl bx,1
    mov bx,[bx+offset ormsk]
    mov al,9
    out dx,al
    inc dx
    in al,dx
    and al,10111111b

For assembly i use or used below:
vasm – vasm is a portable and retargetable assembler – which can be used for a lot of different CPUs
masm – a assembler for 80×86, i used this for programming on DOS machines. Also for little projects i used the alway available debug executable.
seka/masterseka – programming 68000 on my amiga

6502 cont.

UPDATE: 20220823 Sid working

Kicad VIA/PIA tester

Above is my Kicad design (reverse engineering print below, which was made for my 6802CPU, which i could use to test the 6822 PIA)
The 6822 is simular to 6502 in design. So i’m going to redo this for my 6502.
The 7 segment displays are a start of hex-keyboard/display combo i’m going to post more of in the next days.

Below a part of the rom for the LCD dual line display.

Part of the ROM assembly code, top part is text (o.a. japanese)

Started to write routines which i can call to manipulate the display. Setting the pointer to a message, setting the line to use and a subset of controlls like: Center, Right, binary to ascii, scrolling, etcetera

        lda #0             ; set line number
        sta lineno         ; store
        jsr gotoline       ; goto line in display
        lda #<message      ; get address from message and store for printline subroutine
        sta messagestore
        lda #>message
        sta messagestore+1
        jsr printline      ; print

        lda #1  ; set line number
        sta lineno      ; store
        jsr gotoline
        lda #<message2
        sta messagestore
        lda #>message2
        sta messagestore+1
        jsr printline

Above additions:
New address decoder
Below left the new graphical display, below right a test board which shows address lines and decoded chip-enable lines.

A15 high -> ROM
A15 && A14 low -> RAM
combination of A15 low and A14 high – A13 and A12 wil select peripherals.

Adress decoding

Above is a start of a wirewrapped version, i also started a PCB design in KIcad that will continuously be changed as i alter designs.

UPDATE SID Working! Using new address decoder.

SID = $7000

makesound:
	lda #0
	sta SID+$5 ; Channel1 - attack/decay
	
	lda #250
	sta SID+$6 ; Channel1 - Sustain/Release
	
	lda #$95
	sta SID+$0 ; Channel1 - Frequency low-byte
	
	lda #$44
	sta SID+$1 ; Channel1 - Frequency high-byte

	lda #%00100001
	sta SID+$4 ; SAW + Gate

	lda #$0f
	sta SID+$18 ; Volume max

Memory map generator

Started to write a program to generate a memory map like this

It will be a python script which generates a ascii table.

| a15 | a14 | a13 | a12 | a11 | a10 | a09 | a08 | a07 | a06 | a05 | a04 | a03 | a02 | a01 | a00 |
|  1  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  | ROM
|  0  |  0  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  | RAM
|  0  |  1  |  1  |  x  |  x  |  x  |  x  |  x  |  x  |  x  |  x  |  x  |  a  |  a  |  a  |  a  | VIA
|  0  |  0  |  0  |  0  |  0  |  0  |  0  |  1  |  a  |  a  |  a  |  a  |  a  |  a  |  a  |  a  | PS

Above example shows:

  • Rom – $8000 and up
  • Ram – $0000 till $3FFF
  • Via chip – $6xxx-$7xxxx 16 addresses repeating in this block.
    This will be the interesting/hard part
  • Program stack – in RAM – $0100-$01FF

Generated output

| 0000 | ram |     |     |      |      |
| 00ff | ram |     |     |      |      |
| 0100 | ram |     | ps  |      |      |
| 01ff | ram |     | ps  |      |      |
| 0200 | ram |     |     |      |      |
| 3fff | ram |     |     |      |      |
| 4000 |     |     |     |      |      |
| 5fff |     |     |     |      |      |
| 6000 |     |     |     | via1 |      |
| 6fff |     |     |     | via1 |      |
| 7000 |     |     |     |      | via2 |
| 7fff |     |     |     |      | via2 |
| 8000 |     | rom |     |      |      |
| ffff |     | rom |     |      |      |
#!/bin/python

# 0 = address should be 0 .. Duh
# 1 = address should be 1 .. Duh
# a = address 0 or 1
# x = not connected, future function

# try
#via1 = ["0","1","1","0","x","x","x","x","x","x","0","x","a","a","a","a"]

rom = ["1","a","a","a","a","a","a","a","a","a","a","a","a","a","a","a"]
ram = ["0","0","a","a","a","a","a","a","a","a","a","a","a","a","a","a"]
via1 = ["0","1","1","0","x","x","x","x","x","x","x","x","a","a","a","a"]
via2 = ["0","1","1","1","x","x","x","x","x","x","x","x","a","a","a","a"]
ps  = ["0","0","0","0","0","0","0","1","a","a","a","a","a","a","a","a"]

counter = 0
prevhexw = f"{0:04x}"

prevram = "nix"
prevrom = "nix"
prevps = "nix"
prevvia1 = "nix"
prevvia2 = "nix"

while counter < 65536:
    binw = f"{counter:016b}"
    hexw = f"{counter:04x}"
    binint = bin(int(counter))
    address=0

    ramcheck=0    
    romcheck=0    
    pscheck=0
    via1check=0
    via2check=0

    printram = "   "
    printrom = "   "
    printps = "   "
    printvia1 = "    "
    printvia2 = "    "
    myram=ram.copy()
    myrom=rom.copy()
    myps=ps.copy()
    myvia1=via1.copy()
    myvia2=via2.copy()
    while address < 16:

        if myram[address] == "a":
            myram[address]=binw[address]
        if myram[address] == "x":
            myram[address]=binw[address]
        if myram[address] != binw[address]:
            ramcheck=1

        if myrom[address] == "a":
            myrom[address]=binw[address]
        if myrom[address] == "x":
            myrom[address]=binw[address]
        if myrom[address] != binw[address]:
            romcheck=1

        if myps[address] == "a":
            myps[address]=binw[address]
        if myps[address] == "x":
            myps[address]=binw[address]
        if myps[address] != binw[address]:
            pscheck=1

        if myvia1[address] == "a":
            myvia1[address]=binw[address]
        if myvia1[address] == "x":
            myvia1[address]=binw[address]
        if myvia1[address] != binw[address]:
            via1check=1

        if myvia2[address] == "a":
            myvia2[address]=binw[address]
        if myvia2[address] == "x":
            myvia2[address]=binw[address]
        if myvia2[address] != binw[address]:
            via2check=1


        address=address+1

    if ramcheck==0:
        printram="ram"
    if romcheck==0:
        printrom="rom"
    if pscheck==0:
        printps="ps "
    if via1check==0:
        printvia1="via1"
    if via2check==0:
        printvia2="via2"


    if prevram != printram or prevrom != printrom or prevps != printps or prevvia1 != printvia1 or prevvia2 != printvia2:
        printlinep = f"| {prevhexw} | {prevram} | {prevrom} | {prevps} | {prevvia1} | {prevvia2} |"
        printline = f"| {hexw} | {printram} | {printrom} | {printps} | {printvia1} | {printvia2} |"
        if prevram != "nix":
            print(printlinep)
        print(printline)
    prevram=printram
    prevrom=printrom
    prevps=printps
    prevvia1=printvia1
    prevvia2=printvia2
    prevhexw=hexw
    counter=counter+1;
printline = f"| {hexw} | {printram} | {printrom} | {printps} | {printvia1} | {printvia2} |"
print(printline)

Badge picture plus sound in micropython

python mch2022-tools/webusb_fat_dir.py /flash/apps/python/easy
for f in easy.mp3 easy.png icon.png __init__.py ; do python  mch2022-tools/webusb_fat_push.py $f /flash/apps/python/easy/$f ; done

Micropython code __init__.py

mport display
import mch22
from audio import play
import buttons
from time import sleep
from machine import Pin
from neopixel import NeoPixel

powerPin = Pin(19, Pin.OUT)
dataPin = Pin(5, Pin.OUT)
np = NeoPixel(dataPin, 5)
powerPin.on()


def on_home_btn(pressed):
  if pressed:
    mch22.exit_python()


display.drawPng(0,0,"/apps/python/easy/easy.png")
display.flush()



# Led setup
#   2   3    
#      1
#     0     4

np[0] = (23,5,15)
np[1] = (3,15,22)
np[2] = (25,24,1)
np[3] = (25,24,1)
np[4] = (23,4,15)
np.write()


buttons.attach(buttons.BTN_HOME, on_home_btn)
# playing with volume 0 to wakeup sound device, else it is going to clip
play('/apps/python/easy/easy.mp3', volume=0)
sleep(7)
while True:
    play('/apps/python/easy/easy.mp3', volume=100)
    sleep(30)

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

C64 PRG to cartridge.

I’ve got the tools and Bigred made me enthusiastic again.
My goal is to make a C64 Cartridge from a PRG. And Not any program, it is the 8085 Emulator from Sepp.

Serveral problems i have to ‘fix’

  • The program is 17K, Cartridges can only be 16K.
    So i have to use 2x 8K and compress the data.
    This means it have to be uncompressed at start time.
    ( I was thinking of using exomiser for this )
  • Program starts normally at $0820 and probably is not optimised to run anywhere else.
    So a starting routine has to copy the program from cartridge memory to the correct location

Luckily i have the source! How cool is that

For version 4.73 it states : Starting at $0820 .. but my hexdump is off by one??!?

root@battlestation:/home/fash/Projects/minipro# hexdump -C /tmp/8085.prg  | head
00000000  01 08 1e 08 c5 07 9e 32  30 38 30 20 42 59 20 4d  |.......2080 BY M|
00000010  41 52 54 49 4e 20 4d 45  59 45 52 49 4e 4b 00 00  |ARTIN MEYERINK..|
00000020  00 20 ec 08 20 7f 19 20  2b 2c 20 11 19 20 b8 08  |. .. .. +, .. ..|
00000030  20 20 2c 20 a0 2c 20 f2  2c 20 11 e1 4c 00 15 aa  |  , ., ., ..L...|
00000040  aa a2 06 ad b7 08 9d 48  d8 bd 48 04 20 88 39 9d  |.......H..H. .9.|
00000050  48 04 ca 10 ee a9 60 8d  4c 04 4c 50 47 00 a9 d0  |H.....`.L.LPG...|
00000060  2c a9 f0 8d 45 1f 4c 11  e1 1e 93 0d 20 20 4d 41  |,...E.L.....  MA|
00000070  52 54 49 4e 20 4d 45 59  45 52 49 4e 4b 27 53 0d  |RTIN MEYERINK'S.|
00000080  0d 20 38 30 38 35 20 45  4d 55 4c 41 54 4f 52 20  |. 8085 EMULATOR |
00000090  20 56 34 2e 38 30 0d 0d  20 20 28 43 29 20 31 20  | V4.80..  (C) 1 |

00000020 00 20 ec starts with 00 at $0020 .. and not 20 ?!?!

Tools used until now:

  • Vice – C64 Emulator
    x64 -cartcrt 8085.crt
  • c1541 – Linux disk tool for C64 images.
    Used this to extract the 8085emulator PRG
  • prg2crt.py – a convertor from PRG to a cartrid file which can be used by Vice
    python2 prg2crt.py 8085.prg 8085.crt
  • minipro – eeprom programming tool for Linux
    minipro -p AT28C64 -w /tmp/test.bin
  • cartconv (tool from vice to convert crt <-> bin)
    cartconv -t normal -i test.bin -n ‘my cart’ -o test.crt
  • xa – Cross assembler 65xx/R65C02/65816
  • ACME – the ACME Crossassembler for Multiple Environments
Memory Map C64 – source c64-wiki.com

Card Low starts at $8000, so that’s the place where those roms are going to be.
To place on this address:

Copy routine : from ($8000 + this copy routine) to $0820
When to decompress??
jmp routine to $0820

A cartridge file >16K and with his emulation headers seems to work??!

Also nice: Magic Desk Cartridge Generator V3.0

UPDATE: 20220811

exomizer sfx 0x0820 8085.prg -o data.exo # Compress and start at 0x0820 
xa frame.asm -o frame.bin # Add code and write binary
x64 --cart16 frame.bin # Test cartridge with Vice

frame.asm

;---------------------------------------------------------- 
; example usage
; xa frame.asm -o frame.bin
; cartconv -t normal -i frame.bin -n 'my cart' -o frame.crt
; x64 -cartcrt frame.crt
;----------------------------------------------------------

;no load-adress for bin-file, so no header here

*=$8000
.word launcher ;cold start
.word launcher ;warm start
.byte $c3	;c
.byte $c2	;b
.byte $cd	;m
.byte $38	;8
.byte $30	;0

launcher
  stx $d016
  jsr $fda3	;prepare irq
  jsr $fd50	;init memory
  jsr $fd15	;init i/o
  jsr $ff5b	;init video
                ;make sure this sets up everything you need,
                ;the calls above are probably sufficient
  ldx #$fb
  txs

;set up starting code outside of cartridge-area
move_starter
  ldx #(starter_end-starter_start)
loop1
  lda starter_start,x
  sta $100,x
  dex
  bpl loop1
  jmp $100
;---------------------------------
starter_start	
  ldx #$40 ;64 pages = 256 * 64 = 16384 Bytes
  ldy #0
loop
src
  lda exomized_data,y
dst
  sta $801,y
  iny
  bne loop
  inc src+2-starter_start+$100 
  inc dst+2-starter_start+$100
  dex
  bpl loop

;make sure settings for $01 and IRQ etc are correct for your code
;remember THIS table from AAY64:

;       Bit+-------------+-----------+------------+
;       210| $8000-$BFFF |$D000-$DFFF|$E000-$FFFF |
;  +---+---+-------------+-----------+------------+
;  | 7 |111| Cart.+Basic |    I/O    | Kernal ROM |
;  +---+---+-------------+-----------+------------+
;  | 6 |110|     RAM     |    I/O    | Kernal ROM |
;  +---+---+-------------+-----------+------------+
;  | 5 |101|     RAM     |    I/O    |    RAM     |
;  +---+---+-------------+-----------+------------+
;  | 4 |100|     RAM     |    RAM    |    RAM     |
;  +---+---+-------------+-----------+------------+
;  | 3 |011| Cart.+Basic | Char. ROM | Kernal ROM |
;  +---+---+-------------+-----------+------------+
;  | 2 |010|     RAM     | Char. ROM | Kernal ROM |
;  +---+---+-------------+-----------+------------+
;  | 1 |001|     RAM     | Char. ROM |    RAM     |
;  +---+---+-------------+-----------+------------+
;  | 0 |000|     RAM     |    RAM    |    RAM     |
;  +---+---+-------------+-----------+------------+

  lda #$35 ;cart is always on instead of BASIC unless it can be switched off via software
  sta $01
  jmp $80d ;for exomizer, i.e.

starter_end
;----------------------------------
exomized_data
.bin 2,0,"data.exo"
;syntax for exomizer 2.0.1:
;exomizer sfx sys game.prg -o data.exo
main_file_end
;fill up full $4000 bytes for bin file ($c000-$8000=$4000)
.dsb ($c000-main_file_end),0

Exomiser info

 Reading "8085.prg", loading from $0801 to $4CE9.
 Crunching from $0801 to $4CE9.
Phase 1: Instrumenting file
-----------------------------
 Length of indata: 17640 bytes.
 [building.directed.acyclic.graph.building.directed.acyclic.graph.]
 Instrumenting file, done.

Phase 2: Calculating encoding
-----------------------------
 pass 1: optimizing ..
 [finding.shortest.path.finding.shortest.path.finding.shortest.pat]
  size 80273.0 bits ~10035 bytes
 pass 2: optimizing ..
 [finding.shortest.path.finding.shortest.path.finding.shortest.pat]
  size 80039.0 bits ~10005 bytes
 pass 3: optimizing ..
 Calculating encoding, done.

Phase 3: Generating output file
------------------------------
 Encoding: 1101112133423160,1122,2010223445667788,032144406789BBCD
 Length of crunched data: 10034 bytes.
 Crunched data reduced 7606 bytes (43.12%)
 Target is self-decrunching C64 executable,
 jmp address $0820.
 Writing "data.exo" as prg, saving from $0801 to $304C.
Memory layout:   |Start |End   |
 Crunched data   | $07E7| $2F18|
 Decrunched data | $0801| $4CE9|
 Decrunch table  | $0334| $03D0|
 Decruncher      | $00FD| $01C0| and $9F,$A7,$AE,$AF
 Decrunch effect writes to $DBE7.
Decruncher:  |Enter |During|Exit  |
 RAM config  |   $37|   $37|   $37|
 IRQ enabled |     1|     1|     1|

UPDATE:20230126

; CODE COPY FROM http://www.lemon64.com/forum/viewtopic.php?t=60786&sid=2559442c8b963d7aac27cb13b493f372
; Thanks for posting: Richard of TND
; this is for a 16KB cart, using ACME!! 

      !to "mycart.crt",cart16crt 

scr = $0400 

DecrunchADDR = 2061 ;SYS 2061   (HEX $080D) 

      *=$8000 
      !word launcher 
      !word launcher 
      !byte $c3,$c2,$cd,$38,$30 ;CBM 80 
      
      

launcher 
   sei 
   stx $d016 
   jsr $fda3 ;prepare irq 
   jsr $fd50 ;input memory 
   jsr $fd15 ;initialise i/o 
   jsr $ff5b ;initialise video memory 
 
;For a more professional boot up. Make 
;the border and screen black. AFTER 
;the video memory, etc has finished. 

   lda #$00 
   sta $d020 
   sta $d021 
   cli 

;Switch off the screen. 

   lda $d011 
   and #%11101111 
   sta $d011 

;Move transfer code over to the screen 
;memory. 

   ldx #$00 
tloop   lda transfer,x 
   sta scr,x 
   inx 
   bne tloop 
   jmp scr 

transfer 
   ldx #$00 
tr1      lda linkedgame,x         ;Move from linked address 
  sta $0801,x                        ;Direct to BASIC start address 
   inx 
   bne tr1 
   inc scr+4 
   inc scr+7 
   lda scr+4 
   bne transfer 
   jsr $e453 ;load basic vectors 
   jsr $e3bf ;init basic ram 

   ldx #$fb 
   txs 

   ;Execute the game, by jumping to the 
   ;de-cruncher's start address. 
   ;jmp $0820 
   jmp DecrunchADDR


;Link crunched game as a PRG file to memory after 
;the cartridge build code. 

linkedgame 
   !bin "8085sys.prg",,2 

FileSize = * 
!if FileSize >$c000 { 
!error "FILE SIZE IS TOO BIG TO FIT 16KB CARTRIDGE" 
} else { 

   *=$c000 
} 

Exomizer:

exomizer sfx sys  8085.prg -o 8085sys.prg
 Reading "8085.prg", loading from $0801 to $4CE9.
 Crunching from $0801 to $4CE9.
Phase 1: Instrumenting file
-----------------------------
 Length of indata: 17640 bytes.
 [building.directed.acyclic.graph.building.directed.acyclic.graph.]
 Instrumenting file, done.

Phase 2: Calculating encoding
-----------------------------
 pass 1: optimizing ..
 [finding.shortest.path.finding.shortest.path.finding.shortest.pat]
  size 80273.0 bits ~10035 bytes
 pass 2: optimizing ..
 [finding.shortest.path.finding.shortest.path.finding.shortest.pat]
  size 80039.0 bits ~10005 bytes
 pass 3: optimizing ..
 Calculating encoding, done.

Phase 3: Generating output file
------------------------------
 Encoding: 1101112133423160,1122,2010223445667788,032144406789BBCD
 Length of crunched data: 10034 bytes.
 Crunched data reduced 7606 bytes (43.12%)
 Target is self-decrunching C64 executable,
 jmp address $0820.
 Writing "8085sys.prg" as prg, saving from $0801 to $304C.
Memory layout:   |Start |End   |
 Crunched data   | $07E7| $2F18|
 Decrunched data | $0801| $4CE9|
 Decrunch table  | $0334| $03D0|
 Decruncher      | $00FD| $01C0| and $9F,$A7,$AE,$AF
 Decrunch effect writes to $DBE7.
Decruncher:  |Enter |During|Exit  |
 RAM config  |   $37|   $37|   $37|
 IRQ enabled |     1|     1|     1|
exomizer sfx $\0801 8085.prg -o 8085out.prg
 Reading "8085.prg", loading from $0801 to $4CE9.
 Crunching from $0801 to $4CE9.
Phase 1: Instrumenting file
-----------------------------
 Length of indata: 17640 bytes.
 [building.directed.acyclic.graph.building.directed.acyclic.graph.]
 Instrumenting file, done.

Phase 2: Calculating encoding
-----------------------------
 pass 1: optimizing ..
 [finding.shortest.path.finding.shortest.path.finding.shortest.pat]
  size 80273.0 bits ~10035 bytes
 pass 2: optimizing ..
 [finding.shortest.path.finding.shortest.path.finding.shortest.pat]
  size 80039.0 bits ~10005 bytes
 pass 3: optimizing ..
 Calculating encoding, done.

Phase 3: Generating output file
------------------------------
 Encoding: 1101112133423160,1122,2010223445667788,032144406789BBCD
 Length of crunched data: 10034 bytes.
 Crunched data reduced 7606 bytes (43.12%)
 Target is self-decrunching C64 executable,
 jmp address $0801.
 Writing "8085out.prg" as prg, saving from $0801 to $304C.
Memory layout:   |Start |End   |
 Crunched data   | $07E7| $2F18|
 Decrunched data | $0801| $4CE9|
 Decrunch table  | $0334| $03D0|
 Decruncher      | $00FD| $01C0| and $9F,$A7,$AE,$AF
 Decrunch effect writes to $DBE7.
Decruncher:  |Enter |During|Exit  |
 RAM config  |   $37|   $37|   $37|
 IRQ enabled |     1|     1|     1|

This looks okay: (monitor in vice)

Attaching crt in vice

Maybe one of these problems:

1) you CAN NOT use BASIC routines when a cart is inserted (without weird tricks, i.e.
storing BASIC routines on cart etc)

2) you need to be careful about $01 as you may map in ROM at $8000 without expecting it.

Please refer to this if in doubt:
http://unusedino.de/ec64/technical/aay/c64/memcfg.html

[3] You should also be careful about the usage of KERNAL routines as some of them
sweep across BASIC-code as well!

Finding files on my fileserver

I use several tools to find files on my server.

Loads of stuff on my main fileserver.
(Graph is a great tool called DUC) https://duc.zevv.nl/

Besides a search engine, i have a file finder.
Due to the massive amount of data, i like to find things by other means than knowing the directory structure.

I can find files by filename, but also by contents.

I’ll talk about find by contents first.

I’ve got loads of documents in Pdf, HTML, txt, doc, sheets , wordperfect etcetera.
Those documents i can find using a tool named Namazu.
This is quite a old tool, but i’m using it for a long time and it still works great.
I didn’t find a better replacement yet.
(But i’ve been looking into : elasticsearch, Solr, Lucene)

http://www.namazu.org/ is easy to install, but if you want the tool to scrape different kinds of documents you have to add some additional software.

My multipurpose printer can scan pages in pdf.
Those are only embedded jpg’s in a pdf container.
I will talk about how i handle these later.

My current start page :
This index contains 267,763 documents and 14,036,762 keywords.
Search example of namazu

Some things to consider when implementing namazu:

  • tweak the file types to scrape, it makes no sense to scrape binaries
  • tweak the directories to scrape (example below)
    • 0 1 * * 1 fash /usr/bin/mknmz -f /etc/namazu/mknmzrc –output-dir=/namazu/ /mnt/private/paperwork/ /mnt/private/information/ /mnt/private/Art\ en\ hobby\ Projects/ /mnt/private/Music\ Projects/ /mnt/private/bagpipe-music-writer/ –exclude=XXX –exclude=/mnt/binaries > /tmp/namazu.log 2>&1
  • you can set a parameter in the config for search only, this disables downloading the found link in the results!

Before Namazu i used HtDig.

Screenshot htdig

HtDIg also can scrape remote websites, Namazu can’t.

Preparing PDF for indexing:

I’ve written some scripts to make PDFs containing scanned text scrape-able.
( https://gitlab.com/fash/inotify-scanner-parser )
What it does:

  • My scanner puts a scanned pdf on my fileserver in a certain directory
  • Inotify detects a written file
  • it will copy the file, run OCR on it (tesseract) and writes a txt file (scapeable)
  • After that the text will be embedded (overlay) on the PDF, so now it becomes searchable/scrapeable
  • When certain keywords are found, it will sort documents in subdirs
Example from a scanned jpg, i can find OCR words!
(note .. the overlay is exact on the found words)

Finding files by name:

For finding files a made a little webpage like this:

It is a simple webpage grabbing through a list of files.
It takes the first keyword and does a grep, it takes a second keyword to match also.
I can select different file databases to search. (This case is private)
Between search and private i can give the number of entries to print.
So i can do
Search “ansible” NOT “tower” 50 entries from the public fileset

Crontab:

20 5 * * * /usr/bin/find /mnt/shark*  > /var/www/html/findfiles/sharkoon
10 4 * * * /usr/bin/find /tank/populair > /var/www/html/findfiles/populair
20 4 * * * /usr/bin/find /tank/celtic > /var/www/html/findfiles/celtic
etc

And a php script (dirty fast hack, never came around it to make it a final version)

<html><head><title></title></body>
<font face="Tahoma"><small>|keyword|(keyword)|search|(nr results)|NOT SECOND KEYWORD|share|</small><BR>
Search: <form method="post" action="/findfiles/?"><input type="Text" name="words" size=10 value=""><input type="Text" name="words2" size=10 value=""><input type="Submit" name="submit" value="search"><input type="Text" name="nrlines" size=3 value=""><input type="checkbox" name="not" unchecked>
<SELECT NAME=findfile>
<OPTION VALUE=private>private
<OPTION VALUE=celtic>celtic
<OPTION VALUE=populair>populair
<OPTION VALUE=dump>public
<OPTION VALUE=sharkoon>sharkoon
</SELECT>
</form>
<P><PRE>
<?php
$words2=$_POST['words2'];
$words=$_POST['words'];
$filefile=$_POST['filefile'];
$findfile=$_POST['findfile'];
$nrlines=$_POST['nrlines'];
$not=$_POST['not'];


if ($words2=="xsearch") { $findfile="other"; $words2=""; }
if ($nrlines) {  } else { $nrlines=100; }
if ($words && $words2=="") {
$words = preg_replace("(\r\n|\n|\r)", "", $words);
$words = preg_replace("/[^0-9a-z]/i",'', $words);
$command = "/bin/cat $findfile |/bin/grep -i $words |head -$nrlines";
$blah=shell_exec($command);
$blah=str_replace($words, "<b><font color=red>$words</font></b>",$blah);
print $blah;
}
if (($words) and ($words2)) {
$words = preg_replace("(\r\n|\n|\r)", "", $words);
$words = preg_replace("/[^0-9a-z.]/i",'', $words);
$words2 = preg_replace("(\r\n|\n|\r)", "", $words2);
$words2 = preg_replace("/[^0-9a-z.]/i",'', $words2);
if ($not=="on") {
$command = "/bin/cat $findfile |/bin/grep -i $words | /bin/grep -iv $words2 |head -$nrlines";
} else {
$command = "/bin/cat $findfile |/bin/grep -i $words | /bin/grep -i $words2 |head -$nrlines";
}
$blah=shell_exec($command);
$blah=str_replace($words, "<b><font color=red>$words</font></b>",$blah);
$blah=str_replace($words2, "<b><font color=red>$words2</font></b>",$blah);
print $blah;
}
?>
</PRE>
</body></html>

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

Race track Controller

I got a vintage racetrack from a colleage a while back.

In the past i had some ideas controlling train or race tracks.
For train tracks i wanted to write intelligent maneuver software.
For a racetrack a web controllable race. Maybe with a webcam mounted on the car??

L298N – DC motor controller

So i bought a little DC motor controller (2 channels) and took a esp32.

ESP: 
GPIO04 Player1 IN1 
GPIO05 Player1 IN2
GPIO19 Player2 IN1 
GPIO18 Player2 IN2
GPIO13 PWM Player1
GPIO14 PWM Player2

The webinterface is behind a reverse proxy (apache)

TO BE POSTED .. arduino code

<VirtualHost *:443>
   SSLEngine on
   SSLProxyEngine On

   SSLProtocol all -SSLv2 -SSLv3 +TLSv1
   SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:!RC4+RSA:+HIGH:+MEDIUM

   SSLCertificateFile /etc/ssl/.......cer
   SSLCertificateKeyFile /etc/ssl/private/........key
   SSLCertificateChainFile /etc/ssl/private/GlobalSignRootCA.cer
   SSLCertificateChainFile /etc/ssl/private/AlphaSSLCA-SHA256-G2.cer

   CustomLog /var/log/httpd/media_ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"


    ServerAdmin webmaster@henriaanstoot.nl
    ServerName race.henriaanstoot.nl

ProxyRequests Off
ProxyPreserveHost On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off

<Location />
ProxyPass  http://10.1.0.25/
ProxyPassReverse  http://10.1.0.25/
</Location>

    ErrorLog /var/log/httpd/race.henriaanstoot.nl-error.log
    CustomLog /var/log/httpd/race.henriaanstoot.nl-access.log combined
</VirtualHost>