Z80 Assembly Language

  Рет қаралды 14,273

John's Basement

John's Basement

2 жыл бұрын

You can support this channel on Patreon! / johnsbasement
This is part of a KZbin playlist/series: • Z80 Retro
This is a discussion of, arguably, the most useful reference documentation of Z80 Assembly Language.
Here is a video I did that discusses how machine stacks work. Note that the Z80 stack is a FULL DESCENDING stack (specifically mentioned 6 minutes in):
• Introduction to Stacks...
Links to documentation seen in this video:
Original ye-olde Z80 Assembly Language Programming Manuals:
zxevo.ru/inc/Zilog_Z80_assembl...
Modern OCR'd version of the same thing with creative errors in it:
www.zilog.com/docs/z80/um0080.pdf
Original ye-olde datasheet with green-card-ish table of instructions:
www.bitsavers.org/components/z...
www.zilog.com/docs/z80/ps0178...
Modern re-created version of the same thing including the undocumented instructions:
www.z80.info/zip/z80sean.zip
Arguably, the best books on Z80 Assembly language are by Lance Leventhal:
archive.org/details/Z-80_Asse...
archive.org/details/bitsavers...
Music used in this video (Vibe Tracks, Alternate) was downloaded from the KZbin Audio Library: kzbin.info_...
#Z80
#CPM
#homebrew
#retrocomputer

Пікірлер: 111
@rhowe212
@rhowe212 4 ай бұрын
This is such a perfect overview of the Z80, warts and all. I actually have a physical copy of the old manual which Zilog kindly posted to me when as a 10 year old I phoned them asking strange questions 😂
@JohnsBasement
@JohnsBasement 4 ай бұрын
Thanks! Yeah. Back in the day I had a similar experience with Western digital when I called asking for 1771 and 1791 datasheets. Not only did they send me a databook for everything they made, they included samples of a couple FDCs and a data separator! -- I was quite the loyal fan ever since. I still use their WD gold spindles in my servers today.
@retroflics
@retroflics 2 ай бұрын
Back in 1986, I was 14 and dad bought me an Amstrad CPC 464. I started off with Basic and then Z80 Assembler. The thing is, I never had a manual, a datasheet, a book... Nothing. I had some monthly magazines with Z80 code samples and their hexadecimal machine codes. I had to use Basic to put the machine code into the RAM. I still remember that "3E 64 CD 5A BB C9" prints a lowercase d letter and returns. I liked to draw polygons, circles in loops as "demos" were popular back then. I didn't know the algorithm to calculate sine, cosine etc., so, using Basic, I stored these values multiplied by 100 for each angle in a memory block, so that I could use them in Assembler. Z80 taught me the notion of variables, comparisons, functions, binary, hexadecimal, pushing, popping, logical operators etc in a sturdy way. This is why I could learn more than 15+ languages so far easily.
@JohnsBasement
@JohnsBasement 2 ай бұрын
And the ACM/academia has been trying to rid the field of Computer Science courses of Assembly, Organization & Architecture, and Operating systems to make room for what is arguably little more than using Application programs by configuring them with bits of Python. Unless you understand the machine, PLEASE, don't write software for medical, military, safety,.... Pretty much anything outside of games/amusements.... And even then.... 🤮
@andymouse
@andymouse 2 жыл бұрын
I remember writing an Assembly Language program back in college days that drove seven segment displays and it was a stopwatch with a single button to start, stop and clear and this tutorial brought back great memories so maybe I will follow along and see if I could write it now !....cheers.
@JohnsBasement
@JohnsBasement 2 жыл бұрын
A bit-banged SD card driver is the only piece still missing before we can implement a BIOS & boot up CP/M. (It is complex enough that I wanted to make sure everyone has the assembly docs needed to follow along.)
@fphenix
@fphenix Жыл бұрын
56:40 Although unused, bit 5 and 3 in the Flag register are not 0. If I recall correctly they are a copy of bit 5 and 3 from the Accumulator. Also R is sometimes used as a very basic "random-ish" number.
@saturn5tony
@saturn5tony Жыл бұрын
I just subbd to you John. I've watched so far a dozen or so of your vids. I am not a beginner. I worked for NSF doing tech work for the 8008 in 1975. Coming back into retro stuff, now that Im retired. Really need to do more with the Z80 for fun. I will say you are great for what what I've seen so far. Thank you so much for this series. Awesome, just awesome. -Tony
@JohnsBasement
@JohnsBasement 8 ай бұрын
Thanks for this supportive comment! I hope you're having fun!
@AndrewKlimin
@AndrewKlimin Жыл бұрын
Wow, great explanation and thanks for highlighting the difference between old and modern manual!
@JohnsBasement
@JohnsBasement Жыл бұрын
Thanks for saying so. It is frustrating to see what was a great resource suffer like this. Several acquaintances over the years have noted the value of that original reference when learning assembly language. Anyone starting with the modern version will not have the same advantage that we did. 😕
@javiermitchell7073
@javiermitchell7073 Жыл бұрын
I'm astonished, I have been looking for these sort of stuff for years and only now I have found your chanel!. THANKS, THANKS, THANKS
@JohnsBasement
@JohnsBasement Жыл бұрын
I'm glad to know it is useful! Thank you for saying so!
@daniels.4270
@daniels.4270 3 ай бұрын
This video is educational pure gold
@JohnsBasement
@JohnsBasement 3 ай бұрын
Thanks for such a kind review!
@DavidTLutz
@DavidTLutz Жыл бұрын
Another great video! Thanks again. Mention of Leventhal's book below the video took me back to my epiphany in a bookstore in the mid-80's where I caught my first glimpse of what was really going on here with digital logic changing state millions of times a second and creating amazing effects. My first experience with a computer was an Osborne Executive running CP/M on a Z80. I think it later become known as a "luggable" versus a "portable".
@JohnsBasement
@JohnsBasement Жыл бұрын
Those were cool! Everything was so expensive back then.. and I was a poor student earning a part time minimum wage. 😩
@DavidTLutz
@DavidTLutz Жыл бұрын
@@JohnsBasement I was in Alabama where my father had a test and balance company with a friend of his. They had three of these. He wrote a couple of programs in Basic for making reports on the presentation of their findings in certain aspects of of their testing. I got to play with the third one, learned Basic and wrote the two remaining programs that he needed - do not remember what they were. I only lasted a year in Alabama and went back to California, where I have been for the last 35 years and now am fulfilling my curiosity for all this stuff in my retirement days. Life is a trip!
@JohnsBasement
@JohnsBasement Жыл бұрын
@@DavidTLutz Thanks for sharing your enthusiasm. I think I'm having again as much fun re-living this stuff than I did the first time!
@jrkorman
@jrkorman Жыл бұрын
My very first Z-80 tools for my Radio Shack Model I was T-BUG and a copy of Rodnay Zaks "Programming the Z80". No assembler for a while, everything was hand assembled code. First real program was disassembling T-BUG to find the command "processor" and modifying it to add a "D"ump command that would display a 256 byte "page" of memory in a 16x16 format with ASCII; which was something that T-BUG lacked! Still have that book too, shortly joined by William Barton's "TRS-80 Assembly Language Programming". Nothing like hand assembling/disassembling to quickly teach you the actual machine code.
@JohnsBasement
@JohnsBasement Жыл бұрын
Good times!!
@jackrubin
@jackrubin 2 жыл бұрын
Love your rants! Takes me back to sitting in front of my SOROC trying to reconfigure CP/M. The only opcode that is still burned into my brain is "C3" because of the many jumps I took into the unknown. And it was JMP because I was still running an 8080 CPU.
@JohnsBasement
@JohnsBasement 2 жыл бұрын
😂... Thanks.
@lordsmeagol3390
@lordsmeagol3390 Жыл бұрын
I have a lot more than C3 in my brain ... due to starting Z80 coding on an unexpanded Nascom 1 (no room for an assembler, so all in hex). It took almost no time for the very frequent instructions (AF, 3E, 21, C3, CD ...) to stick in my brain. Then, seeing the simple pattern in the register-to-register LD group, it was easy to just memorize the pattern and add 63 more codes to my brain (the 64th being 76 HALT). I applied this thinking to the rest of the instruction set, which prompted me into experimenting with the 'holes' and finding the undocumented instructions. My brain became a complete Z80 assembler/disassembler; Even now I can still code directly in hex on a virtual Nascom 1, 2, Tatung Einstein in MAME :)
@SusanAmberBruce
@SusanAmberBruce 4 ай бұрын
I am watching this video again as it a resource, Thanks John! I would like to give a like each time I visit! KZbin didn't think of that one, Huh!
@JohnsBasement
@JohnsBasement 4 ай бұрын
Thank you!! Glad to help!
@keyster747
@keyster747 2 жыл бұрын
if my memory does not fail me i think i used the R register to salt a random number generator back in the early 80's. not saying it was perfect but i was only 13 or 14 at the time so to me it was magic!
@JohnsBasement
@JohnsBasement 2 жыл бұрын
Not bad at all! If done in response to user input it'd be better than nothing.
@nexpro6985
@nexpro6985 3 ай бұрын
This was very enlightning thank you. I am in the process of resurrecting the manual for 'Machine Lightning' a games dev package for ZX Spectrum 48k. The original manual was printed in fine small text on a deep green paper. Ensuring that the final document is both faithful and correct has proved to be a bigger task than I envisaged. The assembler is reporting that ORG is undefined, hey ho back to the grind.
@JohnsBasement
@JohnsBasement 3 ай бұрын
You're very welcome. These early systems were great! So simple anyone could understand the entire thing!
@Z80System
@Z80System 11 ай бұрын
Great explanation, thanks very much, you make my day !
@YoutubeBorkedMyOldHandle_why
@YoutubeBorkedMyOldHandle_why 2 жыл бұрын
Thank you very much for all your dedication and hard work John! MAN ... I really wish I had profs who could teach as well as you, back in my university days. Decades old memories have come flooding back and I'm learning lots of new things. Thanks. FYI: I commented many videos ago about re-doing your board with SMD parts (of course Z80 parts are DIPs.) I have a design now. It took a bit longer than I imagined (it 'always' does!) So, I decided to combine the Z80 board and the programmer onto a single PCB, because ... why not? The SMD parts free up some space, so I made everything fit. Also, I didn't see much point in using a big ugly cable for connect to the Raspberry Pi, so my plan is to just stick a female socket on the bottom of the board and connect it directly to a Pi. A few minor part changes, and a bit of re-arranging, but otherwise pretty much identical to your design(s.) I still need to check the footprints against a hard copy before declaring it done, though a few parts have yet to arrive. Ummm ... If you want to look it over when I'm done, I could e-mail you a link to my files first, rather than just sticking the link here. I mean ... I wouldn't want to give you all the credit before you've had a chance to review it ... just in case I've screwed it up horribly ;-) Up to you. Best wishes.
@JohnsBasement
@JohnsBasement 2 жыл бұрын
Sounds cool! Sure send it to my first name at winans.org. someone else sent one recently as well. I'm glad to know I'm not the only one having fun with this stuff!
@YoutubeBorkedMyOldHandle_why
@YoutubeBorkedMyOldHandle_why 2 жыл бұрын
@@JohnsBasement Actually, I was getting a bit concerned. You've put a huge effort into this project, yet your channel has a rather modest following. Not too surprising perhaps, since it is not the entertaining fluff that most people go for. Still, I'm convinced that those who are here ... are REALLY dedicated. Trouble is, you haven't left a lot to comment on ... since you've answered pretty much every possible question, in excruciating, yet easily comprehensible detail. I'll need a few more days to clean things up, then I'll send you a link. Thanks again.
@JohnsBasement
@JohnsBasement 2 жыл бұрын
@@KZbinBorkedMyOldHandle_why Then I have some really good news for you! From the small: My SD card driver and the management of the CP/M filesystem is working. But I think there is plenty of room for improvements. I am starting to record that stuff this weekend. To the medium: I have yet to implement the bank-selected memory filesystem cache that I hope to add. I'm sure that will get interesting. I have a prototype video display made with an ICE40HX4K that shows some promise as an add-on board for the Retro! or maybe part of a rethink and basis of a whole new system design. And for the big: Sean Hymel has just started the series that I have been mulling over doing for a while (I shouldn't have waited so long) about running RISC-V on a cheap FPGA... I think it might be fun to scratch-write an O/S in C and run it on such a thing. This whole trip down CP/M memory lane started last fall as a result of my looking at it for inspiration in my first-draft of that O/S for my own FPGA-RISC-V projects. THIS is what *I* wanna be talking about! Anybody interested?
@YoutubeBorkedMyOldHandle_why
@YoutubeBorkedMyOldHandle_why 2 жыл бұрын
@@JohnsBasement Seriously John ... you read minds too? I've been hugely interested in conquering fpga/verilog for some time, but kept getting distracted with other projects. Then I came across Sean's videos series and I've been totally hooked. I'm currently up to lesson 8 'memory.' This is a bit of a challenge, but I refuse to look at his solution until I have mine working. I'm pretty close. Sean is another really excellent teacher. He covers everything methodically, in easily understandable steps. And, he has obviously put a huge amount of effort into his really well organized support material. I'm thrilled that you mentioned him. Also, as a real bonus, Sean is basing his video series around the Lattice IceStick ... which by an amazing coincidence, I just happened to have purchased back when they were still readily available ;-) There are lots of online fpga/verilog videos, but Sean's series is the best I've seen. I was going to mention Sean's series, before you beat me to it. Notably: Sean talked about something called "IceStudio" where there is a project happening called "Z80 CPU for OpenFPGAs, with IceStudio." I've only just looked at it briefly, but it may be quite interesting: icestudio.io/ github.com/Obijuan/Z80-FPGA Another thought which occurred to me some time ago, and ties all of this together, involves yet another amazing youtube presenter: Ben Eater. Among other things, Ben made an absolutely brilliant series, by designing and building a rudimentary working computer from scratch on breadboards. Clearly this was intended as a 'teaching opportunity', as it's not exactly very practical, but it got me thinking. What about a project to pretty much duplicate Ben's series, but built one module at a time on an fpga, rather than breadboards? A merging of old and new technologies, so-to-speak. Not only would this be a super teaching opportunity, but it might also end up being genuinely useful. So, to answer your question, Yes ... I'm definitely interested.
@JohnsBasement
@JohnsBasement 2 жыл бұрын
Ben's got some great stuff too! I want to do a RISC-V RV32E from the ground up in verilog. I was not sure it'd fit on an Ice40 or not. I haven't looked at the code Sean is using. He has it running on the icestick so it will DEFINITELY fit on the custom HX4K board that I wanna build (the stick is a 1K.) Sean is also using a newer version of the PNR tool that I was last messing with. For me, it looks like a super-fun year with an upgrade to KiCad6, upgrades to my open-source FPGA tools, a RISC-V on an FPGA, and some fun with whatever peripherals I discover I want to connect to it!
@derekchristenson5711
@derekchristenson5711 Жыл бұрын
Thanks for the overview! I've built the Z80-Retro! and just got CP/M and its filesystem up and working yesterday. Now, I'll have to do something with Z80 assembly! I've done a little MIPS assembly in university, but that was a couple years ago. I'll probably be happy if I can get it to print "Hello World" and count to 100 in Z80 assembly. 😛 If I can do that right, and I think of something interesting to program, maybe I'll have the confidence to write something fancy, hehe.
@JohnsBasement
@JohnsBasement Жыл бұрын
Thanks! It's nice to know when someone gets some value out of one of my videos! Start simple!! As seen in the Z80 Retro! series, I started with blinky and then went right onto getting the SIO squawking so I can print messages and therefore debug without an ICE, simulator, etc. I find it hugely rewarding to be able to get something up and running with a minimum of help! Have fun! Let us know how it goes! -- I check the discord from time to time. Plenty of others out there that are looking at making Retro! boards and hacking them to suit their interests.
@YoutubeBorkedMyOldHandle_why
@YoutubeBorkedMyOldHandle_why Жыл бұрын
If I might recommend, do a search for "Learn Z80 Assembly - With ChibiAkumas!" This guy is mostly into game programming and has an amazing set of instructional videos on all kinds of retro platforms. He's gone to a huge effort to set up programming environments for people just starting with assembler. John goes into a way more technical detail, but this guy will get you back in the game ;-)
@davidbonner4556
@davidbonner4556 2 жыл бұрын
Back in the days before you got started (TRS-80) the first 2 8080 systems didn't have text I/O unless you had a teletype... Those machines relied on Binary toggle switches and LED light displays. That's why the early manuals ALL included the bit patterns for op codes. The Altair 8800 actually used a silkscreen representation for "Split Octal", where a high 8 bit value was represented as 377Q. The other, the Imsai 8080 used a Hex silkscreen. The main thing about those days was there were no standards so every eventuality had to be documented. As far as the R register is concerned, I wrote a card shuffling program on my Cromemco C-10 using the R register as a kind of auto-running Random number seed, generating small inaccuracies into the final configuration of the (up to) 5 decks of cards in the dealing shoe for Nevada style Blackjack.
@JohnsBasement
@JohnsBasement 2 жыл бұрын
Indeed those MITS & IMSAI systems did! You'll see some more about an IMSAI box that I've been trying to repair soon. I was exposed to hex before octal. Given that the octet won as the standard size of a byte, it seems to make sense that hex won more mindshare. I remember assembling an IMSAI CP-A back in the day. If I recall correctly, the manual included a note suggesting that the reds and blues be groupd into 3s or 4s to suit the owner's preference. I've never seen one in 3s. The Altair was grouped into 3s. It never felt right to me. Yeah. Entropy seems to be a popular use of the R register.... that I overlooked back in the day. I can't imagine how much time I could have saved if I had access to any sort of a user community hack in the late 70s. Of course finding myself in the midst of 'been there, done that' could have also had a negative impact on my excitement of discovery as my own needs constantly drove me to continuously forage for answers. There's a whole world of cool stuff out there!
@willofirony
@willofirony 2 жыл бұрын
I seem to remember (from 45 years ago) seeing the "undocumented" opcodes. I also remember that not all manufacturers had all of them and, at that time, no assembler recognised them. So, to use them, one had to db the machine code into the code (though we called it poking). If you passed the source code to a friend (and their cpu had a different manufacturer) the computer would react (as C++ programmers say) with undefined behaviour. The friend tended to react with very defined behaviour. The manufacturers of the CPUs in The TRS-80 model 1s tended to have all the undocumented opcodes.
@JohnsBasement
@JohnsBasement 2 жыл бұрын
🤣.... Yeah. I would recommend avoiding the "unofficial-but-works" instructions unless you are willing to certify them on your target processors.
@7alken
@7alken 10 ай бұрын
one reason I dint dive deep into Z80 assembly yet is that for me all assemblers/ISA are the same, yet syntactically different ... so I am planing to bundle my VMEX with assembler too, but more similar to C ... and for this I found recently also nice tiny Bruce Tomlin ASMX multi-cpu macroassembler, which will be good start to add there my own thing targeting risc-v based VMEX and try to target also native processors, even with some tiny runtime and shared concepts, to share common syntax everywhere ... so also on Z80
@qqw1-101
@qqw1-101 11 ай бұрын
thank you 🙏
@edwardmyers7734
@edwardmyers7734 2 жыл бұрын
I used the refresh register as a random seed number generator.
@JohnsBasement
@JohnsBasement 2 жыл бұрын
I'm conflicted on this. It is a great idea. But best done after a random period of time since the last reset since using it like this is returning a jittery timer value % 0x7F. For a simple seed, it is great as-is. If you need better, consider reading it after each key-press in the BIOS console driver & add it to the last value... Or shift the last value left and xor the new reading into that shifted result...
@williamdrum9899
@williamdrum9899 Жыл бұрын
It's ok but not the greatest, since it's somewhat deterministic if you do it right at startup
@koenlefever
@koenlefever 2 жыл бұрын
29:10 Counterexample: ARM has LDIR/LDDR equivalents with even more options: LDMIA, LDMIB, LDMDA, LDMDB and their STM counterparts.
@JohnsBasement
@JohnsBasement 2 жыл бұрын
Those are not particularly RISCy operations indeed! It has been a while since I tinkered with these on an ARM... Don't all those instructions transfer data between registers and memory? The Z80 LDIR is an interruptible/resumable memory-to-memory copy!
@koenlefever
@koenlefever 2 жыл бұрын
@@JohnsBasement Yes you're right, I was confused: one still has to write a little loop around LDM/STM pairs, but it is possible to move eg. blocks using 8 registers at the same time.
@JohnsBasement
@JohnsBasement 2 жыл бұрын
@@koenlefever 😂 good. I was afraid I might be losing it there for a minute.
@williamdrum9899
@williamdrum9899 Жыл бұрын
Those are more like MOVEM.L on the 68000 really
@JavierGomez-yh6zb
@JavierGomez-yh6zb Жыл бұрын
Yes, you work is genial , thank you .
@JohnsBasement
@JohnsBasement Жыл бұрын
Thank you very much!
@SusanAmberBruce
@SusanAmberBruce 2 жыл бұрын
I got a very quick question for you, John, so I have just been reading an old copy of Intel's 8080 Assembly language programing manual and on page 11 I noticed an example like this: Example Label Code Operand INS1: MVI REG4, 2EH INS2: MVI 4H, 2EH INS3: MVI 8/2, 2EH Assuming REG4 has been equated to 4, all the above instructions will load the value 2EH into register 4 (the H register). and I thought wait a minute that doesn't look right a move immediate instruction can only have an 8bit operand, so what do you say? I am finding your videos both entertaining and informative, I have a nice little 8080 kit computer by the way and that is what I am starting with.
@JohnsBasement
@JohnsBasement 2 жыл бұрын
I say... 1) for an 8-bit register, an 8-bit immediate operand makes sense, and 2) look at the LXI instruction. ;-)
@buzzz241
@buzzz241 Жыл бұрын
2EH is 8bit, a byte. A byte can hold anywhere between 00H - FFH, 0 - 255 decimal. ‘H’ means Hexadecimal number.
@JohnsBasement
@JohnsBasement Жыл бұрын
@@buzzz241 🤣. I now see I completely misunderstood the question!! Thanks Brent.
@buzzz241
@buzzz241 Жыл бұрын
@@JohnsBasement I wondered about that. 😃
@lordsmeagol3390
@lordsmeagol3390 Жыл бұрын
You still need to be careful using these old manuals/scans. Visible @ 1:05:37 The LD r,(IX+d) instruction has the wrong coding; it shows 01101, which should be 01110 It's quite easy in this case to spot and correct the error, as IX and IY behave a lot like HL, with the additional displacement. DD and FD turn most HL instructions (not the ED ones) into IX/IY instructions repectively, with the memory ones gaining the displacement.
@JohnsBasement
@JohnsBasement Жыл бұрын
Indeed it appears that we have to be careful about trusting anything!!! The new ones have what appear to be OCR errors from scanning the old ones... that have errors of their own. 😕
@wrappeda
@wrappeda Жыл бұрын
I cut my computering teeth on the Z80 (and later the Z180). Always found the assemblY (I hear ya) language to be most intuitive & always ybrwepretws in particular the LOAD instr's as for example LD AA,B as Load A from/with B. The 8080 MOV instructions seem to imply that data are being MOVed from source to destination, but as always copied which makes more sense getting a handle on twhat the cpu is actually doing. I used to use the R reg if I wanted a semi random number, just LD A,R (or some such). The dots in the F register after (mostly) a LD instruction, wouls always leave the'dotted' flag alone. ~Useful, as you could do a logic operation,but leave the result for later on with a JP.JR etc. operation
@JohnsBasement
@JohnsBasement Жыл бұрын
Oh yeah! Definitely useful to know that LD and some other instructions don't alter the flags! Often we can optimize our code by deferring the use of the flags in a JP or similar instruction. I have yet to use a Z180. I'm looking at a Z8S180 (close enough) for my next project though. So maybe soon!
@wrappeda
@wrappeda Жыл бұрын
@@JohnsBasement Thank you for the reply John. Apologies for the dodgy typing - I was using a large TV with very small text several feet away, so combined with 66 year old eyes.... Well you know.... I learned so much from the Z80 and I have to say in certain applications it still holds up to far superior hardware today. BTW - have fun with the Z180 - It has a 1MB memory, but that comes courtesy of a MMU, so addressing memory isn't as straighforward as you might think!! - still have to work in 64K chunks as I remember. xxA
@JohnsBasement
@JohnsBasement Жыл бұрын
@@wrappeda Until this project, I haven't touched my Z80 stuff since 1990. Looking back at it today I am pleasantly surprised how compact the code seems to be. I believe you are correct about the 180. 64K at-a-time out of 1M with 3 segments of variable sized chunks of contiguous 4K blocks... which is notably more flexible than my retro-board bank select logic... AND the Z8S180 is available in 3.3v so it is much simpler to interface to newer chips like CPLDs and FPGAs. I hope someone is interest in a old + new project. Because I am excited about trying one.
@andreasseck2377
@andreasseck2377 Жыл бұрын
i've got a question to you: (watch interesting all your videos),,, in video-card-testing video by a bootet cpm2.2 you used "ddt". i'm born 1963 and had in 83 my first cp/m computer (built from the magazine "MC") -- wow lot of money at this time, double 5,25"floppy in echma70,,, -- all what lou lough now in 2022,,, but there was no other in this time... now, just in this time i already had a "ddtz" on my disks. why dont you use this? -- you are working on a z80 and not on a 8080,,, down-compatible or iven if???
@JohnsBasement
@JohnsBasement Жыл бұрын
Never heard of it before. Who published it? Is it officially "free"?
@andreasseck2377
@andreasseck2377 Жыл бұрын
@@JohnsBasement ... thy for your reply 1st. and yes of course, there was a project in a german comuter magazine called "MC" to build a cpm-z-80 machine with ecb-bus in a 19" rack -- and we did this in ??? let me lie,,, 1983 in the company (perhaps you herard it -- now called leica-camera,, this time it was "ernst leitz-wetzlar" -- where the leica cameras were manufactured,,, -- and not only cameras, they built electron-raster-microscopes e.g,,, -- there was great of of electical-engeneering. so we had account to of layout making, producing double sided component cards,,, -- and a lot of engeneers out of the 8080/8085-scene working there... and we built it, the project published in "MC" (some learners, some just finished, and some engeneers)... -- mass expensive with "basf"-5,25" floppy drives, but the amount of abut 10 people takes it to go in pricing. ==> so i got one of the machines. vector-grafik-chip (extra card ecb-bus), and so on -- including an adapted bios by one of our "engeneers",,, that was my 2nd computer (sinclair zx81 was my first). i studied electronics -- and we (me and my comilitants) did our home work on this machine at my home -- cause the calculation-centre in gießen (germany) with a cyber??? was unusable,,, thy had cooling-probs,,, yellow to red traffic-light allways -- so we went to my student home and did there our "fortran80" -- one disk with bs-and word-star on it as editor, the other with the f80-compiler... ==> and believe me,,, on this system-discs were a lot more stuff as in your project, the whole cp/m seems to... -- including a "ddtz" special for debugging z80 -- else i did never tell you about,,, so i wondered... perhaps this was "grabbed" from e.g. sinclair or who ever built z80 systems this time??? -- but it was!!! i didn'n know else, until you presented "ddt (without-z") in your video. else/ever... that was learned by you now 2022 that there were cp/m s for 8080 or so? i went my way then far on to to the motorola 68000,,, atari came in, but i got an industrial vme-bus machine,,, from kws-karlsruhe(germany) -- called "sam68k" -- and got happy with that a long time,,, and yes.,, then came te ibm-xt-clones,,, ff,,, -- ms.dos, windows,,, -- and now i do my embedded work on 8051 flash-clones (89s52) and doing first steps with lattice fpga's and the mico-8 cpu which is embedded there. so 10 Mhz and multiplexed busses are now going to 100MHz and the "wishbone"-bus??? lol,,, at thanksgiving some engeneers took te bone of this "turkey" served there as usual -- cracked the bone into 2 parts -- one read-only, one write-only (bus) -- and a few handshake aknowledges ==> closed their eyes and built it: the "wish-bone"... ==> see lattice pages or datasheets ==> best take the "brevia"-board -- and have a look on,,, that's an xp2 fpga with onboard mico-8 cpu (all gnu and c-compiler that serves this)... best regards,,, andreas seck, and even a loud "lol" and "hihi" -- but this was so in the 80s. now in 2022 it's an adventure to get those chips as a z80 or 6502... thx for your reply to me -- and merry christmas to you
@ChrisSavageEngineer
@ChrisSavageEngineer Жыл бұрын
John, I watched the whole video waiting to see you run your assembler. I was curious what you're running. But you mentioned at the end you would cover that next, but I see no video on the assembler. I am curious if you're running an assembler compatible with modern version of windows and if so, what.
@JohnsBasement
@JohnsBasement Жыл бұрын
Sorry about that. I had conflicting ideas on how to go about talking about this topic... It made editing the result a problem. I use z80asm on Linux because it is trivial to install and run on a Raspberry PI. It should also be trivial to run in WSL on Windows. I've sen the source code for it and it is pretty simple. Should you be inclined to do so, I expect that it would build and run on windows as it is. The project page for it appears to be located here: savannah.nongnu.org/projects/z80asm
@ChrisSavageEngineer
@ChrisSavageEngineer Жыл бұрын
@@JohnsBasement thanks for your reply. As a former content creator I know all too well how a video can evolve (or devolve) during filming. You get off track and run out of time. I used to have hundreds of videos on my site. The 6502 and Z80 were how I first got into computers. I gave up on the older stuff when the software stopped working on newer PCs and there was little in other options. That said, an initial test shows that the old Table-driven Assembler I used to use may still work from a command prompt in Windows. I've seen people using WinAPE as well as one called, "ZEUS". I have not tried any of these. I was looking forward to getting back into the Z80 starting with an RC2014 kit I picked up some time ago. Also picked up one of Ben Eater's 6502 kits.
@JohnsBasement
@JohnsBasement Жыл бұрын
@@ChrisSavageEngineer Tons-o-fun!! I've seen a number of Ben's videos. He is doing some good stuff! Side note: Someone recently told me that they did a CP/M port to an RC2014 board using my series as a guide. It has started me thinking about the possibility of rearranging my cleaning up my build tree so that it could target both platforms. If you try doing the same thing, let me know how it goes.
@ChrisSavageEngineer
@ChrisSavageEngineer Жыл бұрын
@@JohnsBasement My interest in the Z80 was never really about CP/M, but more about the architecture. I also like the language and prefer to just program in raw ASM, hence my earlier question about your assembler. I apologize that I sometimes forget whether I am commenting as Chris Savage or Savage///Circuits. Hopefully not causing any confusion.
@ChrisSavageEngineer
@ChrisSavageEngineer Жыл бұрын
@@JohnsBasement Thank you for sharing that. Are you using a device programmer on the Raspberry Pi as well? I have the common TL866 II and possibly software for Windows, which was hard to come by. I've never seen software for other platforms.
@edgeeffect
@edgeeffect 2 жыл бұрын
Zilog assembly is so much "prettier" than Intel ! I remember BC being called Byte Counter and DE eing called DEstination.... I think this applies when you do things like LDIR and DJNZ kids at school used to talk about using the REFRESH register.... but I never understood what they were talking about. That was more of a nostalgia trip than a quick introduction for me... but it was still cool!
@JohnsBasement
@JohnsBasement 2 жыл бұрын
The refresh register is a free running counter. It is designed to be used as a row counter for DRAM refresh circuitry... saving the number of chips required. Sometimes people use it as a source for random numbers.
@edgeeffect
@edgeeffect 2 жыл бұрын
@@JohnsBasement "Random Numbers" ... now that does sound familiar.
@lordsmeagol3390
@lordsmeagol3390 Жыл бұрын
@@JohnsBasement Yes, it just increments (only the lower 7 bits) at each instruction fetch. I used it as a counter in my pseudo-random number generator for several games. My generator was very simple, but effective: A friend's Nascom 2 had a resistor network on the parallel port to produce reasonably linear digital-to-analogue. This was connected to an amplified speaker. The result was decent static hiss without any noticeable pattern :) My simple code is: ED 5F LD A,R 80 ADD A,B 0F RRCA 47 LD B,A 91 SUB C 07 RLCA 4F LD C,A or variations: rotate in other directions, or through carry, or a self-modifying-code version to save using B,C: ED 5F LD A,R x: C6 xx ADD A,nn 0F RRCA 32 xx xx LD (x+1),A y: D6 yy SUB nn 07 RLCA 32 yy yy LD (y+1),A Combining this with some user input produces decent randomness with very little code and not many CPU cycles.
@JohnsBasement
@JohnsBasement Жыл бұрын
@@lordsmeagol3390 Ah! Not bad. I was more concerned with using R only as a seed. Tossing it in as you go sounds interesting especially if your application includes human-caused (and/or other) time delays/jitter between accessing the R register.
@marcovtjev
@marcovtjev 2 жыл бұрын
Well, as a x86 assembler programmer, memorizing all instructions and variants is quite hard 🙂 I did know the 6502/10 ones by heart at some point though.
@JohnsBasement
@JohnsBasement 2 жыл бұрын
I can imagine! (I tinkered with the x86 a bit in the '90s. Somewhere I have a simple O/S that starts out of what I guess is now called legacy BIOS, sets up the MMU, jumps into 32-bit mode and exercises the various peripherals.) I then moved onto hacking on ARM systems... which felt a whole lot cleaner!! These days I'm looking at RISC-V.
@williamdrum9899
@williamdrum9899 Жыл бұрын
ORG $1300 EE 20 D0 4C 00 13
@johncochran8497
@johncochran8497 Жыл бұрын
And there's part of the Z80 documentation that's just plain wrong. Specifically, how the non-maskable interrupt interacts with IFF1 and IFF2 flip flops. The original documentation states that when a NMI is accepted, the IFF1 flag is copied to the IFF2 flag. That is just plain wrong, and stupid. Stupid because it would cause the state of the IFF1 flag to be lost in case of a nested NMI. The actual way those two flip flops work. IFF1 determine if maskable interrupts are accepted. 0 = maskable interrupted disabled, 1 = maskable interrupts enabled. The reset pin will cause both IFF1 and IFF2 to be set to 0. The DI command will cause both IFF1 and IFF2 to be set to 0 the EI command will cause both IFF1 and IFF2 to be set to 1 Accepting a maskable interrupt will cause both IFF1 and IFF2 to be set to 0 So far, the IFF2 flag seems rather useless. But it does have a purpose. Accepting a maskable interrupt will cause IFF1 to be set to 0. IFF2 is left alone and unchanged. And of course, the RETN operation will copy IFF2 to IFF1. In a nutshell, the only operations that will change IFF2 are CPU reset, DI & EI opcodes, and accepting a maskable interrupt. In all of those cases, both IFF1 and IFF2 are changed in an identical manner. As for the assembler pseudo ops, the EQU and DEFL pseudo ops are not the same. The EQU operation will indicate an error if the same label is defined with a different value, while the DEFL operation will not flag that as an error. Now why would you want that? Well, let me explain. All too many years ago, I used the M80 assembler along with its macro capability to create a set of structured programming macros. I forget the exact details of them, but in a nutshell you could write assembly language programs with structured programming pseudo ops. For instance, assume the following code: if (a > 10) { a += 7 } a += '0' A straight forward implementation in Z80 assembly would be CP 10 JR C,SKIP ADD A,7 SKIP: ADD A,'0' Nice and simple. But that label "SKIP" is an issue. It's only purpose for existing is to provide a target to jump to for that logical IF. And given that the labels are rather short, your assembly language program gets littered with labels that are only referenced once by a jump statement that's nearby and have no other significance. They're just littering the code. My structured macros would allow me to write something like: $IF cp 10 jr NZ,$FALSE ADD A.7 $ENDIF ADD A,'0' Notice that I'm jumping to a label called "$FALSE" That label was created within the $IF macro and specifies the address to jump to if the "IF" condition was false. There was also a label called "$TRUE" that would be jumped to on a TRUE condition (short circuit expression evaluation). The macros I had were something like $IF .. $THEN ... $ELSE ... $ENDIF $WHILE ... $WEND $DO ... $UNTIL etc And all of the above macros would define the labels $TRUE and $FALSE for use as jump targets. They would also internally create a stack to allow for nesting of the control structures. The stack would be a label that was incremented and decremented via the DEFL operation and it's current value used to construct another label using the stack pointer's value as part of it's name. So under the cover, there would be a lot of labels being defined and redefined, but as a programmer, I would not see those labels. And as a result, I could write programs where any labels that I did define were significate. In fact, most of the labels I used were simply subroutine names. All of the other labels who's purpose was to provide targets for loops and conditions were handled under the covers via the macros and were used by me as simply $TRUE or $FALSE.
@edgeeffect
@edgeeffect 2 жыл бұрын
"typographical creativity going on it it" made me laugh.
@JohnsBasement
@JohnsBasement 2 жыл бұрын
😁
@Stefan_Boerjesson
@Stefan_Boerjesson Жыл бұрын
Anyone having a tip how, where, to get hold of an assembler running on Pc?
@JohnsBasement
@JohnsBasement Жыл бұрын
I haven't used windows in years. But there should be plenty to choose from. I have found myself sifting through this list a time or two: www.z80.info/z80sdt.htm
@user-uq2ks2dr4p
@user-uq2ks2dr4p 24 күн бұрын
Do it! Have we not got tied of the bloatware of modern languages yet? And that OS you know the one. I have seen a few z80 videos and they talk about 512k banked ram. I love assembly language, I like having tiny ram. Today's crazy computers have 4gigs or more of ram, and 64bit CPUs running 3gigs or more. Back in the day I had a Amstrad CPC 464 with a green screen, and I learned to code by magazines. At the moment I am building a 6502S breadboard computer *Ben Eaters* one. I have a Z80 cpu and its support Chips plenty of static 32k ram and 8k EEPROMS. I would love to build a breadboard Z80 with maybe 8k Ram or something small. You really don't need much, we seemed to have use to these bloated new computers and OS.
@JohnsBasement
@JohnsBasement 22 күн бұрын
Things used to be sooo simple. And we definitely did serious business with those tiny machines! In some ways, modern computing seems to have taken a step backward. So much of the improvements that have come since the '80s seem have to gone into things like GUIs with semi-transparent windows and buttons with rounded corners.
@dave7f611
@dave7f611 Жыл бұрын
I enjoyed the green card reference.
@JohnsBasement
@JohnsBasement Жыл бұрын
😀👍
@williamdrum9899
@williamdrum9899 Жыл бұрын
It boggles my mind that after all these years, Zilog's official manual STILL doesn't acknowledge IXH/IXL/IYH/IYL. Never mind the fact that most assemblers let you actually type it as is, without having to manually inline &DD/&FD.
@JohnsBasement
@JohnsBasement Жыл бұрын
It seems like the quality of all datasheets has eroded quite significantly since the '80s. Gotta love it when the most recent data on decade old chips is still 'preliminary.'
@waynec369
@waynec369 Жыл бұрын
Not sure what everyone else watched , but damn... Tooo wordy... holy $hit this was painful. Early on he states he's going to show how to think about the Z80. Instead he shows you how to read the different versions of the manual. Maybe he got around to it, but I bailed an hour into it.
@JohnsBasement
@JohnsBasement Жыл бұрын
😂 I have never been accused of brevity!
@Stefan_Boerjesson
@Stefan_Boerjesson Жыл бұрын
That was a poor manual You got. The Zilog documents explained it all in a lot less number of pages.
@JohnsBasement
@JohnsBasement Жыл бұрын
Yeah. The older datasheets seem better than the revised/modern docs.
@shidongxu3410
@shidongxu3410 3 ай бұрын
I'm getting old enough since I studied Z-80 at the age of 20
@JohnsBasement
@JohnsBasement 3 ай бұрын
I woke up this morning and I was old. 😨
@shidongxu3410
@shidongxu3410 3 ай бұрын
@@JohnsBasementWhen I'm sixty-four by now. 😂
Zilog Z80 Deep Dive - How does it work?
15:05
NCOT Technology
Рет қаралды 19 М.
I MADE A CARDBOARD SWING!#asmr
00:40
HAYATAKU はやたく
Рет қаралды 16 МЛН
0% Respect Moments 😥
00:27
LE FOOT EN VIDÉO
Рет қаралды 36 МЛН
Who enjoyed seeing the solar eclipse
00:13
Zach King
Рет қаралды 103 МЛН
everything is open source if you can reverse engineer (try it RIGHT NOW!)
13:56
Low Level Learning
Рет қаралды 1,2 МЛН
Emulating a CPU in C++ (6502)
52:28
Dave Poo
Рет қаралды 943 М.
A new OS for the Z80! [Open Source][Zeal 8-bit OS]
11:05
Zeal 8-bit Computer
Рет қаралды 122 М.
Understanding the Z80 Memory Map
14:12
Kenneth Finnegan
Рет қаралды 29 М.
Documentary - The Sinclair ZX80, ZX81, and Timex Sinclair 1000
21:38
The 8-Bit Guy
Рет қаралды 1,1 МЛН
Assembly Language in 100 Seconds
2:44
Fireship
Рет қаралды 1,4 МЛН
Subscribe for more!! #procreate #logoanimation #roblox
0:11
Animations by danny
Рет қаралды 3,9 МЛН
Опасная флешка 🤯
0:22
FATA MORGANA
Рет қаралды 727 М.
phone charge game #viral #tranding #new #reels
0:18
YODHA GAMING RAAS
Рет қаралды 10 МЛН
Which Phone Unlock Code Will You Choose? 🤔️
0:14
Game9bit
Рет қаралды 1,8 МЛН