|
| 1 | +/** |
| 2 | + * @file vdc-global.asm |
| 3 | + * @brief Vdc module |
| 4 | + * @details Simple macros for Vdc. |
| 5 | + * |
| 6 | + * @author Raffaele Intorcia raffaele.intorcia@gmail.com |
| 7 | + * |
| 8 | + * @copyright MIT License |
| 9 | + * Copyright (c) 2024 c128lib - https://github.com/c128lib |
| 10 | + * |
| 11 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 12 | + * of this software and associated documentation files (the "Software"), to deal |
| 13 | + * in the Software without restriction, including without limitation the rights |
| 14 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 15 | + * copies of the Software, and to permit persons to whom the Software is |
| 16 | + * furnished to do so, subject to the following conditions: |
| 17 | + * |
| 18 | + * The above copyright notice and this permission notice shall be included in all |
| 19 | + * copies or substantial portions of the Software. |
| 20 | + * |
| 21 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 22 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 23 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 24 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 25 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 26 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 27 | + * SOFTWARE. |
| 28 | + * |
| 29 | + * @date 2024 |
| 30 | + */ |
| 31 | + |
| 32 | +#importonce |
| 33 | + |
| 34 | +#import "vdc.asm" |
| 35 | + |
| 36 | +.filenamespace c128lib |
| 37 | + |
| 38 | +/** |
| 39 | + * @brief Go to 40 columns mode |
| 40 | + * |
| 41 | + * @remark Register .A will be modified. |
| 42 | + * @remark Flags N and Z will be affected. |
| 43 | + * |
| 44 | + * @since 1.1.0 |
| 45 | + */ |
| 46 | +.macro c128lib_Go40() { Go40() } |
| 47 | + |
| 48 | +/** |
| 49 | + * @brief Go to 80 columns mode |
| 50 | + * |
| 51 | + * @remark Register .A will be modified. |
| 52 | + * @remark Flags N and Z will be affected. |
| 53 | + * |
| 54 | + * @since 1.1.0 |
| 55 | + */ |
| 56 | +.macro c128lib_Go80() { Go80() } |
| 57 | + |
| 58 | +/** |
| 59 | + * @brief Set background and foreground color, also disable bit 6 of |
| 60 | + * HORIZONTAL_SMOOTH_SCROLLING register |
| 61 | + * |
| 62 | + * @param[in] background Background color |
| 63 | + * @param[in] foreground Foreground color |
| 64 | + * |
| 65 | + * @remark Register .A and .X will be modified. |
| 66 | + * @remark Flags N, Z and O will be affected. |
| 67 | + * |
| 68 | + * @since 1.1.0 |
| 69 | + */ |
| 70 | +.macro c128lib_SetBackgroundForegroundColor(background, foreground) { SetBackgroundForegroundColor(background, foreground) } |
| 71 | + |
| 72 | +/** |
| 73 | + * @brief Set background and foreground color, also disable bit 6 of |
| 74 | + * HORIZONTAL_SMOOTH_SCROLLING register. Use vars instead of labels. |
| 75 | + * Warning: high nibble of background must be 0, it's up to developer |
| 76 | + * to check this. |
| 77 | + * |
| 78 | + * @param[in] background Background color address |
| 79 | + * @param[in] foreground Foreground color address |
| 80 | + * |
| 81 | + * @remark Register .A and .X will be modified. |
| 82 | + * @remark Flags N, Z, C and O will be affected. |
| 83 | + * |
| 84 | + * @since 1.1.0 |
| 85 | + */ |
| 86 | +.macro c128lib_SetBackgroundForegroundColorWithVars(background, foreground) { SetBackgroundForegroundColorWithVars(background, foreground) } |
| 87 | + |
| 88 | +/** |
| 89 | + * @brief Read from Vdc internal memory and write it to Vic screen memory by |
| 90 | + * using coordinates. |
| 91 | + * |
| 92 | + * @param[in] xPos X coord on Vdc screen |
| 93 | + * @param[in] yPos Y coord on Vdc screen |
| 94 | + * @param[in] destination Vic screen memory absolute address |
| 95 | + * @param[in] qty Number of byte to copy |
| 96 | + * |
| 97 | + * @remark Register .A and .X will be modified. |
| 98 | + * @remark Flags N, Z and O will be affected. |
| 99 | + * |
| 100 | + * @since 1.1.0 |
| 101 | + */ |
| 102 | +.macro c128lib_ReadFromVdcMemoryByCoordinates(xPos, yPos, destination, qty) { ReadFromVdcMemoryByCoordinates(xPos, yPos, destination, qty) } |
| 103 | + |
| 104 | +/** |
| 105 | + * @brief Read from Vdc internal memory and write it to Vic screen memory by |
| 106 | + * using source address. |
| 107 | + * |
| 108 | + * @param[in] source Vdc memory absolute address |
| 109 | + * @param[in] destination Vic screen memory absolute address |
| 110 | + * @param[in] qty Number of byte to copy |
| 111 | + * |
| 112 | + * @remark Register .A, .X and .Y will be modified. |
| 113 | + * @remark Flags N, Z and C will be affected. |
| 114 | + * |
| 115 | + * @since 1.1.0 |
| 116 | + */ |
| 117 | +.macro c128lib_ReadFromVdcMemoryByAddress(source, destination, qty) { ReadFromVdcMemoryByAddress(source, destination, qty) } |
| 118 | + |
| 119 | +/** |
| 120 | + * @brief Read from Vic screen memory and write it to Vdc internal memory by |
| 121 | + * using coordinates. |
| 122 | + * |
| 123 | + * @param[in] xPos X coord on Vic screen |
| 124 | + * @param[in] yPos Y coord on Vic screen |
| 125 | + * @param[in] destination Vdc internal memory absolute address |
| 126 | + * @param[in] qty Number of byte to copy |
| 127 | + * |
| 128 | + * @remark Register .A, .X and .Y will be modified. |
| 129 | + * @remark Flags N, Z and C will be affected. |
| 130 | + * |
| 131 | + * @since 1.1.0 |
| 132 | + */ |
| 133 | +.macro c128lib_WriteToVdcMemoryByCoordinates(source, xPos, yPos, qty) { WriteToVdcMemoryByCoordinates(source, xPos, yPos, qty) } |
| 134 | + |
| 135 | +/** |
| 136 | + * @brief Read from Vic screen memory and write it to Vdc internal memory by |
| 137 | + * using coordinates. |
| 138 | + * |
| 139 | + * @param[in] source Vdc memory absolute address |
| 140 | + * @param[in] destination Vic screen memory absolute address |
| 141 | + * @param[in] qty Number of byte to copy |
| 142 | + * |
| 143 | + * @remark Register .A, .X and .Y will be modified. |
| 144 | + * @remark Flags N, Z and C will be affected. |
| 145 | + * |
| 146 | + * @since 1.1.0 |
| 147 | + */ |
| 148 | +.macro c128lib_WriteToVdcMemoryByAddress(source, destination, qty) { WriteToVdcMemoryByAddress(source, destination, qty) } |
| 149 | + |
| 150 | +/** |
| 151 | + * @brief Returns the address start of Vdc display memory data. This |
| 152 | + * is stored in Vdc register SCREEN_MEMORY_STARTING_HIGH_ADDRESS and |
| 153 | + * SCREEN_MEMORY_STARTING_LOW_ADDRESS. |
| 154 | + * The 16-bit value is stored in $FB and $FC. |
| 155 | + * |
| 156 | + * @remark Register .A and .X will be modified. |
| 157 | + * @remark Flags N, Z and O will be affected. |
| 158 | + * |
| 159 | + * @since 1.1.0 |
| 160 | + */ |
| 161 | +.macro c128lib_GetVdcDisplayStart() { GetVdcDisplayStart() } |
| 162 | + |
| 163 | +/** |
| 164 | + * @brief Set the pointer to the RAM area that is to be updated. |
| 165 | + * The update pointer is stored in Vdc register CURRENT_MEMORY_HIGH_ADDRESS |
| 166 | + * and CURRENT_MEMORY_LOW_ADDRESS. |
| 167 | + * |
| 168 | + * @param[in] address Address of update area |
| 169 | + * |
| 170 | + * @remark Register .A and .X will be modified. |
| 171 | + * @remark Flags N, Z and O will be affected. |
| 172 | + * |
| 173 | + * @since 1.1.0 |
| 174 | + */ |
| 175 | +.macro c128lib_SetVdcUpdateAddress(address) { SetVdcUpdateAddress(address) } |
| 176 | + |
| 177 | +/** |
| 178 | + * @brief Write a value into Vdc register without using kernal |
| 179 | + * routine instead of pure instruction. It needs register |
| 180 | + * number in X and value to write in A. |
| 181 | + * It costs 11 bytes and 14 cycles. |
| 182 | + * |
| 183 | + * @pre Register .X must be filled with internal Vdc register |
| 184 | + * to write on. |
| 185 | + * @pre Register .A must be filled with the value that will be |
| 186 | + * written to internal Vdc register. |
| 187 | + * @remark Flags N, Z and O will be affected. |
| 188 | + * |
| 189 | + * @since 1.1.0 |
| 190 | + */ |
| 191 | +.macro c128lib_WriteVdc() { WriteVdc() } |
| 192 | + |
| 193 | +/** |
| 194 | + * @brief Read a value from Vdc register without using kernal |
| 195 | + * routine instead of pure instruction. It needs register |
| 196 | + * number in X and value is written in A. |
| 197 | + * It costs 11 bytes and 14 cycles. |
| 198 | + * |
| 199 | + * @pre Register .X must be filled with internal Vdc register |
| 200 | + * to read from. |
| 201 | + * @remark Register .A will be modified. |
| 202 | + * @remark Flags N, Z and O will be affected. |
| 203 | + * @post Register .A will contain the value read from internal |
| 204 | + * Vdc register. |
| 205 | + * |
| 206 | + * @since 1.1.0 |
| 207 | + */ |
| 208 | +.macro c128lib_ReadVdc() { ReadVdc() } |
0 commit comments