|
|
|
|
|
by memsom
3555 days ago
|
|
I did this in C#. It was a lunch time project at work a couple of years ago. It was fun. I still want to do a V2 and remove all of the shortcuts I put in because I didn't want to write code for the stack and stuff like that. At the end of the day, my solution was spookily similar to this - the 32bit instructions - well, yeah, I was the same! It was just simpler. I did have a few general purpose registers (V1, V2 and V3 I think) and I did have routines to handle bytes, words and such like. So stuff like this (as a random example I pulled from the source): ORG START START: ST_B 10 LOOP: ST_B 10 ADD_B ;;value will go back on stack LD_B V1 SM_B V1 ;;value we use next loop SM_B V1 ;;value we compare SM_B V1 ;;value we echo to console TRP 21 ;;writes to the console ST_S '',13,10,$ TRP 21 ;;writes to the console CMP_B 50 ;;compares stack to the constant JNE LOOP ST_S 'The End',13,10,$ TRP 21 ;;writes to the console END |
|