2016-07-21 03:07:10 +01:00
|
|
|
import os, os.path
|
|
|
|
import string
|
|
|
|
import array
|
|
|
|
import time
|
|
|
|
import cherrypy
|
|
|
|
import User_Interface as UI
|
|
|
|
|
|
|
|
class StringGenerator(object):
|
|
|
|
@cherrypy.expose
|
|
|
|
def index(self):
|
|
|
|
return UI.returnPage()
|
|
|
|
|
|
|
|
@cherrypy.expose
|
|
|
|
def Memory(self, col=8, row=8, value=0):
|
|
|
|
if 0 > int(col) or 0 > int(row):
|
|
|
|
return "Out of range"
|
|
|
|
if int(value, 16) > 255:
|
|
|
|
return "Too big"
|
2016-08-12 04:09:02 +01:00
|
|
|
UI.Set_Memory(int(col)+(int(row) * 16) + UI.Current_Page , int(value, 16))
|
2016-07-21 03:07:10 +01:00
|
|
|
return UI.returnPage()
|
|
|
|
|
|
|
|
@cherrypy.expose
|
|
|
|
def Register(self, Reg="", value=0):
|
2016-08-12 04:09:02 +01:00
|
|
|
UI.Set_Register(int(Reg[1:]), int(value, 16))
|
2016-07-21 03:07:10 +01:00
|
|
|
return UI.returnPage()
|
|
|
|
|
|
|
|
@cherrypy.expose
|
|
|
|
def RUN(self):
|
|
|
|
UI.Step_lilith()
|
|
|
|
if UI.Current_IP in UI.Watchpoints:
|
|
|
|
raise cherrypy.HTTPRedirect("/")
|
|
|
|
return UI.returnPage()
|
|
|
|
|
|
|
|
@cherrypy.expose
|
|
|
|
def STEP(self):
|
|
|
|
UI.Step_lilith()
|
|
|
|
return UI.returnPage()
|
|
|
|
|
|
|
|
@cherrypy.expose
|
|
|
|
def STOP(self):
|
|
|
|
return UI.returnPage()
|
|
|
|
|
|
|
|
@cherrypy.expose
|
|
|
|
def RESET(self):
|
2016-08-12 01:18:53 +01:00
|
|
|
UI.Reset_lilith()
|
2016-07-21 03:07:10 +01:00
|
|
|
return UI.returnPage()
|
|
|
|
|
|
|
|
@cherrypy.expose
|
|
|
|
def DEBUG(self, Inst=""):
|
|
|
|
UI.Watchpoints
|
|
|
|
UI.Watchpoints.add(int(Inst, 16))
|
|
|
|
return UI.returnPage()
|
|
|
|
|
2016-08-12 01:18:53 +01:00
|
|
|
@cherrypy.expose
|
|
|
|
def PAGEDOWN(self):
|
|
|
|
UI.Current_Page = UI.Current_Page + 4096
|
|
|
|
return UI.returnPage()
|
|
|
|
|
|
|
|
@cherrypy.expose
|
|
|
|
def PAGEUP(self):
|
|
|
|
UI.Current_Page = UI.Current_Page - 4096
|
|
|
|
if 0 > UI.Current_Page:
|
|
|
|
UI.Current_Page = 0
|
|
|
|
return UI.returnPage()
|
|
|
|
|
2016-08-21 01:36:56 +01:00
|
|
|
@cherrypy.expose
|
|
|
|
def SPEEDBREAKPOINT(self):
|
|
|
|
UI.Step_lilith()
|
|
|
|
while UI.Current_IP not in UI.Watchpoints:
|
|
|
|
UI.Step_lilith()
|
|
|
|
return UI.returnPage()
|
|
|
|
|
2016-07-21 03:07:10 +01:00
|
|
|
if __name__ == '__main__':
|
|
|
|
conf = {
|
|
|
|
'/': {
|
|
|
|
'tools.sessions.on': True,
|
|
|
|
'tools.staticdir.root': os.path.abspath(os.getcwd())
|
|
|
|
},
|
|
|
|
'/generator': {
|
|
|
|
'request.dispatch': cherrypy.dispatch.MethodDispatcher(),
|
|
|
|
'tools.response_headers.on': True,
|
|
|
|
'tools.response_headers.headers': [('Content-Type', 'text/plain')],
|
|
|
|
},
|
|
|
|
'/static': {
|
|
|
|
'tools.staticdir.on': True,
|
|
|
|
'tools.staticdir.dir': './public'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
webapp = StringGenerator()
|
|
|
|
webapp.generator = StringGenerator()
|
|
|
|
cherrypy.quickstart(webapp, '/', conf)
|