Search found 215 matches

by Garth
Fri May 05, 2017 8:27 pm
Forum: NESdev
Topic: Thinking about writing a BASIC interpreter
Replies: 15
Views: 5580

Re: Thinking about writing a BASIC interpreter

Although I've never used EhBASIC, it did appear to be an outstanding BASIC for 6502 when I looked into it years ago. Unfortunately the originator, Lee Davison, died unexpectedly a few years ago; but it has been kept available by others. See it at http://web.archive.org/web/20120913042809/http://myco...
by Garth
Sat Apr 29, 2017 2:48 pm
Forum: NESdev
Topic: Indirect addressing without index possible?
Replies: 9
Views: 2677

Re: Indirect addressing without index possible?

The 65c02 (CMOS) has the (ZP) addressing mode (ie, without the indexing); but something you can do for the NMOS 6502, if the code is in RAM instead of ROM, is to do self-modifying code where you make the pointer variable be the operand of the instruction itself. This has the added benefits of speed ...
by Garth
Fri Apr 21, 2017 9:15 pm
Forum: NESdev
Topic: Push arguments to stack
Replies: 23
Views: 7131

Re: Push arguments to stack

Let me see if I can pseudo code that... LDA #var 3 PHA LDA #var 2 PHA LDA #var 1 PHA For conciseness (since I'm a macro junkie), you could make macros to synthesize the 65816's PEA, PEI, and PER instructions (which stand for "Push Effective Absolute," "Indirect," and "Relat...
by Garth
Fri Apr 21, 2017 8:38 pm
Forum: NESdev
Topic: Push arguments to stack
Replies: 23
Views: 7131

Re: Push arguments to stack

LDA abs,X. Interesting. Let me see if I can pseudo code that... LDA #var 3 PHA LDA #var 2 PHA LDA #var 1 PHA TSX STX stackP ;stack pointer JSR subR Leave the TSX for the subroutine, so it is only done there and not in every place that calls it. The $1XX numbers will be a little different because of...
by Garth
Fri Apr 21, 2017 2:58 pm
Forum: NESdev
Topic: Push arguments to stack
Replies: 23
Views: 7131

Re: Push arguments to stack

That works; but note that if you do that, nesting routines requires that you push the ZP indirect address onto the stack and restore it at the end (in addition to pushing and pulling the index register). LDA abs,X does not require any variable space, and it takes one less cycle than LDA (ZP),Y. In t...
by Garth
Fri Apr 21, 2017 9:48 am
Forum: NESdev
Topic: Push arguments to stack
Replies: 23
Views: 7131

Re: Push arguments to stack

I know this topic is a year old, but the material is always valuable. If you need more than just A, X, and Y, passing parameters via the page-1 hardware stack or a virtual stack in ZP or elsewhere in memory can work very well and have major benefits over using static variables. The 6502 stacks treat...
by Garth
Thu Apr 20, 2017 6:44 pm
Forum: Other Retro Dev
Topic: Development Languages
Replies: 50
Views: 28109

Re: Development Languages

Is it only concern about speed that prevented people from using higher-level languages? or the lack of tools, perhaps? I remember seeing some game for the NES here was made with cc65's C compiler, and it didn't (seem) to have speed issues. Are you kidding ? I tried to make a program that basically ...
by Garth
Thu Apr 20, 2017 2:52 am
Forum: NESdev
Topic: Any way to avoid getting stuck in code?
Replies: 15
Views: 9605

Re: Any way to avoid getting stuck in code?

Very good advice above. I would comment that no matter how experienced you are, it is easy to lose control of a project if you don't always try, even from the beginning, to always be more structured, more neat, improve your commenting, etc.. I've been a macro junkie since about 1986 or '87. Macros c...
by Garth
Thu Apr 20, 2017 2:36 am
Forum: NESdev
Topic: Function params & local vars using a stack in ASM6
Replies: 35
Views: 15667

Re: Function params & local vars using a stack in ASM6

I'm not familiar with ASM6, but I'll be watching this topic with interest. My 6502 stacks treatise addresses local variables in section 14, at http://wilsonminesco.com/stacks/loc_vars.html, and in the middle of the page I express a wish for being able to do something in macros to create and destroy ...
by Garth
Mon Apr 17, 2017 10:48 am
Forum: Newbie Help Center
Topic: Question about smoothly handling multiple loops in asm.
Replies: 33
Views: 11166

Re: Question about smoothly handling multiple loops in asm.

To make sure it's clear:
A branch that is taken normally takes 3 clock cycles, but it's 4 if it crosses a page boundary. Most branches do not cross page boundaries.
by Garth
Sun Apr 09, 2017 2:38 pm
Forum: Newbie Help Center
Topic: Is there an easier way to do this?
Replies: 38
Views: 9040

Re: Is there an easier way to do this?

I'm not familiar with your assembler, but you can probably set the line width for the .lst file so you don't get annoying wraps. I set mine to 160, the width in compressed mode for my dot-matrix printer which I use for programming because I want the fanfold paper and not split program structures at ...
by Garth
Wed Apr 05, 2017 10:35 am
Forum: Newbie Help Center
Topic: Is there an easier way to do this?
Replies: 38
Views: 9040

Re: Is there an easier way to do this?

I used the tab character a lot when memory and disc size were a lot more limited; but more recently I've set my editor's (MultiEdit) options to use spaces to bring me up to the next tab column when I press the tab key. It's more of a pain when you want to backspace over it, since you have to backspa...
by Garth
Tue Apr 04, 2017 10:27 pm
Forum: Newbie Help Center
Topic: Is there an easier way to do this?
Replies: 38
Views: 9040

Re: Is there an easier way to do this?

Thanks. I just ask because ASM6 is not one of the several assemblers I've used, but it seem that everyone using it puts labels on their own lines, increasing the number of lines required to write your code, and adding sometimes-undesirable breaks.
by Garth
Tue Apr 04, 2017 4:26 pm
Forum: Newbie Help Center
Topic: Is there an easier way to do this?
Replies: 38
Views: 9040

Re: Is there an easier way to do this?

Does ASM6 really require labels to be on their own line, with nothing following on the same line??
by Garth
Tue Apr 04, 2017 1:27 pm
Forum: Newbie Help Center
Topic: How to use the stack?
Replies: 7
Views: 2540

Re: How to use the stack?

I have a treatise on 6502 stacks (plural, not just the page-1 hardware stack) at http://wilsonminesco.com/stacks/ . For your situation, you'll find a lot of help even if you only read the first page or two. Hopefully you'll get enthused and keep going though. It has 19 chapters plus appendices. Ther...