[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] TAS in GFA Linker



Vincent,

I was re-reading the thread and noticed I missed the subtle differences
between TAS and BSET regarding what it actually tests.
TAS - entire byte - both Z and N are used
BSET - only the bit being set - only Z is used

Would this alternate patch method below work?
Should work in all cases when one doesn't have clue how the asm routine
works that they are trying to patch.

;original code
    tas    (a1)
    bpl.s  label

;alternate code    
temp:       dc.w 0    ;add this somewhere or use a free register if you can

    move.b  (a1),temp ;copy the byte in question (previous value)
    bset    #7,(a1)   ;clobber bit 7 as tas would do
    tst.b   temp      ;set Z and N based on prev value like tas
    bpl.s   label     ;original branch instruction unchanged


-- 
Lonny Pursell    http://www.bright.net/~gfabasic/