View Single Post
Old 25 October 2019, 06:35   #1
KONEY
OctaMED Music Composer

KONEY's Avatar
 
Join Date: Jan 2009
Location: Venice - Italy
Age: 45
Posts: 419
nOOb needing help to understand Conditional Branching

My first steps in 68k assembly and already stuck in something very trivial like how to reuse pieces of code

I learnt a subroutine is made up by a label, some code and a RTS statement. Call it with "BSR label" and after the code inside is executed and the RTS reached the flow continues from below where the BSR was issued.

But what if I need to execute a function only with some conditions AND go back? BEQ and BNE jump to a subroutine but at the RTS the program exits. I need instead to BRA to a specific label to make it work but this prevents me from being able to call the subroutine from any part of the code I'd like.

I'm missing something... but I can't figure out what to look in manuals. All I can find are sentences like: "conditional branching will not continue from where it was called, thanks for reading." : banghead

any help...
KONEY is offline  
 
Page generated in 0.04392 seconds with 11 queries