Re: Aw: Re: [stella] OT: Programming, CS theory

Subject: Re: Aw: Re: [stella] OT: Programming, CS theory
From: Chris Wilkson <ecwilkso@xxxxxxx>
Date: Fri, 26 Oct 2001 15:21:28 -0400 (EDT)
On Fri, 26 Oct 2001, Glenn Saunders wrote:

> If we're talking about syntax, what I dislike the most about assembly syntax
> vs. high level languages is how hard it is to visualize the differences
> between a plain old label and a subroutine.

What difference?  :P

> So if you have a big subroutine it's hard to differentiate the natural
> startpoint from internal labels used by loops and branching stuff.

What I do...well...first, my code is SMALL.  And I tend to not use subroutines,
but...what I do when I *do* use a subroutine, is I gives it a name.  Then
the insertion points have numerical subscripts.  Another method that I use,
and I think this will help you, is to use a "Current routine:calling routine"
format.  For example, if I had a routine called FOO and I jumped into the
middle of it from something called BAR, I'd label the insertion point FOO_BAR.
This of course gets crazy fast, which is why I tend to just use numerical
subscripts.  "FOO_start", "FOO_001", "FOO_002", etc.

But the thing that will help you (and others), more than anything else, is
commenting.  We all know that, but I like to say it anyway.  Because knowing
is a lot different than doing.

> It's also a little hard to think of a subroutine as not having to have a
> singular startpoint.  You can seek into and JSR into any line of a
> subroutine you want.  You can't do that in any other language I know of.

If it helps, think of it as an implied GOTO statement.  So the first entry
isn't really a subroutine.  It a piece of code that then jumps to a subroutine.
For example...
        ...
FOO_start     LDA   $4
              CLC       ; implied "GOTO FOO_001"
FOO_001       ADC   #7  ; entering here from another routine
              RTS
        ...

I know it's just made up justification and fritzfumbling, but it works for
me.  :)

> Plus it's hard to think about function parameters either, since there are no
> rules for how to pass parameters to assembly subroutines.  You can use the
> stack, use the registers, or use general RAM.

Rules are arbitrary.  Period.  What's the difference if sumguy made up the
rules when he made up the language, or if you make a rule that you'll only
pass parameters via the stack.  Or via RAM.  Now take it one step further
and define a rule for each separate function.

(stop looking at me like that!)

-Chris


-
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

Current Thread