spotlessmind1975 / ugbasic

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

Add support for keyword DRAW (SB) #834

Open spotlessmind1975 opened 1 month ago

spotlessmind1975 commented 1 month ago

Syntax:

  DRAW "nnnnnnnn .... 9" ,x,y,plot type

The DRAW command allows you to prepare a figure and then display it on the screen. The figure is composed as when drawing on a sheet of paper, without removing the pencil from it. However, it exists a notable difference: it is in fact possible to command the COMMODORE 64 to move the pencil, without however making the corresponding sign (see the example in paragraph 6.5.17). The x and y parameters of the DRAW command are the coordinates of the point on the screen where the figure begins. Each n value in quotes represents an instruction for COMMODORE 64 on how to move the pencil to draw the figure. On each program line it is possible to place the maximum 74 such statements in quotes. However, it is possible add instruction strings, up to a maximum of 255. For continue the figure beyond this limit, a new origin must be defined where the previous string ended. They are listed below instructions and the associated value.

0 move one pixel to the right
1 move one pixel up
2 move in pixels down
3 move one pixel to the left
5 move one pixel to the right and draw a point
6 move one pixel up
7 move one pixel down
8 move one pixel to the left
9 finished figure

Please note that by using only the instructions listed, it is possible build any figure. The figure, however, is not drawn until a DRAW and ROT commands are not executed (previous paragraph). The DRAW command defines the shape while ROT generates it. The plot type is been described in paragraph 2.4.

godot64 commented 1 month ago

The amount of pixels a step goes gets defined by the ROT command. It's not one pixel but as many as ROT angle, step says.

Arndt

spotlessmind1975 commented 1 month ago

Hi @godot64 , and thank you for the comment!

I will follow this specification. The ROT command has been described here: #890