Macros
Vars
Shallan65 macro toolkit for the MEGA65.
- Uses NCM and FCM mode and the raster rewrite buffer to provide a powerful layer and sprite framework
- DMA job data macros
- SDCard loading
The S65 namespace is mostly used internally by the engine, however some methods and vars may be of use.
Measures the byte size of a block of assembly and records it in the memory report output by
S65_MemoryReport Called at the start and the end of the code block you wish to measure by passing the same name in both
Usage:
S65_AddToMemoryReport(name)
Parameters:
Called at the very end of your program code this macro will produce a report of the memory used in each of the framework calls
Usage:
S65_MemoryReport()
Restores the base page from S65_LastBasePage
Usage:
S65_RestoreBasePage()
Pulls the AXYZ registers off the stack
Usage:
S65_RestoreRegisters()
Pushes the AXYZ registers onto the stack
Usage:
S65_SaveRegisters()
Saves the current base page in S65_LastBasePage and sets the base page to the S65 Base page area
Usage:
S65_SetBasePage()
Generates a string of 16 bit words based on the text input. The upper nybblwe of each word is $00 and the lower nybble is the normal 8 bit .screencode encoded value. terminates the string with $ffff
Usage:
S65_Text16(str)
Parameters:
Outputs a string to the kick assembler console at build time
Usage:
S65_Trace(str)
Parameters:
Defaults to $ff80000
Usage:
S65_COLOR_RAM
{dword} S65 BasePage pointer into color ram. It is guaranteed to have the upper two bytes set at all times so can be used to access the color ram using 32bit indirect z addressing. DO NOT change bytes 2 and 3!
Note: Requires
S65_SetBasePage or
Layer_SetScreenPointersXY to correctly set up the base page before using indirect indexed adressing modes.
Usage:
S65_ColorRamPointer
Contains the address at which the last Asset_Import macro finished importing. Useful for chaining imports together
Usage:
S65_LastImportPtr
{word} S65 BasePage pointer into to the IO data for the last layer that was fetched using
Layer_Get
Usage:
S65_LastLayerIOPointer
{word} S65 BasePage pointer into to the IO data for the last sprite that was fetched using
Sprite_Get
Usage:
S65_LastSpriteIOPointer
{word} S65 BasePage value that is used as a return for many commands when the result is a word rather than a byte.
Usage:
S65_ReturnValue
Number of bytes that make up an entire screen row
Usage:
S65_SCREEN_LOGICAL_ROW_WIDTH
Defaults to $0800
Usage:
S65_SCREEN_RAM
Number of characters that make up an entire screen row
Usage:
S65_SCREEN_ROW_WIDTH
Screen row offset for the row terminator bytes
Usage:
S65_SCREEN_TERMINATOR_OFFSET
Contains the height of the visible screen in pixels
Usage:
S65_ScreenPixelHeight
Contains the width of the visible screen in pixels
Usage:
S65_ScreenPixelWidth
{dword} S65 BasePage pointer into screen ram. It is guaranteed to have the upper two bytes set at all times so can be used to access the screen ram using 32bit indirect z addressing. DO NOT change bytes 2 and 3!
For this reason you MUST use a Screen RAM location that does not cross a 64kb boundary and aligned to page boundarys as the engine assumes this for speed
Note: Requires
S65_SetBasePage or
Layer_SetScreenPointersXY to correctly set up the base page before using indirect indexed adressing modes.
Usage:
S65_ScreenRamPointer
16 bytes of spare storage free for use when the S65 base page is active to assist with using commands that expect to be in S65 base page
Usage:
S65_SpareBasePage
Height of the visible screen background layer in characters
Usage:
S65_VISIBLE_SCREEN_CHAR_HEIGHT
Width of the visible screen background layer in characters
Usage:
S65_VISIBLE_SCREEN_CHAR_WIDTH
Functions
Data
API for controlling the screen ram and color ram. Using the raster rewrite buffer to create and manipulate layers
Defines an animation sequence
Usage:
Anim_Define(name, spriteSet, start, end)
Parameters:
Returns the animation sequence object
Usage:
Anim_Get(name)
Parameters:
The object returned by Anim_Get / truct Anim_Sequence { id, name, address, spriteSet, startFrame, endFrame, color} *
Usage:
Anim_Sequence
Macros
Functions
Data
Vars
API for the assets pipeline. Provides methods for importing assets and their metadata files
Adds a new external asset file to the SDCard containing the binary data providewd. It can then be loaded later using the name provided
Usage:
Asset_AddExternal(name, data)
Parameters:
Ends the data/code block that was previously started with an Asset_StartExternal and returns the program counter to where it was prior to starting the block.
Usage:
Asset_EndExternal()
Helper function to preload the _chars file generated by png65 into a given address and load the _ncm file
When loading using these imports you only need the first part of the path and file name. eg
Asset_ImportCharset("map","assets/bin/tileset1", $8000)
Will load both the "assets/bin/tileset1_chars.bin" and the "assets/bin/tileset1_ncm.s" files. NOTE: MUST be called before the Layer_InitScreen
Usage:
Asset_ImportCharset(name, path, address)
Parameters:
Data generation macro that imports the full 256 color palette for the given charset name. The charset must be imported already otherwise this will fail.
Usage:
Asset_ImportCharsetPalette(name)
Parameters:
Helper function to preload the sprites _chars file generated by png65 into a given address and load the _meta file
S65 provides space for up to 16 sprite set imports at any one time
When loading using these imports you only need the first part of the path and file name. eg
Asset_ImportSpriteset("player","assets/bin/sprites1", $8000)
Will load both the "assets/bin/sprites1_chars.bin" and the "assets/bin/sprites1_meta.s" files. NCM or FCM is determined from the metafile
NOTE: MUST be called before the Layer_InitScreen
Usage:
Asset_ImportSpriteset(name, charpath, address)
Parameters:
Data generation macro that imports the full 256 color palette for the given spriteset name. The spriteset must be imported already otherwise this will fail.
Usage:
Asset_ImportSpritesetPalette(name)
Parameters:
Helper function to preload the _tiles and _map file generated by ldtk65 into a given address
When loading using these imports you only need the first part of the path and file name. eg
Asset_ImportTilemap("map","assets/bin/map", $8000)
Will load both the "assets/bin/map_tiles.bin" and the "assets/bin/map_map.s" files. NOTE: MUST be called before the Layer_InitScreen
Usage:
Asset_ImportTilemap(name, path, charset, address)
Parameters:
Loads an external asset previosuly defined using Asset_AddExternal or Asset_StartExternal from SDcard into the memory address provided
Usage:
Asset_LoadFromExternal(name, address)
Parameters:
Internal macro used to preload assets when imports have been done at or above $f000. Before initialisation any preloaded assets get loaded here
Usage:
Asset_Preload()
Signals the start of a blcok of data/code that will be saved to the SDCard for importing at runtime.
NOTE: If you are using this to save code make sure to use .pseudopc directive to set your intended load address as the program counter will be reset to $0000 for this
Usage:
Asset_StartExternal(name)
Parameters:
This method returns the charset object containing all the vars needed to perform many operations.
id - The numerical id of the charset assigned by Asset_ImportCharset
name - The name of the charset
address - The start address for the charset char data
colorAddress - The start address for the color table if present
palette - A {List} of bytes containing the palette data
colors - A {List} of bytes containing the ncm color mapping data
Usage:
Asset_GetCharset(name)
Parameters:
Sprite sets are assigned numerical values from 0 to 15 in order as they are imported. This method returns the spriteset object containing all the vars needed to perform many operations, .id is used whenever referencing a spriteset in commands e.g.
Sprite_SetSpriteMeta id - The numerical id of the spriteset assigned by Asset_ImportSpriteset
name - The name of the spriteset
address - The start address for the spriteset char data
metaAddress - The start address for the spriteset metadata
meta - A {List} of bytes containing the metadata
palette - A {List} of bytes containing the palette data
Usage:
Asset_GetSpriteset(name)
Parameters:
This method returns the tilemap object containing all the vars needed to perform many operations.
NOTE: The first four bytes of the tilemap data are thew width and height of the map in tiles (16 bit word values)
id - The numerical id of the tilemap assigned by Asset_ImportTilemap
name - The name of the tilemap
tilemapAddress - The start address for the tilemap data
tiledefAddress - The start address for the tile definition data
tilemap - A {List} of bytes containing the tilemap data
tiles - A {List} of bytes containing the tile definiton data
Usage:
Asset_GetTilemap(name)
Parameters:
The object returned by GetCharset
Usage:
Asset_Charset
The object returned by GetSpriteset
Usage:
Asset_Spriteset
The object returned by GetTilemap
Usage:
Asset_Tilemap
Pointer to the lookup table for the spritesets meta data tables
Usage:
Asset_Asset_SpriteListMetaTable
Pseudocommands
Data
Pseudocommands
Data generator that copys a defined number of bytes from one location in memory to another using the DMagic chip @ 20mb/s
This is NOT executable code, only data and should be used as such
Usage:
DMA_CopyJob source : destination : length : chain : backwards
Parameters:
Data generator that disables the transparent byte masking. This is the default state.
This is NOT executable code, only data and should be used as such
Usage:
DMA_DisableTransparency
Data generator that enables transparent byte masking. This will ignore any source bytes that match the given byte and leave the destination byte untouched.
This is NOT executable code, only data and should be used as such
Usage:
DMA_EnableTransparency transparentByte
Parameters:
Executes the DMagic job at the given address.
Usage:
DMA_Execute address
Parameters:
Data generator that fills a defined number of bytes from one location in memory to another using the DMagic chip @ 40mb/s
This is NOT executable code, only data and should be used as such
Usage:
DMA_FillJob sourceByte : destination : length : chain
Parameters:
Data generator that sets the DMagic header bytes defining the source and destination banks.
This is NOT executable code, only data and should be used as such
Note: The bank number of a memory adress is its 5th and 6th nybble. e.g. $ff80000 is bank number $ff
Usage:
DMA_Header sourceBank : destBank
Parameters:
Data generator that sets the source and/or destination stepping values. The DMA will use a fixed point step for each increment on the source and destination by default they are both set to the fixed point 8:8 value $0100 (or 1.0 in decimal)
This is NOT executable code, only data and should be used as such
Usage:
DMA_Step sourceStep : destStep
Parameters:
Usage:
DMA_F018_DMA_11_byte_format
Functions
Simple debug time namespace for displaying live memory contents via watchers
Creates a watcher that is then displayed in the debug overlay. 4 bytes at a time are watcehd at each address. Best declared directly after your S65 library import. Requires NODEBUG to NOT be defined
Usage:
Debug_AddWatcher(label, address)
Parameters:
Pseudocommands
Macros
Functions
Data
Vars
Lists
Hashtables
API for controlling the screen ram and color ram. Using the raster rewrite buffer to create and manipulate layers
Pseudocommands
Writes a string of bytes to the currently active layer at the provide co-ordinates. Optionally allows the use of color, setting Color RAM Byte 1 all bits (so includes bit4-blink, bit5-reverse, bit6-bold and bit7-underline), this will only work on non NCM layers with char indices less than $100
This is a conveinience function it is better to use Layer_WriteToScreen as it is more efficient
Note: As layer screen rows are interlaced in memory, its important to not let the string extend off the right edge of the layer as it can break the RRB on other layers. There is an upper limit string length of 128
Usage:
Layer_AddText xpos : ypos : textPtr : color
Parameters:
Usage:
Layer_AdvanceScreenPointers Optional
Parameters:
Fills the screen RAM area for ALL layers with a given 16bit value. Note this will overwrite any RRB GotoX markers also
NOTE: Absolute addressing will fetch 2 bytes from the target address (aka ABS16)
Usage:
Layer_ClearAllLayers clearChar
Parameters:
Fills the screen RAM area for the currently selected layer with a given 16bit value. Optionally clearing the color too
Usage:
Layer_ClearLayer clearChar : clearColor
Parameters:
This method sets the currently active layer for all Layer commands.
Note: This method will also call
S65_SetBasePage which is required for the Layer functions
Usage:
Layer_Get layerNum
Parameters:
Returns the gotox value for the current selected layer into
S65_ReturnValue
Usage:
Layer_GetGotoX
Sets the gotox value for the current selected layer so that it is rendered in a
Layer_Update with a new shifted X position
NOTE: Absolute addressing will fetch 2 bytes from the target address (aka ABS16)
Usage:
Layer_SetGotoX gotox
Parameters:
Usage:
Layer_SetScreenPointersXY xpos : ypos
Parameters:
Shift the cahrs on this layer horizontally
Usage:
Layer_Shift xshift
Parameters:
Y sorts the sprite render order for this layer, using the sprite y pos + its height as a base
Usage:
Layer_SortSprites start
Parameters:
Updates ALL the layers. This is basically the render method, it sets all the GOTOX markers for the various layers and calls the Sprite_Update method
Note: this is an expensive operation in both memory and cpu, it should be called once only per frame and put it in a subroutine if you need to call it from more than one place
Usage:
Layer_Update
Usage:
Layer_WriteToScreen screenSource : colorSource : size
Parameters:
Defines a new RRB Sprite layer in Screen RAM. RRB Sprite layers are always NCM mode (16x8px chars). IO for this layer is assigned to the Layer IO dynamic memory area
Note that chars per line is NOT the max sprites per line as a sprite can be any multiple of 16 chars wide
RRB Sprite space is a buffer limited by a set amount of chars per line. During an update each new Sprite uses a GOTOX marker and however many RRB chars wide it is. So, for example, a 32x32 RRB sprite is 2 chars wide + a GOTOX marker so will take 3 chars of space.
Note: There is a RRB Sprite hard limit of 256 per RRB Sprite layer. The majority of the memory and cpu time consumed by the RRB Sprite system is a result of the number of maxSprites. Reducing this number will have the best impact on SpriteIO area memory usage as each sprite slot (regardless if its enabled or not in
Sprite_IOflagswill use at least 10 bytes each. And every sprite that IS enabled will use some cpu time to update.
Usage:
Layer_DefineRRBSpriteLayer(charsPerLine, maxSprites)
Parameters:
Sets Registers:
Defines the screen resolution in 8x8 charachters (regardless if NCM is being used) and if it should be stretched horizontally to fit the width of the display.
Layer_InitScreen will configure the borders and TEXTXPOS and TEXTYPOS to center the screen on the display.
NOTE:
- charHeight above 32 will use V400 mode and disable any RRB double buffering and double rate RRB
- charWidth above 42 will use H640 mode
Usage:
Layer_DefineResolution(charWidth, charHeight, stretchWide)
Parameters:
Defines a new screen layer in Screen RAM optionally shifting its RRB GOTOX offset.
Note: the maximum charWidth for a layer is 126
Usage:
Layer_DefineScreenLayer(charWidth, offsetX, ncm)
Parameters:
Sets Registers:
Initialises the MEGA65 and VIC-IV and parses the Layer definitions into a Screen RAM layout
Usage:
Layer_InitScreen(screenBaseAddress)
Parameters:
Returns the address of the color RAM at the given position on this screen layer
Usage:
Layer_GetColorAddress(layerNumber, xpos, ypos)
Parameters:
Usage:
Layer_GetIO(layerNumber, register)
Parameters:
Returns the current number of layers, useful for assigning to constants to name each layer for use in your code.
Usage:
Layer_GetLayerCount()
Returns the address of the char at the given position on this screen layer
Usage:
Layer_GetScreenAddress(layerNumber, xpos, ypos)
Parameters:
Table of GOTOX Attribute in color ram for each layer
Usage:
Layer_GotoXColorPositions
Table of current GOTOX positions for all the layers
Usage:
Layer_GotoXPositions
Table of start address offsets for each layer
Usage:
Layer_LayerWidth
Contains the current Screen Row Logical Width in bytes
Usage:
Layer_LogicalWidth
Pointer to Table of start address offsets for each layer
Usage:
Layer_AddrOffsets
Pointer to a dma subroutine that clears the screen ram layer, A=layer, X=charLo, Y=charHi
Usage:
Layer_DMAClear
Pointer to a dma subroutine that clears the color ram layer, A=layer, X=color
Usage:
Layer_DMAClearColor
Pointer to a dma subroutine that clears the color ram layer for RRB sprites, A=layer
Usage:
Layer_DMAClearColorRRB
A pointer to the table containing the address of each layers dynamic data, this memory is initialised on a
Layer_InitScreen it's size is dependant on the screen layer structure, RRB sprite layers use the most memory
Usage:
Layer_DynamicDataTable
The IO register index for this layers GOTOX value. Retrieve the absolute address by passing it to the
Layer_GetIO function.
Usage:
Layer_IOgotoX
RRB SPRITE LAYER ONLY. The IO register index for this layers maximum chars per line value.
Retrieve the absolute address by passing it to the
Layer_GetIO function.
Usage:
Layer_IOmaxCharsRRB
RRB SPRITE LAYER ONLY. The IO register index for this layers maximum sprites value.
Retrieve the absolute address by passing it to the
Layer_GetIO function.
Usage:
Layer_IOmaxSpritesRRB
RRB SPRITE LAYER ONLY. The IO register index for this layers RRB sprite rowCharCount table, used internally by the RRB sprite system.
Retrieve the absolute address by passing it to the
Layer_GetIO function.
Usage:
Layer_IOrowCountTableRRB
Pointer to the table of flags indicating if layers are RRB sprite layer
Usage:
Layer_IsRRBSprite
Pointer to the table of LSB values for the address of the start of each screen row directly
Usage:
Layer_RowAddressBaseLSB
Pointer to the table of MSB values for the address of the start of each screen row directly
Usage:
Layer_RowAddressBaseMSB
Pointer to the table of LSB values for the address of the start of each screen row directly after the first GOTOX
Usage:
Layer_RowAddressLSB
Pointer to the table of MSB values for the address of the start of each screen row directly after the first GOTOX
Usage:
Layer_RowAddressMSB
How many sprites there are max in this layer
Usage:
Layer_SpriteCount
Pointer to the table of LSB values for the address of the start of the layers sprite IO area
Usage:
Layer_SpriteIOAddrLSB
Pointer to the table of MSB values for the address of the start of the layers sprite IO area
Usage:
Layer_SpriteIOAddrMSB
Pointer to the LSB of table of sorted sprite indices
Usage:
Layer_SpriteSortListLSB
Pointer to the MSB of table of sorted sprite indices
Usage:
Layer_SpriteSortListMSB
The list of defined layers used to create the Screen RAM layout
Usage:
Layer_LayerList
Items:
A layer definition used to create the Screen RAM layout
Usage:
Layer_LayerListTable
Keys:
Pseudocommands
Macros
Data
Vars
Pseudocommands
Assigns palettes to the MEGA65 palette banks.
Usage:
Palette_Assign palleteChar : paletteHWSprite : paletteRRBSprite
Parameters:
Cycles a range of colors in the current palette shifting them in a loop by 1 backwards
Usage:
Palette_Cycle from : count
Parameters:
Copys palette data from a given address into the currently active palette.
Usage:
Palette_LoadFromMem addr : size
Parameters:
Loads a full 256 color palette from SD card into the currently active palette
Usage:
Palette_LoadFromSD addr
Parameters:
Sets the currently active palette in IO memory.
Usage:
Palette_Set paletteNum
Parameters:
Loads a full 256 color palette from SD card into the currently active palette using the name referenced in a
Asset_AddExternal
Usage:
Palette_LoadFromExternal(name)
Parameters:
The MEGA65 has up to 4 palettes that can be assigned to the various graphic types Sprite and Character. At any one time one of the palettes will be banked into IO memory at $d100-$d3ff. Note: While the palette format is RGB788 the nybbles of each byte are switched e.g. $F0 becomes $0F, to maintain compatibility with the C65
Usage:
Palette_MEGA65_Palette
MEGA65 palette 0
Usage:
Palette_0
MEGA65 palette 1
Usage:
Palette_1
MEGA65 palette 2
Usage:
Palette_2
MEGA65 palette 3
Usage:
Palette_3
Pseudocommands
Macros
API for using the SD card to load assets to memory using mostly macros
Pseudocommands
Loads a file from the SDCard into attic RAM
Usage:
SDCard_LoadToAtticRam addr : filePtr
Parameters:
Loads a file from the SDCard into chip RAM
Usage:
SDCard_LoadToChipRam addr : filePtr
Parameters:
Loads a binary from SD card into the attic ram location provided
Usage:
SDCard_LoadExternalToAtticRam(name, name)
Parameters:
Loads a binary from SD card into the chip ram location provided
Usage:
SDCard_LoadExternalToChipRam(name, name)
Parameters:
Pseudocommands
Macros
Functions
Data
Vars
Contains the API for managing RRB sprites
Pseudocommands
This method is a prerequisite for getting or setting any sprites IO registers it sets the "current active" sprite used by the Sprite Get and Set methods by storing the pointer to that sprites IO area in
S65_LastSpriteIOPointer Note: This method will also call
S65_SetBasePage which is required for the subsequent Sprite functions
Usage:
Sprite_Get layerNum : sprNum
Parameters:
Returns the color of the currently selected sprite in
S65_ReturnValue and the accumulator Lo byte is color
Note that colors are in the upper nybble in NCM mode, so palette slice $02 is represented as $20
Usage:
Sprite_GetColor
Returns the dimensions of the currently selected sprite into
S65_ReturnValue Lo byte is width, Hi byte is height
Usage:
Sprite_GetDimensions
Returns the enabled state of the current selected sprite into
S65_ReturnValue
Usage:
Sprite_GetEnabled
Returns the current pointer of the currently selected sprite into
S65_ReturnValue
Usage:
Sprite_GetPointer
Usage:
Sprite_GetPositionX
Usage:
Sprite_GetPositionY
Resets one or more of the currently selected sprites flags. You can use the
flag constants provided by S65 to abstract the values. The other flags are left untouched
Usage:
Sprite_ResetFlags flags
Parameters:
Sets the sprites animation id and resets its timer and frame counter. A value of 0 turns off the animation and returns control of the sprites pointer to Sprite_IOptr.
Usage:
Sprite_SetAnim animId : speed
Parameters:
Sets the currently selected sprites color. Note that colors are in the upper nybble in NCM mode, so palette slice $02 is represented as $20
Usage:
Sprite_SetColor color
Parameters:
Sets the currently selected sprites width and height. There is a hard limit of 255 chars to make up any one sprite therefore width * height MUST be less than 256
Usage:
Sprite_SetDimensions width : height
Parameters:
Usage:
Sprite_SetEnabled enabled
Parameters:
Sets one or more of the currently selected sprites flags. You can use the
flag constants provided by S65 to abstract the values. The other flags are left untouched
Usage:
Sprite_SetFlags flags
Parameters:
Sets the current selected sprite pointer. If pointer is passed as a register it sets ONLY the LSB, MSB sets to 0. If ABS mode is used then two bytes are read from that address and used to set the value
Usage:
Sprite_SetPointer pointer
Parameters:
Sets the current selected sprite X position. If position is passed as a register it sets ONLY the LSB, MSB sets to 0. If ABS mode is used then two bytes are read from that address and used to set the value
Usage:
Sprite_SetPositionX xpos
Parameters:
Sets the current selected sprite Y position. If position is passed as a register it sets ONLY the LSB, MSB sets to 0. If ABS mode is used then two bytes are read from that address and used to set the value
Usage:
Sprite_SetPositionY ypos
Parameters:
Enables the currently selected sprite and popualtes its IO registers with the meta data for the given spriteset index. Affects:
- IOflags (Enabled, NCM)
- IOwidth
- IOheight
- IOptr
- IOcolor
Usage:
Sprite_SetSpriteMeta spritesId : spriteNum
Parameters:
Usage:
Sprite_GenerateLayerData()
Internally used to generate the runtime lookup tables for sprite meta data
Usage:
Sprite_GenerateMetaData()
Usage:
Sprite_GetIO(layerNumber, spriteNumber, register)
Parameters:
This is a byte array used by the engine when Asset_ImportSpriteset and Asset_ImportSpritesetMeta is used to store all the meta data for the sprites such as mappings from sprite to character numbers, colors etc.
Usage:
Sprite_MetaData
This is a byte array used by the engine for storing animation sequences. Animations are not stored in a table but in a sequential list, specific aniamtion data addresses can be retrievd using Anim_Get().address
Usage:
Sprite_SequenceData
Sprites animation id if non zero takes over control of the sprites pointer from Sprite_IOptr
Usage:
Sprite_IOanim
Used internally to keep track of the current frame for the sprites animation
Usage:
Sprite_IOanimFrame
The speed of the aniamtion, lower=faster, minimum 1
Usage:
Sprite_IOanimSpeed
Used internally to keep track of the time per frame for the sprites animation
Usage:
Sprite_IOanimTimer
The color to apply to all the chars in this sprite.
Usage:
Sprite_IOcolor
Usage:
Sprite_IOflagEnabled
Usage:
Sprite_IOflagFlipH
The value to set the flip V bit in
Sprite_IOflags NOTE: Currently due to HW limitations (missing ROWMASK functionality) this flag will cause rendering issues and should NOT be used
Usage:
Sprite_IOflagFlipV
Turns on NCM for this sprite
NOTE: It is best to use NCM where possible as it takes half the processing time per visible sprite on a Layer_Update, less chars on a line, and less memory for the image data at the cost of dropping to 16 colors
Usage:
Sprite_IOflagNCM
Starts as zero sets to 1 when the first animation loop has passed
Usage:
Sprite_IOflagOneShot
Flags for the state of this sprite bit 7 = Flip V (Not yet implemented) bit 6 = Flip H bit 5 = Enabled bit 0 = One shot flag
Usage:
Sprite_IOflags
This registers is set internally on creation of a sprite and should NOT be manually changed
Usage:
Sprite_IOflipHoffset
This registers is set internally on creation of a sprite and should NOT be manually changed
Usage:
Sprite_IOflipVoffset
The height in chars for this sprite, sprites will automatically advance through the char set as they are drawn in pieces, top to bottom, left to right.
Usage:
Sprite_IOheight
The IO register offset for looking up the sprite pointer location in memory. Pass this to the
Sprite_GetIO function, to retrieve the address.
Usage:
Sprite_IOptr
The width in chars for this sprite, sprites will automatically advance through the char set as they are drawn in pieces, top to bottom, left to right.
Usage:
Sprite_IOwidth
The IO register offset for looking up the a sprites x position location in memory. Pass this to the
Sprite_GetIO function, to retrieve the address.
Usage:
Sprite_IOx
The IO register offset for looking up the a sprites y position location in memory. Pass this to the
Sprite_GetIO function, to retrieve the address.
Usage:
Sprite_IOy
The size in bytes of the IO registers for a single sprite
Usage:
Sprite_SpriteIOLength
Pseudocommands
Macros
Data
Tools and utilities for configuring the processor and launching programs.
Pseudocommands
peforms a 16bit compare between value A and valueB, setting flags accordingly
Usage:
System_Compare16 valueA : valueB
Parameters:
GetRandom16
Returns a random 16 bit number in
S65_ReturnValue Accumulator will have the hi byte
Usage:
System_GetRandom16
GetRandom8
Usage:
System_GetRandom8
Hides the display by setting illegal values in $d011. Useful for blacking out screen when loading from SDCard
Usage:
System_HideScreen
SeedRandom16
Seeds the random number generator using a 16bit non zero value. Passing a register will use that byute for both LSB and MSB
Usage:
System_SeedRandom16 seed
Parameters:
Shows the display after a HideScreen by setting valid values in $d011. Useful for blacking out screen when loading from SDCard
Usage:
System_ShowScreen
Creates the
Basic Upstart for the MEGA65 at location $2001 pointing to the given SYS entry address
Usage:
System_BasicUpstart65(addr)
Parameters:
If the preprocessor #define NODEBUG is not defined this will set the border color to the give value. Useful for debugging
Usage:
System_BorderDebug(color)
Parameters:
Disables the C65 rom protection making it writable
Usage:
System_DisableC65ROM()
Switches the MEGA65 45GS_02 processor to use 40.5Mhz mode
Usage:
System_Enable40Mhz()
Enables rewrite double buffering to prevent clipping on the left side of the screen and enable 2 raster scans per line for double pixel clock in V200 mode.
Usage:
System_EnableFastRRB()
Switches the VIC chip in the MEGA65 into VIC4 mode.
Usage:
System_EnableVIC4()
Halts execution and waits for the given raster line
Usage:
System_WaitForRaster(raster)
Parameters:
Usage:
System_BasicUpstart65_Format
Pseudocommands
Data
API for the tilemap system
Pseudocommands
Draws a rectangle from the currently active tilemap to the currently active layer using the current screenpointers
NOTE: that this routine will NOT wrap at the edge of the later so make sure to not ewxceed the layers right edge or you may cause RRB corruption
Usage:
Tilemap_Draw srcX : srcY : srcWidth : srcHeight
Parameters:
Draw a single tile at the current location
Usage:
Tilemap_DrawTile tileId
Parameters:
This method sets the currently active tilemap for all tilemap commands.
Note: This method will also call
S65_SetBasePage which is required for the Tilemap functions
Usage:
Tilemap_Get tilemapId
Parameters:
Start of the tables for the Tilemap meta data
Usage:
Tilemap_TilemapData