How do I know my Assembler fully works?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I know my Assembler fully works?

burge91
I have tested it for Pong.asm and Rect.asm and Max.asm, and I have just decided that (mainly because of Pong.asm) this is enough testing. Are there any more programs that would make me sure? Because for example I had to do some modifications on Rect and 1/4 way through Pong before it would work properly.
Reply | Threaded
Open this post in threaded view
|

Re: How do I know my Assembler fully works?

WBahn
Administrator
That's a good question. Those three probably do a pretty good job, but there will always be some uncertainly -- and that's true of "real" software products even more so.

You could write a program (or a series of programs) that test every possible instruction. This is possible because the ISA for Hack is so small. There are only 1792 legal C-type instructions.

The most likely oversight you might have made -- and that could bite you later in the project -- is not properly allowing for all of the legal identifiers. So make sure that you are properly allowing for not only the letters and digits, but also the special characters {.,_,$,:}, including identifiers that start with any of these (except digits). Also that your identifiers are case sensitive. You can do a reasonable test for this with a small program by just examining the .hack file.

You also want to make sure that your variables are properly being assigned to RAM locations starting at address 16. That same small program should allow you to verify this.