Our server costs ~$56 per month to run. Please consider donating or becoming a Patron to help keep the site running. Help us gain new members by following us on Twitter and liking our page on Facebook!
Current time: October 31, 2026, 2:46 pm

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PicoBlaze Simulator in JavaScript
#61
RE: PicoBlaze Simulator in JavaScript
#62
RE: PicoBlaze Simulator in JavaScript
(August 21, 2022 at 5:31 am)FlatAssembler Wrote: Anyway, @bennyboy , I have managed to modify the simulator to use switch-case instead of if-else, and the "Decimal to Binary" and "Binary to Decimal" examples work again. Unfortunately, they are not significantly faster. https://github.com/FlatAssembler/PicoBla...mulator.js

Yeah, I wasn't sure that it would.  However, as a work of the programming arts, the new file is vastly superior-- I think anyone reading that will take some interest, instead of getting a headache.

If it is issues with the DOM and so on, i.e. if the execution of JavaScript code is not the bottleneck, then I'd recommend separating out highly repeated code.  For example, I see a lot of this kind of thing:
Code:
   case 0x31000:      // RETURN Z ; Return from a function only if the Zero Flag is set.      if (flagZ[regbank]) {        if (callStack.length)          PC = callStack.pop() + 1;        else {          if (playing)            clearInterval(simulationThread);          alert("The program exited!");        }      } else        PC++;      break;   case 0x35000:      // RETURN NZ ; Return from a function only if the Zero Flag is not set.      if (!flagZ[regbank]) {        if (callStack.length)          PC = callStack.pop() + 1;        else {          if (playing)            clearInterval(simulationThread);          alert("The program exited!");        }      } else        PC++;      break;

Could be
Code:
  case 0x31000:      // RETURN Z ; Return from a function only if the Zero Flag is set.      PopIf (flagZ[regbank]);      break;   case 0x35000:      // RETURN NZ ; Return from a function only if the Zero Flag is not set.      PopIf (!flagZ[regbank]);      break;
The comment and the name of the function (which will do all the cut stuff) will now make it very clear what is going on.
#63
RE: PicoBlaze Simulator in JavaScript
#64
RE: PicoBlaze Simulator in JavaScript
#65
RE: PicoBlaze Simulator in JavaScript
(August 21, 2022 at 11:05 am)FlatAssembler Wrote: By the way, what do you think about the user interface of the PicoBlaze Simulator?
I like the animation of it, and it looks like a sincerely interesting project.

You have a lot going on-- IMO you should assume the client will be on a PC, and use the full width of the media, with multiple large columns, 1 for each section: 1 for the assembler example selection and lines display, another for the input terminal, etc.

If you have time, it may be worth learning a CSS framework, like Boostrap. Seeing the example pages may inspire you in how to lay out the page more productively.
#66
RE: PicoBlaze Simulator in JavaScript
#67
RE: PicoBlaze Simulator in JavaScript
(August 22, 2022 at 9:07 am)FlatAssembler Wrote: As far as I know, it is the PHP that can be deployed almost anywhere as a back-end language, not .NET. Am I missing something?
Yes. The old .NET framework was Windows-dependent. The new .net can be run on any modern platform, including Linux, Kubernetes, IIS, and Apple. Maui is a cross-platform app system related to Blazor-- it runs as an app on any popular OS, and uses native controls instead of a web interface.

Quote:I thought the vast majority of back-ends these days were written in PHP.
That only matters if you already know PHP and prefer it. You can use almost any of the most popular languages as a back-end for a website now.
#68
RE: PicoBlaze Simulator in JavaScript
bennyboy Wrote:You can use almost any of the most popular languages as a back-end for a website now.
But then I cannot host it for free, right? To work in a language I want to work for back-end development, I need to buy an expensive VPS, right?
#69
RE: PicoBlaze Simulator in JavaScript
(August 22, 2022 at 11:49 am)FlatAssembler Wrote:
bennyboy Wrote:You can use almost any of the most popular languages as a back-end for a website now.
But then I cannot host it for free, right? To work in a language I want to work for back-end development, I need to buy an expensive VPS, right?

Free hosting is bullshit.  I hate it.  However, some of the big hosting sites have free tiers: GitHub, Firebase, AWS, etc.

Blazor WASM is pre-compiled and runs on client even without an internet connection (once it's been downloaded).  I think ANY kind of WASM solution can probably be served from a CDN or a static-files host.

Here's an example of someone using just GitHub and Firebase (google free static-files host) to successfully run a free app:


And a similar (hard accent to understand though) example for Node.js


Of course, any free system will have limitations over corporate paid services. But I think for what you are doing, they will be fine.

You can google "___ free hosting" for whatever framework you are interested in, and you will likely find some kind of video about how to do it.
#70
RE: PicoBlaze Simulator in JavaScript
bennyboy Wrote:Free hosting is bullshit. I hate it.
What makes you say so? I am, thus far, only using free hosting. PicoBlaze Simulator, along with my entire website, is hosted on GitHub Pages, which is a free service.
What do you think about the zero-investment rule? That is, that you should not invest any money into trying out your new software ideas? I have no idea if people are going to like my website for sharing PicoBlaze programs, so why should I invest money if I have no good reasons to think I will get a return on investment?
bennyboy Wrote:Blazor WASM is pre-compiled and runs on client even without an internet connection (once it's been downloaded). I think ANY kind of WASM solution can probably be served from a CDN or a static-files host.
I know that, I made a compiler targetting WebAssembly. But that does not help me to create a back-end I can run for free, right? I mean, I cannot run WebAssembly on a back-end that supports only PHP (like most free hostings do), nor would it be easy to make a back-end in my own programming language that compiles to WebAssembly (as it is a fairly low-level language).
bennyboy Wrote:Firebase (google free static-files host)
So, how is Firebase different from GitHub Pages? I watched the video and I failed to understand what does one gain by using FireBase instead of GitHub pages for WebAssembly.
bennyboy Wrote:And a similar (hard accent to understand though) example for Node.js
I must admit I completely failed to understand that video. Where is his NodeJS code that is running on FireBase? I already have a static-file hosting service, that is GitHub Pages, I want to build and deploy a back-end, so that people can share and comment on their own PicoBlaze programs.



Possibly Related Threads…
Thread Author Replies Views Last Post
  A weird bug in the preprocessor of PicoBlaze Simulator in JavaScript FlatAssembler 81 31531 December 19, 2023 at 4:46 pm
Last Post: BrianSoddingBoru4
  Reformatting tools for JavaScript FlatAssembler 0 1044 June 14, 2020 at 10:13 am
Last Post: FlatAssembler
  Anatomy of religion in RELIGION SIMULATOR game gravitysoftware 12 5327 February 8, 2015 at 12:52 pm
Last Post: c172
  Analysis of a Facebook social engineering/Javascript "hack" Autumnlicious 4 4632 March 2, 2011 at 9:29 am
Last Post: fr0d0



Users browsing this thread: 3 Guest(s)