|
Post by Maxim on Jun 3, 2008 10:43:37 GMT
In Zaks, or wherever you got that from, they mean there are "some number" of registers and you can consider that they are all addressable, hence "registers 0 to N" - there are N+1 in total, and programmers like to start counting at zero. (Although saying "0 to n-1" would be more common.) It certainly doesn't mean there are 24 registers labelled 0, 1, .. 8, 9, A, B, ... , M, N.
|
|
|
Post by Stan on Jun 3, 2008 22:27:54 GMT
Oh, I see N as in byte. He gets a little confusing with some of his term usage at times, but yeah, that's where I got that nibble.
|
|
|
Post by Stan on Jun 6, 2008 1:06:49 GMT
Got some more pages written, just need to upload pictures and such before putting them up (one at a time, of course). I hope it reads better now, I did a massive reconstruction of the previous pages up to where you see on the site. Right now I've figured out how to manipulate background color. Wow, I'm so advanced. By the way, and this is directed mainly at Bock or Maxim, does anyone know if there is a list for SMS sounds related to middle C? It would be a good idea if there was such a thing, so one could write music within the parameters of the SMS and THEN program it.
|
|
|
Post by Stan on Jun 10, 2008 2:53:26 GMT
Well, finished up the next section where you get to make love to the stack. I also, in case you missed the post, went through and changed a bunch, condensing information and making corrections where Maxim pointed out some areas that needed clarified. This should be getting easier for you guys, and we're reaching the end of this part of the tutorial. About four pages left total, and then we'll get into a section with instruction set references to ALL the functions you can do with the Z80 (not explained fully in any way, just provided so you can print them out and such). After this, the programming begins, referring back to the instruction set section so you can understand as you go. That's really the only way to do it, no sense explaining all two million quadrillion instructions before you even use them.
|
|
|
Post by Maxim on Jun 10, 2008 18:39:45 GMT
OK, here goes... Stacks are often represented as shown, it's a fairly standard diagram. I think I mentioned earlier the clichéd "deck of cards" analogy. An email inbox is a very poor analogy. I can sort it any way I like, and the emails can leave my inbox at random. It's just a list, not a stack. The cards analogy is better. My preferred analogy is the ticket spikes they used to have in cinemas, except I imagine it nailed to the ceiling because it grows downwards. But that's a bit weird and out of date, I guess. Describing subroutines as a side issue when discussing the stack seems wrong. Subroutines are a much more important core concept that you ought to have discussed before this if you think they need explaining. Switching animals in Psycho Fox is not at all like calling a subroutine. Interrupts are conceptually the same as subroutines, except they're "forced" by external triggers, and interrupt the normal flow of the code - hence the name. So as far as the stack is concerned, they're no different, just a return address on the stack. However, from my experience, the concept of interrupts is quite hard to grasp (I avoided using them for a long time) and is best left until later, and dealt with on its own - after subroutines. The Pause button triggers an interrupt, but all other inputs do not. Temporary data storage on the stack is not particularly fast, not much faster than storing it to RAM the hard way (ld opcodes). Talking about return addresses here is confusing - this is supposed to be a separate usage of the stack. Other instructions that interact with the stack are call, ret[in]? and rst. Since the stack grows downwards, pushing decrements SP and popping increments it. If I "put data on top of" some other data, doesn't that mean I've overwritten it? You need to be very clear here. When you push, SP is decremented by 2 bytes and the data is stored in RAM at the new address and the byte after it. Popping reads from (SP) and (SP+1) and then adds 2 to SP. Reading data and changing SP is rolled up into a single instruction but it's not magic, the microcode is doing the two parts in order. The two-subroutine stack example confused me a lot. I think it all makes a lot more sense with worked examples, with code. But then I'm biased that way If you want to keep it at a higher level for now, I suggest you work with pseudocode. Something like 1 set A = 3 2 push A 3 call function "double" 4 pop A ... function "double": 100 set A = A x 2 101 return and track the stack, and the contents of A, throughout. Make an animated GIF if you like. If you want to make it more realistic, make the stack grow downwards, and show the value of SP at the same time.
|
|
|
Post by Stan on Jun 10, 2008 18:57:51 GMT
Awesome. Yeah, I thought about the email thing when I first wrote it, and in fact had in there something like 'unless you organize it differently,' but I was trying to save space. I'll think of something else. What's a good example of a subroutine then? That was the first thing that popped in my head. I'll fix these things later tonight. Again, I'm being brief in some instances because I'm quite soon going to be showing real examples, I just want basic ideas out there in this part because it's mainly architecture and such. Don't want to introduce opcodes before going over the hardware, and when we finally get to them in the next section (which I'm starting to write now), I can use real examples so readers get a feel for how a subroutine or what not actually works. Thanks for all the help, I really need someone like you to read this stuff over and pick out mistakes and areas I need to elaborate more on.
|
|
|
Post by Stan on Jun 12, 2008 1:47:46 GMT
Alright, all finished. Need to fine tune a few things, but that's the total package of information you need to understand the Z80 and how it works. Next, we're going to get to programming! I'll be starting with a brief explanation of algorithims, tree diagrams, the instruction set and then basic programs. As before, any complaints or corrections, let me know here by posting away.
|
|
|
Post by Bock on Jun 12, 2008 7:36:40 GMT
What are tree diagrams anyway?
|
|
|
Post by Stan on Jun 12, 2008 14:56:57 GMT
I think they're more commonly referred to as flowcharts.
|
|
|
Post by Stan on Jun 18, 2008 4:16:08 GMT
Well, almost done with the preliminary shite for the basic programming section. Thus far I have an intro, assembly jarble page and basic assembly. I was hoping to hear more about the tech stuff I put up from users who this is all new to, but at least Maxim and Bock gave me the spiderpig slapping. Anyway, it will be up soon.
|
|
|
Post by Stan on Jun 18, 2008 16:41:18 GMT
Alright, got the basics all down. Here's what I need. I've posted already at SMSpower here about it, but if you want to post away here, feel free. I'm working on the full (or at least which ones are necessary) directive and opcode list for the Master System. Each of them will be linked to pages that explain what they are and how they work with simple examples. If you want to chip in, please feel free, otherwise I'll write it all myself. I figured this would be the perfect time to get others involved.
|
|
|
Post by Stan on Jul 4, 2008 14:26:43 GMT
Well, got a bunch of stuff written. I just need to add some pictures and fine tune a few issues. Sorry for the delay if you've been waiting, I recently took a tutoring job so I've pretty much been writing a book for that.
|
|
|
Post by Stan on Aug 13, 2008 19:49:05 GMT
Phew, well, before I put up the assembly section, I'm going to flesh out the background code tutorial part some more. Maxim has been helping me out, explaining certain things and I have a little problem I'm going to solve before going further with it. I don't want to put up the assembly section just yet.
|
|
|
Post by Stan on Nov 19, 2008 14:21:45 GMT
Just a bit of an update for anyone who's been wondering. Once this semester is over I'm going to put up the next sections I have ready to go. They're just going to be some basic stuff about working on simple programming maps and then your first program (background color). I'm getting some more help from two other people who want to contribute a little to the project, so after that I'm going to decide what's the next logical step. Probably just going to be a simple background program and how to write your own, but I haven't completely decided.
|
|
|
Post by Stan on Dec 12, 2008 7:16:23 GMT
Thanks for all the help so far. I just added the 'Programming' section to the main site navigation page. It just links to the article, but it's visible as a selectable part of the site now instead of within the articles list. Now that my time is more open and Chinese isn't killing me and raping my mind, I can finally get the pages I've had sitting here for awhile up. In the next few weeks I'll get the assembly section going and a few other things I've had in wait.
|
|