LCD Maze generating using the SPI Protocol on the Z80
ฝัง
- เผยแพร่เมื่อ 13 ก.ค. 2024
- ** For $5 off your first order at PCBWay, click here: www.pcbway.com/setinvite.aspx... **
www.pcbway.com PCBWay Printed Circuit Boards the Easy Way.
Learn how to communicate with an LCD Screen using the Serial Peripheral Interface or SPI. In fact, communicate with any peripheral that uses the SPI Protocol. All specifically for the Z80 Microprocessor.
Also, just for fun, I've created a Maze Generating program that uses the Recursive Backtrack method.
The code is written in Z80 assembly and using a 128x64 Graphical LCD.
For the code, datasheets and resources look at the GitHub repo:
github.com/bchiha/Z80_LCD_128...
This code is so awesome it has its own repository!
00:00 Intro with Elite and 3D fundamentals
00:46 LCD Screen SPI protocol for serial communication
02:21 LCD Pin connections for serial interface
04:03 PCB and TEC-1F Connection
06:22 SPI code walkthrough for the Z80
11:11 Demonstration of SPI code on the LCD Screen
12:03 Idea for the Maze Generation program
13:20 Recursive Backtrack algorithm theory
15:10 Refactoring the code for the Z80
18:13 Code highlights for the maze program
21:08 Maze generation on the LCD!
23:43 Fast maze generation
24:30 Even faster maze generation with animation
And here are some additional links:
Excellent article on the Recursive Backtrack Algorithm: weblog.jamisbuck.org/2010/12/...
Other maze-generating algorithms with examples: professor-l.github.io/mazes/
nice job!!!! So happy to be one part!
I love such niche channels. 2023 and people still squeezing last FLOP out of 8bit cpus in such way thaty i actually want to retry this at home :D
I know you said VMS Alpha in the narration but when you showed a picture of a VAX 11/780 and showed a copyright date of 2004, that threw me for a loop!
Wow, very cool!
Very nice video, great explanation! I can already see myself watching it over and over how the mazes are generated! 🙂
Love these videos. Every time I see that display I think about building a handheld TEC-1 with just the lcd display and keyboard
Well the TEC-1G includes a 4x20 LCD and will have the ability to add-on the GLCD which will act as a terminal. There's a picture of the 1G at the end of this video
Yeah I'm a member of the facebook group and will get a G board when they become available. I built my first tec in about 1989 and used it for years to program eproms for microcontroller programming. I'm just thinking of a handheld TEC without the LEDs just the graphic LCD and keypad, the chips on the back of the LCD and keypad area and serial interface port. It's completely unnecessary, that's why it appeals to me :)
Z80s and mazes what's not to like (my first micromouse used a Z80) back in 1984
It could be "desk toy" instead of bouncing balls :D
You only need to push cells that have more than one empty neighbour. IOW: if there’s only one direction you can go then don’t push the backtrack cell.
Yes, this is correct. Only one free adjacent cell, no need to backtrack back to it after pushing through. But there is a loss of sequential current cell animation. Trade off!
@@ReadyZ80 True… if you ever need speed thou… ;-)
I'm halfway done on my TEC-1F build, just in time to learn that the TEC-1G is coming soon and it's quite a radical upgrade. You planning on building one? (Edit: I suppose it's an obvious answer when your name is on the back of the PCB!)
I have a Beta 1G board and will most likely do a vid on it. Stay tuned.
8:19 I don't know what clock you running your cpu but those clock pluse is not to fast/short ?
Good question. I was going to talk about this but cut it out.
I'm using a 4Mhz clock, one clock cycle is 1/4000000 or 250ns. The OUT instruction takes 11 clock cycles (2750ns). The minimum SPI clock cycle as per the spec is 400ns.
What would be the fastest clock that can do two OUT instructions and an XOR A in 400ns? The three instructions take 26 CPU clock cycles. Therefore
CPU Clock = 26 / (4x10^-7) = 65Mhz
@@ReadyZ80 Oh I didn't know that SPI is so fast...
Cycles i know and can calculate but I didn't know SPI specs, my bad 😅