Skip to content

Commit

Permalink
Add non-zero requirement for conio and DMA copy
Browse files Browse the repository at this point in the history
A DMA copy/fill count of 0 actually means 64 kB.
This is an issue for e.g. conio and empty strings.
This adds documentation to address this.
  • Loading branch information
mlund committed Sep 10, 2024
1 parent 1cf4c3e commit ab8d787
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions include/mega65/conio.h
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,9 @@ void fastcall cputs(const unsigned char* s);
* @brief Output multiple screen codes at X,Y coordinates
* @param x The X coordinate where string will be printed
* @param y The Y coordinate where string will be printed
* @param s An array of screen codes to print
* @param s An array of screen codes to print. Must have non-zero length.
* @remarks This function works with screen codes only. To output ordinary
* @warning Undefined behavior if `s` has zero length.
*/
void cputsxy(unsigned char x, unsigned char y, const unsigned char* s);

Expand Down Expand Up @@ -943,8 +944,9 @@ void cputcxy(unsigned char x, unsigned char y, unsigned char c);
* @brief Output N copies of a single character at X,Y coordinates
* @param x The X coordinate where character will be printed
* @param y The Y coordinate where character will be printed
* @param count The number of characters to output
* @param count The number of characters to output. Must be larger than zero.
* @param c The screen code of the characters to print
* @warning Undefined behavior if `count` is zero.
*/
void cputncxy(
unsigned char x, unsigned char y, unsigned char count, unsigned char c);
Expand Down
6 changes: 3 additions & 3 deletions include/mega65/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,23 +141,23 @@ void dma_poke(uint32_t address, uint8_t value);
* @brief Copy a block of memory using DMA
* @param source_address 28-bit address to copy from
* @param destination_address 28-bit address to copy to
* @param count Number of bytes to copy
* @param count Number of bytes to copy. Note that 0 = 64 kB.
*/
void lcopy(uint32_t source_address, uint32_t destination_address, size_t count);

/**
* @brief Fill a block of memory with a single byte using DMA
* @param destination_address Start address (28-bit)
* @param value Fill value
* @param count Number of bytes to fill
* @param count Number of bytes to fill. Note that 0 = 64 kB.
*/
void lfill(uint32_t destination_address, uint8_t value, size_t count);

/**
* @brief Fill a block of memory with a single byte using DMA with a step
* @param destination_address Start address (28-bit)
* @param value Fill value
* @param count Number of bytes to fill
* @param count Number of bytes to fill. Note that 0 = 64 kB.
* @param skip Skip every n bytes
*/
void lfill_skip(
Expand Down

0 comments on commit ab8d787

Please sign in to comment.