Video Macros&Constants | |
Macros and Constants | |
cpct_memPage6 | Macro that encodes a video memory page in the 6 Least Significant bits (LSb) of a byte, required as parameter for cpct_setVideoMemoryPage |
Video Memory Pages | Useful constants defining some typical Video Memory Pages to be used as parameters for cpct_setVideoMemoryPage |
cpct_setBorder | Changes the colour of the screen border. |
cpct_clearScreen | Macro to simplify clearing the screen. |
cpct_clearScreen_f8 | Macro to simplify clearing the screen: fast version (in chuncks of 8 bytes) |
cpct_clearScreen_f64 | Does exactly the same as cpct_clearScreen_f8 but calling cpct_memset_f64 instead of cpct_memset_f8. |
Macro that encodes a video memory page in the 6 Least Significant bits (LSb) of a byte, required as parameter for cpct_setVideoMemoryPage
#define cpct_memPage6 (PAGE)
(1B) PAGE | Video memory page wanted |
u8 | Video Memory Page encoded in the 6 LSb of the byte. |
This is just a macro that shifts PAGE 2 bits to the right, to leave it with just 6 significant bits. For more information, check functions cpct_setVideoMemoryPage and cpct_setVideoMemoryOffset.
Useful constants defining some typical Video Memory Pages to be used as parameters for cpct_setVideoMemoryPage
cpct_pageCO | Video Memory Page 0xC0 (0xC0··) |
cpct_page8O | Video Memory Page 0x80 (0x80··) |
cpct_page4O | Video Memory Page 0x40 (0x40··) |
cpct_page0O | Video Memory Page 0x00 (0x00··) |
Changes the colour of the screen border.
#define cpct_setBorder (HWC) cpct_setPALColour (16, (HWC))
(1B) HWC | Hardware colour value for the screen border. |
This is not a real function, but a C macro. Beware of using it along with complex expressions or calculations, as it may expand in non-desired ways.
For more information, check the real function cpct_setPALColour, which is called when using cpct_setBorderColour (It is called using 16 as pen argument, which identifies the border).
Macro to simplify clearing the screen.
#define cpct_clearScreen (COL)
(1B) COL | Colour pattern to be used for screen clearing. Typically, a 0x00 is used to fill up all the screen with 0’s (firmware colour 0). However, you may use it in combination with cpct_px2byteM0, cpct_px2byteM1 or a manually created colour pattern. |
Fills up all the standard screen (range [0xC000-0xFFFF]) with COL byte, the colour pattern given. It uses <cpc_memset> to do the task, just filling up 16K bytes out of COL value, starting at 0xC000.
This function takes 98331 microseconds to fill the screen. This is 4.924 VSYNCs on a 50Hz display.
Macro to simplify clearing the screen: fast version (in chuncks of 8 bytes)
#define cpct_clearScreen_f8 (COL)
(2B) COL | Colour pattern to be used for screen clearing. Typically, a 0x0000 is used to fill up all the screen with 0’s (firmware colour 0). However, you may use it in combination with cpct_px2byteM0, cpct_px2byteM1 or a manually created colour pattern. Take into account that CPC’s memory access is little-endian: this means that using 0x1122 as colour pattern will fill up memory with the sequence 0x22, 0x11, 0x22, 0x11... |
Fills up all the standard screen (range [0xC000-0xFFFF]) with COL pair of bytes, the colour pattern given. It uses <cpc_memset_f8> to do the task, just filling up 16K bytes out of COL value, starting at 0xC000.
<cpc_memset_f8> disables interrupts and moves SP while operating. It also sets interrupts to enabled at its end, without taking into account its previous status. Take it into account when using this macro.
This function takes 41036 microseconds to fill the screen. This is 2.086 VSYNCs on a 50Hz display.
Does exactly the same as cpct_clearScreen_f8 but calling cpct_memset_f64 instead of cpct_memset_f8. Therefore, it works in chuncks of 64 bytes, being a 33% faster.
#define cpct_clearScreen_f64 (COL)
(2B) COL | Colour pattern to be used for screen clearing. Typically, a 0x0000 is used to fill up all the screen with 0’s (firmware colour 0). However, you may use it in combination with cpct_px2byteM0, cpct_px2byteM1 or a manually created colour pattern. Take into account that CPC’s memory access is little-endian: this means that using 0x1122 as colour pattern will fill up memory with the sequence 0x22, 0x11, 0x22, 0x11... |
Fills up all the standard screen (range [0xC000-0xFFFF]) with COL pair of bytes, the colour pattern given. It uses <cpc_memset_f64> to do the task, just filling up 16K bytes out of COL value, starting at 0xC000.
<cpc_memset_f64> disables interrupts and moves SP while operating. It also sets interrupts to enabled at its end, without taking into account its previous status. Take it into account when using this macro.
This function takes 33843 microseconds to fill the screen. This is 1.721 VSYNCs on a 50Hz display.