Jump to content

Open Club  ·  61 members

DASM
IGNORED

Build-time assumption checking


Pat Brady

Recommended Posts

I attached a file containing macros I use to check assumptions at build-time.

 

assert itself is similar to assert() in C. It confirms the expression evaluates to non-zero. It uses setstr, so if your dasm is not up-to-date, delete the setstr and the following echo. It will still work and will report the line number but not the failed expression.

 

There are a bunch of macros to confirm parts of addresses are the same. These can be used to ensure that branches and indirect reads don't cross pages, and that data striped across pages is correctly aligned. Probably other purposes too.

 

Finally, validateindirectjmp confirms the low byte of an address is not the last byte on a page. Rationale is that jmp (indirect), when given such an address, will jump to an address that is probably not what you want.

 

In all cases, "confirm" means it throws an assembly error if the condition is untrue.

 

I find these useful. Hopefully someone else does too.

assert.s

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...