The circumstances that brought these things to my attention might be my fault (bugs in the emulator and/or test cases and/or me being a noob and/or low on caffeine), so I’m not sure if they really are bugs in the library.

### PROJ_TILEDMODE 1 doesn’t define POK_BITFRAME

I had to add `#define POK_BITFRAME 0`

to My_settings.h for SoftVMS to compile.

It wasn’t necessary before?

###
`Pokitto::lcdRectangle(1,1,5,5)`

doesn’t draw a square

Expected: Either a 4x4 or 5x5 square, not a 5x4 rectangle.

Is it really supposed to have an exclusive upper bound for Y, but inclusive for X?

```
void Pokitto::lcdRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) {
int16_t temp;
if (x0>x1) {temp=x0;x0=x1;x1=temp;}
if (y0>y1) {temp=y0;y0=y1;y1=temp;}
if (x0 > POK_LCD_W) return;
if (y0 > POK_LCD_H) return;
if (x1 > POK_LCD_W) x1=POK_LCD_W;
if (y1 > POK_LCD_H) y1=POK_LCD_H;
if (x0 < 0) x0=0;
if (y0 < 0) y0=0;
int32_t max=(x1-x0)*(y1-y0);
if( max ){
setWindow( y0, x0, y1-1, x1-1 );
write_command(0x22);
setup_data_16(color); // setup the data (flat color = no change between pixels)
CLR_CS_SET_CD_RD_WR; // go to vram write mode
while(max--){
CLR_WR;SET_WR; //CLR_WR;SET_WR;//toggle writeline, pokitto screen writes a column up to down
}
setWindow(0, 0, 175, 219);
}
}
```

###
`drawRow`

with x0<0 and x1>width draws nothing.

Expected: draw the visible portion of the line. drawColumn has the same issue.

Not sure if bounds should be exclusive/inclusive, suggested implementation might need adjustment.

```
void Display::drawRow(int16_t x0, int16_t x1, int16_t y){
if ((uint16_t)y>=height) return; //completely out of bounds
if (x0>x1) {
int x=x0;
x0=x1;
x1=x; // swap around so that x0 is less than x1
}
if (x0<0) x0=0;
if (x1>=width ) x1=width-1;
if (x0>x1) return; //completely out of bounds
for (int x=x0; x <= x1; x++) {
drawPixel(x,y);
}
}
```

I also find it odd that there’s int16_t everywhere. Is there any reason for this?

ARM can only pass 32-bits around, so it has to add extra instructions to sign-extend / truncate and I can’t think of any advantage to using smaller types on it. It just results in marginally larger/slower code.

edit: fix typo