This specific feature is recent, and the language is quite young.helpcomputer0 wrote: ↑Mon Sep 18, 2023 10:57 pm My only issue with ugBasic so far is there doesn't seem to be that many games made with it which makes me question it.
Regardless, if it saves time, it comes in handy despite this.
You can also use inline assembly seamlessy, if needed.
Maybe there was a misunderstanding.ParadigmShifter wrote: ↑Mon Sep 18, 2023 10:37 pm Yup I know why C is slow on 8 bit processors, which is the main reason I program in ASM on the speccy.
All your points about assembly are definitely valid, but they have one flaw: you have to know both language and hardware details. And, to develop a game or just a prototype, you must master both. Ultimately, in my opinion, it's just too much effort for a prototype. The reason for choosing a high-level language, in the end, is just this.
The real point is that the choice usually falls on C because it is known and widespread. There are also good cross compilers (like z88dk) which avoid compiling directly on the hardware, and that makes possible to work with hardware thanks to libraries. In my humble opinion, on 8-bit targets, there could be specialized languages which could give better results than C.
Sincerely, I don't think recursive functions are very useful in a real-time computing context with 8-bit processors. And, even if they were, they can always be translated into an iterative algorithm (which are usually more efficient, for the reason you well explained when you explained how you use Z80 registers). Furthermore, the stack is poorly suited to efficient multitasking, especially with a large number of tasks where each one claims to have its own.ParadigmShifter wrote: ↑Mon Sep 18, 2023 10:37 pm Does ugBasic not support recursive functions then if it does not use the stack if it can help it?
The reason BASIC was chosen is not because C or Python were particularly complex, at least in terms of syntax, to write a parser for. The reason is the same why it was chosen in '80 as the language of choice for 8-bit home computers: it was not created for a specific purpose, it was not very formal and it had a very gentle learning curve. Characteristics that it still has today, unlike many other languages, including C and Python.ParadigmShifter wrote: ↑Mon Sep 18, 2023 10:37 pm I guess you picked Basic as the syntax for ugBasic because many people interested in retro coding will have used Basic originally then.
It also fits perfectly with the concept of "isomorphism" which is the basis of ugBASIC. In a nutshell, there is no rigid separation between language and hardware and, at the same time, there is no "abstraction" to support multiple targets that introduces unnecessary slowness, like (generic C) libraries do.
For this reason I consider it preferable to C, at least in this very specific context, but your mileage may vary.