Тёмный

Z80 Assembly Language for the ZX Spectrum Tutorial, Episode 1: The Basics 

The Retro Desk
Подписаться 12 тыс.
Просмотров 63 тыс.
50% 1

Наука

Опубликовано:

 

1 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 160   
@Dunbar0740
@Dunbar0740 3 года назад
Wish I'd seen this vid in 1983. Better late than never.
@oneheckofabanana2016
@oneheckofabanana2016 3 года назад
This video did not exist back then. However, I am the best. So there is no need to worry. All in due time, my friend. Learn patience, and your key to success will lie within.
@BinaryReader
@BinaryReader 3 года назад
This is a hugely valuable resource! Modern processors are far too sophisticated to trivially jump into for beginners, so something like the Zilog Z80 is just the right balance of sophistication and approachability. Having a full series on this processor is something Im exceptionally keen on as i am looking to write my own Z80 emulator. Thank you so much!
@cnc-maker
@cnc-maker 3 года назад
There are 2 things that made the Z80 the 8080 killer. The fact that it only needed +5v instead of +5v, +12V, and -5V was absolutely huge, as well as the fact that it only needed a simple oscillator for the clock as well. The 8080 required a weird 2 phase clock that was beyond bizarre.
@klave8511
@klave8511 3 года назад
The 8085 sorted all that out in 1976.
@cnc-maker
@cnc-maker 3 года назад
@@klave8511 that isn't quite accurate. While it did allow a single +5v power supply to be used, and a single phase oscillator to be used as well, it's touting of being 100% binary compatible was false. There were originally undocumented changes to flags that complicated code to support both processors. Plus, it had none of the additional functionality of the Z80, which eclipsed all use of the 8080 and 8085 combined. I will say that the 8032 line of microcontrollers was nice, but that was a completely different market, which the 8085 sort of entered.
@TheSulross
@TheSulross 2 года назад
I have a vintage computer that uses the Intel 8085 - the Tandy TRS-80 Model 200. It's really a powerhouse of a portable computer with productivity programs that can be quickly sommoned from ROM - like the Multiplan spreadsheet. Probably safe to say that this line of portables from Tandy (Model 100 and follow-ons) were the most successful 8085 computers
@TSteffi
@TSteffi Год назад
Also the LDIR/OTIR type opcodes make a big difference. Thanks to those opcodes, the Z80 could do copy and search operations much faster than the 8080.
@radiognome1971
@radiognome1971 3 года назад
Oh, what a joy. Thanks for reviving these childhood memories of my school holidays in the '80-s, converting mnemonics to op-code with pencil and paper.
@michaelclift6849
@michaelclift6849 3 года назад
Exactly this! Not on a ZX, I had a single board computer called a TEC1 by an Australian company called Talking Electronics. I went mad with it, making expansions, and hand assembling code to punch in opcodes on a 4x4 keypad.
@slithymatt
@slithymatt 3 года назад
@@michaelclift6849 that is hard core! Wish I had a hex keypad today.
@dalixman2754
@dalixman2754 Год назад
Exactly what I had to do until I saved enough to buy an Assembler :)
@andrewdunbar828
@andrewdunbar828 3 года назад
I consider it respectful to pronounce the Z in Z-80 and ZX as "zed" when talking about British computers and "zee" when talking about American computers, at least in public (-:
@axelBr1
@axelBr1 3 года назад
The trouble is that the Z80 is a yankee chip, so I guess it should be called the Zee 80, but Zed 80 sounds better
@StarsManny
@StarsManny 3 года назад
Most native English speakers in the world are American. So let's use the American way. I'm sure most non Americans like me don't care much either way anyway.
@isyt1
@isyt1 2 года назад
@@StarsManny that’s completely not true. If you add up Indian, Nigerians, British, Irish, Australian, New Zealand, South Africa, Germans then it’s far more than America and they all use real English, not American English. See Wikipedia article entitled “List of countries by English-speaking population”
@paulklasmann1218
@paulklasmann1218 Год назад
@@StarsManny The language is English, not American. In English it is pronounced "zed". Anything else is wrong in an English exam.
@Just_lift_anyone
@Just_lift_anyone Год назад
Some good points, one very bad point here. All of it respectful (maybe not mine 😂) but yes, it is Zed 😅
@dodgydruid
@dodgydruid 3 года назад
I cut my teeth on a ZX80 kit which was a lot of effort but the damned thing was too limited to do anything of consequence, the ZX81 improved things but the Spectrum took it all to a new level and because it was built upon the 80 and 81's core, was a breeze to migrate too. Another contender also entered the fray at this time, that of CP/M much favoured by the Amstrad machines and became cohabitable on the Spectrum 3's where many Amstrad games could work natively on Spectrum 3's and I used to create personalised Locoscript installs for companies which was a nice bit of extra money using CP/M. I used to have big notepads for setting up a programme, create its flowchart, break the flowchart down into modules then work on each module once I had set up the framework, I was working in a bank in the 90's and I sat there one lunchtime and knocked them up a far better database with decent sockets to talk with other bank systems, the programme was actually tiny and super robust and they stopped using it in early 2000's so it lasted pretty well, of course me being green around the gills I got a cheque for £500 for doing that but £500 in the eighties was not to be sniffed at and like any young lad I blew it on beer, parties and young ladies hehe I spotted this vid as I used to be pretty good at all of this but have lost my way the last 20 odd years, would love to relearn it all and all thru this vid I was thinking "Oh yes, that's how it went" lol
@stupossibleify
@stupossibleify 3 года назад
Fantastic tutorial. As a C64 owner I always wondered about programming the Speccy. Looking forward to the next episode!
@dreznik
@dreznik 3 года назад
this takes me back to Z80 assembly experiments on my ZX81... to go into assembly mode there we had to do smtg like RAND USR
@darrellsturdivant7912
@darrellsturdivant7912 2 года назад
Bravo!! Loved every minute of this. Early micro computers, assembly language, emulators, Mac’s and even Atom. Wow. It does not get much better than that. I wrote tons of z80 code back in the day. I even wrote most of my code and compiled it on the mainframe z80 cross assembler. ah, the days of single threaded programming. A simpler time.
@jenny-c
@jenny-c 3 года назад
Oooh that‘s so great! The Spectrum was my first computer and I loved to code in assembler (also later in M68000 assembler for the QL). Watching this video is like travelling back in time and all the memories coming back. Thank you!
@ulysses_grant
@ulysses_grant 3 месяца назад
This playlist comes to the rescue. It's like seeing an old book of photographs of a dearest friend in a moment like this. Farewell, Z80.
@mig7287
@mig7287 3 года назад
Best memories. I loved assembly programming on my Spectrum. Dot Net on my PC is not as much fun. Starting now to do assembly on the PC.
@mrunixman1579
@mrunixman1579 2 года назад
I never programmed in assembly on a Spectrum but I have on a PC and just passed a course on it. I came across this video due to interests in the Spectrum's programming languages when code appears on screen after crashing a game.
@ArcangelOrtiz
@ArcangelOrtiz 3 года назад
Thanks, it was informative
@rjy8960
@rjy8960 3 года назад
I'll be following this - I'm 54 and cut my teeth on creating assembly code and hardware design for various different 4- and 8-bit processors. The first machine I programmed was an 8085 in hex - I remember cheating and using absolute addressing rather than relative addressing to make life easier. Assemblers make life so much easier. Good luck with the series! :)
@TheAgent4125
@TheAgent4125 3 года назад
Great start - looking forward to the next one.
@axelBr1
@axelBr1 3 года назад
My first computer was a ZX81 with 1K of memory. And although I wanted to program the Z80 in Assembler, and asked my dad for the book "Programming the Z80" for Christmas, but never got round to actually doing it. Great to see something for the Z80, I've been following Ben Eater's 6502 projects, but it's not the same.
@005AGIMA
@005AGIMA 3 года назад
oooooh I'm so in! Subbed. Perhaps I will finally write a game after all these years? :D
@rodoherty1
@rodoherty1 3 года назад
I know that feeling! I've wanted to write a C64 game for so long. I'm working through Matt's X16 series and, so far, I'm hanging in there! Hope you get to realise that dream!
@adamjones6252
@adamjones6252 2 года назад
just getting into Z80 programming - nice primer :) looking forward to working through the series.
@microdocker
@microdocker 3 года назад
Clear explanation, nice and comprehensive infografics and pleasant narration! Thank you!
@HA7DN
@HA7DN 3 года назад
Having just programmed 8085 I can already see this is waaaay friendlier, despite being closely related...
@AlessandroGrussu
@AlessandroGrussu 3 года назад
Interesting video, and a commendable effort to teach the basics of Z80 assembly to the masses. However, I have some reservations. I find the exclusive use of the hexadecimal system in a tutorial aimed at absolute beginners a questionable choice, more so if it is proposed without explaining anything about it. Also, ZesarUX is far too complex to use for a beginner: Spectaculator and SpecEmu would have been better choices in my opinion. Not that I am a Z80 Assembly expert - far from it - but if I had your experience and knowledge, I would have chosen a more "for dummies" approach, delving into details that I could genuinely believe not to need any explanation.
@DanielImmanuel2143
@DanielImmanuel2143 Год назад
You've made this video sound like child's play! Thank you. Z80 was always my best processor along with 6502 thank you, you made it easier to understand...better than some lecturers 😊
@trinitron40237
@trinitron40237 3 года назад
I feel 25 years younger watching this video. I did a 3ph PWM inverter project based on Z80 back then.
@martinj.fowler6262
@martinj.fowler6262 4 месяца назад
The Latin and Classical Studies teacher at our school was a computer hobbyist. He gave me his copy of Picturesque Editor/Assembler/Monitor/Debugger and said "See if you can work out how to use it, I have no idea". It took me another year or so but I eventually worked it out with a little help from a friend :D I wrote a couple of little games for the Spectrum in Z80 but never fully finished for release. I've still got the tapes but don't think they'll work after all these years. I'd have to guess at the org address to run it and the source was created using Laser Genius Assembler Suite.
@davidorama6690
@davidorama6690 3 года назад
If you’d have posted these videos earlier I could of learnt assembly coding from you and would of been a hero in my High School and maybe Bill Gates instead of a geek who became an accountant. Thanks. 35 years too late. Try harder next time! 🤣
@kilianhekhuis
@kilianhekhuis 3 года назад
Very nice video! Clearly explained, good pace, good information density. Can't wait for the next one!
@1Rictec
@1Rictec Год назад
"bro i cant pass this level on this game can you do something?" ok looking for DEC (HL) on the code , remove it and there you go infinity lives...oh the memories lol
@taldmd
@taldmd 3 года назад
neat! for following episodes, could we expect an explanation of the ZX48 memory map, how did develop in asm back in the 80's, and what made the ZX48 a unique platform (ROM, graphics, sound and input subsystems, etc), different from other Z80 based microcomputers?
@ronvanderlee7298
@ronvanderlee7298 3 года назад
Memory layout: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-_J4ahkWtNYw.html 😉🙂
@slithymatt
@slithymatt 3 года назад
Yes, we'll get into all of that
@amiller112
@amiller112 3 года назад
Good video. I have been interested in learning assembly for a while and as I still have my original spectrum +3 this series seems like a good place to start.
@cprince10
@cprince10 11 месяцев назад
Great video. If I draw a box using Plot and Draw, how do I fill in the box with colour?
@TheBeeshSpweesh
@TheBeeshSpweesh 3 года назад
7:32 - "(absolute), C" is an invalid LD operand combination on the Z80. 13:27 - There are instructions that load an immediate to the memory byte pointed to by HL, IX+offset, and IY+offset, but not by a 16-bit absolute address. You can make the code clobber HL instead of A as a result.
@slithymatt
@slithymatt 3 года назад
Good catch with the LD (xx),C. I'm not sure how I missed that! And yeah, you could use (hl), too, but I didn't want to get into indirect addressing in the first example
@TheBeeshSpweesh
@TheBeeshSpweesh 3 года назад
There's a Z80 knockoff I'm kind of obsessed with that has that LD...
@pavloskairis9994
@pavloskairis9994 11 месяцев назад
6502 was fun ... I wrote code for the BBC model B.
@Dandema
@Dandema Месяц назад
Reading books and saw this videos several times. Awesome ❤
@Dostofei44
@Dostofei44 2 месяца назад
Is this possible to write in BBC BASIC SDL?
@kcinplatinumgaming2598
@kcinplatinumgaming2598 3 года назад
takes me back not codedd any z80 since the 1990s, I dont think i done any assembly on spectrums mostly Amstrad CPC when i developed a text editor and some small projects on the PCW systems but mostly coding on low power stand alone chips systems hardware like controllers, io ect .. serial devices with Z80 logic.. but mostly other CP/M based systems .. mad really that Digital Research could have been instead of Microsoft .. Gary Kildall could have been instead of Bill Gates
@AndrewHelgeCox
@AndrewHelgeCox 2 года назад
UK game developers often worked on the Z80 Amstrad CPC when targeting the spectrum.
@slithymatt
@slithymatt 2 года назад
I could see that. Definitely a better system for development on.
@Choober65
@Choober65 Год назад
ZX Spectrum, best computer EVER 🤣
@alexandrugoia2982
@alexandrugoia2982 8 месяцев назад
Have you some experience with gens-3 assembler directly on spectrum computer/emulator ?
@slithymatt
@slithymatt 8 месяцев назад
No, never tried it.
@SteveInScotland
@SteveInScotland 3 года назад
Speccy is an affectionate name often used in magazines back in the day but it kind of makes my skin crawl when it’s used too often or in inappropriate places. For me at least, I prefer just hearing the regular name of Spectrum. It’s kind of similar to if you kept saying Bro all the time, you could but in general you likely wouldn’t. No hate, just my opinion.
@slithymatt
@slithymatt 3 года назад
I try to switch it up, because saying Zed-Ecks-Spectrum over and over can get monotonous.
@SteveInScotland
@SteveInScotland 3 года назад
@@slithymatt absolutely it’s full name is far too long winded but just Spectrum is easy enough I think. I mean it’s your channel, do your thing.
@caphep
@caphep Год назад
Atom has been discontinued and the Z80 language package for syntax is not available any more. Can anyone recommend an alternative editor for this tutorial?
@slithymatt
@slithymatt Год назад
VSCode is the closest, and if you don't want the Microsoft proprietary libraries you can install the fully FOSS version "Codium"
@croll_uk
@croll_uk 3 года назад
Awesome. Used to have a Speccy in the late 80's. Would be nice to reminisce and finally write assembly instead of basic. 10 Print 'ME' . 20 GOTO 10 ... lol
@Veso266
@Veso266 Год назад
How would I do this direcly on the spectrum? Were there any good asemblers back in the day?
@slithymatt
@slithymatt Год назад
I don't know about anything specific, but I'm sure it would be possible. There were several assemblers for Z80-based computers that ran CP/M
@DarrenLGoldsmith
@DarrenLGoldsmith 3 месяца назад
Back in the day, I dreamt of creating a program (game) such a Manic Miner, or Jet Set Willy... just like my hero Matthew Smith. It all seemed far too complicated though - indeed, almost magical - and I had no idea where to start. Now that I'm in my 50s, I'd really like to give it a proper go. Would this be a good series to get me off and running, or at least walking? Does anyone have any other recommendations? Bear in mind, when it comes to any kind of coding at all, I am a *complete* beginner! Cheers!
@slithymatt
@slithymatt 3 месяца назад
I would first recommend learning some basic programming first. Not literally BASIC per se, but something like Python just to get your feet wet before getting into assembly.
@DarrenLGoldsmith
@DarrenLGoldsmith 3 месяца назад
@@slithymatt Thanks!
@euphoricmonkey8409
@euphoricmonkey8409 11 месяцев назад
Thanks for this series. I had a spectrum as a kid and just wasn’t smart enough to understand assembly. Now I’m a LOT older it’s fun to look back now I’m a BIT wiser. The Z80 is such a manageable cpu to understand.
@thinking-laaf
@thinking-laaf Год назад
The alternate registers are moderately useful. If zilog had added a means to find out which set is active, that would have increased their usefulness...
@slithymatt
@slithymatt Год назад
Indeed! Instead the alternate registers are always the ones not directly accessible. One of the unused status bits would be nice!
@RufianEmbozado
@RufianEmbozado 3 года назад
Awesome introduction! I wish I'd had this kind of resource back in the day (although that maybe would have killed some of the joy of discover things on my own, but anyway).
@wlorenz65
@wlorenz65 3 года назад
Why is it See-Eighty and Said-Ex-Eighty but not See-Ex-Eighty?
@slithymatt
@slithymatt 3 года назад
The Z80 is an American chip, while the ZX80 is a British computer
@HansBezemer
@HansBezemer 3 года назад
Nothing new for me, but well explained! But it makes me remember a lot of good times. Gives me a very good reason to visit your next presentation!
@qzorn4440
@qzorn4440 3 года назад
gee this is wonderful info, i wished i had this when learning logic and the 8080, etc... thanks a lot...:)
@Theineluctable_SOME_CANT
@Theineluctable_SOME_CANT 2 года назад
Great little tutorial. Thoroughly enjoyed it! Great channel...
@VasaMusic438
@VasaMusic438 2 года назад
Fantastic !!!!!!!!
@davidmarks509
@davidmarks509 3 года назад
I liked it. TY
@RockTo11
@RockTo11 3 года назад
Oh yes. I'm really looking forward to this series. Specifically beca6ineant to make games for the Amstrad CPC and Gameboy.
@slithymatt
@slithymatt 3 года назад
I won't be getting into the hardware specifics of those platforms in this series, but I hope it provides a good basis for understanding Z80 assembly, which you can then apply to systems besides the ZX Spectrum. Just be aware that the Game Boy CPU only has a subset of the Z80 instructions
@iliasgkotsidis3204
@iliasgkotsidis3204 2 года назад
Beautiful
@JimmWare
@JimmWare Год назад
Well done!
@toastyPredicament
@toastyPredicament 2 года назад
Shut
@DAVIDGREGORYKERR
@DAVIDGREGORYKERR 3 года назад
The MEMOTECH MTX512 can combine Assembly and BASIC together I.E. ASSEM 10 10 CODE &H4000 LD HL,&H20 &H4004 LD BC,AH32 &H4008 ADD BC,HL &H400C LD (HL),BC &H4010 RET 20 REM End of assembly. the MTX512 also has a proper keyboard which makes coding easier. What about storing you assembly language in the REM statements and do CALL RAND USER(16384) or you can do like in this example goto 10.
@slithymatt
@slithymatt 3 года назад
I don't know anything about the Memotech computers. Looks like a nice feature!
@DAVIDGREGORYKERR
@DAVIDGREGORYKERR 3 года назад
@@slithymatt if a special piece of hardware plugged into the back of the computer you can load and run SINCLAIR Spectrum games for both the 48K and 64K machines and it just happens that you can get the MEMOTECM HDX512 (Hard drive) or the MEMOTECH FDX512 (Dual floppy drive) and can run CPM/80.
@TheBeeshSpweesh
@TheBeeshSpweesh 3 года назад
Are you sure the MTX512's assembler supports "ADD BC, HL" and "LD (HL), BC" as pseudo-instructions? The Z80 has neither. I'm gonna guess you reversed the operand order for those. The latter can be done via: LD C, (HL) ; Load low byte INC HL ; Advance to high byte LD B, (HL) ; Load high byte DEC HL ; Go back (may not be needed) Once again, I know nothing about the BASIC used by that machine.
@DAVIDGREGORYKERR
@DAVIDGREGORYKERR 3 года назад
The processor is the ZILOG Z80A get the the MEMOTECH program book and have a look at the machine code for the Sound To Light programme
@TheBeeshSpweesh
@TheBeeshSpweesh 3 года назад
@@DAVIDGREGORYKERR I know! I saw that it used the Z80.
@jurijzahn8985
@jurijzahn8985 3 года назад
I am traveling back in time 😁. Very nice! Thanks!
@iliasgkotsidis3204
@iliasgkotsidis3204 2 года назад
I need to ask a question the tutorial is very helpful but i am having a rough time finding an ide to make the .asm file work
@slithymatt
@slithymatt 2 года назад
I don't use an IDE, all you need is a text editor and the sjasmplus assembler. See the GitHub link in the description for more info
@iliasgkotsidis3204
@iliasgkotsidis3204 2 года назад
@@slithymatt thank you
@fcf8269
@fcf8269 3 года назад
Would love to see this when I got my spectrum :) Any plans to make a series for the 68K?
@slithymatt
@slithymatt 3 года назад
I've definitely considered it. That was my first assembly language many years ago, and I still have my textbook. I would probably target the Amiga.
@Gruntos
@Gruntos 3 года назад
If I remember the IX and IY registers could be addresses as 8 bit registers IX.L and IX.H my old assembler had this functionality. Not sure if it was common practice though. I did a lot with screen drawing on the specky. Most people used LDIR which would cause a screen flicker but it was faster to call LDI in a block 1024 blocks as the LDIR took 24 T states and the LDI 8 ( memory falling here). I think the fastest way was to move the SP to the top of screen memory and push the screen byte. Had a lot of fun with the z80 and 68000
@slithymatt
@slithymatt 3 года назад
Yes, you can address ixh and ixl in the same ways you can h and l, for the most part. There are a few exceptions where you can't substitute index register halves, when h or l is one operand, but (hl) is the other. For example: ld (hl),h is valid, but you can't do ld (hl),ixh. What you can do is ld(ix+x),h, but again not ld(ix+x),ixh.
@nicadi2005
@nicadi2005 Год назад
@Gruntos "I think the fastest way was to move the SP to the top of screen memory and push the screen byte." - Yes, I do recall hearing about that technique - fairly recently, as a matter of fact. But I haven't quite figured it out yet, to be honest... I do understand (to some extent) why this would be an attractive approach, though: i.e. using 16-bit transfers per opcode (rather than 8-bit ones), as well as the address decrement/increment being handled automatically. However, I keep seeing the fact that the stack is implemented 'upside-down' for the Z80 as a serious (potential) impediment to achieving high performance for this technique, in certain applications... (P.S. I can explain more thoroughly what I actually mean by all of that, however I would risk turning this post into an interminable essay - and I would rather NOT go that way... At least, not unless someone else here first manifests further interest in hearing more about my musings on the matter...)
@AdamSommer70
@AdamSommer70 3 года назад
Great video, thanks for posting!
@colonelbarker
@colonelbarker 3 года назад
Thank you for making this!
@kirill_bykov
@kirill_bykov 2 года назад
16:36 AFAIK, $ sign means current compilation address in most assembly languages. And hexadecimal form is written as ####H, started with decimal number, so you have to prefix it with zero sometimes to obey the rule.
@slithymatt
@slithymatt 2 года назад
No, it just means hex. Each assembler has different notation, but $ is very common for hex. Some assemblers allow multiple notation, including prepending # or postpending H
@kirill_bykov
@kirill_bykov 2 года назад
@@slithymatt, M80 and GEN80 support H-suffixed and do not support $-prefixed hex notation, even Zeus does not. All three use $ as the current compliation address. I did not tell $ is not supported at all for this purpose, simply uncommon. Is common for Pascal though.
@ian_b
@ian_b 3 года назад
There will never again be a register pair as great as hl.
@slithymatt
@slithymatt 3 года назад
HL' is just waiting in the wings, though...
@ian_b
@ian_b 3 года назад
@@slithymatt Well I admit, I tend to flip-flop between the two.
@richardturnnidge
@richardturnnidge 3 года назад
Brilliant, looking forward to the series.
@thedogwooddandy
@thedogwooddandy 3 года назад
so grateful. thank you!
@heidirichter
@heidirichter 3 года назад
This was great, thank you!
@r_bilek
@r_bilek 3 года назад
Very very very good !
@zembalu
@zembalu 3 года назад
Thank you for that video! I have a ZX Spectrum since the 80ies, and programmed video games in assembler. I really would like to turn this thing on again, but there are two impediments: I have no old fashioned TV as a monitor, and I have no cassette drive, not to speak of the cassettes with the assembler and so on. Any clue, how to fix this?
@slithymatt
@slithymatt 3 года назад
Any TV with an analog PAL tuner should work, assuming you have a PAL unit. Most modern TVs still support analog RF video, but it may be stretched out on the screen. As for a tape deck, you can use anything that can play a sound through a headphone jack. You just need a dubbing cable, with a 3.5mm plug on both ends. Then you can just play the sound file through the cable.
@zembalu
@zembalu 3 года назад
@@slithymatt Thank you! That helps a lot.
@XXXXXX-dy5fs
@XXXXXX-dy5fs 3 года назад
There is a simple mod to bypass the TV modulator and give a composite video output. As for storage there are several modern alternatives to tape. Some use SD cards to copy file images from your PC to the SD interface that plugs into the Spectrum.
@zembalu
@zembalu 3 года назад
@@XXXXXX-dy5fs thank you!
@LarsHHoog
@LarsHHoog 3 года назад
7:40 shows a LD (NN),C instruction that Z80 doesn't have.
@LarsHHoog
@LarsHHoog 3 года назад
But the contents is promising and I hope many will learn lots.
@slithymatt
@slithymatt 3 года назад
Yeah, someone else caught that already. Had a bit of a brain fart there. I'm to change it to A in the slides in the repo
@LarsHHoog
@LarsHHoog 3 года назад
@@slithymatt There was no damage caused :)
@hadireg
@hadireg 3 года назад
👍👍awesome series!
@kychemclass5850
@kychemclass5850 3 года назад
Great to see such a series begin!
@johnwilliams7999
@johnwilliams7999 3 года назад
What a great video! Maybe a daft question but why would you use assembly if you can compile c to machine code.
@slithymatt
@slithymatt 3 года назад
There are many reasons, but mostly when you are dealing with extremely tight constraints, like on a low-RAM system with a slow CPU and no operating system (which is pretty much all 8-bit home computers and game consoles), the code generated by C will be too bulky and inefficient. C was invented for Unix and systems capable of running it.
@cyberp0et
@cyberp0et 3 года назад
Why not program in BASIC, since it comes with the system :)
@johnwilliams7999
@johnwilliams7999 3 года назад
@@cyberp0et I used to program in basic a long time ago and ill probably tinker with it a little when I get around to it. I like to code in language like rust and probably c is the closest thing to that that u can code with on this machine.
@Michael75579
@Michael75579 3 года назад
It's difficult to imagine how constrained the Spectrum and other machines of the time were unless you've used them. The ancient (2010) PC I'm running a Spectrum emulator on to follow these tutorials has a quad-core Intel CPU running at 2.66Ghz and 4G of memory; that's around 750 times the CPU clock speed and over 85000 times the memory of my original Spectrum 48K.
@AhmadAlMutawa_abunoor
@AhmadAlMutawa_abunoor 3 года назад
This is an excellent level of explanation. Even to a veteran programmer in different languages. My question is: will this code work for MSX computers? I am interested in writing programs for the MSX, but could not find enough information and videos for it, since it was not very popular in the USA
@ped7g
@ped7g 3 года назад
the video ram and other memory layout of MSX is very likely completely different (I don't know how MSX has it), so the code itself will still work the same, write value $D6 into memory at address $5800, but the MSX computer will not create blinking square on screen. (what will happen on MSX depends what is in that area of memory, probably nothing of significance/direct response). Also the output format SNA is ZX snapshot, so you will need to figure out how to produce binary which can be loaded by MSX emulator (or real MSX computer), AFAIK games for MSX are often produced as ROM-cartridge images, I know one huge MSX project does use sjasmplus for it, but it builds the whole file byte by byte manually, ie. any required "headers" of ROM cartridge and special values like checksum are part of the source code, and the source output is captured "as is" as raw stream of bytes (OUTPUT -> OUTEND directives of sjasmplus, or --raw command line option). in other words, it makes some sense to follow ZX tutorials (the Z80 assembly is still Z80 assembly, but [only] the machine-specific parts differ), and you can also use tools presented here, but you need to find some "glue" tutorial dedicated to MSX which will fill you on those machine-specific details, what's the memory layout of MSX, how to use it's HW features like graphics, sound, sprites, etc.... There's excellent web dedicated to MSX at msx dot org, where you can find also wiki with tips for programmers, and probably also some links to other tutorials or example projects and HW info. If you are completely new to assembly, and you really want to do MSX, it may make sense to start rather with MSX tutorials, and scavenge the ZX assembly tutorials a bit later, when you can somewhat tell which parts are machine specific features, and pick up the Z80 assembly tricks which do apply also for MSX.
@solhsa
@solhsa 3 года назад
The z80 code itself will "work", but referring to anything outside it (like display memory) will differ from one z80 computer to another.
@solhsa
@solhsa 3 года назад
Since even when writing for the speccy you'll probably want to have some kind of hardware reference in hand, writing for the msx shouldn't be much different - you just need a different reference =)
@cnc-maker
@cnc-maker 3 года назад
Also be aware that this assembler does not use the original Z80 syntax. The “$” (dollar sign) used by this assembler is not a part of the Z80 assembly syntax. Also, by default, all numbers in Z80 assembly are considered to be hexadecimal, not decimal. There are other differences as well, but you get the jist.. If you are using a different assembler, you might need to tweak the assembly in order for it to work for you.
@andyleighton3616
@andyleighton3616 3 года назад
The basic information about how the instructions work is the same. However MSX is totally different to the Spectrum. Anything to do with writing to screen, reading the keyboard, etc will be completely different. The MSX did not have an area of screen memory in the main 64K. It used dedicated VRAM accessed by a visual display processor chip (a Texas Instruments one for earlier MSX machines). The process for writing (and reading) the MSX VRAM (and VDP) require a few techniques Matt hasn't talked about. Basically using OUT and IN instructions (and also DI / EI to disable / enable interrupts). There were probably also MSX bios routines to do some of that too (just as we saw in the Hello World example program).
@idea1407
@idea1407 3 года назад
Very awesome. Great tutorial.
@idea1407
@idea1407 3 года назад
Yep, just got sjasmplus up and running on my raspberry pi zero w. Your code worked just fine.
@curtisvaughan8955
@curtisvaughan8955 2 года назад
OMG finally somebody doing everything on Linux! Thank you so much. I was so tired of emulating programs under wine to follow along with other tutorials.
@donaldklopper
@donaldklopper 3 года назад
Pure gold, man!
@slithymatt
@slithymatt 3 года назад
Thanks! I was shooting for at least 18K
@donaldklopper
@donaldklopper 3 года назад
@@slithymatt 24K for sure. I just love the application to the Spectrum ecosystem. Even your narration is on point :-) Where were you in 1983 when I got my ZX81?
@slithymatt
@slithymatt 3 года назад
@@donaldklopper learning how to code at school using Logo on an Apple II, naturally.
@ped7g
@ped7g 3 года назад
IMHO it's a bit better to end these early snapshot examples with `jr $` (infinite loop of self-jump). (and leave the "ret to basic" for later, when you will deal also with loader/sysvars/etc) It's also nice reminder for asm beginners, that the CPU doesn't stop where the source does, and keeps executing whatever it finds in memory further down, unless it is explicitly prevented.
@annieworroll4373
@annieworroll4373 Год назад
Just good enough, just cheap enough, just simple enough, and with a huge number of people who know how to work with them gave this thing a very long life in embedded applications after the 8 bit PC era faded. It's still being made! And being used for so long every tiny edge case has been figured out making its behavior incredibly predictable, which is crucial in a lot of embedded applications.
@AndersJackson
@AndersJackson 3 года назад
Emacs also have syntax highlightning.
@slithymatt
@slithymatt 3 года назад
There's one in every crowd... 😉
@AndersJackson
@AndersJackson 3 года назад
@@slithymatt yes, but it is plain better. :-)
@IngieKerr
@IngieKerr 3 года назад
Inspired, I've now got a tiny blue stick-person rotating in a character cell... with a pause subroutine to slow it down enough to see it. I'd make it move around the screen but sprites on a spectrum memory map are beyond my brain for today :) I mean, it's easy-ish to move "sprites" sideways on a speccy screen, it's just the moving up and down that gets tricky :) As a child I had a language extension tape _"Fifth"_ (I'd link to it, but a product name like that wasn't built for legacy searching an internet :) , which was a library of sprite routines and such, and wasn't a derivative of Forth, despite its obvious pun. I recall it being quite nice - hacking around with its demos, but I think at the time I hadn't tuned into the delights of such things, or what I was doing. edit: found a reference, if anyone remembers this: worldofspectrum.org/archive/software/utilities/fifth-crl-group-plc ... I cite this, since when a 12yr old, I remember I found it fascinating, and looking back at the manual on this link, I can see why... but I can also see why it went over my head at the time :)
@slithymatt
@slithymatt 3 года назад
Very cool! I never heard of this "Fifth" -- very cute name. Was it only for the Spectrum?
@IngieKerr
@IngieKerr 3 года назад
@@slithymatt I believe so, aye... I can't recall why I bought it back then, but I imagine I read an advert in _Your Spectrum_ magazine saying "WRITE YOUR OWN GAMES, MAKE ££££", sent off naively, opened the box and realised I was lacking various other parts, namely those in my brain :)
Далее
Looking at the Zilog Z80 - NEW SERIES!
13:23
Просмотров 116 тыс.
Fast and Beautiful Assembly
34:28
Просмотров 12 тыс.
Emulating a CPU in C++ (6502)
52:28
Просмотров 985 тыс.
Compilers, How They Work, And Writing Them From Scratch
23:53
Introducing 0DE5
39:38
Просмотров 88 тыс.
How computer processors run conditions and loops
17:03
Просмотров 108 тыс.
Z80 Assembly Language
1:44:45
Просмотров 16 тыс.
Assembly Basics: The Language Behind the Hardware
12:55
Understanding the Z80 Memory Map
14:12
Просмотров 31 тыс.
Мэджик! Смартфон 2-в-1!
0:48
Просмотров 761 тыс.