Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #1922 > unrolled thread
| Started by | jamesiwalker77@gmail.com |
|---|---|
| First post | 2015-10-25 21:59 -0700 |
| Last post | 2015-10-26 10:23 -0700 |
| Articles | 5 — 4 participants |
Back to article view | Back to comp.sys.apple2.programmer
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
| From | jamesiwalker77@gmail.com |
|---|---|
| Date | 2015-10-25 21:59 -0700 |
| Subject | DA statement not registering after running compiled program. |
| Message-ID | <9106d3b6-6cd3-41d3-bec5-d604f093bd67@googlegroups.com> |
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.
[toc] | [next] | [standalone]
| From | John Brooks <jbrooks@blueshiftinc.com> |
|---|---|
| Date | 2015-10-25 22:55 -0700 |
| Message-ID | <19f80cdf-b623-4cbc-a160-0e70ebc1bfef@googlegroups.com> |
| In reply to | #1922 |
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
[toc] | [prev] | [next] | [standalone]
| From | Benoit0123 <bgilon@free.fr> |
|---|---|
| Date | 2015-10-26 10:08 +0000 |
| Message-ID | <benoit0123-1445854213@macgui.com> |
| In reply to | #1922 |
jamesiwalker77 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. > Below is an amended source code w/o having to deal with two separate object code that should also work. And yes, the Merlin assembler works as designed and is a great tool. ORG $0300 LDX #DATEND-DATBEG-1 ]LOOP LDA DATBEG,X STA $6000,X DEX BPL ]LOOP * Now you can play as if data was @ $6000 LDA $6000 STA $2000 DONE RTS DATBEG ORG $6000 DA $FFFF * The following ORG restore the original assembly PC (adjusted by the amount * of code assembled since the ORG $6000 directive above). ORG DATEND -- Growing old is mandatory.. growing up is optional.. But the other way round is as true.
[toc] | [prev] | [next] | [standalone]
| From | "Anton Treuenfels" <teamtempest@yahoo.com> |
|---|---|
| Date | 2015-10-26 08:49 -0500 |
| Message-ID | <xPidnYOP9abFsrPLnZ2dnUU7-IednZ2d@earthlink.com> |
| In reply to | #1922 |
<jamesiwalker77@gmail.com> wrote in message
news:9106d3b6-6cd3-41d3-bec5-d604f093bd67@googlegroups.com...
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.
===============
What Merlin is showing you is the value of its internal program counter when
each statement was assembled. This lets you verify that it is what you
expect (and it is).
But this does not have anything to do with how the result is loaded into the
machine. Your output is one block of code, and that one block is loaded to
one address. Most often that is what programmers want. If they want
something different, they have to arrange for it themselves.
If you really want to keep one block but still separate the code and data by
that much, another way to do it would be to fill up all space between the
two existing blocks with a meaningless value using a repeat loop. Of course
when loaded that would also fill the hires screen with whatever that value
happened to be, as that lies between $300 and $6000.
Or you could drop the idea of separating the code and data by putting the
data right after the code.
- Anton Treuenfels
[toc] | [prev] | [next] | [standalone]
| From | jamesiwalker77@gmail.com |
|---|---|
| Date | 2015-10-26 10:23 -0700 |
| Message-ID | <60d3cc87-23ba-4b65-88f4-7292d0a206aa@googlegroups.com> |
| In reply to | #1922 |
Thanks, everyone, for your answers.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.sys.apple2.programmer
csiph-web