6502 basics

MarcWalters
Member
Member
Posts: 55
Joined: Wed Jun 11, 2014 2:33 pm
Location: Lake Macquarie, NSW, Australia
Contact:

Re: 6502 basics

Post by MarcWalters »

Alas, Prime, you were hoping for opinions AND consensus! Unfortunately each of us has a slightly differing opinion on commenting and level of detail and word usage and formatting and capitalisation and voice and ...

I suggest you just write two different versions of the tutorial, one brief and the other containing plenty of detail. Some beginners will not need hand-holding, others will.


Prime

Re: 6502 basics

Post by Prime »

MarcWalters wrote:Alas, Prime, you were hoping for opinions AND consensus! Unfortunately each of us has a slightly differing opinion on commenting and level of detail and word usage and formatting and capitalisation and voice and ...

Ya no kidding Marc :)

I suggest you just write two different versions of the tutorial, one brief and the other containing plenty of detail. Some beginners will not need hand-holding, others will.
In all seriousness I won't be commenting as I did again,anyone with the desire to learn will have the material at hand be it a book or google to reference the instruction set.
dudz
Member
Member
Posts: 140
Joined: Tue Jun 17, 2014 5:40 am
Contact:

Re: 6502 basics

Post by dudz »

A loop counter is a variable
wat?
satpro

Re: 6502 basics

Post by satpro »

dudz wrote:
A loop counter is a variable
wat?
Man, please knock it off. That behavior sucks so much. Giving a guy shit about commenting code, x=x+1, "wat?" and all that crap. You did the same thing to a post of mine and more or less turned the post (a good one, too) into crap -- and don't think for a second I've forgotten and all is fine. Meanwhile, and while enjoying the comfort of an anonymous keyboard, your code upload level sits at "x = NULL".

So, how about some code (or at least a tutorial) from you? The first line could go like this: "A loop counter is a variable."
dudz
Member
Member
Posts: 140
Joined: Tue Jun 17, 2014 5:40 am
Contact:

Re: 6502 basics

Post by dudz »

if only you had understood the point. try reading the post i referred to again:
Prime wrote:
dudz wrote:
What should your comment be? So you end up putting x=x+1. Not a big deal in the larger context.
"increment loop counter" would be much more like it, IMHO
A loop counter is a variable so that statement is incorrect and misleading,i'll fix that for you

"Increment x register used as loop counter" ;)
that implies that the X register cant be a loop counter, because it is not a variable (and thus my suggested comment is "incorrect and misleading") - which is, frankly, bullshit - of course a register can keep a variable, only because you dont store it to memory, it does not mean its not one. and how much code i uploaded is completely irrelevant for that matter (and you have no idea of how much i contributed to various places anyway). much more important though, "increment x register" does not belong into the comment, just like "x=x+1" - because thats what the damned instruction does, and you can always look that up. in the comments belongs what the instruction does in the program, ie what you can not look up in the opcode reference.

and nowhere did i give that guy shit, i just suggested what i think is an improvement - which he asked for in the first place. i dont know what his background is, but this kind of comments are typical beginner mistakes - and thus shouldnt appear in a tutorial by all means.
Prime

Re: 6502 basics

Post by Prime »

Prime wrote:
dudz wrote:
What should your comment be? So you end up putting x=x+1. Not a big deal in the larger context.
"increment loop counter" would be much more like it, IMHO
A loop counter is a variable so that statement is incorrect and misleading,i'll fix that for you

"Increment x register used as loop counter" ;)
dudz wrote:
that implies that the X register cant be a loop counter, because it is not a variable (and thus my suggested comment is "incorrect and misleading") - which is, frankly, bullshit -
So me saying Increment x register used as (loop counter) is me implying x register can't be used as a loop counter?
satpro

Re: 6502 basics

Post by satpro »

The point is that you frequently criticize inconsequential, non-issues (the "comment point value" of x=x+1... a non-factoring cycle count in an article describing a generic loop for a stack frame, to name just two), ...and then casually toss in something like the comment about Prime's beginner commenting style -- which by the way, is a subjective luxury an author enjoys. And let's face it, if you're still farting around on a Commodore 64 and criticizing fellow programmers (and their code commenting style) in public, then you are a beginner yourself. Let's get serious here -- the guy is a professional programmer.

Crappy comments is no comments at all. After that is up to the author's fancy. The same goes for tutorials written in a little text box. It's real easy to sit on the outside looking in. You wanna be Stephen King? Fine, then be Stephen King... in your next tutorial. And enough already -- look where this thread has ended up. I forgot what it's about.
dudz
Member
Member
Posts: 140
Joined: Tue Jun 17, 2014 5:40 am
Contact:

Re: 6502 basics

Post by dudz »

So me saying Increment x register used as (loop counter) is me implying x register can't be used as a loop counter?
no. you said "that statement is incorrect and misleading" because "A loop counter is a variable" - and that is simply not the case. infact, making a difference between "a variable" and "a register" hardly ever makes sense at all (in 6502 code), because most of the time (on 6502 anyways) registers are (temporary and/or local) variables. if the register would hold a constant value, then it makes sense to put that into a comment. of course your comment is correct, and contains even more information even than what i suggested - but it again describes the "inx" instruction ("increment x register") which is not what a comment should do. as said before, good comments describe what happens in the context of the program, they dont describe what individual instructions or operations do (thats what an opcode reference is for). in this example perhaps "advance loop counter" or maybe "advance index" would be even better for matter, because thats really all that matters at this point. look at the next line for example:

Code: Select all

bne ClearScreenLoop  //if x register is not equal to zero goto ClearScreenLoop
this is trying to be precise, but ends up being slightly wrong and misleading. what the instruction does is "branch if zero flag is not set" (it does not care about the X register at all). so for that to make any sense, you'd have to put "increment X register, and set zero flag to 1 if the result is zero" as comment into the previous line (which is really over the top). hence reducing it to just "repeat until index overflows" or something like that is a better idea IMHO. infact, putting one comment "increment index and repeat until it overflows" over both lines would probably be even better. less is more :)

edit: MarcWalters already said it very well in his first post actually... except that you probably shouldnt really refer to richards tutorials (actually forget them =P)
Prime

Re: 6502 basics

Post by Prime »

You are incorrect and it is misleading! xregister is not a loopcounter it can be used as a loopcounter I did say increment x register used as loop counter.Look dudz I've ignored your personal attack and let it go.
You've hijacked my thread over a silly reason x = x +1 and made a comment increase loop counter which I corrected you on which I also put a smiley to let you know I was sorta joking at the same time.Now your nit picking again about bne.
Do you understand the concept of spoon feeding a person that doesn't know even what a variable is?That's what I was trying to do,why do you get so defensive?
I edited my first post with your definition of bne thanks for that.
I don't want to argue how about were both correct and incorrect that seem fair?
dudz
Member
Member
Posts: 140
Joined: Tue Jun 17, 2014 5:40 am
Contact:

Re: 6502 basics

Post by dudz »

yeah whatever. read MarcWalters post about a dozen times more, there is little to add to it left. if you can't see how it is not a good idea to comment "inx" with "x=x+1",then you should team up with satpro perhaps :)
Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 3 guests