Another thing that might be worth considering is to use the SAVE and LOAD commands instead of LIST and ENTER, which are much harder to get right. Since these commands work with a tokenized format, the resulting file should be smaller, which likely means it will be processed faster as well. I'm not sure if it's customary to use a different extension than SRC for this format, but I've seen M65 used before.
The DATMOV routine did not work properly because what is stored at address $600 is a string, and the routine code only starts after the string ends. The .BYTE directive simply places bytes in memory one after the other, it's up to you to decide if they are meant to be interpreted as code or data. What happens when you tell the 6502 to start executing code at $600 is that it will interpret the characters of the string as instructions, which for all practical purposes is garbage. Atari roots seems like a good book so far, but I think this example doesn't help the reader very much. Doesn't seem like it explains anywhere that after you assemble a program MAC/65 will print the addresses of all the labels it contains, so you are supposed to start executing at the address that is displayed for the routine name. An alternative to this is to always put the main routine at the start of the listing, so there is no ambiguity as to where in memory it will end up. In this particular case, the string could be placed at the end of the listing, right after the RTS opcode and before the .END directive. In the case where the program worked properly is likely because the string was very short, so it only executed a few instructions that didn't make it branch somewhere else in memory nor stomp the string. You could confirm this by stepping through the program in the debugger from the very first instruction, it should execute maybe two or three garbage instructions and then the program counter will match with the first real instruction of the program, so the garbage it executed before is of no consequence.
@@STN-t5k aha ! That does explain it ! Yes, it was one of those examples that we weren’t meant to fully understand which I find a bit irritating sometimes :) thanks for the explanation !
Zero page addressing is one of the ways that the 6502 compensates for having so few registers. Indexed indirect addressing is probably the least useful mode, but indirect indexed addressing is super useful for doing array lookups and the like. I don't think I ever came across a good reason to use indexed indirect addressing, though I'm sure there's some reason to want to be able to address random bits of memory based off of an index register.
Another thing that might be worth considering is to use the SAVE and LOAD commands instead of LIST and ENTER, which are much harder to get right. Since these commands work with a tokenized format, the resulting file should be smaller, which likely means it will be processed faster as well. I'm not sure if it's customary to use a different extension than SRC for this format, but I've seen M65 used before.
The DATMOV routine did not work properly because what is stored at address $600 is a string, and the routine code only starts after the string ends. The .BYTE directive simply places bytes in memory one after the other, it's up to you to decide if they are meant to be interpreted as code or data. What happens when you tell the 6502 to start executing code at $600 is that it will interpret the characters of the string as instructions, which for all practical purposes is garbage.
Atari roots seems like a good book so far, but I think this example doesn't help the reader very much. Doesn't seem like it explains anywhere that after you assemble a program MAC/65 will print the addresses of all the labels it contains, so you are supposed to start executing at the address that is displayed for the routine name. An alternative to this is to always put the main routine at the start of the listing, so there is no ambiguity as to where in memory it will end up. In this particular case, the string could be placed at the end of the listing, right after the RTS opcode and before the .END directive.
In the case where the program worked properly is likely because the string was very short, so it only executed a few instructions that didn't make it branch somewhere else in memory nor stomp the string. You could confirm this by stepping through the program in the debugger from the very first instruction, it should execute maybe two or three garbage instructions and then the program counter will match with the first real instruction of the program, so the garbage it executed before is of no consequence.
@@STN-t5k aha ! That does explain it ! Yes, it was one of those examples that we weren’t meant to fully understand which I find a bit irritating sometimes :) thanks for the explanation !
Zero page addressing is one of the ways that the 6502 compensates for having so few registers. Indexed indirect addressing is probably the least useful mode, but indirect indexed addressing is super useful for doing array lookups and the like. I don't think I ever came across a good reason to use indexed indirect addressing, though I'm sure there's some reason to want to be able to address random bits of memory based off of an index register.