diff --git a/inc/vdp.h b/inc/vdp.h index 0dde6d08..184d1d67 100644 --- a/inc/vdp.h +++ b/inc/vdp.h @@ -991,6 +991,43 @@ void VDP_setWindowHPos(u16 right, u16 pos); * The Vertical position of the window in 1 tile unit (8 pixels). */ void VDP_setWindowVPos(u16 down, u16 pos); +/** + * \brief + * Turns off the window. + */ +void VDP_setWindowOff(); +/** + * \brief + * Positions the window from the top edge of the screen by the specified number of rows (tiles). + * + * \param rows + * The number of rows, expressed in tiles. + */ +void VDP_setWindowOnTop(u16 rows); +/** + * \brief + * Positions the window from the bottom edge of the screen by the specified number of rows (tiles). + * + * \param rows + * The number of rows, expressed in tiles. + */ +void VDP_setWindowOnBottom(u16 rows); +/** + * \brief + * Positions the window from the left edge of the screen by the specified number of columns, each 2 tiles wide (16 pixels). + * + * \param cols + * The number of columns, expressed in double tiles. + */ +void VDP_setWindowOnLeft(u16 cols); +/** + * \brief + * Positions the window from the right edge of the screen by the specified number of columns, each 2 tiles wide (16 pixels). + * + * \param cols + * The number of columns, expressed in double tiles. + */ +void VDP_setWindowOnRight(u16 cols); /** * \brief diff --git a/src/vdp.c b/src/vdp.c index 707a63bd..a0e2670c 100644 --- a/src/vdp.c +++ b/src/vdp.c @@ -808,6 +808,31 @@ void VDP_setWindowVPos(u16 down, u16 pos) *pw = 0x9200 | v; } +void VDP_setWindowOff() +{ + VDP_setWindowVPos(false, 0); + VDP_setWindowHPos(false, 0); +} + +void VDP_setWindowOnTop(u16 rows) +{ + VDP_setWindowVPos(false, rows); +} + +void VDP_setWindowOnBottom(u16 rows) +{ + VDP_setWindowVPos(true, (screenHeight / 8) - rows); +} + +void VDP_setWindowOnLeft(u16 cols) +{ + VDP_setWindowHPos(false, cols); +} + +void VDP_setWindowOnRight(u16 cols) +{ + VDP_setWindowHPos(true, (screenWidth / 16) - cols); +} void VDP_waitDMACompletion() {