stan cartwright - 2021-04-16

Hi, I ripped some glcd line draw code so I can modify it so if a line is off screen it re appears other side.
Well I have not sorted the code only ripped the basic draw line...which isn't much code.
If I check pset for edges/screen size/defined rectangle each pixel will make it slow.
need a new routine to plot to pre defined point then carry on to end from other edge/side

Any way this is simple draw code. does the classic image not fast as gcb line but near and should be easy to mod.

#chip mega328p,16
#option explicit
#include <glcd.h>
#include <uno_mega328p.h >

    #define GLCD_TYPE GLCD_TYPE_ILI9341
    'Pin mappings for SPI - this GLCD driver supports Hardware SPI and Software SPI
    #define GLCD_DC       DIGITAL_8         ' Data command line
    #define GLCD_CS       DIGITAL_10          ' Chip select line
    #define GLCD_RESET    DIGITAL_9         ' Reset line
    #define GLCD_DI       DIGITAL_12          ' Data in | MISO    - Not used therefore not really required
    #define GLCD_DO       DIGITAL_11          ' Data out | MOSI
    #define GLCD_SCK      DIGITAL_13          ' Clock Line
    #define ILI9341_HardwareSPI

GLCDRotate ( Landscape )
GLCDCLS ILI9341_Black

dim cntr as word

dim dx,dy,sx,sy,er,e2 as integer
dim x2,x1,y1,y2 as word
dim colour as word

for cntr=1 to 319
 draw (cntr,1,320,240,ILI9341_White)
next
end
;--------------------------
;this the draw line routine
sub draw (in x1,in y1,in x2,in y2,in colour)
  DX = ABS(X2 - X1):SX = -1:IF X1 < X2 THEN SX = 1
  DY = ABS(Y2 - Y1):SY = -1:IF Y1 < Y2 THEN SY = 1
  ER = -DY:IF DX > DY THEN ER = DX
;  rotate er right simple
 ER = ER / 2
pixel:
  pset X1,Y1,colour
  if x1=x2 then
    if y1=y2 then return
  end if
  E2 = ER
  IF E2 > -DX THEN ER = ER - DY:X1 = X1 + SX
  IF E2 < DY THEN ER = ER + DX:Y1 = Y1 + SY
GOTO pixel