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


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

Re: How Do JSR and RTS work?

From David Schmidt <schmidtd@my-deja.com>
Newsgroups comp.sys.apple2.programmer
Subject Re: How Do JSR and RTS work?
Date 2016-03-18 12:31 -0400
Organization A noiseless patient Spider
Message-ID <nchab7$ff3$1@dont-email.me> (permalink)
References (1 earlier) <6c24a42b-765a-41c0-ab56-c65c2f3b743e@googlegroups.com> <1cbfed59-7b2e-4e57-9680-d0e6b371c46d@googlegroups.com> <5154e50a-2087-41c9-97cf-5a521910cc5b@googlegroups.com> <9b3871a5-0823-4e2d-9a95-0090e41fbee2@googlegroups.com> <5434f9c6-60c3-40ca-863a-ffbedf472361@googlegroups.com>

Show all headers | View raw


On 3/18/2016 12:22 PM, alxmist@aol.com wrote:
> The instructional program I'm on now is all about using a built-in
> routine for COUT. The only RTS in this listing seems to be the one
> for JSR HOME. Wouldn't the program need an RTS for each time I use
> COUT?
>
> CTR EQU $06
> HOME EQU $FC58
> COUT EQU $FDED
> START JSR HOME
>   LDA #$FF
>   STA CTR
> LOOP LDA CTR
>   JSR COUT
>   DEC CTR
>   BEQ END
>   JMP LOOP
> END RTS

Oh, certainly - the RTS is part of the COUT and HOME routines, which 
lives off in ROM somewhere separate from your program.  So you're 
calling a subroutine that does the returning to you as part of its work. 
  So that HOME routine is doing something like this, elsewhere in memory 
($FC58, to be exact):

HOME (do some work)
   (do some more work)
   (just about done)
   RTS

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


Thread

How Do JSR and RTS work? alxmist@aol.com - 2016-03-17 10:02 -0700
  Re: How Do JSR and RTS work? David Schmidt <schmidtd@my-deja.com> - 2016-03-17 13:19 -0400
    Re: How Do JSR and RTS work? Michael Pohoreski <michael.pohoreski@gmail.com> - 2016-03-17 16:38 -0700
      Re: How Do JSR and RTS work? David Schmidt <schmidtd@my-deja.com> - 2016-03-17 20:34 -0400
  Re: How Do JSR and RTS work? Michael J. Mahon <mjmahon@aol.com> - 2016-03-17 12:29 -0500
  Re: How Do JSR and RTS work? wssimms@gmail.com - 2016-03-17 10:29 -0700
    Re: How Do JSR and RTS work? wssimms@gmail.com - 2016-03-17 10:32 -0700
  Re: How Do JSR and RTS work? Michael Pohoreski <michael.pohoreski@gmail.com> - 2016-03-17 15:37 -0700
    Re: How Do JSR and RTS work? Michael Pohoreski <michael.pohoreski@gmail.com> - 2016-03-17 16:16 -0700
  Re: How Do JSR and RTS work? markpmlim@yahoo.com.sg - 2016-03-17 18:41 -0700
    Re: How Do JSR and RTS work? wssimms@gmail.com - 2016-03-17 20:22 -0700
      Re: How Do JSR and RTS work? Michael Pohoreski <michael.pohoreski@gmail.com> - 2016-03-18 08:10 -0700
        Re: How Do JSR and RTS work? wssimms@gmail.com - 2016-03-18 08:47 -0700
          Re: How Do JSR and RTS work? alxmist@aol.com - 2016-03-18 09:22 -0700
            Re: How Do JSR and RTS work? David Schmidt <schmidtd@my-deja.com> - 2016-03-18 12:31 -0400
              Re: How Do JSR and RTS work? alxmist@aol.com - 2016-03-18 09:36 -0700
                Re: How Do JSR and RTS work? David Schmidt <schmidtd@my-deja.com> - 2016-03-18 12:39 -0400
                Re: How Do JSR and RTS work? Michael Pohoreski <michael.pohoreski@gmail.com> - 2016-03-18 12:25 -0700
            Re: How Do JSR and RTS work? gids.rs@sasktel.net - 2016-03-18 13:09 -0700

csiph-web