9 # error This is a userspace-only header, not allowed by the current build.
12 #include <sifteo/abi.h>
13 #include <sifteo/cube.h>
14 #include <sifteo/math.h>
15 #include <sifteo/video/color.h>
16 #include <sifteo/video/sprite.h>
17 #include <sifteo/video/framebuffer.h>
18 #include <sifteo/video/bg0rom.h>
19 #include <sifteo/video/bg0.h>
20 #include <sifteo/video/bg1.h>
21 #include <sifteo/video/bg2.h>
22 #include <sifteo/video/tilebuffer.h>
34 static const unsigned LCD_width = 128;
35 static const unsigned LCD_height = 128;
36 static const unsigned TILE = 8;
39 static const Int2 LCD_size = { LCD_width, LCD_height };
42 static const Int2 LCD_center = { LCD_width / 2, LCD_height / 2 };
86 ROT_LEFT_90_MIRROR = _SYS_VF_XY_SWAP,
87 ROT_MIRROR = _SYS_VF_X_FLIP,
88 ROT_LEFT_90 = _SYS_VF_XY_SWAP | _SYS_VF_Y_FLIP,
89 ROT_180_MIRROR = _SYS_VF_Y_FLIP,
90 ROT_RIGHT_90 = _SYS_VF_XY_SWAP | _SYS_VF_X_FLIP,
91 ROT_180 = _SYS_VF_X_FLIP | _SYS_VF_Y_FLIP,
92 ROT_RIGHT_90_MIRROR = _SYS_VF_XY_SWAP | _SYS_VF_X_FLIP | _SYS_VF_Y_FLIP
129 _SYSAttachedVideoBuffer sys;
143 operator _SYSVideoBuffer* () {
return &sys.vbuf; }
144 operator const _SYSVideoBuffer* ()
const {
return &sys.vbuf; }
145 operator _SYSAttachedVideoBuffer* () {
return &sys; }
146 operator const _SYSAttachedVideoBuffer* ()
const {
return &sys; }
155 operator _SYSCubeID ()
const {
183 poke(
offsetof(_SYSVideoRAM, first_line) / 2, firstLine | (numLines << 8));
227 const uint8_t mask = _SYS_VF_XY_SWAP | _SYS_VF_X_FLIP | _SYS_VF_Y_FLIP;
232 xorb(
offsetof(_SYSVideoRAM, flags), (r ^ flags) & mask);
239 const uint8_t mask = _SYS_VF_XY_SWAP | _SYS_VF_X_FLIP | _SYS_VF_Y_FLIP;
250 case ROT_NORMAL:
return TOP;
251 case ROT_LEFT_90:
return LEFT;
252 case ROT_180:
return BOTTOM;
253 case ROT_RIGHT_90:
return RIGHT;
266 const uint32_t sideToRotation =
270 (ROT_RIGHT_90 << 24) ;
272 ASSERT(topSide >= 0 && topSide < 4);
273 uint8_t r = sideToRotation >> (topSide * 8);
486 _SYS_vbuf_fill(*
this, 0, 0, _SYS_VA_FIRST_LINE / 2);
540 _SYS_vbuf_init(*
this);
541 _SYS_setVideoBuffer(*
this, *
this);
555 _SYS_vbuf_lock(*
this, addr);
566 _SYS_vbuf_unlock(*
this);
587 void poke(uint16_t addr, uint16_t word) {
588 _SYS_vbuf_poke(*
this, addr, word);
595 void pokeb(uint16_t addr, uint8_t byte) {
596 _SYS_vbuf_pokeb(*
this, addr, byte);
602 void pokei(uint16_t addr, uint16_t index) {
603 _SYS_vbuf_poke(*
this, addr, _SYS_TILE77(index));
610 void xorb(uint16_t addr, uint8_t byte) {
611 _SYS_vbuf_xorb(*
this, addr, byte);
617 uint16_t
peek(uint16_t addr)
const {
618 return _SYS_vbuf_peek(*
this, addr);
624 uint8_t
peekb(uint16_t addr)
const {
625 return _SYS_vbuf_peekb(*
this, addr);