Jump to content
IGNORED

Cancel RTS instruction Assembler


Recommended Posts

This feature can also be used as tail call optimization. If your subroutine ends with:

	jsr some_routine
	rts

you can optimize it to:

	jmp some_routine

 

That's valid for every point where your subroutine ends. So:

	beq zero
	bmi minus

	jsr do_plus
	rts

minus
	jsr do_minus
	rts

zero
	jsr do_zero
	rts

equals:

	beq zero
	bmi minus

	jmp do_plus

minus
	jmp do_minus

zero
	jmp do_zero

 

Edited by ivop
  • Like 4
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...