User Tools

Site Tools


javascript_terminal_v3

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
javascript_terminal_v3 [2023/11/30 02:29] appledogjavascript_terminal_v3 [2023/11/30 02:37] (current) appledog
Line 94: Line 94:
  
 == Refactoring Needed == Refactoring Needed
-V3 is V2 but with changes made in how terminal is controlled by the main program. The error of processing commands in the terminal was addressed with the BASIC class. The same idea needs to be made with an OS or TerminalCommands class, to separate that functionality out of the Terminal class. The Terminal class is only supposed to maintain and possibly draw the terminal -- and actually the draw code might be removed into a class that maintains canvas as a virtual 'screenobject -- like in Java NetWhack where there was a Screen and a Terminal class.+V3 is V2 but with changes made in how terminal is controlled by the main program. The code has also become somewhat spaghetti. I partially addressed this by removing the Tile class from V3 and adding BASIC command processing into its own class. But much more work needs to be done on this. The BASIC class should maintain the copy of the program code, and the Terminal class might need to offload it's draw funcion to a Screen class. We might even move event checking into an OS or CPU class. Or both. But the OS class would eventually be replaced by programs running on the CPU (a ROM).
  
-The code has also become somewhat spaghetti. I partially addressed this by removing the Tile class from V3 and adding BASIC command processing into its own classBut much more work needs to be done on thisThe BASIC class should maintain the copy of the program code.+In a real VM, the code would not be stored in a program[] array but in memory[] and read from there by the interpreter. There are lots of little design clashes between the idea of a VM, the idea of a Game (NetWhack) and the idea of s hybrid scripting language written in JavascriptThey are not really compatableSo for a V4 the goal will be to pare down and really isolate the functionality of Terminal, and to clean up main by making a class Screen, and also perhaps a class Keyboard, class Mouse, etc.
  
-Andin a real VM, the code would not be stored in program[] array but in memory[] and read from there by the interpreter. There are lots of little design clashes between the idea of VM, the idea of a Game (NetWhack) and the idea of s hybrid scripting language written in JavascriptThey are not really compatable. So for a V4 the goal will be to pare down and really isolate the functionality of Terminal, and to clean up main by making class Screenand also perhaps a class Keyboard, class Mouse, etc.+== Bugs 
 +Wellthere are still few 'bugs' but maybe they are just quality of life fixes. I'd like the terminal to retain it's cursor y position, if possible, during resize -- orto clear the screen of existing textFrankly it isn't important enough for me to worry about right now, and it probably isn'really a true bugso I will leave it for now.
  
 == Final Thoughts == Final Thoughts
javascript_terminal_v3.1701311372.txt.gz · Last modified: 2023/11/30 02:29 by appledog

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki