Fourth week my internship in Aeste has officially passed, I must admit it is a pleasure working here. I spent the week continuing my work on achieving my first task, which is to integrate IO signals to jointJS. Last week, I talked about generating text files using boost::filesystem. The file was generated in the JSON format which listed some important data. Initially, I planned to use Wt Json library to transmit the data to the Javascript component but my colleague Peter told me about JSON.parse() which is built in to Javascript language. I like how Javascript enables us to call from other functions and objects without needing to set header libraries. And a global variable which can be used throughout the project just by simply typing var glob_var; outside the functions. I think this reduces the need to pass objects or values as function parameters.

Previously, I managed to set the address of an object manually. I verify this by stepping through the assembly codes and find that the preset address is being used to store and load values. However, using addresses like this would overwrite processor instruction sets which would be disastrous. To solve this, an exception was created to handle these specific address values. At first, I was puzzled at how to create an “exception”. The solution was pretty easy, as the processor is simulated in Javascript, all I had to do was edit the LW and SW section of the code. Next, I created an empty array which would store the values. Whenever there is a Store or Load instruction with the IO address, instead of using the processor memory, the values will be stored/loaded in/from the arrays.

Instead of using arrays, Dr. Shawn said I should create IO objects with load/store methods. I spent some time to research on creating an object with Javascript. For this interested, I think this is a good link which explains how OOP works in Javascript. Click here. Being new in programming, my initial program contained many switch…case and if…else program flow control statements. However, Dr. Shawn pointed out how unnecessary it was and recommended me to use an indexing method. As of now, I’m trying to map addresses into load/store functions, which would be interesting to see once I get it working.