2015-06-28 | Paul Boddie | file changeset files shortlog | Introduced a simpler way of invoking subroutines with the user stack, employing explicit return addresses. Changed the user stack layout slightly to support jumping to stored addresses more conveniently. Modified the third example task somewhat. Reinstated return values for the new_task subroutine. |
paul@0 | 1 | #!/usr/bin/env python |
paul@0 | 2 | |
paul@0 | 3 | from UEFfile import UEFfile |
paul@0 | 4 | from subprocess import call |
paul@0 | 5 | from os import remove |
paul@0 | 6 | |
paul@0 | 7 | def readfile(filename): |
paul@0 | 8 | f = open(filename, "rb") |
paul@0 | 9 | try: |
paul@0 | 10 | return f.read() |
paul@0 | 11 | finally: |
paul@0 | 12 | f.close() |
paul@0 | 13 | |
paul@0 | 14 | call(["ophis", "-o", "switcher.bin", "switcher.oph"]) |
paul@0 | 15 | |
paul@0 | 16 | uef = UEFfile() |
paul@0 | 17 | uef.import_files(0, [ |
paul@0 | 18 | ("SWITCHER", 0x2000, 0x2000, readfile("switcher.bin")) |
paul@0 | 19 | ]) |
paul@0 | 20 | uef.write("switcher.uef", write_emulator_info=False) |
paul@0 | 21 | |
paul@0 | 22 | remove("switcher.bin") |
paul@0 | 23 | |
paul@0 | 24 | # vim: tabstop=4 expandtab shiftwidth=4 |