Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #2009

Re: Secret Shame? Reading Source Code

Newsgroups comp.sys.apple2.programmer
Subject Re: Secret Shame? Reading Source Code
From Michael J. Mahon <mjmahon@aol.com>
References <n4es54$pps$1@dont-email.me> <017be5b1-68a5-426c-884a-f01e2686308b@googlegroups.com> <n4hbcc$1m8$1@dont-email.me> <WYCdnbTAV8FBBPHLnZ2dnUVZ5hQAAAAA@giganews.com> <n4k5pi$gk7$1@dont-email.me>
Message-ID <fvidnf23F-YDNPDLnZ2dnUVZ5umdnZ2d@giganews.com> (permalink)
Date 2015-12-13 11:23 -0600

Show all headers | View raw


ultramagnus_tcv <mikew@thecomputervalet.com> wrote:
> On 2015-12-12 22:04:12 +0000, Michael J. Mahon said:
> 
>> It's not really so mysterious--take heart!  ;-)
> 
> Ah! Heh. I find your coming in here quite nice. A wizard appears! ;-)
> 
>> Assemblers mostly differ in fairly trivial ways, such as the mnemonics
>> chosen for "pseudo ops" that are *not* machine instructions, but
>> instructions to the assembler to reserve data space, define constants, or
>> control the listing.  The syntax for describing arithmetic/logical
>> expressions as operands may also differ, both in operators used (+, -, ^
>> [exor], etc.) and in complexity of operations permitted.
> 
> Yes, I think I understand that. My only experience is with Merlin and 
> the earliest one at that. So, I've been introduced to a lot of the 
> concepts, psuedo ops among them. I haven't peeked at any other 
> assemblers except for bringing up EDASM one time in a virtual 
> environment and realizing how different it was from Merlin.
> 
>> In the example you give, the pseudo-op is "dw", which stands, as you
>> guessed, for "double word"--in this case, a two-byte data item. Its operand
>> is an expression which is evaluated as a 16-bit quantity by the assembler,
>> then used as the (initial) value of the two-byte field.
> 
> Roger.
> 
>> In this case, the
>> value is the value of the symbol LDR.ADR minus the value of the symbol
>> K.DRIVES, which is apparently $0062.
> 
> This is something new for me, Symbols. I take it there is a symbol 
> table that is not part of this PDF?

Most likely, the listing you are looking at is not the complete assembly
listing, but just a part. The symbols that are apparently undefined are
defined (either as labels or as "equ"s) elsewhere in the complete listing. 

Even if the program is created from separately assembled modules that are
linked together, each module listing would have pseudo-ops that specify
which symbols are "imported" from other modules or "exported" to other
modules.

>> The leftmost field of virtually every assembly line is an optional label,
>> which gets defined as the current value of the location counter, which
>> corresponds to the address of the first generated byte (if any) for this
>> line.
>> 
>> So, for each assembly line:
>> 
>> <optional label>  <op/pseudo-op>  <optional operand expression>  <;
>> optional comment>
>> 
>> And each listing line is the source line preceded by:
>> 
>> <current location counter> <generated data> <source file line number>
>> 
>> The <generated data> may be truncated to a few bytes to keep the listing
>> down to one line per source line, but it's all still there in the object
>> code file.  (This "unlisted" data is one thing that could lead to incorrect
>> results if the hex visible in the listing is just typed into the monitor.)
> 
> Ok. So, in this case, we have the assembly source but not necessarily 
> the object code (or symbol table) that could be used to assemble SOS 
> from scratch? Does that mean this particular source is incomplete?

Yes, exactly. 

> Thanks again, Michael (and everyone else). This is really helping.
> 

Excellent!  

Keep at it, and it will all make sense. ;-)

You may have already done it, but a careful reading of the Apple II Monitor
ROM listing (which *is* complete) will prove very rewarding.
-- 
-michael - NadaNet 3.1 and AppleCrate II:  http://michaeljmahon.com

Back to comp.sys.apple2.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Secret Shame? Reading Source Code ultramagnus_tcv <mikew@thecomputervalet.com> - 2015-12-11 10:06 -0600
  Re: Secret Shame? Reading Source Code Chris Torrence <gorthmog@gmail.com> - 2015-12-11 08:50 -0800
    Re: Secret Shame? Reading Source Code ultramagnus_tcv <mikew@thecomputervalet.com> - 2015-12-12 08:38 -0600
      Re: Secret Shame? Reading Source Code Michael J. Mahon <mjmahon@aol.com> - 2015-12-12 16:04 -0600
        Re: Secret Shame? Reading Source Code Michael J. Mahon <mjmahon@aol.com> - 2015-12-12 16:10 -0600
        Re: Secret Shame? Reading Source Code ultramagnus_tcv <mikew@thecomputervalet.com> - 2015-12-13 10:21 -0600
          Re: Secret Shame? Reading Source Code Michael J. Mahon <mjmahon@aol.com> - 2015-12-13 11:23 -0600
            Re: Secret Shame? Reading Source Code ultramagnus_tcv <mikew@thecomputervalet.com> - 2015-12-13 11:41 -0600
          Re: Secret Shame? Reading Source Code dempson@actrix.gen.nz (David Empson) - 2015-12-14 08:15 +1300
            Re: Secret Shame? Reading Source Code Michael J. Mahon <mjmahon@aol.com> - 2015-12-13 17:16 -0600
            Re: Secret Shame? Reading Source Code Jeff Blakeney <CUTjeffrey_blakeney@yahoo.ca> - 2015-12-13 18:17 -0500
              Re: Secret Shame? Reading Source Code Michael J. Mahon <mjmahon@aol.com> - 2015-12-13 17:39 -0600
              Re: Secret Shame? Reading Source Code m.omalley.au@gmail.com - 2016-01-24 02:26 -0800
                Re: Secret Shame? Reading Source Code Michael J. Mahon <mjmahon@aol.com> - 2016-01-24 10:45 -0600
                Re: Secret Shame? Reading Source Code wssimms@gmail.com - 2016-01-24 15:20 -0800
                Re: Secret Shame? Reading Source Code Michael J. Mahon <mjmahon@aol.com> - 2016-01-24 23:33 -0600
                Re: Secret Shame? Reading Source Code wssimms@gmail.com - 2016-01-25 05:01 -0800
                Re: Secret Shame? Reading Source Code Michael J. Mahon <mjmahon@aol.com> - 2016-01-25 16:29 -0600
    Re: Secret Shame? Reading Source Code michael.pohoreski@gmail.com - 2016-01-27 07:09 -0800
  Re: Secret Shame? Reading Source Code wssimms@gmail.com - 2015-12-11 18:02 -0800
    Re: Secret Shame? Reading Source Code awanderin <awanderin@gmail.com> - 2015-12-11 23:01 -0700
      Re: Secret Shame? Reading Source Code Michael Pohoreski <michael.pohoreski@gmail.com> - 2016-01-28 12:33 -0800
        Re: Secret Shame? Reading Source Code Michael Barry <barrym95838@yahoo.com> - 2016-01-28 22:50 -0800
          Re: Secret Shame? Reading Source Code wssimms@gmail.com - 2016-01-29 02:04 -0800
          Re: Secret Shame? Reading Source Code Michael J. Mahon <mjmahon@aol.com> - 2016-01-29 13:58 -0600
          Re: Secret Shame? Reading Source Code Michael Pohoreski <michael.pohoreski@gmail.com> - 2016-01-29 16:10 -0800
          Re: Secret Shame? Reading Source Code Michael Pohoreski <michael.pohoreski@gmail.com> - 2016-01-29 16:15 -0800
            Re: Secret Shame? Reading Source Code Brian Patrie <bpatrie@bellsouth.spamisicky.net> - 2016-01-31 03:50 -0600
  Re: Secret Shame? Reading Source Code michael.pohoreski@gmail.com - 2016-01-25 11:03 -0800
  Re: Secret Shame? Reading Source Code michael.pohoreski@gmail.com - 2016-01-25 11:04 -0800
  Re: Secret Shame? Reading Source Code michael.pohoreski@gmail.com - 2016-01-27 07:14 -0800
    Re: Secret Shame? Reading Source Code ultramagnus_tcv <mikew@thecomputervalet.com> - 2016-04-29 19:33 -0500

csiph-web