How to add structured control-flow to any assembler

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Tame that spaghetti monster. :wink:

 

If your assembler doesn't already have structured control-flow, i.e. something like

_IF cc .. _ELSE .. _ENDIF,

_BEGIN .. _UNTIL cc,

_BEGIN .. _WHILE cc .. _ENDW,

then here's how to add it yourself for free, without needing access to the assembler's source code. http://dkeenan.com/AddingStructu... This is not to be confused with conditional assembly but rather eliminating the need for most explicit jumps, and the labels they jump to, and thereby making your code more readable and maintainable. -- Dave Keenan

Last Edited: Mon. Oct 5, 2015 - 12:11 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have updated Part 2 with far more readable macros to implement structured short-circuit conditionals in assembly language, that don't require overlapping structures.

 

http://dkeenan.com/AddingStructuredControlFlowToAnyAssembler2.htm

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If your assembler doesn't already have structured control-flow, i.e. something like
_IF cc .. _ELSE .. _ENDIF,
_BEGIN .. _UNTIL cc,
_BEGIN .. _WHILE cc .. _ENDW,

"Then learn C"?

 

Let's face it C is just a grown up macro language on top of assembler really isn't it?

 

I don't see a lot of point over-engineering some Asm only solution to this - what is the possible argument for not just switching to C anyway? (if necessary, for the 3% of your code that is time critical revert to hand crafted Asm if you really feel the need).

 

PS the link in your first post was broken - I've fixed that - in future don't be tempted to try and use BBCode tags such as [ url ] on this board - a recent forum code update has shot them to pieces!

 

PPS OK sorry, now I get it - you are refreshing a 5 year old thread - so, yeah, the recent change to forum software broke that link :-(

Last Edited: Mon. Oct 5, 2015 - 12:12 PM