Subject: [stella] BASIC functions - ADR() From: Glenn Saunders <mos6507@xxxxxxxxx> Date: Fri, 8 Jul 2005 20:39:05 -0400 |
== Peek and poke could be done with inline asm, but it would be trivial to add them in as well. What does ADR do? == It's like a pointer. It returns the address of the variable. It's used all the time in BASIC for memory management. My old player missile graphics book for the Atari home computers did a lot of low-level memory type stuff that way with string buffers. One of the big problems with classic BASIC is that variables used for convenience in labeling take up RAM. 1 DIM A 2 A = 100 10 GOSUB A 100 PRINT "TEST" 101 RETURN In this case, if you hardcoded GOSUB A as GOSUB 100 then you save RAM, but you make your code less readable and harder to update in the case of renumbering. The only advantage here is if you changed A on the fly so that the GOSUB didn't always resolve to the same line number. But that's the exception, not the rule. You are mostly just storing a bunch of numbers in a RAM table as a programmer convenience and it's wasteful on a machine with only 128 bytes of RAM. So I think your kind of BASIC should allow the use of RAM-free aliases just as assembler does, which would be resolved at compile time and never actually use up RAM. In fact, I would try to just drop the line numbers completely, just as DASM doesn't use line numbers. Once you have labels that you can use for GOTO and GOSUB then you're pretty much covered as far as flow control goes. --------------------------------- Sell on Yahoo! Auctions - No fees. Bid on great items. Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://stella.biglist.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] 3E + interlace woes, B. Watson | Thread | RE: [stella] BASIC functions - ADR(, Fred Quimby |
Re: [stella] Atari 2600 BASIC compi, Kirk Israel | Date | RE: [stella] BASIC functions - ADR(, Fred Quimby |
Month |