Added CSS-counter based auto line-numbering to code samples. Rather delightfully, it doesn't interfere with copy/paste at all, unlike some other websites which come to mind.
Yay!

I'm pleased that it turned out to be as simple as it did (requiring very little lexer support).
That's partly because I special cased the first line instead of trying to do it "right".
Is the WIP version complete enough for reading? If so, can someone please compile it for me? Smile I'm not able to install pandoc.
I'm having a very hard time compiling the .md files. I already have pandoc installed. I clicked on the make.bat file and it opened up command prompt and said can't find the external file.
Ploppz wrote:
Is the WIP version complete enough for reading? If so, can someone please compile it for me? Smile I'm not able to install pandoc.


Yep! We haven't deleted any of the stuff from the original, just enhanced it. Tari helpfully hosts an up-to-date version of the compiled guide right here.
Awesome!

I have some questions. Day 2, 10: Directives. There is shown a Hello world example, and some parts are explained. However, I don't find "text .equ number" in the source code. And lastly: Should'nt .EQU be used in the sample code, instead of "#define ProgStart $9D95"? Since $9D95 is a number.
Ploppz wrote:
Awesome!

I have some questions. Day 2, 10: Directives. There is shown a Hello world example, and some parts are explained. However, I don't find "text .equ number" in the source code. I'm also confused what ".equ" means.
In Brass and SPASM, .equ, =, and #define are all more or less interchangeable, although this was not true with the old and outdated TASM.
Quote:
Is it a variable name I can define myself?
Yes, same as = and #define.
Quote:
And lastly: Should'nt .EQU be used in the sample code, instead of "#define ProgStart $9D95"? Since $9D95 is a number.
Nope, they're interchangeable.
I'm a bit confused here: http://media.taricorp.net/83pa28d/lesson/day05.html#structures

First off, I would first assume the third block of code to be in assembly, but it's obviously not. Maybe you should clarify that, because as mentioned earlier, .EQU is the same as =. So my immediate thought was "huh? Are they now putting data where they were previously putting meta-data?"

In the fourth code block, you first use "length", and then "CD.length". Is this a typo?

On line 11 and 12 in the fourth code block, you define the CD attributes. .DB "Pulse" etc. But isn't it strict that the first attribute needs to be 32 bytes? I don't think .DB "Pulse" puts 32 bytes there, so then, the other attributes don't reside where you'd expect them to?
Ploppz wrote:
I'm a bit confused here: http://media.taricorp.net/83pa28d/lesson/day05.html#structures

First off, I would first assume the third block of code to be in assembly, but it's obviously not. Maybe you should clarify that, because as mentioned earlier, .EQU is the same as =. So my immediate thought was "huh? Are they now putting data where they were previously putting meta-data?"
This is how you define structures in C, C++, and similar languages. It's just an analogy for now; you're not expected to actually compile this code in any form.

Quote:
In the fourth code block, you first use "length", and then "CD.length". Is this a typo?
This is how you access the members of a structure. Take a look at the Wikipedia entry on structures for some clarification.

Quote:
On line 11 and 12 in the fourth code block, you define the CD attributes. .DB "Pulse" etc. But isn't it strict that the first attribute needs to be 32 bytes? I don't think .DB "Pulse" puts 32 bytes there, so then, the other attributes don't reside where you'd expect them to?
That's correct; it puts only five bytes there. That example is confusingly written, and I'll try to make it clearer at some point.
Thanks.

The second answer: I'm wondering why both length and CD.length is used. Should "length" be substituted with "CD.length" in the example, as a typo, or is "length" something different than "CD.length"?

The third answer: How do you fill in the missing bytes? Do you somehow move the program counter forward?
Ploppz wrote:
The second answer: I'm wondering why both length and CD.length is used. Should "length" be substituted with "CD.length" in the example, as a typo, or is "length" something different than "CD.length"?
Yeah, that's an error. The CD.* constants are defined, then ignored.

Ploppz wrote:
The third answer: How do you fill in the missing bytes? Do you somehow move the program counter forward?
Depending on your assembler, yes. The simplest version is just something like

Code:
.db 0, 0, 0, 0, 0, ...
but that's no fun to type and a pain to change. More usefully, there's .block and .fill to generate blocks of data.

I've fixed up that section with these clarifications.
Ah, awesome! One more question: Why .db "Pulse", 0? Why the 0?

Edit: Ah, I saw that note about null-terminating and read about it. However, doesn't .BLOCK insert zero's? What kind of bytes does .BLOCK insert?
The values inserted by .block are unspecified. It'll probably be zeroes in most cases, but it would be bad form to depend on that. If you need a specific value, use .fill.
I'm here now http://media.taricorp.net/83pa28d/lesson/day08.html#signed-comparisons

In my understanding, the guide says that Parity is whether or not the number of set bits is even or odd - so I'll go by that. And Overflow is whether the sign bit has changed.

Now first, I'm having a hard time deducing myself from S == P/V to A >= num.

I see that S == Overflow means that the sign bit was 0 before CP/SUB, and S != Overflow means that the sign bit was 1 before CP/SUB, but going from there I can't see how you can tell that A>=num. (This is just a matter of understanding the number theory)

The second thing I'm wondering:

Code:

    SUB    -5
    JP    PO, $+5    ; P/V reset, and XORing with zero does nothing
    XOR   $80
; Can now use M for <, or P for >=

Why $+5? How do you know where you're going to land? I can't at least see that at a glance. Also, what does "M" mean? It can be the 'condition' argument of JP/JR, but P can't be that (it's either PE or PO).
Ploppz wrote:

The second thing I'm wondering:

Code:

    SUB    -5
    JP    PO, $+5    ; P/V reset, and XORing with zero does nothing
    XOR   $80
; Can now use M for <, or P for >=

Why $+5? How do you know where you're going to land? I can't at least see that at a glance. Also, what does "M" mean? It can be the 'condition' argument of JP/JR, but P can't be that (it's either PE or PO).


See: http://media.taricorp.net/83pa28d/ref/z80is.html

"$+5" is "current Program Counter + 5". To know where you're going to land, you need to know how big the instructions are.


Code:
jp cc,imm16
is a three-byte opcode. jp PO, is 0xE2 followed by the address to jump to.


Code:
xor imm8
is a two-byte opcode, 0xEE followed by the value you're XORing.

Thus jp PO,$+5 lands just after the xor.
Might I suggest removing the relative offsets for jumping in a beginner's tutorial guide? It adds unnecessary complexity and makes it less readable.
I think it should be discussed somewhere, though. It's used a lot and is helpful for learning/remembering how big each instruction is.

EDIT: As for readability, i prefer:

Code:
  cp 7
   jr c,$+3
     inc a
  cp 17
   jr c,$+3
     inc a
  cp 27
   jr c,$+3
     inc a
;...
to:

Code:
  cp 7
   jr c,skip1
     inc a
skip1:
  cp 17
   jr c,skip2
     inc a
skip2:
  cp 27
   jr c,skip3
     inc a
skip3
;...


EDIT2: In day 8, i believe the "AND 2n-1" should be "AND 2^n-1".
Day2: Registers aren't mentioned
lennartVH01 wrote:
Day2: Registers aren't mentioned
..so?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
» Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
» View previous topic :: View next topic  
Page 5 of 8
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement