Like in this C# code:
Code: Select all
foo = 5;
bar = 7;
foo = bar;
qux = foo;
Moderator: Moderators
Code: Select all
foo = 5;
bar = 7;
foo = bar;
qux = foo;
Indeed, but I mean what would the result show upon? A hilarious glitches, or the decisions would be ignored, or crashes?The wrong values will go to the wrong variables, decisions will be made based on the wrong conditions, causing the logic you tried to implement to fail.
The specific result will follow the logic of whatever you actually told it to do.DocWaluigean wrote:Indeed, but I mean what would the result show upon? A hilarious glitches, or the decisions would be ignored, or crashes?
Because there is no sources for 6502 programming tutorials in my taste and acknowledge, and there's no love or fun ways to learn programming languages of 6502 Assembly in English without grammar screw-ups, or mis-translation. If you look about many sites in English (At least from my perspective), there isn't any feelings of effort of love. It's only business writing to make the employees understand how programming concepts work on things "far more better to do than to make inprofitable children's toys." in old days. If I tried to do the fun ways, I'd get the info much worse then I were years ago, and I'm sure as heck be criticized as bad as Joe Cracker for getting many information wrong in case I want to teach the newcomers.Kasumi wrote:Like I said, the other countries like Japan has made coding really fun, and I feel we're really behind if lesser-grammar people can't understand the US style.
I'm curious what makes you think this is true. If you know Japanese enough to understand they make coding fun, then you why not just follow the better, more fun ways to learn? If you don't know Japanese, how are you sure it's any different?
I'll try soon again. I had the Easy6502, and I disliked the informations they are speaking, and going wrong directions. And after the "Introduction" list, I gave up few days after when it shows no result. All I keep getting is "LDA and STA is a color palette code." years ago.Kasumi wrote:I realize I've mentioned it a dozen times already, but could you please try easy6502? It allows you to just try things and see what happens. Even if you don't even read it, you can still use it to look at exactly what happens with each instruction.
The gif stops showing what happens with the mouse at stx $0704 because I didn't set up the memory viewer to go that far down. Still, it should demonstrate how one can run code instruction by instruction and follow along.
Edit: The reason I keep saying this is because rather than asking about abstract concepts, you can ask about exact behavior. The difference is between
"Does this do what I expect it to do?"
And,
"This doesn't do what I expected it to do, can you help me understand why?"
You're asking about the concepts which isn't exactly a problem, but tools exist to let you play directly with the CPU. Why aren't you trying them? I'm not asking to be snarky. Is there something about the tool you're having trouble with or don't understand?
As mush as I would agree with you if I was on everyone's level, things get complex when I put A and 1 and # and other characters together like playing with 3D toys fitting in a hole. The thing is everyone has style of learning abilities that in some cases, it's always omitted during lectures, which result in F in school stuff.Sumez wrote:That's one major difference between coding assembly, and coding high level languages.DocWaluigean wrote:It's my fault for not replying or read-and-think, and attempting to re-read it. But why is nearly every information has to be written so difficult?
The high level languages (especially super abstracted stuff like C# and Java) is designed by humans to be read by humans. They are better at making sense at a more straight forward level.
When you are writing machine code, you are talking the computer's language. And when stuff is designed for computers to do it most effectively, it might not always be the straightforward way humans expect. For example, this is why the A register can do a lot of stuff that the X and Y registers can.
Honestly, it's not really that complex, you just need to get into it. Get some hands-on experience. Once you get used to the quirks and limitations, you'll be able to apply human logic to your project.
Somewhat consequentially.pubby wrote:Do you understand variables, DocWaluigean?
Like in this C# code:What would the values of foo, bar, and qux be after running this?Code: Select all
foo = 5; bar = 7; foo = bar; qux = foo;
Code: Select all
5
7
False.
False.
Code: Select all
5
7
False.
[color=#BF0000][[[Insert Error and Shut Down Comments Here.]]][/color]
I'll take it as hilarious glitches or crashes. Thanks!rainwarrior wrote:The specific result will follow the logic of whatever you actually told it to do.DocWaluigean wrote:Indeed, but I mean what would the result show upon? A hilarious glitches, or the decisions would be ignored, or crashes?
THIS is going to take a while for me to think. It'll be edit...Kasumi wrote:Let's switch up the thinking. Easy6502/Nerdy Nights were written for beginners. Keeping that in mind, they already tried to cover things down to the teeniest tiniest examples. They're not trying to show off or lose you. They're trying to help you.
Now, if you don't understand them, it doesn't mean the tutorials are bad. Indeed, they may just not suit your learning style. But the thing I'm trying to figure out is what kind of lesson are you expecting? In my mind, easy6502 is what you're describing. So how specifically is it failing you? "I disliked the information." Why? "going wrong directions" How? "I gave up few days after when it shows no result." What did you try specifically that got no result?
All you have to do to progress is be specific about what you want, and be specific about what you don't understand. Programming is literally all about being as specific as possible. I can't help you if you don't tell me what the problem is. And I genuinely don't know what the problem is.
All I want is your questions. If I mention easy6502 (lots of times) and then you don't use it and also don't ask about your issues with it, what do you actually want? Some resource that's "better"? I'm not in the business of offering solutions that aren't the best that I know!
I truly believe easy6502 is the best resource for you right now. It's fine if you don't get it, I'm happy to answer questions about it. But if you don't read it, or don't ask questions about what I consider the best resource, what else can I do? If you were me in this situation, trying to help you, what would you do? What do you want?
*** Response ***Kasumi wrote:Let's switch up the thinking. Easy6502/Nerdy Nights were written for beginners. Keeping that in mind, they already tried to cover things down to the teeniest tiniest examples. They're not trying to show off or lose you. They're trying to help you.
Now, if you don't understand them, it doesn't mean the tutorials are bad. Indeed, they may just not suit your learning style. But the thing I'm trying to figure out is what kind of lesson are you expecting? In my mind, easy6502 is what you're describing. So how specifically is it failing you? "I disliked the information." Why? "going wrong directions" How? "I gave up few days after when it shows no result." What did you try specifically that got no result?
All you have to do to progress is be specific about what you want, and be specific about what you don't understand. Programming is literally all about being as specific as possible. I can't help you if you don't tell me what the problem is. And I genuinely don't know what the problem is.
All I want is your questions. If I mention easy6502 (lots of times) and then you don't use it and also don't ask about your issues with it, what do you actually want? Some resource that's "better"? I'm not in the business of offering solutions that aren't the best that I know!
I truly believe easy6502 is the best resource for you right now. It's fine if you don't get it, I'm happy to answer questions about it. But if you don't read it, or don't ask questions about what I consider the best resource, what else can I do? If you were me in this situation, trying to help you, what would you do? What do you want?
Please, tell me if you understand what I mean with specific after saying what my mind wants.All you have to do to progress is be specific about what you want, and be specific about what you don't understand. Programming is literally all about being as specific as possible. I can't help you if you don't tell me what the problem is. And I genuinely don't know what the problem is.
There are a lot of things you can do only with A, such as add, subtract, shift/rotate... but multiplication is something the 6502 doesn't do out if the box at all. If you need multiplication, you'll need to implement a multiplication algorithm using shifting and addition.DocWaluigean wrote:A can increment by more than one, whether adding and multiplying, right?
They're the same as A in the sense that they all hold 8-bit values and can be loaded and stored, but other than that they're meant for different purposes.And X and Y only increment by only one, otherwise, same as A, right?
That's not easy to predict, it will depend on all the code that came before and all the code that'll come after. If you wanted to put 5 in a variable, but ended up putting 10, the consequence of that will depend on what this variable is used for at a later time. It may represent the speed of a character's jump, in which case the character will jump higher than he normally would, or it may be the index of an entry in a jump table, in which case the wrong destination would be jumped to and the program would crash. It's hard to predict all the ramifications of a bug.Indeed, but I mean what would the result show upon? A hilarious glitches, or the decisions would be ignored, or crashes?
Offensive to the CPU? Well, it is a dumb piece of hardware... It can only execute a few commands, and will blindly follow whatever orders you give it. If that's not the definition of dumb, I don't know what is!Before other comments, I feel that's offensive with "think like dumb CPU"...
Sorry dude but that's incorrect. All variables end up equal to 7.DocWaluigean wrote:The values of those depends. It goes two ways:
foo will be shown as 5. bar will be shown as 7. There's a complete differences between " = " and " == " Either way, it possibly be converted into Boolean Logic and result in false, because 5 does not equal to 7. qux has no value, so by system's potential default, it'll be assign as "0" because it has no value. I forgot in some code cases, it will be 1. So by that idea, it will also be result in false because 0 [1?] does not equal to 5. So its either this...
oh, I think I understand what you mean.tokumaru wrote:There are a lot of things you can do only with A, such as add, subtract, shift/rotate... but multiplication is something the 6502 doesn't do out if the box at all. If you need multiplication, you'll need to implement a multiplication algorithm using shifting and addition.DocWaluigean wrote:A can increment by more than one, whether adding and multiplying, right?
They're the same as A in the sense that they all hold 8-bit values and can be loaded and stored, but other than that they're meant for different purposes.And X and Y only increment by only one, otherwise, same as A, right?
That's not easy to predict, it will depend on all the code that came before and all the code that'll come after. If you wanted to put 5 in a variable, but ended up putting 10, the consequence of that will depend on what this variable is used for at a later time. It may represent the speed of a character's jump, in which case the character will jump higher than he normally would, or it may be the index of an entry in a jump table, in which case the wrong destination would be jumped to and the program would crash. It's hard to predict all the ramifications of a bug.Indeed, but I mean what would the result show upon? A hilarious glitches, or the decisions would be ignored, or crashes?
Offensive to the CPU? Well, it is a dumb piece of hardware... It can only execute a few commands, and will blindly follow whatever orders you give it. If that's not the definition of dumb, I don't know what is!Before other comments, I feel that's offensive with "think like dumb CPU"...
The CPU doesn't work anything like a human, so you can't expect it to know what you want it to do based on context, you have to break down each task in tiny little bits that the CPU is capable of handling.
For example, as a grown-up, you can easily understand the command "make a ham sandwich", but a young kid may not know how to do that, so you'll have to break that task in smaller tasks that the kid does know how to do. You may have to go "take a slice of bread", "put it on the plate", "take a slice of ham", "put it on the bread", and so on, until the whole sandwich is done. Working with the 6502 is the same thing: it only "knows" how to do a handful of things, so whenever you need to do something more complicated than it can handle, you have to break it down into smaller tasks that it can do.
?pubby wrote:Sorry dude but that's incorrect. All variables end up equal to 7.DocWaluigean wrote:The values of those depends. It goes two ways:
foo will be shown as 5. bar will be shown as 7. There's a complete differences between " = " and " == " Either way, it possibly be converted into Boolean Logic and result in false, because 5 does not equal to 7. qux has no value, so by system's potential default, it'll be assign as "0" because it has no value. I forgot in some code cases, it will be 1. So by that idea, it will also be result in false because 0 [1?] does not equal to 5. So its either this...
I really think you should learn more programming before diving into the 6502. Get to the point where you can write actual programs that do useful things. The skills will transfer.
Right now, all of this is flying over your head because of fundamental misunderstandings. Registers, for example, are really similar to variables. If you don't understand variables, you're not going to understand registers. And it's easier to learn variables in an easy to use language, like C#.
Best of luck.
The PL (programming language) was stated as C# in pubby's example. Let's circle back to the actual question: viewtopic.php?p=223961#p223961DocWaluigean wrote:This stuff I'm talking about is from BASIC programming languages.
A:What would the values of foo, bar, and qux be after running this?Code: Select all
foo = 5; bar = 7; foo = bar; qux = foo;
This is incorrect, as pubby stated. Regardless of the PL. Here's how it works, in linear order at runtime:Somewhat consequentially.
The values of those depends. It goes two ways:
foo will be shown as 5. bar will be shown as 7. There's a complete differences between " = " and " == " Either way, it possibly be converted into Boolean Logic and result in false, because 5 does not equal to 7. qux has no value, so by system's potential default, it'll be assign as "0" because it has no value. I forgot in some code cases, it will be 1. So by that idea, it will also be result in false because 0 [1?] does not equal to 5. So its either this...
Code: Select all
FOO = 5
BAR = 7
FOO = BAR
QUX = FOO
Code: Select all
FOO = 5
BAR = 7
IF FOO = BAR THEN ...
IF QUX = FOO THEN ...
Code: Select all
foo = $00 ; Memory location $00
bar = $01 ; Memory location $01
qux = $02 ; Memory location $02
lda #5
sta foo ; foo = 5
lda #7
sta bar ; bar = 7
lda bar
sta foo ; foo = bar
lda foo
sta qux ; qux = foo
My native tongue [Language I was born with] is Mexican Spanish... but I speak primarily with English most of my life. Personal issue-wise, I'm not really good with English, same thing with Spanish. Able to speak fluent English doesn't mean I know English grammar completely well... My forms of communication is very complex. I could draw every picture, and it could make more sense than what I'm talking right now...koitsu wrote: Finally: Easy6502 is mentioned because it provides a really easy way, via a web page, for someone to write 6502 code and "understand" it, with a way of doing visuals to indicate results. Its debugger is a bit "meh, I agree, but that's where the "coloured dots on the screen" aspect comes in handy. For truth statements (ex. "is bar == 7?"), you can for example say "if false, draw a blue dot. if true, draw red dot". Then you know what's true/false. A good debugger can make this possible too, but Easy6502 doesn't have that.
P.S. -- And I meant this with utmost respect (I myself do English/Chinese/little Korean/little Swedish): I get the impression there's a language barrier here. Am I wrong? If English isn't your native tongue, then what is? We have TONS of multi-lingual folks here (examples: Portuguese, Spanish, French, German, Swedish, Danish, Finnish, Dutch, Japanese, Chinese, and some Russian) who can help.
Why do you think this will go differently? What I mean by that is, if I were to tutor you, I would be telling you to do exactly what I'm telling you to do in this thread. You'd be putting things into easy6502's debugger. The only difference would be you could get answers to questions immediately.If I were you, I would try to find someone who I hope I can successfully convince, like Shiru, Dahrkdaiz, etc. to tutor me,
Code: Select all
lda #$01
sta $08
lda #$02
sta $0200
lda #$01
sta $05FF
There is a white dot all the way down and right.Kasumi wrote:Why do you think this will go differently? What I mean by that is, if I were to tutor you, I would be telling you to do exactly what I'm telling you to do in this thread. You'd be putting things into easy6502's debugger. The only difference would be you could get answers to questions immediately.If I were you, I would try to find someone who I hope I can successfully convince, like Shiru, Dahrkdaiz, etc. to tutor me,
But you've gotten answers to questions on this thread pretty immediately when you've asked them too.
I understand your complaints about easy6502's tutorial. (Which... I didn't write? I'm not sure if you think I wrote easy6502.)
But ignoring that. Honestly, here is my ideal situation: That you are able to run 6502 code, on your own, and see exactly what happens. Here are the steps to do that:
Go the website: https://skilldrick.github.io/easy6502
Ignore all the text on it. Find one of the debugger windows. Do the following:
Delete all existing text in it.
TypeCheck "Monitor"Code: Select all
lda #$01 sta $08 lda #$02 sta $0200 lda #$01 sta $05FF
Click "Assemble".
Check "Debugger"
Click Run.
Tell me what happens in the black box in the right.
Code: Select all
0000: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 d3