Re: Returning values from a basic extension function
Posted: Thu Oct 15, 2020 11:12 am
Haha, thats pretty definitive, yes!mk79 wrote:<>Code: Select all
move.w bv..chrix,a1
RIP Sir Clive Sinclair 1940 - 2021
https://theqlforum.com/
Haha, thats pretty definitive, yes!mk79 wrote:<>Code: Select all
move.w bv..chrix,a1
It's a good feeling isn't it? Well done.daniel_baum wrote:This is the first time I have ever attempted an sbasic extension, so I am rather chuffed that it works. There's still a bit of debugging to do before I am sure that it won't brick the system![]()
Hi Norm,NormanDunbar wrote:It's a good feeling isn't it? Well done.daniel_baum wrote:This is the first time I have ever attempted an sbasic extension, so I am rather chuffed that it works. There's still a bit of debugging to do before I am sure that it won't brick the system![]()
If you are on pre-JS, I think, extensions don't work after loading the code until NEW is called. From JS one, this is not necessary.
Cheers,
Norm.
Cursors are sprites on SMSQ/E, they can have any colour, alpha transparency and even animation. Check out marcel-theme and fading-cursor here https://www.kilgus.net/smsqe/gd2-high-colour/. Should also be part of the QPCDemo.win file supplied with QPC I think.daniel_baum wrote:Also, is it possible to change the cursor colour in QD? On my system (QPC2 in high colour mode) it's light blue, and doesn't stand out very well against the grey background.
You test in the main SBasic or some daughter SBasic?daniel_baum wrote:It's SMSQ/E 3.36. The extension works. It just fails to find some names which it finds successfully after the NEW.
Congrats on getting it to work!daniel_baum wrote:Hi all,
I finally managed to debug my basic extension... it turns out that there are some name table entries with a name pointer of FFFF, and things went screwy when I tried to follow them into the name list. They are SBasic variables of some kind (maybe unused or invalid or something?) , so obviously when you NEW they disappear and everything works. My loop now identifies and ignores them, and everything at least appears to work now![]()
You've probably found a temporary name table entry which could be the argument to a procedure or function or saved local variable.daniel_baum wrote: I finally managed to debug my basic extension... it turns out that there are some name table entries with a name pointer of FFFF, and things went screwy when I tried to follow them into the name list. They are SBasic variables of some kind (maybe unused or invalid or something?) , so obviously when you NEW they disappear and everything works. My loop now identifies and ignores them, and everything at least appears to work now![]()
Code: Select all
700 REMark ntdump_bas NameTable Dump Utility
710 REMark v2.0 20190120 Jan Bredenbeek
720 REMark requires: TK2 extensions AND Minerva OR SMSQ
730 DEFine PROCedure ntdump(n$)
740 LOCal l%,nt,ty%,ty$,dt%,dt$,no%,nl%,nl$,q$
750 q$=PARSTR$(n$,1)
755 wh=20:lc=1:REMark window height and counter
760 REMark loop for all NT entries
770 PRINT 'Type','Value','Pointer',,'Name'
775 argb=PEEK_L(\60\-24):locb=PEEK_L(\60\-20):loct=PEEK_L(\60\-16)
780 FOR nt=0 TO PEEK_L(\\28)-PEEK_L(\\24)-8 STEP 8
790 ty%=PEEK(\24\nt):dt%=PEEK(\24\nt+1):REMark name & data type
791 SELect ON ty%
792 =0:ty$="Unset"
793 =1:ty$="Expr"
794 =2:ty$="Var"
795 =3:ty$="Array"
796 =4:ty$="SBproc"
797 =5:ty$="SBfunc"
798 =6:ty$="REP"
799 =7:ty$="FOR"
800 =8:ty$="MCproc"
801 =9:ty$="MCfunc"
802 =REMAINDER :ty$="? ("&HEX$(ty%,8)&")"
803 END SELect
810 no%=PEEK_W(\24\nt+2):REMark namelist offset
815 IF nt>=argb AND no%>=0 THEN no%=PEEK_W(\24\no%+2)
820 IF nt>=argb AND nt<locb THEN ty$=ty$&"A"
825 IF nt>=locb AND nt<loct THEN ty$=ty$&"L"
830 IF no%>=0 THEN
835 nl%=PEEK(\32\no%):nl$=""
840 FOR l%=1 TO nl%:nl$=nl$&CHR$(PEEK(\32\no%+l%))
845 ELSE
850 nl$="*NO NAME*"
855 END IF
860 SELect ON dt%
861 =0:dt$="n/a"
862 =1:dt$="string"
863 =2:dt$="float"
864 =3:dt$="integer"
865 =REMAINDER :dt$="? ("&HEX$(dt%,8)&")"
867 END SELect
870 IF q$<>"" AND NOT (q$ INSTR nl$) THEN NEXT nt
875 lc=lc+1:IF lc>wh THEN
877 i$=INKEY$(-1):IF i$=="q" OR i$=CHR$(27) THEN EXIT nt
878 lc=1
879 END IF
880 PRINT ty$,dt$,HEX$(PEEK_L(\24\nt+4),32),nl$
890 END FOR nt
900 END DEFine ntdump