corrected pixel byte values
This commit is contained in:
parent
0320168d5f
commit
26c10b129c
|
@ -347,7 +347,7 @@ sending a byte to .Screen/pixel will perform the drawing in the screen.
|
|||
the high nibble of that byte will determine the layer in which we'll draw:
|
||||
|
||||
* 0: draw a single pixel in the background
|
||||
* 1: draw a single pixel in the foreground
|
||||
* 4: draw a single pixel in the foreground
|
||||
|
||||
and the low nibble of the byte will determine its color.
|
||||
|
||||
|
@ -368,10 +368,10 @@ the 8 possible combinations of the pixel byte that we have for drawing a pixel a
|
|||
& * 01: draw pixel with color 1 in the background layer
|
||||
& * 02: draw pixel with color 2 in the background layer
|
||||
& * 03: draw pixel with color 3 in the background layer
|
||||
& * 10: draw pixel with color 0 in the foreground layer
|
||||
& * 11: draw pixel with color 1 in the foreground layer
|
||||
& * 12: draw pixel with color 2 in the foreground layer
|
||||
& * 13: draw pixel with color 3 in the foreground layer
|
||||
& * 40: draw pixel with color 0 in the foreground layer
|
||||
& * 41: draw pixel with color 1 in the foreground layer
|
||||
& * 42: draw pixel with color 2 in the foreground layer
|
||||
& * 43: draw pixel with color 3 in the foreground layer
|
||||
|
||||
## hello pixel
|
||||
|
||||
|
@ -380,7 +380,7 @@ let's try it all together! the following code will draw a pixel with color 1 in
|
|||
```
|
||||
#0008 .Screen/x DEO2
|
||||
#0008 .Screen/y DEO2
|
||||
#11 .Screen/pixel DEO
|
||||
#41 .Screen/pixel DEO
|
||||
```
|
||||
|
||||
the complete program would look as follows:
|
||||
|
@ -402,7 +402,7 @@ the complete program would look as follows:
|
|||
( draw a pixel in the screen )
|
||||
#0008 .Screen/x DEO2
|
||||
#0008 .Screen/y DEO2
|
||||
#11 .Screen/pixel DEO
|
||||
#41 .Screen/pixel DEO
|
||||
```
|
||||
|
||||
woohoo!
|
||||
|
@ -421,19 +421,19 @@ for example, we can draw multiple pixels in an horizontal line, setting the y co
|
|||
|
||||
( draw 6 pixels in an horizontal line )
|
||||
#0008 .Screen/x DEO2
|
||||
#11 .Screen/pixel DEO
|
||||
#41 .Screen/pixel DEO
|
||||
|
||||
#0009 .Screen/x DEO2
|
||||
#11 .Screen/pixel DEO
|
||||
#41 .Screen/pixel DEO
|
||||
|
||||
#000a .Screen/x DEO2
|
||||
#11 .Screen/pixel DEO
|
||||
#41 .Screen/pixel DEO
|
||||
|
||||
#000b .Screen/x DEO2
|
||||
#11 .Screen/pixel DEO
|
||||
#41 .Screen/pixel DEO
|
||||
|
||||
#000c .Screen/x DEO2
|
||||
#11 .Screen/pixel DEO
|
||||
#41 .Screen/pixel DEO
|
||||
|
||||
#000d .Screen/x DEO2
|
||||
#11 .Screen/pixel DEO
|
||||
|
@ -444,7 +444,7 @@ note that we have to set the color for each pixel we draw; that operation signal
|
|||
we can define a macro to make it easier to repeat that:
|
||||
|
||||
```
|
||||
%DRAW-PIXEL { #11 .Screen/pixel DEO } ( -- )
|
||||
%DRAW-PIXEL { #41 .Screen/pixel DEO } ( -- )
|
||||
```
|
||||
|
||||
## reading and manipulating coordinates
|
||||
|
@ -515,7 +515,7 @@ using these macros we defined above, our code could end up looking as following:
|
|||
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ]
|
||||
|
||||
( macros )
|
||||
%DRAW-PIXEL { #11 .Screen/pixel DEO } ( -- )
|
||||
%DRAW-PIXEL { #41 .Screen/pixel DEO } ( -- )
|
||||
%INC-X { .Screen/x DEI2 INC2 .Screen/x DEO2 } ( -- )
|
||||
|
||||
( main program )
|
||||
|
|
Loading…
Reference in New Issue