Omnimaga

Calculator Community => TI Calculators => ASM => Topic started by: _Nicco_ on February 18, 2013, 03:17:39 am

Title: Learning z80 ASM
Post by: _Nicco_ on February 18, 2013, 03:17:39 am
Hey guys, I just bought a TI-84+SE from ebay and I would really like to learn z80 assembly.

I currently know of the 28 day tutorial thing but do you guys have any tips to get me started?

I think I can handle assembly since it wont be my first language and I think I'm a quick learner.

Also quick question.  Isn't assembly an interpreted language, so do you need to modify the text file before sending it to the calculator?  What I'm trying to say is that there is no compiler or something like that right?
Title: Re: Learning z80 ASM
Post by: Matrefeytontias on February 18, 2013, 03:40:12 am
ASM in 28 days is a nice starting point, you don't have to know anything in ASM before learning with it.

Also quick answer : assembly is a compiled language (assembled in fact), so you have to compile your *.z80 files into *.8xp files before sending them to your calc (everything's explained in ASM in 28 days) . An alternative is to use the on-calc assembler Mimas (http://www.ticalc.org/archives/files/fileinfo/431/43140.html) to edit and assemble your programs directly on-calc.
Title: Re: Learning z80 ASM
Post by: chickendude on February 18, 2013, 03:55:12 am
CoBB's tutorial is pretty good: http://sgate.emt.bme.hu/patai/publications/z80guide/

Other than that, here's what i wrote at Cemetech:
Some things that can be helpful to understand to be able to start writing fun games quickly:
-indirection
-what buffers are and why/how to use them
-direct input
-tilemapping
-how the LCD is mapped: 1 byte = 8 pixels. This complicates drawing individual pixels a bit but means your sprites will be much smaller in size.
-bit shifting commands, absolutely necessary once you want to start making games that scroll smoothly and also very useful for optimizing
-storing and accessing data in tables

Assembly uses an assembler, i use spasm. Essentially you just run the source file through spasm and it outputs a .8xp. The assembly mnemonics correspond directly with the z80s commands, the assembler just converts the mnemonics into assembly opcodes (hex) as well as making a lot of other things easier for you, for example calculating addresses so you don't need to count how many bytes there are to jump to the right address and lots more.

If you have any questions, please ask! I don't think it's as difficult as people think (it was my first language, after English) it just takes a little while to get used to thinking differently.
Title: Re: Learning z80 ASM
Post by: Keoni29 on February 18, 2013, 04:18:53 am
Quote
it was my first language, after English
I had to learn English first XD
Title: Re: Learning z80 ASM
Post by: _Nicco_ on February 18, 2013, 08:43:08 pm
Alright.  I was told by a couple people to use the DoorsCS sdk as my assembler.  Can someone help me out with that?

What do I need to run it?  I noticed that inside the tasm folder there was a .py file.  Does that mean that I need to install python to run this?  If I do which version is recommended?
Title: Re: Learning z80 ASM
Post by: Geekboy1011 on February 18, 2013, 08:52:22 pm
Yea you will need python. Eaither version wotks thankfully so go with your preferance if your not coding python go with thr smaller one :p
Title: Re: Learning z80 ASM
Post by: DJ Omnimaga on February 20, 2013, 04:15:09 am
(it was my first language, after English)

I thought it was the other way around?? O.O

Anyway I think both ASM and BASIC are incredibly hard if you get very used to the opposite and are the kind of person to have serious troubles adapting to changes that drastic. (Like any other change for that matter). Another problem was Asm in 28 days, because when it was written it didn't take into account that there are people who can only learn languages with examples of programs that actually do stuff and animated screenshots of the programs in action. The TI-BASIC section of the 83+ manual had a similar problem, but not as bad. This is why some people prefered ASMGuru approach, but sadly it's TI-82 STATS/83-only. Thankfully, Hot_Dog's ASM guide for the absolute beginner fixed that gap, though, along with Axe which acts as a bridge between BASIC and ASM sort-of.
Title: Re: Learning z80 ASM
Post by: TIfanx1999 on February 20, 2013, 06:48:56 am
Yea ASM in 28 days assumes you already have some computer programming experience IIRC, and it's a lot more technical.
Title: Re: Learning z80 ASM
Post by: Scipi on February 20, 2013, 11:40:26 am
Hot_Dog's tutorials was what finally nailed in certain concepts for me, like registers and flags. I know enough of the basics to understand assembly, at least.
Title: Re: Learning z80 ASM
Post by: _Nicco_ on February 20, 2013, 11:31:14 pm
I do have some programming experience.  I'm trying out 28 days and if I get lost there then I'll also try Hot_Dog's.  I haven't learned basic so that Might be  + if what DJ_O says is true.
Title: Re: Learning z80 ASM
Post by: DJ Omnimaga on February 21, 2013, 01:27:48 am
Well I didn't say no programming BASIC at all, but rather that if you program it for several months intensively and get too used to it, then you might have problems if you are the kind of person to have troubles getting rid of certain habits.
Title: Re: Learning z80 ASM
Post by: _Nicco_ on February 21, 2013, 01:41:22 am
What's the difference between Spasm and Brass?

Is one better than the other or are they just two programs that work just as well?
Title: Re: Learning z80 ASM
Post by: DJ Omnimaga on February 21, 2013, 04:21:07 am
It depends of your preferences. Spasm used to be much more popular until Doors CS7 SDK (which uses Brass) arrived. Kerm have really tried hard to convince people to go with the latter so today more people use that one. You might want to wait until someone with more experience tells the pros *and* cons of each, though, to make your choice.

Some people still use TASM, though, since that's all we had from 1999 to 2006 (back when ASM was at its peak), but it's very rudimentary, buggy and it doesn't run on 64-bit OSes.
Title: Re: Learning z80 ASM
Post by: Spyro543 on February 21, 2013, 09:09:14 am
I tried to learn ASM too, but I found that SPASM doesn't work on my (64-bit) computer. Maybe I'll have better luck with Brass (where can I get it)?
Title: Re: Learning z80 ASM
Post by: harold on February 21, 2013, 09:15:25 am
Here: http://benryves.com/products/brass
Title: Re: Learning z80 ASM
Post by: chickendude on February 21, 2013, 09:36:17 am
To me, Brass seemed much more complicated. Spasm is super fast, has powerful macro support, and can compile about anything easily (except maybe nostub TI-83 programs). Brass has lots of features and seems to be good for organizing your code. Use whichever one you like, i chose Spasm because it's faster and more lightweight, plus your code can be compiled on Linux/Windows/Mac. If you use certain features of Brass you might be limited to Windows, unless you want to reformat the file to be "spasm-compatible". Actually, my claim that Spasm is faster is based off of when i used Brass several years ago, so that might not be correct anymore. I don't know if Brass has seen much development since then but it's still a very powerful assembler (i think it can even rle compress your data for you). I just know that Spasm can compile a 40kb (final on-calc size) project importing lots of .bmps in the blink of an eye, which you'd realize how amazing that is if you'd ever used TASM before :D

And i don't think anyone still uses TASM anymore, it's a pain just to get it to run and the other alternatives (namely, Brass and Spasm) are much more convenient and feature-rich.

As to which one to use? You pick, it'll probably be the first one you get working. :P DJ_O says most people use Brass nowadays, and maybe that's true, but apart from Kerm and probably Benryves, i don't really know of anyone else. Maybe it's because a lot of the assembly programmers i speak to don't use Windows and have no other choice or maybe because the format feels closer to what we were used to with TASM or maybe just 'cuz it's so straightforward, i dunno. If you're going to start a huge project you might like some features of one over the other that let you organize your code more easily, but really it's not going to make that much of a difference: the assembled output will be exactly the same using both assemblers ;)
Title: Re: Learning z80 ASM
Post by: _Nicco_ on February 23, 2013, 11:49:30 am
Ah alright.  Thanks.

Right now I started using Brass and have yet to check out spasm.  I'll probably just stick with Brass for now
Title: Re: Re: Re: Learning z80 ASM
Post by: DJ Omnimaga on February 24, 2013, 02:49:03 pm
To me, Brass seemed much more complicated. Spasm is super fast, has powerful macro support, and can compile about anything easily (except maybe nostub TI-83 programs). Brass has lots of features and seems to be good for organizing your code. Use whichever one you like, i chose Spasm because it's faster and more lightweight, plus your code can be compiled on Linux/Windows/Mac. If you use certain features of Brass you might be limited to Windows, unless you want to reformat the file to be "spasm-compatible". Actually, my claim that Spasm is faster is based off of when i used Brass several years ago, so that might not be correct anymore. I don't know if Brass has seen much development since then but it's still a very powerful assembler (i think it can even rle compress your data for you). I just know that Spasm can compile a 40kb (final on-calc size) project importing lots of .bmps in the blink of an eye, which you'd realize how amazing that is if you'd ever used TASM before :D

And i don't think anyone still uses TASM anymore, it's a pain just to get it to run and the other alternatives (namely, Brass and Spasm) are much more convenient and feature-rich.

As to which one to use? You pick, it'll probably be the first one you get working. :P DJ_O says most people use Brass nowadays, and maybe that's true, but apart from Kerm and probably Benryves, i don't really know of anyone else. Maybe it's because a lot of the assembly programmers i speak to don't use Windows and have no other choice or maybe because the format feels closer to what we were used to with TASM or maybe just 'cuz it's so straightforward, i dunno. If you're going to start a huge project you might like some features of one over the other that let you organize your code more easily, but really it's not going to make that much of a difference: the assembled output will be exactly the same using both assemblers ;)
I think Iambian still uses TASM. As for Brass popularity I know that Kerm tried very hard to convince people to use it in the past since DCS SDK, which he setup, relies on Benryves ASM tools.
Title: Re: Learning z80 ASM
Post by: chickendude on February 25, 2013, 12:30:27 am
Iambian might use TASM, but i think they also use spasm. The E:SoR source compiles with spasm, at least. But i guess it doesn't really matter, what is more important is getting started writing cool stuff :D
Title: Re: Learning z80 ASM
Post by: DJ Omnimaga on February 25, 2013, 12:58:03 am
Ah ok. From what I remember, he said he stuck with TASM for very long because he already setup a lot of things on his ASM environment that only worked with TASM, so he didn't switch except maybe for certain projects.

Otherwise there might be the ones who started TI programming in the late '90s but are hardcore old-school purists who love command lines and will never ever use anything with a GUI. :P

TASM is really unreliable, though. It takes several seconds to compile HELLO WORLD and it has several bugs such as not supporting common bcall syntaxes and the No END directive before EOF. If I was still dedicated to calc programming and decided to learn ASM again, I would use modern tools.
Title: Re: Learning z80 ASM
Post by: Geekboy1011 on February 25, 2013, 01:02:18 am
Iambian Uses spasm for all of his projects now. As for brass or spasm i prefer brass but its what i am used to useing currently from all of the dcs work i have been doing. And i likes its feature set and really good documentation. which i find spasm lacking. but thats just me good luck _nicco_!
Title: Re: Learning z80 ASM
Post by: tpt1234567890 on October 29, 2013, 12:13:13 am
ASM in 28 days is a nice starting point, you don't have to know anything in ASM before learning with it.

Also quick answer : assembly is a compiled language (assembled in fact), so you have to compile your *.z80 files into *.8xp files before sending them to your calc (everything's explained in ASM in 28 days) . An alternative is to use the on-calc assembler Mimas (http://www.ticalc.org/archives/files/fileinfo/431/43140.html) to edit and assemble your programs directly on-calc.

I used this to learn how to use ASM
Title: Re: Learning z80 ASM
Post by: willrandship on October 29, 2013, 12:21:21 am
Mimas isn't as featureful, though, and has the same problems with program corruption Axe does. Not their fault, but be careful when you only have source files on one volatile device.
Title: Re: Learning z80 ASM
Post by: tpt1234567890 on October 29, 2013, 12:23:00 am
Mimas isn't as featureful, though, and has the same problems with program corruption Axe does. Not their fault, but be careful when you only have source files on one volatile device.

I agree wholely. Make sure your codes are correct before running them (They could crash your calculator)
Title: Re: Learning z80 ASM
Post by: Streetwalrus on October 29, 2013, 11:27:24 am
If you knew how many times I crash my calc in a minute when I code in Axe. :P
Title: Re: Re: Learning z80 ASM
Post by: DJ Omnimaga on October 29, 2013, 11:30:33 am
Thankfully, DCSE8 lets me edit programs from archive without having to run them first (then ON Break them). I wish DCS7 was updated with that feature. Or there is Zstart that does it, right? That said, be careful about archive corruption as well. X.x
Title: Re: Learning z80 ASM
Post by: Sorunome on October 29, 2013, 11:44:22 am
yeah, zstart lets you edit programs out of archive from the program editor :)
Title: Re: Learning z80 ASM
Post by: willrandship on October 29, 2013, 01:57:13 pm
DCS7 lets you do it too, just not from the homescreen.
Title: Re: Learning z80 ASM
Post by: tpt1234567890 on October 29, 2013, 05:06:43 pm
DCS7 lets you do it too, just not from the homescreen.

Interesting. I never knew about that! SHould be useful!