Search found 183 matches

by Garth
Wed Jan 18, 2017 10:35 pm
Forum: Newbie Help Center
Topic: Reset handler/reset vector confusion?
Replies: 51
Views: 10785

Re: Reset handler/reset vector confusion?

Regarding the macro allowing varying numbers of input parameters to set or clear flags: Once that list of flags grows enough, you loose the space you save by not clearing the RAM in a loop. That's if it's practical to keep them together, for loop indexing. You might want to keep them separate though...
by Garth
Wed Jan 18, 2017 2:17 pm
Forum: Newbie Help Center
Topic: Reset handler/reset vector confusion?
Replies: 51
Views: 10785

Re: Reset handler/reset vector confusion?

You can create macros like this in ca65 too. I do it all the time. I'm not familiar with ca65. Does it allow making macros that don't require a given number of input parameters? (just to confirm.) Most assemblers require that every macro invocation use the exact number of parameters specified in th...
by Garth
Wed Jan 18, 2017 12:25 pm
Forum: Newbie Help Center
Topic: Reset handler/reset vector confusion?
Replies: 51
Views: 10785

Re: Reset handler/reset vector confusion?

The beginning of the program should initialize most variables [1] whether that's the reset routine or a program that is started after the reset routine runs. Initializing does not mean zeroing them all. Some will need to be flags that start out set, not clear. Some variables need to contain addresse...
by Garth
Fri Jan 13, 2017 2:46 pm
Forum: General Stuff
Topic: How organized are your PC files?
Replies: 17
Views: 3429

Re: How organized are your PC files?

I'm rather OCD about it, so they're pretty organized but I'm never happy with it. To reply to rainwarrior's post without quoting: Rather O.T.; but I keep thinking about this as I aim toward making up some sort of simple file system to implement with tiny flash modules in a 6502 computer, a system wh...
by Garth
Sat Dec 31, 2016 1:16 pm
Forum: Newbie Help Center
Topic: Check whether there is a value in the array
Replies: 4
Views: 1414

Re: Check whether there is a value in the array

I want to check if the number or not in an array how i can done? This sentence does not really make sense. It sounds like you want to see if a particular number is in the array; but your code looks like you just want to copy the array. To just copy it, assuming it's ok to go in the reverse order to...
by Garth
Wed Dec 21, 2016 1:14 pm
Forum: General Stuff
Topic: Advice on entry level oscilloscopes
Replies: 11
Views: 3974

Re: Advice on entry level oscilloscopes

The following is from the oscilloscope section of the " Basic Workbench Equipment " chapter of my 6502 primer . An oscilloscope is not an absolute necessity, but it's awfully good to have. If you can afford one, then it's a necessity! :D Basic new ones seem to start around $350. It needs to be at le...
by Garth
Tue Dec 20, 2016 2:35 pm
Forum: Newbie Help Center
Topic: What is the Processor Status, and why is it important?
Replies: 12
Views: 3162

Re: What is the Processor Status, and why is it important?

rainwarrior wrote:A PHP / PLP bookending an IRQ routine won't clear the flag, though. The IRQ itself will set I, so such a PLP can only set the flag, not clear it.
Ah, you're right. Limit it only to SEI and CLI. I edited my first post above.
by Garth
Tue Dec 20, 2016 2:13 pm
Forum: Newbie Help Center
Topic: What is the Processor Status, and why is it important?
Replies: 12
Views: 3162

Re: What is the Processor Status, and why is it important?

I re-able interrupts in the HuC6280 inside of interrupt routines. I just set flags to indicate that what level of interrupt is already processing (in which case if another of the same level call happens, it just bails out each time until the flag is clear). It's the only way I can juggle three inte...
by Garth
Mon Dec 19, 2016 8:52 pm
Forum: Newbie Help Center
Topic: What is the Processor Status, and why is it important?
Replies: 12
Views: 3162

Re: What is the Processor Status, and why is it important?

Since the interrupt sequence pushes the processor status register, and that will normally include the I interrupt-disable bit clear, do not bracket the ISR with PHP and PLP (nor SEI and CLI). Why? Because these will then have the effect of re-enabling interrupts before the RTI; and if another interr...
by Garth
Sat Dec 17, 2016 9:36 pm
Forum: Newbie Help Center
Topic: Random Stupid Questions I Think Of
Replies: 20
Views: 7138

Re: Random Stupid Questions I Think Of

4. Are there any situations when programming the NES where (indirect,x) addressing would come in handy? (ZP,X) gets used a lot in virtual stacks, where the virtual stack (a data stack, separate from the return stack) is in ZP, and X is the index into it, and stack cells often have addresses. This i...
by Garth
Sat Dec 17, 2016 9:15 pm
Forum: Newbie Help Center
Topic: Help with NMI and Game Logic
Replies: 25
Views: 5496

Re: Help with NMI and Game Logic

You can gan go 129 bytes forward and 126 bytes backward. It should be -127 - 128 but for whatever reason the people who designed the 6502 fucked up with the microcode. I believe this is also responsible why the address pushed onto the stack when jumping to a subroutine is off by 1. The 6502 does no...
by Garth
Sat Dec 17, 2016 7:13 pm
Forum: Newbie Help Center
Topic: Calling Convention
Replies: 5
Views: 2173

Re: Calling Convention

In my 6502 stacks treatise, chapter 14 is on local variables and environments at http://wilsonminesco.com/stacks/loc_vars.html, and, following naturally, is chapter 15 on recursion at http://wilsonminesco.com/stacks/recurse.html . You can do it!
by Garth
Sat Dec 17, 2016 6:43 pm
Forum: Newbie Help Center
Topic: IF/ELSE in assembly
Replies: 3
Views: 1859

Re: IF/ELSE in assembly

There are different ways to handle this. But to start, note that there's an automatic, implied, built-in compare-to-0 in every instructions that loads or affects A, X, or Y; so there's no need for CMP #0 after LDA. Also, if it's a chain of comparisons against successive numbers, you can increment or...
by Garth
Mon Dec 05, 2016 12:20 pm
Forum: Newbie Help Center
Topic: trouble with JMP and program counter.
Replies: 4
Views: 1602

Re: trouble with JMP and program counter.

I answered your PM before seeing this topic. Feel free to repeat it here if you like. I suppose some readers will be fascinated by the internal details as we figure it out, and others won't be until there's there's something finished and tested. Are you using the ams6 assembler? (I think that's what...
by Garth
Thu Dec 01, 2016 12:56 pm
Forum: Newbie Help Center
Topic: Question about smoothly handling multiple loops in asm.
Replies: 33
Views: 8317

Re: Question about smoothly handling multiple loops in asm.

I get up this morning and find a whole lot of new posts here. I'm glad this idea has quickly generated this level of interest here! It's refreshing, because what I've found in the past is that it's hard to get people past their preconceived notions and keep their attention long enough to clarify tha...