Index
$#! · 0-9 · A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W · X · Y · Z
C
 Can I remove parts of the code if I need memory?
 Clearing screen
 Colours
 Constants
 CPCT_1BITARRAY
 CPCT_2BITARRAY
 CPCT_4BITARRAY
 CPCT_6BITARRAY
 CPCT_ABSOLUTE_LOCATION_AREA
 cpct_akp_digidrumStatus
 cpct_akp_musicInit
 cpct_akp_musicPlay
 cpct_akp_setFadeVolume
 cpct_akp_SFXGetInstrument
 cpct_akp_SFXInit
 cpct_akp_SFXPlay
 cpct_akp_SFXStop
 cpct_akp_SFXStopAll
 cpct_akp_songLoopTimes
 cpct_akp_stop
 cpct_aks2c
 cpct_bin2c
 cpct_bitWeights
 CPCT_BlendMode
 cpct_clearScreen
 cpct_clearScreen_f64
 cpct_clearScreen_f8
 cpct_count2VSYNC
 cpct_disableFirmware
 cpct_disableLowerROM
 cpct_disableUpperROM
 cpct_drawCharM0
 cpct_drawCharM1
 cpct_drawCharM1_f
 cpct_drawCharM2
 cpct_drawSolidBox
 cpct_drawSprite
 cpct_drawSpriteBlended
 cpct_drawSpriteMasked
 cpct_drawSpriteMaskedAlignedTable
 cpct_drawStringM0
 cpct_drawStringM1
 cpct_drawStringM1_f
 cpct_drawStringM2
 cpct_drawTileAligned2x4_f
 cpct_drawTileAligned2x8
 cpct_drawTileAligned2x8_f
 cpct_drawTileAligned4x4_f
 cpct_drawTileAligned4x8
 cpct_drawTileAligned4x8_f
 cpct_drawTileGrayCode2x8_af
 cpct_enableLowerROM
 cpct_enableUpperROM
 CPCT_ENCODE2BITS
 CPCT_ENCODE4BITS
 CPCT_ENCODE6BITS
 cpct_etm_drawTileBox2x4
 cpct_etm_drawTilemap2x4
 cpct_etm_drawTilemap2x4_f
 cpct_etm_drawTileRow2x4
 cpct_etm_setTileset2x4
 cpct_firmware2hw_colour
 CPCT_FW_Colour
 cpct_fw2hw
 cpct_get2Bits
 cpct_get4Bits
 cpct_get6Bits
 cpct_getBit
 cpct_getHWColour
 cpct_getRandom_glfsr16
 cpct_getRandom_glfsr16_u16
 cpct_getRandom_glfsr16_u8
 cpct_getRandom_lcg_u8
 cpct_getRandom_mxor_u16
 cpct_getRandom_mxor_u32
 cpct_getRandom_mxor_u8
 cpct_getRandom_xsp40_u8
 cpct_getScreenPtr
 cpct_hflipSpriteM0
 cpct_hflipSpriteM0_r
 cpct_hflipSpriteM1
 cpct_hflipSpriteM1_r
 cpct_hflipSpriteM2
 cpct_hflipSpriteM2_r
 cpct_hflipSpriteMaskedM0
 cpct_hflipSpriteMaskedM1
 cpct_hflipSpriteMaskedM2
 CPCT_HW_Colour
 cpct_img2tileset
 cpct_installrslib
 cpct_isAnyKeyPressed
 cpct_isAnyKeyPressed_f
 cpct_isKeyPressed
 cpct_keyboardStatusBuffer
 cpct_keyID
 cpct_memcpy
 cpct_memPage6
 cpct_memset
 cpct_memset_f64
 cpct_memset_f8
 cpct_mkproject
 cpct_mode_rom_status
 cpct_mxor32_seed
 cpct_nextRandom_mxor_u32
 cpct_nextRandom_mxor_u8
 cpct_nextRandom_mxor532_u8
 cpct_nextRandom_mxorplus_u32
 cpct_page0O
 cpct_page4O
 cpct_page8O
 cpct_pageCO
 cpct_pageMemory
 cpct_px2byteM0
 cpct_px2byteM1
 cpct_rand
 cpct_rand16
 cpct_rand32
 cpct_rand8
 cpct_reenableFirmware
 CPCT_RELOCATABLE_AREA
 cpct_removeInterruptHandler
 cpct_removeInterruptHandler.s
 cpct_restoreState_mxor_u16
 cpct_restoreState_mxor_u8
 cpct_rgas2c
 cpct_scanKeyboard
 cpct_scanKeyboard_f
 cpct_scanKeyboard_i
 cpct_scanKeyboard_if
 cpct_set2Bits
 cpct_set4Bits
 cpct_set6Bits
 cpct_setBit
 cpct_setBlendMode
 cpct_setBorder
 cpct_setInterruptHandler
 cpct_setPALColour
 cpct_setPalette
 cpct_setSeed_glfsr16
 cpct_setSeed_lcg_u8
 cpct_setSeed_mxor
 cpct_setSeed_xsp40_u8
 cpct_setStackLocation
 cpct_setTaps_glfsr16
 cpct_setVideoMemoryOffset
 cpct_setVideoMemoryPage
 cpct_setVideoMode
 cpct_sp2tile
 cpct_srand
 cpct_srand16(SEED)
 cpct_srand8(SEED)
 cpct_tmx2csv
 CPCT_VMEM_START
 cpct_waitVSYNC
 cpct_winape
 CPCtelera Reference Manual
 cpctm_createTransparentMaskTable
 cpctm_declareMaskTable
 CPCTM_MASKTABLE0M0
 CPCTM_MASKTABLE0M1
 CPCTM_MASKTABLE10M0
 CPCTM_MASKTABLE11M0
 CPCTM_MASKTABLE12M0
 CPCTM_MASKTABLE13M0
 CPCTM_MASKTABLE14M0
 CPCTM_MASKTABLE15M0
 CPCTM_MASKTABLE1M0
 CPCTM_MASKTABLE1M1
 CPCTM_MASKTABLE2M0
 CPCTM_MASKTABLE2M1
 CPCTM_MASKTABLE3M0
 CPCTM_MASKTABLE3M1
 CPCTM_MASKTABLE4M0
 CPCTM_MASKTABLE5M0
 CPCTM_MASKTABLE6M0
 CPCTM_MASKTABLE7M0
 CPCTM_MASKTABLE8M0
 CPCTM_MASKTABLE9M0
 cpctm_reverse_and_select_bits_of_A
 cpctm_reverse_bits_of_A
 cpctm_reverse_mode_0_pixels_of_A
 cpctm_reverse_mode_1_pixels_of_A
 cpctm_screenPtr
 Credits and Some technical details
Well, as long as it won’t crash it, why not ?
Constants and utilities to manage the 27 colours from the CPC Palette comfortably.
Define or declare arrays with 1-bit elements
Define or declare arrays with 2-bits elements
Define or declare arrays with 4-bits elements
Define or declare arrays with 6-bits elements
Macro that produces following code and data to be located at given absolute memory location MEM.
extern volatile u8 cpct_akp_digidrumStatus
This is an internal variable, updated by Arkos Tracker Player, that is used by the player for signalling events to user code.
Sets up a music into Arkos Tracker Player to be played later on with cpct_akp_musicPlay.
Plays next music cycle of the present song with Arkos Tracker Player.
Sets global volumes for creating fade in / out effects.
Returns the number of the instrument which is playing SFX in the selected channel (0 = Channel free / not playing SFX).
Initializes sound effect instruments to be able to play sound effects.
Plays a concrete sound effect, using the instruments of the “SFX song” given to cpct_akp_SFXInit when initializing sound effects.
Stops the reproduction sound FX on given channels
Stops the reproduction of any sound effect in the 3 channels.
extern volatile u8 cpct_akp_songLoopTimes
This is an internal variable, updated by Arkos Tracker Player, that contains the number of times the present song has looped.
Stops playing musing and sound effects on all 3 channels.
Converts an Arkos Tracker (aks) music file into an absolutely located data array to be compiled directly into a binary program.
Script for converting binary files to C arrays
cpct_bitWeights:: .db #0x80, #0x40, #0x20, #0x10, #0x08, #0x04, #0x02, #0x01
Internal array that contains 8 byte-values, each one with 7 bits off and 1 bit on.
Enumerates all blending modes for cpct_drawSpriteBlended.
Macro to simplify clearing the screen.
Does exactly the same as cpct_clearScreen_f8 but calling cpct_memset_f64 instead of cpct_memset_f8.
Macro to simplify clearing the screen: fast version (in chuncks of 8 bytes)
Waits until CRTC produces vertical synchronization signal (VSYNC), counting the number of active wait loop cycles done.
Disables Amstrad CPC firmware, preventing it from being executed at every CPU interrupt.
Disables Lower ROM [0x0000 - 0x3FFF]
Disables upper ROM [0xC000 - 0xFFFF]
Prints a ROM character on a given even-pixel position (byte-aligned) on the screen in Mode 0 (160x200 px, 16 colours).
Prints a ROM character on a given byte-aligned position on the screen in Mode 1 (320x200 px, 4 colours).
Prints a ROM character on a given byte-aligned position on the screen in Mode 1 (320x200 px, 4 colours).
Prints a ROM character on a given byte-aligned position on the screen in Mode 2 (640x200 px, 2 colours).
Fills up a rectangle in video memory (or screen buffer) with a given colour data byte.
Copies a sprite from an array to video memory (or to a screen buffer).
Draws sprites blending them with current contents of screen video memory.
Copies a masked sprite from an array to video memory (or to a screen buffer), using mask as transparency information, to prevent erasing the background.
Draws an sprite to video memory (or to a screen buffer), making use of a given 256-bytes aligned mask table to create transparencies.
Prints a null-terminated string with ROM characters on a given byte-aligned position on the screen in Mode 0 (160x200 px, 16 colours).
Prints a null-terminated string with ROM characters on a given byte-aligned position on the screen in Mode 1 (320x200 px, 4 colours).
Prints a null-terminated string with ROM characters on a given byte-aligned position on the screen in Mode 1 (320x200 px, 4 colours).
Prints a null-terminated string with ROM characters on a given byte-aligned position on the screen in Mode 2 (640x200 px, 2 colours).
Copies a 2x4-byte sprite to video memory (or screen buffer), assuming that location to be copied is in Pixel Lines 0-3 of a character line.
Copies a 2x8-byte sprite to video memory (or screen buffer), assuming that location to be copied is Pixel Line 0 of a character line.
Copies a 2x8-byte sprite to video memory (or screen buffer), assuming that location to be copied is Pixel Line 0 of a character line.
Copies a 4x4-byte sprite to video memory (or screen buffer), assuming that location to be copied is from Pixel Line 0 to Pixel Line 3 of a character line.
Copies a 4x8-byte sprite to video memory (or screen buffer), assuming that location to be copied is Pixel Line 0 of a character line.
Copies a 4x8-byte sprite to video memory (or screen buffer), assuming that location to be copied is Pixel Line 0 of a character line.
Copies a 2x8-byte sprite to video memory (or screen buffer), assuming that the sprite lines are grey-code ordered and the location to be copied is Pixel Line 0 of a character line.
Enables Lower ROM [0x0000 - 0x3FFF]
Enables Upper ROM [0xC000 - 0xFFFF]
Encodes 4 2-bits elements into 1 byte for a CPCT_2BITARRAY
Encodes 2 4-bits elements into 1 byte for a CPCT_4BITARRAY
Encodes 4 6-bits elements into 3 bytes for a CPCT_6BITARRAY
Draws (or redraws) a determined rectangle of tiles inside a tilemap.
This macro uses cpct_etm_drawTileBox2x4 to draw a complete tilemap.
Draws a complete tilemap made of 2x4-bytes tiles.
Draws a given number of consecutive 2x4-bytes tiles of a tilemap as a row.
Sets an internal pointer to the tileset that will be used when drawing tilemaps with etm-2x4 functions.
cpct_firmware2hw_colour::
Array that maps any firmware colour value (0-27) to its equivalent hardware colour value, which is used by cpct_setPalette and cpct_setPALColour functions
Enumerates all 27 firmware colours
Converts an array of firmware colour values into their equivalent hardware colour values.
Returns the value of a given group of 2 bits into an array (0, 1, 2 or 3)
Returns the value of a given group of 4 bits into an array ( [0-15] )
Returns the value ( [0-63] ) of a given group of 6 bits into an array
Returns the status of a given bit into a bitarray (0 or !0)
Converts a firmware colour value into its equivalent hardware one.
Pseudo-random number generator that uses a 16-bits Galois Linear-Feedback Shift Register
Return a pseudo-random 16-bits value using Galois Linear-Feedback Shift Register (G-LFSR) method, with a 16-bits state register.
Return a pseudo-random byte using Galois Linear-Feedback Shift Register (G-LFSR) method, with a 16-bits state register.
Returns a pseudo-random byte using a fast Linear-Congruential-Algebra (LCG) method (33*Seed mod 257)
Gets a high-quality 16-bit pseudo-random number using Marsaglia’s XOR-shift algorithm (using a 32-bits state)
Gets a 32-bit pseudo-random number using Marsaglia’s XOR-shift algorithm (using a 32-bits state)
Gets a high-quality 8-bit pseudo-random number using Marsaglia’s XOR-shift algorithm (Using a 32-bits state)
Generates an 8-bits, high-quality, pseudo-random number with each call.
Returns a byte-pointer to a screen memory location, given its X, Y coordinates.
Horizontally flips a sprite, encoded in screen pixel format, mode 0.
Horizontally flips a sprite, encoded in screen pixel format, mode 0.
Horizontally flips a sprite, encoded in screen pixel format, mode 1.
Horizontally flips a sprite, encoded in screen pixel format, mode 1 (ROM-friendly version)
Horizontally flips a sprite, encoded in screen pixel format, mode 2.
Horizontally flips a sprite, encoded in screen pixel format, mode 2 (ROM-friendly version).
Horizontally flips a sprite, encoded in screen pixel format, mode 0, with interlaced mask.
Horizontally flips a sprite, encoded in screen pixel format, mode 1, with interlaced mask.
Horizontally flips a sprite, encoded in screen pixel format, mode 2, with interlaced mask.
Enumerates all 27 hardware colours
Converts an image file with a set of tile or sprite images into a CPCtelera C-array tileset along with arrays for all tiles/sprites.
Installs and configures CPCRSLib to be used together with CPCtelera
Checks if there is at least one key pressed.
Checks if there is at least one key pressed.
Checks if a concrete key is pressed or not.
extern u8 cpct_keyboardStatusBuffer[10]
10-bytes (80-bits) array containing pressed / not pressed status of all the keys / buttons the Amstrad CPC can manage (up to 80).
Enumerated type with symbols for all the 80 possible Key/Joy definitions.
Copies a bunch of bytes from one place in memory to other.
Macro that encodes a video memory page in the 6 Least Significant bits (LSb) of a byte, required as parameter for cpct_setVideoMemoryPage
Fills up a complete byte-array in memory with a given 8-bit value (as std memset)
Fills up a complete array in memory setting bytes 2-by-2, in chuncks of 64 bytes.
Fills up a complete array in memory setting bytes 2-by-2, in chuncks of 8 bytes.
This script helps in the creation of new projects that use CPCtelera engine.
_cpct_mode_rom_status:: .db #0x9D
8-bit space for storing the latest selection of MODE, INT.GENERATOR and ROM status.
_cpct_mxor32_seed:: .dw #0x1A7B, #0x59F2
Contains the 32-bits seed for Marsaglia’s XOR-shift random number generator.
Calculates next 32-bits pseudo-random number in Marsaglia’s XOR-shift 8-9-23 sequence.
Calculates next 32-bits state for a Marsaglia’s XOR-Shift pseudo-random 8-bits generator, with the tuple (1,1,3) .
Calculates next 32-bits state for a Marsaglia’s XOR-Shift pseudo-random 8-bits generator, with the tuple (5,3,2).
Calculates next 64-bits pseudo-random number using an adaptation of Marsaglia’s XOR-shift+ 128 algorithm to a 64-bits state, using 8-9-23 sequence.
Video Memory Page 0x00 (0x00··)
Video Memory Page 0x40 (0x40··)
Video Memory Page 0x80 (0x80··)
Video Memory Page 0xC0 (0xC0··)
Makes accesible a memory zone from the upper 64Kb on a standard CPC 6128 or from a memory extension.
Transforms 2 pixel colour values [0-15] into a byte value in the video memory pixel format for Mode 0.
Transforms 4 pixel colour values [0-3] into a byte value in the video memory pixel format for Mode 1.
alias for cpct_rand8
returns a random u16 value (16-bits).
returns a random u32 value (32-bits).
returns a random u8 value ( 8-bits).
Re-enables previously disabled Amstrad CPC firmware.
Macro that produces following code to be automatically distributed by the linker amongst available memory space area, starting in the loading location defined by Z80CODELOC (see cfg/build_config.mk file)
Sets nothing as interrupt handler (returns every time it is called).
Restores internal index state of Marsaglia’s XORShift 16-bits generator.
Restores internal index state of Marsaglia’s XORShift 8-bits generator.
This converts RGAS sprite definitions in CPCRSLib asm output format to CPCtelera’s C arrays.
Reads the status of keyboard and joysticks and stores it in the 10 bytes reserved as cpct_keyboardStatusBuffer
Reads the status of keyboard and joysticks and stores it in the 10 bytes reserved as cpct_keyboardStatusBuffer.
Reads the status of keyboard and joysticks and stores it in the 10 bytes reserved as cpct_keyboardStatusBuffer.
Reads the status of keyboard and joysticks and stores it in the 10 bytes reserved as cpct_keyboardStatusBuffer.
Sets the value of a selected group of 2 bits into a bitarray to [0-3]
Sets the value of a selected group of 4 bits (nibble) into a bitarray to [0-15]
Sets the value of a selected element of 6 bits into a bitarray to [0-63].
Sets the value of a concrete bit into a bitarray to 0 or 1
Establishes the blending mode that cpct_drawSpriteBlended will use from now on.
Changes the colour of the screen border.
Sets a user provided function as new interrupt handler.
Changes one colour value of the Palette, similarly to BASIC’s INK instruction.
Changes the hardware palette colour values (selecting new ones).
Sets machine state (seed) for 16-bits Galois Linear-Feedback Shift Register pseudo-random number generator.
Sets the random seed used by cpct_getRandom_lcg_u8.
Sets the new 32-bits seed value for Marsaglia’s XOR-shift random number generator.
Sets 40-bits initial state (seed) for cpct_getRandom_xsp40_u8 pseudo-random number generator.
Sets a new location for the program stack in memory.
Returns a pseudo-random byte uniformly distributed using fast method (33*Seed mod 257)
Sets the 8 Least Significant bits (the offset) of the memory address where video memory starts.
Sets the 6 most significant bits (the page) of the memory address where video memory starts.
Sets the video mode of the CPC Screen, changing resolution and palette size.
Cuts up a big sprite into smaller tiles
alias for cpct_srand8
Sets seed for MXOR generators (SEED = 32 bits value) and restores internal state of cpct_getRandom_mxor_u16.
Sets seed for MXOR generators (SEED = 32 bits value) and restores internal state of cpct_getRandom_mxor_u8.
Script for generating csv files with maps defined in tmx files (from tiled map editor).
The address where screen video memory starts by default in the Amstrad CPC.
Waits until CRTC produces vertical synchronization signal (VSYNC) and returns.
This script lets the user execute winape from command line and automatically run a file from a DSK at will.
Creates a 256-bytes look-up table for drawing standard screen pixel formatted sprites using a given colour index as transparent.
Declares a 256-bytes look-up table for drawing standard screen pixel formatted sprites using a given colour index as transparent.
256-table (assembly definition) with mask values for mode 0 using pen 0 as transparent
256-table (assembly definition) with mask values for mode 1 using pen 0 as transparent
256-table (assembly definition) with mask values for mode 0 using pen 10 as transparent
256-table (assembly definition) with mask values for mode 0 using pen 11 as transparent
256-table (assembly definition) with mask values for mode 0 using pen 12 as transparent
256-table (assembly definition) with mask values for mode 0 using pen 13 as transparent
256-table (assembly definition) with mask values for mode 0 using pen 14 as transparent
256-table (assembly definition) with mask values for mode 0 using pen 15 as transparent
256-table (assembly definition) with mask values for mode 0 using pen 1 as transparent
256-table (assembly definition) with mask values for mode 1 using pen 1 as transparent
256-table (assembly definition) with mask values for mode 0 using pen 2 as transparent
256-table (assembly definition) with mask values for mode 1 using pen 2 as transparent
256-table (assembly definition) with mask values for mode 0 using pen 3 as transparent
256-table (assembly definition) with mask values for mode 1 using pen 3 as transparent
256-table (assembly definition) with mask values for mode 0 using pen 4 as transparent
256-table (assembly definition) with mask values for mode 0 using pen 5 as transparent
256-table (assembly definition) with mask values for mode 0 using pen 6 as transparent
256-table (assembly definition) with mask values for mode 0 using pen 7 as transparent
256-table (assembly definition) with mask values for mode 0 using pen 8 as transparent
256-table (assembly definition) with mask values for mode 0 using pen 9 as transparent
Reorders the bits of A and mixes them letting the user select the new order for the bits by using a selection mask.
Macro: cpctm_reverse_mode_2_pixels_of_A
Reverses the order of pixel values contained in register A, assuming A is in screen pixel format, mode 0.
Reverses the order of pixel values contained in register A, assuming A is in screen pixel format, mode 1.
Macro that calculates the video memory location (byte pointer) of a given pair of coordinates (X, Y)
Close