How To

How does LowRes NX.... work? 🤔


Seba06 2020-05-11 21:45 (Edited)

I looked at the source code and I couldn’t find anywhere where it checked if a line matched with a command or to output something to screen. Maybe it’s because I don’t know C (actually that’s 100% the reason why) but I don’t know what anything does. I try to open the project file with visual studio but when I do a bunch of compiler errors pop up saying a lot of stuff is not declared. So Timo if you had the time to give me a 4 year course on computer science and computer graphics that would be awesome.

Timo 2020-05-12 18:06

Sure, no problem, let's start tomorrow :P Hm, maybe not. But I'll try to explain a bit...

Here you can find all the files of the BASIC interpreter. Files starting with "cmd_" contain the actual commands. They are called from "interpreter.c".

Commands are not executed directly from the source code text. The first step is the tokenization in the file "tokenizer.c". It converts the source code in an array of tokens, which are faster to read for the interpreter. See all tokens in the file "token.h/c".

Here are all the parts for the virtual hardware: graphics, sound, input. In "machine.h" you can see the memory map. This basically works like an emulator.

Have a look. You'll have more questions then I guess ;)

Seba06 2020-05-13 00:20

What c file acts as the sort of "main" file that is the one you run, if that makes sense?

Seba06 2020-05-13 00:27

Also why is the very first error string "OK" lol. Never seen that error pop up

Timo 2020-05-13 15:50

Commands always return an error value, so if there is no error they return 0. "OK" is just a string assigned to it, but it's never shown.

About "main": The iOS and desktop apps work differently. The core of LowRes NX is platform independent, so its entry point is "core.c/h". First the app has to call core_init() and then for each screen refresh core_update()... and some other stuff.

Here you find all files for the desktop version (Mac, Windows, Linux). It includes the "main.c" file with the main function.

Seba06 2020-05-13 16:05

Ok one last question, what did you use to make all that code and what extensions do you use, because when i opened it theres just a bunch of errors, i fixed most of them by setting the additional include files but theres still some errors here and there

Timo 2020-05-13 16:39

It requires SDL2:

Seba06 2020-05-13 21:09

I already had that t was just a bunch of weird stuff, anyways, i managed to fix all of the compiler errors but when I try to run it or build it other errors show up :(

Seba06 2020-05-13 21:36

Quite a lot of them have "to disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details" at the end

Seba06 2020-05-13 21:43

Wait nvm i managed to fix that too. There is however ONE more error standing in the way "entry point must be defined". SORRY that im asking so many questions

Timo 2020-05-14 17:41

Do you use the provided VisualStudio project?? It should work out of the box...

Seba06 2020-05-14 18:02

I did but still

Timo 2020-05-14 18:48

Which version of VisualStudio do you have?

Seba06 2020-05-14 18:51

visual studio community 2017 up to date

Log in to reply.