How To

My Notes on How LowRes NX Works


nathanielbabiak 2020-11-24 12:26 (Edited)

I thought someone might find these useful, figured I'd share my notes on how LowRes NX works (and common mistakes I keep making)...

Order of Operations

The LowRes NX console performs operations in the order shown here:

() | ^ | - | */\ | MOD | +- | <>=<=> | NOT | AND | ORXOR | =

Graphics, Relation among Terms

The manual includes the following text, but I've sorted it below a bit differently to emphasize the relations between the terms.

Graphics, Layers

The manual's discussion of layers is incorrect (as compared to how the console behaves). The manual's text is corrected with the additions and deletions marked here:

The display is composed of 3 layers, which are from back to front:

Each sprite and background cell has an attribute called "priority". By setting it, the cell or sprite will appear in front of the other 2 layers. on a higher display layer. Actually there are 6 layers, from back to front:

Graphics, Inspiring Console Tutorials

These videos explain the graphics for the historic console that inspired this fantasy console:

Typecasting Float to Int

Bitwise Operations

System Stuff

Clock Cycles (cc) and Tokens

CC Measurements

For-next loops (FOR X=LO TO HI STEP S) over n iterations count as:

( 2 + CC(HI) + CC(S) ) * n + ( CC(X=LO) + CC(HI) + CC(S) )

where CC(EXPRESSION) notation means clock-cycles of expression.

3*N+4    FOR X=LO   TO HI
3*N+6    FOR X=LO+1 TO HI
4*N+5    FOR X=LO   TO HI   STEP 1
6*N+7    FOR X=LO   TO HI   STEP 1+0
5*N+6    FOR X=LO   TO HI-1
6*N+7    FOR X=LO   TO HI-1 STEP 1

  1     1      IF ? THEN ...
  2     1      IF ? THEN ...                    ELSE ...
  2   T2 F2    IF ? THEN ... ELSE IF ? THEN ...
  2   T3 F2    IF ? THEN ... ELSE IF ? THEN ... ELSE ...
  2     1      IF ? THEN ...                             END IF
  2     2      IF ? THEN ...                    ELSE ... END IF
  2   T3 F2    IF ? THEN ... ELSE IF ? THEN ...          END IF
  3   T3 F3    IF ? THEN ... ELSE IF ? THEN ... ELSE ... END IF

Misc. Stuff

rilden 2020-11-24 16:40

Another thing I found out:
LowRes NX waits 2 frames when PRINT causes text to scroll up. So if you print a lot of lines, the text will scroll at 30 frames per second.

was8bit 2020-11-24 17:13

Unless you use PRINT TEXT$;

Then it only scrolls when it reaches the end of the screen

was8bit 2020-11-24 17:15

Plus, if you already use WAIT VBL in a DO LOOP, that will also add to the timing of things..

Timo 2020-11-26 18:39

"Boolean (AND/OR/NOT) operators treat any float as 0."

What do you mean? I believe both values are casted to integer and then the operator is applied. All logical operators are also binary operators by the way. That's why "true" is -1 (all bits set).

"VAL("0X"+NUMERALS$) converts hex."

This one is not on purpose. I just used the C function internally. I didn't know it does this :O

"Figure out display order of PRINT vs BG 0/1 and PRIO 0/1, but not yet..."

PRINT uses the current WINDOW. And the window command lets you set the BG.

nathanielbabiak 2020-11-27 00:23

Yep - my mistake. I only ever tested floats between 0 and 0.9999, never 1.0 or higher.

qwaffe 2020-11-27 05:28 (Edited)

this post can really benefit from some markdown formatting. i thought they were random numbers at first.

nathanielbabiak 2020-11-27 16:03 (Edited)

How do I add monospace? I tried double back-quotes (``) but it didn't work :-(

qwaffe 2020-11-28 02:36 (Edited)

put the text inside the back-quotes like normal quotes on single lines. (can be in-line.)

but code blocks are also possible. this can be quite helpful (:

nathanielbabiak 2020-11-28 03:34 (Edited)

Timo, I had to look up that emoji! Can you keep the hex conversion feature and the TRACE CHR$(10) feature? It'd be really nice to make them official...

was8bit 2020-11-28 05:28

I kinda would like to see VAL("%10") =2 and not 0... but its prolly not worth the effort to put it in...

Timo 2020-11-28 08:50 (Edited)

CHR$(10) is as expected so it’s official.

VAL(“0xFF”) doesn’t really make sense in the BASIC world as 0x is not the way here to indicate hex (it’s #).
I will probably not remove it, but I won’t add a binary version.
The only reason I see for it would be doing binary operations using strings instead of bit operators (AND OR XOR), but this is bad for performance and I won’t do this favor for was8bit ;)

was8bit 2020-11-28 09:12

oh my poor bit-brain 0o0 ;)

qwaffe 2020-11-28 11:19

isn't the way to indicate hex in nx "$" and not "#"?

was8bit 2020-11-28 12:25 (Edited)

Corerect, # and $ are side by side on the keyboard, i am sure that was just a typo... just for the record....

Hexadecimal and binary notation can be used for number values:

Timo 2020-11-28 12:59

Sorry, yes it's $. Wasn't a typo, I really don't know how my language works :O

was8bit 2020-11-28 15:08

You are busy with real life, its ok :)

Log in to reply.