[amirus] Re: Макросы

  • From: Andy Parfenov <poweramiga@xxxxxxxxxx>
  • To: amirus@xxxxxxxxxxxxx
  • Date: Fri, 25 Oct 2002 21:53:28 +0500

On 25-Окт-02  , AmiS wrote:\n

A>> ptreplay.library. Выглядит всё так когда запускаешь из cli - всё нормально,
A>> как только пускаешь с иконки музыка сразу отказывается загружаться? Именно
A>> загружаться?

A> А что возвращает PTLoadModule()? Я не знаю почему у тебя не работает....
A> Врожде как должно работать. не забывай про _END

Да разобрался я, глюканул немного. Теперь всё работает. За макрос спасибо. Для
любителей асма даю ещё пару крутых макросов:

;*************************************************
;** Automatic loop support                      **
;** do/while loops & for/next loops             **
;*************************************************

for     Macro           ;a popular for next loop, counts downwards in words
_fc     set _fc+1       ;unique id
_fe     set _fe+1       ;level counter
_fn\<_fe> set _fc       ;level to number
        ifc '','\1'                     ;without parameters
                bra.\0 ._fi\<_fc>_loop
        elseif
                move.\0 \1-1,\2         ;(*) only immediate adressing
        endc
._fi\<_fc>_do:
        EndM

;Examples
;       for             start of the loop, counter already loaded
;                       zero is a legal counter value, the body isn't
;                       executed then
;       for.s           start of the loop, short loop, counter already loaded
;
;       for.l #9,d0     start loop, load counter (9 loops here)
;                       this one gets optimized (one branch less)
;                       but allows only immediate addressing to
;                       load the counter register (d0 here)
;
        
next    Macro           ;end of the loop
        ifle _fe
                fail    ;(*) nest failure: for missing
                mexit
        endc
_ft     set _fn\<_fe>
._fi\<_ft>_loop:
        ifc '','\1'
                fail    ;(*) counter register missing
                mexit
        endc
        ifc '','\2'
._fi\<_ft>_cont:
                dbra \1,._fi\<_ft>_do
        elseif          ;(*) cont invalid with condition
                db\1 \2,._fi\<_ft>_do
        endc
._fi\<_ft>_exit:
_fe     set _fe-1
        EndM
        
;Examples
;       next d0         end of a for loop with counter register d0
;       next eq,d0      end of a loop, terminate the loop if eq OR
;                       counted down to zero
;
;Full example:
;       for.l #12,d0
;        clr.l (a0)+
;       next d0         clears 12 adjacent long words
;                       all labels are generated by the macro set
;

Теперь таким же макаром сделаю себе всё, что хочу!

Regards


Other related posts: