Jump to content
  • entries
    41
  • comments
    373
  • views
    64,045

ZP/immediate load auditor


batari

2,113 views

Many homebrews have had problems with zero page loads when immediate loads were intended. It's a common error that has caught even the best programmers. The problem is that, in most cases, the final binary works as if there were no bug but may occasionally show weird problems on actual hardware. This document describes why this happens.

 

So I've written a very simple utility to find the bugs for you. To use, make a .lst file with dasm by using the -l switch. Then run the .lst through the utility:

 

auditasm<file.lst

 

It might produce a few false positives but so far it's found all of the ZP accesses that shouldn't be there. Please test it on known bad files and let me know how it works. Although it's a DOS program, I haven't tested it .lst files created by DOS dasm.

post-587-1090633128_thumb.jpg

EDIT: I updated the program to eliminate most false positives. New version below:

pesco_pacman_v8c.zip

3 Comments


Recommended Comments

What exactly is it looking for? I would think a good approachto flag a warning on any load of an address <128 other than a label taken from a list; as someone suggested, the list should be pre-initialized with TIA read regs, but you could have a comment-pseudo-op to add to it. Otherwise the E.T. Book Cart mistake would fall through. After all:

 LDA	somelabel

where somelabel==10 looks entirely reasonable from a parsing perspective. It's only if one realizes that somelabel ISN'T the name of one of the TIA regs (even though $0A is the address of INPT2).

Link to comment

What exactly is it looking for? I would think a good approachto flag a warning on any load of an address <128 other than a label taken from a list; as someone suggested, the list should be pre-initialized with TIA read regs, but you could have a comment-pseudo-op to add to it. Otherwise the E.T. Book Cart mistake would fall through. After all:

 LDA	somelabel

where somelabel==10 looks entirely reasonable from a parsing perspective. It's only if one realizes that somelabel ISN'T the name of one of the TIA regs (even though $0A is the address of INPT2).

It's very simple - it looks for a ZP read opcode with an operand <$80, and if the source isn't loading CX* or INPT* then it prints the offending line from the .lst. It does produce false positives sometimes but it has managed to find some errors.

 

I tried it with an old Crazy Balloon source that was known to have this issue and it found the bug. I also found a bunch of other source files I had on my hard drive, and it found a problem with an old source file for Bobby is Hungry (had "lda TIMER"). I don't know if the final game was fixed or not.

Link to comment
It's very simple - it looks for a ZP read opcode with an operand <$80, and if the source isn't loading CX* or INPT* then it prints the offending line from the .lst. It does produce false positives sometimes but it has managed to find some errors

 

Ah. I'd looked through the EXE for a list of TIA labels, but I guess you don't really need a list for those since they all start the same.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

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