Extended Web IDE functionality to include Value setting
This commit is contained in:
parent
fa87eaf072
commit
918dc95bdb
|
@ -16,13 +16,12 @@ class StringGenerator(object):
|
||||||
return "Out of range"
|
return "Out of range"
|
||||||
if int(value, 16) > 255:
|
if int(value, 16) > 255:
|
||||||
return "Too big"
|
return "Too big"
|
||||||
|
UI.Set_Memory(int(col)+(int(row) * 16) + UI.Current_Page , int(value, 16))
|
||||||
return UI.returnPage()
|
return UI.returnPage()
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def Register(self, Reg="", value=0):
|
def Register(self, Reg="", value=0):
|
||||||
index = int(Reg[1:])
|
UI.Set_Register(int(Reg[1:]), int(value, 16))
|
||||||
registers = int(value, 16)
|
|
||||||
return UI.returnPage()
|
return UI.returnPage()
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
|
|
|
@ -5,6 +5,11 @@ import re
|
||||||
subprocess.call("./bin/dis foo | sponge z_disassembled", shell=True)
|
subprocess.call("./bin/dis foo | sponge z_disassembled", shell=True)
|
||||||
vm = ctypes.CDLL('./libvm.so')
|
vm = ctypes.CDLL('./libvm.so')
|
||||||
|
|
||||||
|
vm.get_memory.argtype = ctypes.c_uint
|
||||||
|
vm.get_memory.restype = ctypes.c_char_p
|
||||||
|
vm.step_lilith.restype = ctypes.c_uint
|
||||||
|
vm.set_register.argtype = (ctypes.c_uint, ctypes.c_uint)
|
||||||
|
vm.set_memory.argtype = (ctypes.c_uint, ctypes.c_ubyte)
|
||||||
|
|
||||||
def Reset_lilith():
|
def Reset_lilith():
|
||||||
vm.initialize_lilith()
|
vm.initialize_lilith()
|
||||||
|
@ -14,19 +19,22 @@ def Reset_lilith():
|
||||||
Watchpoints = {0}
|
Watchpoints = {0}
|
||||||
vm.load_lilith(ctypes.create_string_buffer("foo".encode('ascii')))
|
vm.load_lilith(ctypes.create_string_buffer("foo".encode('ascii')))
|
||||||
|
|
||||||
|
|
||||||
def Step_lilith():
|
def Step_lilith():
|
||||||
global Current_IP
|
global Current_IP
|
||||||
vm.step_lilith.restype = ctypes.c_uint
|
|
||||||
Current_IP = vm.step_lilith()
|
Current_IP = vm.step_lilith()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def Set_Memory(address, value):
|
||||||
|
vm.set_memory(address, value)
|
||||||
|
return
|
||||||
|
|
||||||
|
def Set_Register(register, value):
|
||||||
|
vm.set_register(register, value)
|
||||||
|
return
|
||||||
|
|
||||||
def returnPage():
|
def returnPage():
|
||||||
return get_header() + (vm.get_memory(Current_Page)).decode('utf-8') + get_spacer1() + get_registers(0) + get_registers(8) + get_spacer2() + get_disassembled() + get_footer()
|
return get_header() + (vm.get_memory(Current_Page)).decode('utf-8') + get_spacer1() + get_registers(0) + get_registers(8) + get_spacer2() + get_disassembled() + get_footer()
|
||||||
|
|
||||||
vm.get_memory.argtype = ctypes.c_uint
|
|
||||||
vm.get_memory.restype = ctypes.c_char_p
|
|
||||||
|
|
||||||
hexlookup = { 0 : '0', 1 : '1', 2 : '2', 3 : '3', 4 : '4', 5 : '5', 6 : '6', 7 : '7', 8 : '8', 9 : '9', 10 : 'A', 11 : 'B', 12 : 'C', 13 : 'D', 14 : 'E', 15 : 'F' }
|
hexlookup = { 0 : '0', 1 : '1', 2 : '2', 3 : '3', 4 : '4', 5 : '5', 6 : '6', 7 : '7', 8 : '8', 9 : '9', 10 : 'A', 11 : 'B', 12 : 'C', 13 : 'D', 14 : 'E', 15 : 'F' }
|
||||||
|
|
||||||
def formatByte(a):
|
def formatByte(a):
|
||||||
|
|
10
wrapper.c
10
wrapper.c
|
@ -57,6 +57,16 @@ unsigned int get_register(unsigned int reg)
|
||||||
return Globalvm->reg[reg];
|
return Globalvm->reg[reg];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_register(unsigned int reg, unsigned int value)
|
||||||
|
{
|
||||||
|
Globalvm->reg[reg] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_memory(unsigned int address, unsigned char value)
|
||||||
|
{
|
||||||
|
Globalvm->memory[address] = value;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char get_byte(unsigned int add)
|
unsigned char get_byte(unsigned int add)
|
||||||
{
|
{
|
||||||
return Globalvm->memory[add];
|
return Globalvm->memory[add];
|
||||||
|
|
Loading…
Reference in New Issue