Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #1923
| Newsgroups | comp.sys.apple2.programmer |
|---|---|
| Date | 2015-10-25 22:55 -0700 |
| References | <9106d3b6-6cd3-41d3-bec5-d604f093bd67@googlegroups.com> |
| Message-ID | <19f80cdf-b623-4cbc-a160-0e70ebc1bfef@googlegroups.com> (permalink) |
| Subject | Re: DA statement not registering after running compiled program. |
| From | John Brooks <jbrooks@blueshiftinc.com> |
On Sunday, October 25, 2015 at 9:59:44 PM UTC-7, jamesiw...@gmail.com wrote:
> It seems to me that the DA statement is somehow not registering.
>
> My code is:
> ORG $300
> LDA $6000
> STA $2000
> DONE RTS
> ORG $6000
> DA $FFFF
>
> I compiled this program, and Merlin shows correct compilation, with the values of memory addresses $6000 and $6001 both set to $FF.
>
> However, after I save the source and object code (after compiling), I leave the assembler, switch to HGR and BRUN the program. There should be a white line in the upper left corner of the screen. There are pixels plotted there, but not a white line. It seems to be pulling other values from $6000 and $6001 than what my DA statement should put in those addresses. Even after going to the monitor and examining $6000 and $6001, neither are $FF.
>
> Anyone have any idea what is going on here? It seems that there's possibly some point about how program memory is saved which I am missing here.
The good news is that Merlin is working 'as designed' and the problem is easily fixed.
You want to create two separate obj segments, but Merlin only creates one obj by default.
If you look at your saved obj file, you'll find the 7 bytes where were ORGd at $300 at the beginning of your obj file, followed by the 2 $FFFF bytes you ORGd at $6000.
Merlin's default behavior is what programmers often want as they org code to different runtime locations (IE language card, $300, screens, etc) and then relocate the various segments at runtime.
The fix is simply to have Merlin create two obj files:
ORG $300
LDA $6000
STA $2000
DONE RTS
SAV OBJ1
ORG $6000
DA $FFFF
SAV OBJ2
Now when you catalog the disk, you should see a 7-byte OBJ1 with A$300, and a 2-byte OBJ2 with A$6000.
HTH,
-JB
Back to comp.sys.apple2.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
DA statement not registering after running compiled program. jamesiwalker77@gmail.com - 2015-10-25 21:59 -0700 Re: DA statement not registering after running compiled program. John Brooks <jbrooks@blueshiftinc.com> - 2015-10-25 22:55 -0700 Re: DA statement not registering after running compiled program. Benoit0123 <bgilon@free.fr> - 2015-10-26 10:08 +0000 Re: DA statement not registering after running compiled program. "Anton Treuenfels" <teamtempest@yahoo.com> - 2015-10-26 08:49 -0500 Re: DA statement not registering after running compiled program. jamesiwalker77@gmail.com - 2015-10-26 10:23 -0700
csiph-web