revamped pixel output draft
This commit is contained in:
@@ -35,13 +35,13 @@ Unlike Uxn/Varvara or Uxn/SPARTA, Uxn/ESOP only exposes the control block ports
|
||||
In Uxntal, the ESOP's control block would be described as follows:
|
||||
|
||||
```
|
||||
|00 @Control [ &framevec $2 &input $2 &random $1 &status $1 &sound $1 &syscall $1 ]
|
||||
|00 @Control [ &framevec $2 &io $2 &random $1 &status $1 &sound $1 &syscall $1 ]
|
||||
```
|
||||
|
||||
The fields of the control block are:
|
||||
|
||||
- Frame vector (`00-01`) - the port to set the vector to be run on each frame (60 frames per second);
|
||||
- Input (`02-03`) - the port to read input status bits of every key on the keypad;
|
||||
- Input/output (`02-03`) - the port to read input status bits of every key on the keypad and to output pixels at given coordinates;
|
||||
- Random/debug port (`04`) - the port to trace debug information on output and retrieve a random byte value on input;
|
||||
- Status port (`05`) - the port to get the information on battery and get/set screen brightness level;
|
||||
- Sound port (`06`) - the port to perform mono audio beeper operations;
|
||||
@@ -51,15 +51,17 @@ Implementation note: direct writing to or reading from the control block memory
|
||||
|
||||
## Screen output
|
||||
|
||||
All the 4032 pixels of 84x48 screen are allocated in the 504-byte video memory of ESOP (`#fe00-#fff7`) in the left-to-right, top-to-bottom, high-to-low order. To output a pixel at the given coordinates, the app must calculate the appropriate byte position itself.
|
||||
All the 4032 pixels of 84x48 screen are allocated in the 504-byte video memory of ESOP (`#fe00-#fff7`) in the left-to-right, top-to-bottom, high-to-low order. To output a pixel at the given coordinates using memory manipulation routines, the app must calculate the appropriate byte position itself. This process is made easier by reusing I/O port `02-03` with the `DEO2` instruction where you can directly pass X and Y coordinates of the pixel.
|
||||
|
||||
The actual screen contents get updated 60 times per second according to the video memory. Before this process, the frame vector is run, if set in the corresponding control port (`00-01`). All graphics operations must be performed within this frame vector.
|
||||
|
||||
Due to shared nature of the I/O device port, the handler responsible for pixel output in the ESOP implementaion must preserve the input state between port write calls, i.e. save it before the processing and restore afterwards.
|
||||
|
||||
Standard input/output ports are not supported.
|
||||
|
||||
## Keypad input
|
||||
|
||||
The 16 bits of the input ports (`02` and `03`) have the following mapping:
|
||||
When in input mode, the 16 bits of the input ports (`02` and `03`) have the following mapping:
|
||||
|
||||
Bit|15 |14 |13|12|11|10|9|8|7|6|5|4|3|2|1|0
|
||||
---|---|---|--|--|--|--|-|-|-|-|-|-|-|-|-|-
|
||||
|
||||
Reference in New Issue
Block a user