spotlessmind1975 / ugbasic

An isomorphic BASIC language compiler for retrocomputers
Apache License 2.0
85 stars 13 forks source link

Add support for keyword DESIGN (SB+TSB) #829

Open spotlessmind1975 opened 1 month ago

spotlessmind1975 commented 1 month ago

Syntax:

DESIGN c,ad
DESIGN e.sa + gc

reserve space in memory for a sprite. The DESIGN command reserves it in the COMMODORE 64's memory enough space to contain the sprite you want to create. Sprite uses 64 bytes. The first parameter of the DESIGN command specifies whether the sprite is in high-resolution mode or in multi-color mode, which are indicated by the values ​​0 and 1 respectively. The second parameter, ad, defines the starting address in memory of the first byte of the sprite. This number must be a multiple of 64, and must be included in the 2048 and 16319 range; it can be introduced in either form decimal, than hexadecimal. If the value is hexadecimal, it must be preceded by the $ character. If the sprite is to be used on screen high-resolution, you must add a constant value of 49152 in decimal base, or $C000, in hexadecimal base. Each 64-byte area available in memory for a MOB is called 'block'. If you divide the starting address of a sprite by 64, you get the block number. This number is used in the MOB SET command (paragraph 8.2.5) to initialize the sprite. NOTE The value of the graphic constant MUST NOT be added to the starting address to calculate the block number. The areas available in the COMMODORE 64's memory for MOBs and is associated block numbers are listed below:

BLOCK NUMBERS MEMORY LOCATION
32-63 = 2048-4095
128-255 = 8192-16383

If you used the MEM command (paragraph 8.3.2), only the blocks 192-255 are available to store sprites. You can store as many sprites as the space contains memory of your COMMODOR 64. However, you can only view eight at the same time. During the course of the program, you can replace one of the sprites on the screen with another present in memory, using the starting address of its location in the memory itself.

godot64 commented 1 month ago

DESIGN needs a specific number of following basic lines all starting with an "@" (these lines represent the definition of either sprites or characters, depending on the first parameter which can be either 0,1, 2, 3, 5, or 7).

Arndt

spotlessmind1975 commented 1 month ago

Hi @godot64 , and thank you for the comment!

Yes, I will take note of this, for sure. I will work with the goal of "backward compatibility" since actually ugBASIC allows direct loading of PNG/GIF/BMP/... images to define the sprites, instead of using this command.