ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
6847z.c File Reference
#include "../ugbc.h"
#include <math.h>

Go to the source code of this file.

Macros

#define SET_VIDEOAT_400   SAM_F0_CLR; SAM_F1_CLR; SAM_F2_CLR; SAM_F3_CLR; SAM_F4_CLR; SAM_F5_CLR; SAM_F6_CLR; SAM_F1_SET;
#define SET_VIDEOAT_600   SAM_F0_CLR; SAM_F1_CLR; SAM_F2_CLR; SAM_F3_CLR; SAM_F4_CLR; SAM_F5_CLR; SAM_F6_CLR; SAM_F0_SET; SAM_F1_SET;
#define SET_VIDEOAT_C00   SAM_F0_CLR; SAM_F1_CLR; SAM_F2_CLR; SAM_F3_CLR; SAM_F4_CLR; SAM_F5_CLR; SAM_F6_CLR; SAM_F1_SET; SAM_F2_SET;

Functions

void c6847z_collision (Environment *_environment, char *_sprite_mask, char *_result)
 VIC-II: emit code to check for collision
void c6847z_hit (Environment *_environment, char *_sprite_mask, char *_result)
 VIC-II: emit code to check for collision
void c6847z_border_color (Environment *_environment, char *_border_color)
 VIC-II: emit code to change border color
void c6847z_background_color (Environment *_environment, char *_index, char *_background_color)
 VIC-II: emit code to change background color
void c6847z_sprite_common_color (Environment *_environment, char *_index, char *_common_color)
 VIC-II: emit code to change common sprite's color
void c6847z_raster_at (Environment *_environment, char *_label, char *_positionlo, char *_positionhi)
 VIC-II: emit code to set raster irq
void c6847z_next_raster (Environment *_environment)
 VIC-II: emit code to wait for next raster irq
void c6847z_next_raster_at (Environment *_environment, char *_label, char *_positionlo, char *_positionhi)
 VIC-II: emit code to wait for next raster irq at different position
void c6847z_bank_select (Environment *_environment, int _bank)
void console_calculate (Environment *_environment)
void console_calculate_vars (Environment *_environment)
int c6847z_screen_mode_enable (Environment *_environment, ScreenMode *_screen_mode)
void c6847z_bitmap_enable (Environment *_environment, int _width, int _height, int _colors)
void c6847z_bitmap_disable (Environment *_environment)
void c6847z_tilemap_enable (Environment *_environment, int _width, int _height, int _colors, int _tile_width, int _tile_height)
void c6847z_bitmap_at (Environment *_environment, char *_address)
void c6847z_colormap_at (Environment *_environment, char *_address)
void c6847z_textmap_at (Environment *_environment, char *_address)
void c6847z_pset_int (Environment *_environment, int _x, int _y, int *_c)
void c6847z_pset_vars (Environment *_environment, char *_x, char *_y, char *_c)
void c6847z_pget_color_vars (Environment *_environment, char *_x, char *_y, char *_result)
void c6847z_screen_on (Environment *_environment)
void c6847z_screen_off (Environment *_environment)
void c6847z_screen_rows (Environment *_environment, char *_rows)
void c6847z_screen_columns (Environment *_environment, char *_columns)
void c6847z_sprite_data_from (Environment *_environment, char *_sprite, char *_address)
void c6847z_sprite_data_set (Environment *_environment, char *_sprite, char *_address)
void c6847z_sprite_enable (Environment *_environment, char *_sprite)
void c6847z_sprite_disable (Environment *_environment, char *_sprite)
void c6847z_sprite_at (Environment *_environment, char *_sprite, char *_x, char *_y)
void c6847z_sprite_priority (Environment *_environment, char *_sprite, char *_priority)
void c6847z_sprite_expand_vertical (Environment *_environment, char *_sprite)
void c6847z_sprite_expand_horizontal (Environment *_environment, char *_sprite)
void c6847z_sprite_compress_vertical (Environment *_environment, char *_sprite)
void c6847z_sprite_compress_horizontal (Environment *_environment, char *_sprite)
void c6847z_sprite_multicolor (Environment *_environment, char *_sprite)
void c6847z_sprite_monocolor (Environment *_environment, char *_sprite)
void c6847z_sprite_color (Environment *_environment, char *_sprite, char *_color)
void c6847z_tiles_at (Environment *_environment, char *_address)
void c6847z_vertical_scroll (Environment *_environment, char *_displacement)
void c6847z_horizontal_scroll (Environment *_environment, char *_displacement)
void c6847z_get_width (Environment *_environment, char *_result)
void c6847z_tiles_get (Environment *_environment, char *_result)
void c6847z_get_height (Environment *_environment, char *_result)
void c6847z_cls (Environment *_environment)
void c6847z_scroll_text (Environment *_environment, int _direction, int _overlap)
void c6847z_text (Environment *_environment, char *_text, char *_text_size, int _raw)
void c6847z_initialization (Environment *_environment)
void c6847z_finalization (Environment *_environment)
void c6847z_hscroll_line (Environment *_environment, int _direction, int _overlap)
void c6847z_hscroll_screen (Environment *_environment, int _direction, int _overlap)
void c6847z_back (Environment *_environment)
void c6847z_cline (Environment *_environment, char *_characters)
int c6847z_image_size (Environment *_environment, int _width, int _height, int _mode)
Variablec6847z_image_converter (Environment *_environment, char *_data, int _width, int _height, int _depth, int _offset_x, int _offset_y, int _frame_width, int _frame_height, int _mode, int _transparent_color, int _flags)
void c6847z_blit_image (Environment *_environment, char *_sources[], int _source_count, char *_blit, char *_x, char *_y, char *_frame, char *_sequence, int _frame_size, int _frame_count, int _flags)
void c6847z_put_image (Environment *_environment, Resource *_source, char *_x, char *_y, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_flags)
Variablec6847z_new_image (Environment *_environment, int _width, int _height, int _mode)
Variablec6847z_new_images (Environment *_environment, int _frames, int _width, int _height, int _mode)
Variablec6847z_new_sequence (Environment *_environment, int _sequences, int _frames, int _width, int _height, int _mode)
void c6847z_get_image (Environment *_environment, char *_image, char *_x, char *_y, char *_frame, char *_sequence, int _frame_size, int _frame_count, int _palette)
void c6847z_scroll (Environment *_environment, int _dx, int _dy)
void c6847z_put_tile (Environment *_environment, char *_tile, char *_x, char *_y)
void c6847z_tile_at (Environment *_environment, char *_x, char *_y, char *_result)
void c6847z_move_tiles (Environment *_environment, char *_tile, char *_x, char *_y)
void c6847z_put_tiles (Environment *_environment, char *_tile, char *_x, char *_y, char *_w, char *_h)
void c6847z_use_tileset (Environment *_environment, char *_tileset)
Variablec6847z_get_raster_line (Environment *_environment)
void c6847z_slice_image (Environment *_environment, char *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_destination)
int c6847z_palette_extract (Environment *_environment, char *_data, int _width, int _height, int _depth, int _flags, RGBi *_palette)
void c6847z_calculate_sequence_frame_offset (Environment *_environment, char *_offset, char *_sequence, char *_frame, int _frame_size, int _frame_count)
void c6847z_flip_image (Environment *_environment, Resource *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_direction)
void c6847z_screen (Environment *_environment, char *_x, char *_y, char *_c)
void c6847z_cls_box (Environment *_environment, char *_x1, char *_y1, char *_w, char *_h)

Variables

int lastUsedSlotInCommonPalette = 0
char DATATYPE_AS_STRING [][16]

Macro Definition Documentation

◆ SET_VIDEOAT_400

Definition at line 230 of file 6847z.c.

◆ SET_VIDEOAT_600

Definition at line 231 of file 6847z.c.

◆ SET_VIDEOAT_C00

Definition at line 232 of file 6847z.c.

Function Documentation

◆ c6847z_back()

void c6847z_back ( Environment * _environment)

Definition at line 879 of file 6847z.c.

◆ c6847z_background_color()

void c6847z_background_color ( Environment * _environment,
char * _index,
char * _background_color )

VIC-II: emit code to change background color

This function can be used to issue code aimed at changing the background color of the screen.

Parameters
_environmentCurrent calling environment
_indexIndex of the background color
_background_colorBackground color to use

Definition at line 138 of file 6847z.c.

◆ c6847z_bank_select()

void c6847z_bank_select ( Environment * _environment,
int _bank )

Definition at line 226 of file 6847z.c.

◆ c6847z_bitmap_at()

void c6847z_bitmap_at ( Environment * _environment,
char * _address )

Definition at line 425 of file 6847z.c.

◆ c6847z_bitmap_disable()

void c6847z_bitmap_disable ( Environment * _environment)

Definition at line 400 of file 6847z.c.

◆ c6847z_bitmap_enable()

void c6847z_bitmap_enable ( Environment * _environment,
int _width,
int _height,
int _colors )

Definition at line 380 of file 6847z.c.

◆ c6847z_blit_image()

void c6847z_blit_image ( Environment * _environment,
char * _sources[],
int _source_count,
char * _blit,
char * _x,
char * _y,
char * _frame,
char * _sequence,
int _frame_size,
int _frame_count,
int _flags )

Definition at line 1156 of file 6847z.c.

◆ c6847z_border_color()

void c6847z_border_color ( Environment * _environment,
char * _border_color )

VIC-II: emit code to change border color

This function can be used to issue code aimed at changing the border color of the screen.

Parameters
_environmentCurrent calling environment
_border_colorBorder color to use

Definition at line 106 of file 6847z.c.

◆ c6847z_calculate_sequence_frame_offset()

void c6847z_calculate_sequence_frame_offset ( Environment * _environment,
char * _offset,
char * _sequence,
char * _frame,
int _frame_size,
int _frame_count )

Definition at line 1473 of file 6847z.c.

◆ c6847z_cline()

void c6847z_cline ( Environment * _environment,
char * _characters )

Definition at line 883 of file 6847z.c.

◆ c6847z_cls()

void c6847z_cls ( Environment * _environment)

Definition at line 660 of file 6847z.c.

◆ c6847z_cls_box()

void c6847z_cls_box ( Environment * _environment,
char * _x1,
char * _y1,
char * _w,
char * _h )

Definition at line 1572 of file 6847z.c.

◆ c6847z_collision()

void c6847z_collision ( Environment * _environment,
char * _sprite_mask,
char * _result )

VIC-II: emit code to check for collision

This function can be used to issue code aimed at verifying if a sprite has had a collision with another sprite. The result (0 = no collision, 0xff = collision occurred) is returned in the output variable.

Parameters
_environmentCurrent calling environment
_sprite_maskSprite mask to use
_resultWhere to store the result

Definition at line 78 of file 6847z.c.

◆ c6847z_colormap_at()

void c6847z_colormap_at ( Environment * _environment,
char * _address )

Definition at line 432 of file 6847z.c.

◆ c6847z_finalization()

void c6847z_finalization ( Environment * _environment)

Definition at line 833 of file 6847z.c.

◆ c6847z_flip_image()

void c6847z_flip_image ( Environment * _environment,
Resource * _image,
char * _frame,
char * _sequence,
int _frame_size,
int _frame_count,
char * _direction )

Definition at line 1520 of file 6847z.c.

◆ c6847z_get_height()

void c6847z_get_height ( Environment * _environment,
char * _result )

Definition at line 653 of file 6847z.c.

◆ c6847z_get_image()

void c6847z_get_image ( Environment * _environment,
char * _image,
char * _x,
char * _y,
char * _frame,
char * _sequence,
int _frame_size,
int _frame_count,
int _palette )

Definition at line 1361 of file 6847z.c.

◆ c6847z_get_raster_line()

Variable * c6847z_get_raster_line ( Environment * _environment)

Definition at line 1443 of file 6847z.c.

◆ c6847z_get_width()

void c6847z_get_width ( Environment * _environment,
char * _result )

Definition at line 639 of file 6847z.c.

◆ c6847z_hit()

void c6847z_hit ( Environment * _environment,
char * _sprite_mask,
char * _result )

VIC-II: emit code to check for collision

This function can be used to issue code aimed at verifying if a sprite has had a collision with a tile. The result (0 = no collision, 0xff = collision occurred) is returned in the output variable.

Parameters
_environmentCurrent calling environment
_sprite_maskSprite mask to use
_resultWhere to store the result

Definition at line 93 of file 6847z.c.

◆ c6847z_horizontal_scroll()

void c6847z_horizontal_scroll ( Environment * _environment,
char * _displacement )

Definition at line 635 of file 6847z.c.

◆ c6847z_hscroll_line()

void c6847z_hscroll_line ( Environment * _environment,
int _direction,
int _overlap )

Definition at line 850 of file 6847z.c.

◆ c6847z_hscroll_screen()

void c6847z_hscroll_screen ( Environment * _environment,
int _direction,
int _overlap )

Definition at line 866 of file 6847z.c.

◆ c6847z_image_converter()

Variable * c6847z_image_converter ( Environment * _environment,
char * _data,
int _width,
int _height,
int _depth,
int _offset_x,
int _offset_y,
int _frame_width,
int _frame_height,
int _mode,
int _transparent_color,
int _flags )

Definition at line 1088 of file 6847z.c.

◆ c6847z_image_size()

int c6847z_image_size ( Environment * _environment,
int _width,
int _height,
int _mode )

Definition at line 909 of file 6847z.c.

◆ c6847z_initialization()

void c6847z_initialization ( Environment * _environment)

Definition at line 729 of file 6847z.c.

◆ c6847z_move_tiles()

void c6847z_move_tiles ( Environment * _environment,
char * _tile,
char * _x,
char * _y )

Definition at line 1430 of file 6847z.c.

◆ c6847z_new_image()

Variable * c6847z_new_image ( Environment * _environment,
int _width,
int _height,
int _mode )

Definition at line 1274 of file 6847z.c.

◆ c6847z_new_images()

Variable * c6847z_new_images ( Environment * _environment,
int _frames,
int _width,
int _height,
int _mode )

Definition at line 1298 of file 6847z.c.

◆ c6847z_new_sequence()

Variable * c6847z_new_sequence ( Environment * _environment,
int _sequences,
int _frames,
int _width,
int _height,
int _mode )

Definition at line 1329 of file 6847z.c.

◆ c6847z_next_raster()

void c6847z_next_raster ( Environment * _environment)

VIC-II: emit code to wait for next raster irq

This function outputs assembly code needed to wait for the next raster. Meanwhile, the execution of the main code will resume where it left off.

Parameters
_environmentCurrent calling environment

Definition at line 205 of file 6847z.c.

◆ c6847z_next_raster_at()

void c6847z_next_raster_at ( Environment * _environment,
char * _label,
char * _positionlo,
char * _positionhi )

VIC-II: emit code to wait for next raster irq at different position

This function outputs assembly code needed to wait for the next raster on a different position with a different code to execute. Meanwhile, the execution of the main code will resume where it left off.

Parameters
_environmentCurrent calling environment
_labelLabel to jump to when vertical raster reach the value given
_positionloThe vertical position to wait for (bits 7..0)
_positionhiThe vertical position to wait for (bit 8)

Definition at line 222 of file 6847z.c.

◆ c6847z_palette_extract()

int c6847z_palette_extract ( Environment * _environment,
char * _data,
int _width,
int _height,
int _depth,
int _flags,
RGBi * _palette )

Definition at line 1457 of file 6847z.c.

◆ c6847z_pget_color_vars()

void c6847z_pget_color_vars ( Environment * _environment,
char * _x,
char * _y,
char * _result )

Definition at line 484 of file 6847z.c.

◆ c6847z_pset_int()

void c6847z_pset_int ( Environment * _environment,
int _x,
int _y,
int * _c )

Definition at line 443 of file 6847z.c.

◆ c6847z_pset_vars()

void c6847z_pset_vars ( Environment * _environment,
char * _x,
char * _y,
char * _c )

Definition at line 460 of file 6847z.c.

◆ c6847z_put_image()

void c6847z_put_image ( Environment * _environment,
Resource * _source,
char * _x,
char * _y,
char * _frame,
char * _sequence,
int _frame_size,
int _frame_count,
char * _flags )

Definition at line 1208 of file 6847z.c.

◆ c6847z_put_tile()

void c6847z_put_tile ( Environment * _environment,
char * _tile,
char * _x,
char * _y )

Definition at line 1422 of file 6847z.c.

◆ c6847z_put_tiles()

void c6847z_put_tiles ( Environment * _environment,
char * _tile,
char * _x,
char * _y,
char * _w,
char * _h )

Definition at line 1434 of file 6847z.c.

◆ c6847z_raster_at()

void c6847z_raster_at ( Environment * _environment,
char * _label,
char * _positionlo,
char * _positionhi )

VIC-II: emit code to set raster irq

This function outputs assembly code needed to initialize a raster routine. In other words, asynchronously and in parallel with the execution of the main program, the routine starting from the label provided will be executed when the vertical brush on the screen reaches the value of _position. This function is particularly useful when the position is communicated is given as an integer.

Parameters
_environmentCurrent calling environment
_labelLabel to jump to when vertical raster reach the value given
_positionloThe vertical position to wait for (bits 7..0)
_positionhiThe vertical position to wait for (bit 8)

Definition at line 191 of file 6847z.c.

◆ c6847z_screen()

void c6847z_screen ( Environment * _environment,
char * _x,
char * _y,
char * _c )

Definition at line 1562 of file 6847z.c.

◆ c6847z_screen_columns()

void c6847z_screen_columns ( Environment * _environment,
char * _columns )

Definition at line 571 of file 6847z.c.

◆ c6847z_screen_mode_enable()

int c6847z_screen_mode_enable ( Environment * _environment,
ScreenMode * _screen_mode )

Definition at line 297 of file 6847z.c.

◆ c6847z_screen_off()

void c6847z_screen_off ( Environment * _environment)

Definition at line 563 of file 6847z.c.

◆ c6847z_screen_on()

void c6847z_screen_on ( Environment * _environment)

Definition at line 559 of file 6847z.c.

◆ c6847z_screen_rows()

void c6847z_screen_rows ( Environment * _environment,
char * _rows )

Definition at line 567 of file 6847z.c.

◆ c6847z_scroll()

void c6847z_scroll ( Environment * _environment,
int _dx,
int _dy )

Definition at line 1418 of file 6847z.c.

◆ c6847z_scroll_text()

void c6847z_scroll_text ( Environment * _environment,
int _direction,
int _overlap )

Definition at line 672 of file 6847z.c.

◆ c6847z_slice_image()

void c6847z_slice_image ( Environment * _environment,
char * _image,
char * _frame,
char * _sequence,
int _frame_size,
int _frame_count,
char * _destination )

Definition at line 1453 of file 6847z.c.

◆ c6847z_sprite_at()

void c6847z_sprite_at ( Environment * _environment,
char * _sprite,
char * _x,
char * _y )

Definition at line 591 of file 6847z.c.

◆ c6847z_sprite_color()

void c6847z_sprite_color ( Environment * _environment,
char * _sprite,
char * _color )

Definition at line 623 of file 6847z.c.

◆ c6847z_sprite_common_color()

void c6847z_sprite_common_color ( Environment * _environment,
char * _index,
char * _common_color )

VIC-II: emit code to change common sprite's color

This function can be used to issue code aimed at changing the common color of the sprites.

Parameters
_environmentCurrent calling environment
_indexIndex of the background color
_common_colorIndex of the color to use

Definition at line 172 of file 6847z.c.

◆ c6847z_sprite_compress_horizontal()

void c6847z_sprite_compress_horizontal ( Environment * _environment,
char * _sprite )

Definition at line 611 of file 6847z.c.

◆ c6847z_sprite_compress_vertical()

void c6847z_sprite_compress_vertical ( Environment * _environment,
char * _sprite )

Definition at line 607 of file 6847z.c.

◆ c6847z_sprite_data_from()

void c6847z_sprite_data_from ( Environment * _environment,
char * _sprite,
char * _address )

Definition at line 575 of file 6847z.c.

◆ c6847z_sprite_data_set()

void c6847z_sprite_data_set ( Environment * _environment,
char * _sprite,
char * _address )

Definition at line 579 of file 6847z.c.

◆ c6847z_sprite_disable()

void c6847z_sprite_disable ( Environment * _environment,
char * _sprite )

Definition at line 587 of file 6847z.c.

◆ c6847z_sprite_enable()

void c6847z_sprite_enable ( Environment * _environment,
char * _sprite )

Definition at line 583 of file 6847z.c.

◆ c6847z_sprite_expand_horizontal()

void c6847z_sprite_expand_horizontal ( Environment * _environment,
char * _sprite )

Definition at line 603 of file 6847z.c.

◆ c6847z_sprite_expand_vertical()

void c6847z_sprite_expand_vertical ( Environment * _environment,
char * _sprite )

Definition at line 599 of file 6847z.c.

◆ c6847z_sprite_monocolor()

void c6847z_sprite_monocolor ( Environment * _environment,
char * _sprite )

Definition at line 619 of file 6847z.c.

◆ c6847z_sprite_multicolor()

void c6847z_sprite_multicolor ( Environment * _environment,
char * _sprite )

Definition at line 615 of file 6847z.c.

◆ c6847z_sprite_priority()

void c6847z_sprite_priority ( Environment * _environment,
char * _sprite,
char * _priority )

Definition at line 595 of file 6847z.c.

◆ c6847z_text()

void c6847z_text ( Environment * _environment,
char * _text,
char * _text_size,
int _raw )

Definition at line 692 of file 6847z.c.

◆ c6847z_textmap_at()

void c6847z_textmap_at ( Environment * _environment,
char * _address )

Definition at line 436 of file 6847z.c.

◆ c6847z_tile_at()

void c6847z_tile_at ( Environment * _environment,
char * _x,
char * _y,
char * _result )

Definition at line 1426 of file 6847z.c.

◆ c6847z_tilemap_enable()

void c6847z_tilemap_enable ( Environment * _environment,
int _width,
int _height,
int _colors,
int _tile_width,
int _tile_height )

Definition at line 404 of file 6847z.c.

◆ c6847z_tiles_at()

void c6847z_tiles_at ( Environment * _environment,
char * _address )

Definition at line 627 of file 6847z.c.

◆ c6847z_tiles_get()

void c6847z_tiles_get ( Environment * _environment,
char * _result )

Definition at line 646 of file 6847z.c.

◆ c6847z_use_tileset()

void c6847z_use_tileset ( Environment * _environment,
char * _tileset )

Definition at line 1439 of file 6847z.c.

◆ c6847z_vertical_scroll()

void c6847z_vertical_scroll ( Environment * _environment,
char * _displacement )

Definition at line 631 of file 6847z.c.

◆ console_calculate()

void console_calculate ( Environment * _environment)

Definition at line 234 of file 6847z.c.

◆ console_calculate_vars()

void console_calculate_vars ( Environment * _environment)

Definition at line 288 of file 6847z.c.

Variable Documentation

◆ DATATYPE_AS_STRING

char DATATYPE_AS_STRING[][16]
extern

This variable defines as an array of constant pointers. Each element of the array represents the "human" name of a ugBASIC's data type. The main reason is to map an IDto a readable string. If ugBASIC encounters an error, you don't want it to print "Error in type 2," but rather "Error in type FLOAT.". Note that it's vital that the order of strings in the array exactly reflects the order of the IDs in your enum. If you move an element to one, you must also move it to the other, otherwise the mapping will be staggered. Often, a final NULL or UNKNOWN string is added to handle error cases or to allow you to loop through the array without knowing its size beforehand.

Definition at line 133 of file _infrastructure.c.

◆ lastUsedSlotInCommonPalette

int lastUsedSlotInCommonPalette = 0

Definition at line 59 of file 6847z.c.