Aimini / hm-51

Home-made 8051 CPU.
MIT License
1 stars 0 forks source link

A51 test generator script: auto call do function in `test(do)` in __util.py #6

Closed Aimini closed 4 years ago

Aimini commented 4 years ago

When writing a new script, you must first define do (w) and then call __util.test (w).

Although it does not take much time to copy and paste in each script, if you provide a mechanism to automatically call the function named do.

Or you don’t even need to write do, directly provide a global function type variable w to write A51 instruction text, That's the best.

Aimini commented 4 years ago

I have tried to do this, I have intended to do it using globals (), but unfortunately, the globals () function cannot cross modules.

But I created an asm_test class and refactored the test generation process. The do function is no longer needed, you should get the asm_test object from the __util.create_test()'s return value and use it to write text to A51 file.