| @@ -39,26 +39,26 @@ if __name__ == "__main__": · 38 unmodified lines |
| 39 | # } | 39 | # } |
| 40 | | 40 | |
| 41 | d.code = [ | 41 | d.code = [ |
| 42 | opcodes.load(LOmp(0), Imm(0), LOfp(44)), # "$Sys", ldt[0] -> module | 42 | opcodes.load(LOmp(0), Imm(0), LOfp(44)), # "$Sys", ldt[0] -> module |
| 43 | | 43 | |
| 44 | opcodes.frame(Imm(1), LOfp(52)), # types[1] -> new_frame1 (ptr) | 44 | opcodes.frame(Imm(1), LOfp(52)), # types[1] -> new_frame1 (ptr) |
| 45 | opcodes.movp(LOmp(8), SOSOfp(52, 32)), # "Counting..." -> | 45 | opcodes.movp(LOmp(8), SOSOfp(32, 52)), # "Counting..." -> |
| 46 | opcodes.lea(LOfp(48), SOSOfp(52, 16)), # | 46 | opcodes.lea(LOfp(48), SOSOfp(16, 52)), # |
| 47 | opcodes.mcall(LOfp(52), Imm(0), LOfp(44)), # new_frame1, ldt[0], module | 47 | opcodes.mcall(LOfp(52), Imm(0), LOfp(44)), # new_frame1, ldt[0], module |
| 48 | | 48 | |
| 49 | opcodes.movw(Imm(0), LOfp(40)), # 0 -> i (int) | 49 | opcodes.movw(Imm(0), LOfp(40)), # 0 -> i (int) |
| 50 | opcodes.blew(Imm(0x14), SOfp(40), Imm(0xe)),# 0x6: if 20 <= i branch to 0xe | 50 | opcodes.blew(Imm(0x14), SOfp(40), Imm(0xe)),# 0x6: if 20 <= i branch to 0xe |
| 51 | | 51 | |
| 52 | opcodes.frame(Imm(1), LOfp(48)), # types[1] -> new_frame2 (ptr) | 52 | opcodes.frame(Imm(1), LOfp(48)), # types[1] -> new_frame2 (ptr) |
| 53 | opcodes.movp(LOmp(4), SOSOfp(48, 32)), # "%d\n" -> | 53 | opcodes.movp(LOmp(4), SOSOfp(32, 48)), # "%d\n" -> |
| 54 | opcodes.movw(LOfp(40), SOSOfp(48, 36)), | 54 | opcodes.movw(LOfp(40), SOSOfp(36, 48)), |
| 55 | opcodes.lea(LOfp(52), SOSOfp(48, 16)), # new_frame1 -> | 55 | opcodes.lea(LOfp(52), SOSOfp(16, 48)), # new_frame1 -> |
| 56 | opcodes.mcall(LOfp(48), Imm(0), LOfp(44)), # new_frame2, ldt[0] | 56 | opcodes.mcall(LOfp(48), Imm(0), LOfp(44)), # new_frame2, ldt[0] |
| 57 | | 57 | |
| 58 | opcodes.addw(Imm(1), NoOp(), LOfp(40)), # 1 + [i] -> i | 58 | opcodes.addw(Imm(1), NoOp(), LOfp(40)), # 1 + [i] -> i |
| 59 | opcodes.jmp(Imm(6)), # jump to 0x6 | 59 | opcodes.jmp(Imm(6)), # jump to 0x6 |
| 60 | opcodes.ret() # 0xe: return | 60 | opcodes.ret() # 0xe: return |
| 61 | ] | 61 | ] |
| 62 | | 62 | |
| 63 | d.types = [ | 63 | d.types = [ |
| 64 | dis.Type(0, 16, 1, "\xf0"), | 64 | dis.Type(0, 16, 1, "\xf0"), |