User Tools

Site Tools


useful_programs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
useful_programs [2019/07/31 13:11] – [Debug printing] emozolyakuseful_programs [2019/09/17 08:23] – [Bit functions] emozolyak
Line 47: Line 47:
 end  end 
    
-function outbit(condition, x, b) -- output bool conditoin as 0 /1 into a bit +function outbit(condition, x, b) -- output bool condition as 0 /1 into a bit 
      if condition then           if condition then     
          return hasbit(x, b) and x or x + bw(b)           return hasbit(x, b) and x or x + bw(b) 
Line 53: Line 53:
          return hasbit(x, b) and x - bw(b) or x           return hasbit(x, b) and x - bw(b) or x 
      end       end 
 +end 
 +
 +function outBit(condition, alias, b) -- output bool condition as 0 /1 into a bit of a internal register 
 +     local new_value = outbit(condition, R(alias), b)
 +     W(alias, new_value)
 end  end 
    
Line 194: Line 199:
  
 </code> </code>
 +Then the print output can be enhanced like this:
 +{{ :dbg_table_out.png?direct&600 |}}
  
 The //ENABLE_DEBUG// flag should be global boolean variable in the calling script. You may just to set it when needed and save the script.  The //ENABLE_DEBUG// flag should be global boolean variable in the calling script. You may just to set it when needed and save the script. 
useful_programs.txt · Last modified: 2024/03/19 09:39 by emozolyak

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki