home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / MISC / ZEN1_10.ZIP / CONTROL.SRC < prev    next >
Encoding:
Text File  |  1990-01-01  |  1.4 KB  |  86 lines

  1. \*
  2.  *   ZEN 1.10  Flow of control
  3.  *     C 1990  by Martin Tracy
  4.  *             Last modified  1.1.90
  5.  *\
  6. ASSEMBLER
  7.  
  8. ; Branch if false
  9. ZBranch: ; ( f)
  10.         or    bx,bx
  11.         pop   bx
  12.         jz    Branch
  13.         add   si,2
  14.         NEXT
  15.  
  16. ; Branch always
  17. Branch: ;
  18.         mov   si,cs:[si]
  19.         NEXT
  20.  
  21. ; Begin DO ... LOOP or DO ... +LOOP
  22. RDo:    ; ( n n2)
  23.         pop   ax
  24.         add   ax,8000h
  25.         sub   bx,ax
  26.         xchg  bp,sp
  27.         push  ax
  28.         push  bx
  29.         xchg  bp,sp
  30.         pop   bx
  31.         NEXT
  32.  
  33. ; End DO ... LOOP
  34. RLoop:  ;
  35.         inc   WORD PTR [bp]
  36.         jno   Branch
  37. Loop2:  add   si,2
  38. _Undo:  add   bp,4
  39.         NEXT
  40.  
  41. ; End DO ... +LOOP
  42. PLoop:  ; ( n)
  43.         add   [bp],bx
  44.         pop   bx
  45.         jno   Branch
  46.         jo    Loop2
  47.         NEXT
  48. END-CODE
  49.  
  50. \ Undoes one level of loop nesting
  51. CODE UNLOOP ( ) \ CORE
  52.         jmp   _Undo
  53. END-CODE
  54.  
  55.  
  56. \ Ends every colon definition
  57. CODE EXIT ( ) \ CORE
  58.         xchg  bp,sp
  59.         pop   si
  60.         xchg  bp,sp
  61.         NEXT
  62. END-CODE
  63.  
  64. \ Execute execution token w
  65. CODE EXECUTE ( w) \ CORE
  66.         xchg  ax,bx
  67.         pop   bx
  68.         jmp   ax
  69. END-CODE
  70.  
  71.  
  72. \ Does nothing.
  73. CODE NOOP
  74.         NEXT
  75. END-CODE
  76.  
  77. \ Equivalent to @ EXECUTE
  78. \ Does nothing if execution token is zero
  79. CODE PERFORM ( a) \ EXT CORE
  80.         mov   di,bx
  81.         pop   bx
  82.         mov   ax,[di]
  83.         jmp   ax
  84.         NEXT
  85. END-CODE
  86.