Fix various bug reports:

* Menu 1 not redrawn on 50g after error
* Empty menu tabs leave "" when activated
* Angles and polar complex numbers become invalid objects
* Fixed LN complex handling bugs
Progress on bitmap handling routines.
This commit is contained in:
claudiol 2021-09-21 20:12:07 -04:00
parent d1edbebc54
commit 91ee47fa9b
10 changed files with 175 additions and 7 deletions

View file

@ -6942,9 +6942,9 @@ const struct keyhandler_t const __keydefaulthandlers[] = {
KEYHANDLER_NAME(backslash)},
{KM_PRESS | KB_0 | SHIFT_RS | SHIFT_RSHOLD, CONTEXT_ANY,
{KM_PRESS | KB_SPC | SHIFT_RS | SHIFT_RSHOLD, CONTEXT_ANY,
KEYHANDLER_NAME(rulesep)},
{KM_PRESS | KB_0 | SHIFT_ALPHA | SHIFT_RS | SHIFT_RSHOLD, CONTEXT_ANY,
{KM_PRESS | KB_SPC | SHIFT_ALPHA | SHIFT_RS | SHIFT_RSHOLD, CONTEXT_ANY,
KEYHANDLER_NAME(rulesep)},

View file

@ -1979,6 +1979,7 @@ void status_popup_handler()
else {
DRAWSURFACE scr;
cgl_initscr(&scr);
halRedrawMenu1(&scr);
halRedrawMenu2(&scr);
halRedrawStatus(&scr);
}

View file

@ -7262,7 +7262,7 @@ void LIB_HANDLER()
return;
}
// CHECK IF IMAGINARY PART IS A VALID NUMBER
if(!ISNUMBER(*imag)) {
if(!ISNUMBERORANGLE(*imag)) {
RetNum = ERR_INVALID;
return;
}

View file

@ -2181,7 +2181,7 @@ void LIB_HANDLER()
// LIBRARY MUST RETURN: RetNum=OK_CONTINUE IF OBJECT IS VALID OR RetNum=ERR_INVALID IF IT'S INVALID
if(ISPROLOG(*ObjectPTR)) {
if(OBJSIZE(*ObjectPTR) < 2) {
if(OBJSIZE(*ObjectPTR) < 1) {
RetNum = ERR_INVALID;
return;
}

View file

@ -1706,7 +1706,18 @@ void LIB_HANDLER()
// ONLY ACCEPT THE ANGLE IN RADIANS
trig_convertangle(&im, angmode, ANGLERAD);
swapReal(&RReg[0], &RReg[9]);
// CHECK IF NOT NORMALIZED
if(re.flags&F_NEGATIVE) {
re.flags^=F_NEGATIVE;
// ADD/SUBTRACT PI TO THE ANGLE
REAL pi;
decconst_PI(&pi);
if(im.flags&F_NEGATIVE) addReal(&RReg[9],&RReg[0],&pi);
else subReal(&RReg[9],&RReg[0],&pi);
}
else swapReal(&RReg[0], &RReg[9]);
hyp_ln(&re);
finalize(&RReg[0]);

View file

@ -303,6 +303,160 @@ WORDPTR rplBmpToDisplay(WORDPTR bitmap)
}
#endif
#if DEFAULTBITMAPMODE == BITMAP_RAW64KC
switch (type) {
case BITMAP_RAWMONO:
{
HALFWORDPTR destptr;
BYTEPTR srcptr;
BINT mask = 1;
BINT pixel;
srcptr = (BYTEPTR) (bitmap + 3);
destptr = (HALFWORDPTR) (newbmp + 3);
while(npixels) {
// READ A PIXEL FROM SOURCE
pixel = *srcptr & mask;
// CONVERT TO PROPER FORMAT
if(pixel)
pixel = RGB_TO_RGB16(0,0,0); // ASSUME MONOCHROME GRAPHICS ARE BLACK ON WHITE (SAME AS 50G OR A FAX)
else
pixel = RGB_TO_RGB16(255,255,255);
// WRITE TO DESTINATION
*destptr = (HALFWORD) pixel;
//INCREASE SOURCE POINTER
mask <<= 1;
if(mask > 128) {
++srcptr;
mask >>= 8;
}
// INCREASE DEST PTR
++destptr;
--npixels;
}
break;
}
case BITMAP_RAW16G:
{
HALFWORDPTR destptr;
BYTEPTR srcptr;
BINT mask = 0xf,rot=4;
BINT pixel;
srcptr = (BYTEPTR) (bitmap + 3);
destptr = (HALFWORDPTR) (newbmp + 3);
while(npixels) {
// READ A PIXEL FROM SOURCE
pixel = 0xf0 - ((*srcptr & mask) << rot);
if(pixel&0x80) pixel|=0xf;
// CONVERT TO PROPER FORMAT
pixel = RGB_TO_RGB16(pixel,pixel,pixel); // ASSUME GRAY16 GRAPHICS ARE BLACK ON WHITE (SAME AS 50G BITMAPS)
// WRITE TO DESTINATION
*destptr = (HALFWORD) pixel;
//INCREASE SOURCE POINTER
mask <<= 4;
rot^=4;
if(mask > 0xf0) {
++srcptr;
mask >>= 8;
}
// INCREASE DEST PTR
++destptr;
--npixels;
}
break;
}
case BITMAP_RAW256G:
{
HALFWORDPTR destptr;
BYTEPTR srcptr;
BINT pixel;
srcptr = (BYTEPTR) (bitmap + 3);
destptr = (HALFWORDPTR) (newbmp + 3);
while(npixels) {
// READ A PIXEL FROM SOURCE
pixel = *srcptr;
// CONVERT TO PROPER FORMAT
pixel = RGB_TO_RGB16(pixel,pixel,pixel);
// WRITE TO DESTINATION
*destptr = (HALFWORD)pixel;
//INCREASE SOURCE POINTER
++srcptr;
++destptr;
--npixels;
}
break;
}
case BITMAP_RAW64KC:
{
break;
}
case BITMAP_RAWARGB:
{
HALFWORDPTR destptr;
WORDPTR srcptr;
BINT destmask = 0;
WORD pixel;
srcptr = (WORDPTR) (bitmap + 3);
destptr = (HALFWORDPTR) (newbmp + 3);
while(npixels) {
// READ A PIXEL FROM SOURCE
pixel=*srcptr;
// CONVERT TO PROPER FORMAT
pixel = RGB_TO_RGB16((pixel>>16)&0xff,(pixel>>8)&0xff,(pixel)&0xff);
*destptr = (HALFWORD) pixel;
//INCREASE SOURCE POINTER
srcptr++;
// INCREASE DEST PTR
++destptr;
--npixels;
}
break;
}
}
#endif
// ALL PIXELS CONVERTED
return newbmp;

View file

@ -317,6 +317,7 @@ WORD libComputeHash2(WORDPTR start, BINT nwords);
#define ISPROGRAM(prolog) ( ISPROLOG(prolog) && ((LIBNUM(prolog)==DOCOL) || (LIBNUM(prolog)==SECO)))
#define ISSECO(prolog) ( ISPROLOG(prolog) && (LIBNUM(prolog)==SECO))
#define ISNUMBER(prolog) (ISBINT(prolog)||ISREAL(prolog)||ISREALCONSTANT(prolog))
#define ISNUMBERORANGLE(prolog) (ISBINT(prolog)||ISREAL(prolog)||ISANGLE(prolog)||ISREALCONSTANT(prolog))
#define ISNUMBERCPLX(prolog) (ISBINT(prolog)||ISREAL(prolog)||ISCOMPLEX(prolog)||ISCONSTANT(prolog))
#define ISSTRING(prolog) (ISPROLOG(prolog) && ((LIBNUM(prolog)&~3)==DOSTRING))

View file

@ -15,6 +15,7 @@ typedef void (*LIBHANDLER)(void);
typedef uint16_t HALFWORD;
typedef uint32_t WORD;
typedef uint8_t BYTE;
typedef HALFWORD *HALFWORDPTR;
typedef WORD *WORDPTR;
typedef BYTE *BYTEPTR;
typedef int32_t BINT;

View file

@ -57,7 +57,7 @@
@#name lib104_menu
{
NUMINT ROOT MSOLVE "" ""
NUMINT ROOT MSOLVE { "" } { "" }
{ { "Finan" 1 } { :: #06801000h TMENULST ; :: #06801000h TMENUOTHR ; } }
}

View file

@ -30,7 +30,7 @@
@#name lib66_trig
{
SIN COS TAN { "" :: ; } { { "Angles" 1 } :: #03000000h TMENULST ; }
SIN COS TAN { "" } { { "Angles" 1 } :: #03000000h TMENULST ; }
ASIN ACOS ATAN ATAN2
}