Hi Steve,

I was going to mention your amazing code from way back when we played with 
one-line programs (and maybe even steal some code ;-) ) but didn't feel like 
hunting through the archives; didn't think of the personal libraries, duh!

m
  ----- Original Message ----- 
  From: Stephen Adolph 
  To: [email protected] 
  Sent: Wednesday, October 26, 2022 10:41 AM
  Subject: Re: [M100] Notoriously S.L.O.W BASIC posted - help speeding it up 
appreciated


  Will,
  Here is a bit of compact code I wrote to convert bases given a number.  There 
may be some simplifications and or speed ups here.



  The one line version
  1 V$=" 
"+CHR$(13)+CHR$(8)+"0123456789ABCDEF":E=INSTR(V$,INKEY$):ONEGOTO1:F=(F-(E=2))MOD3:G=9*F+2-F^2:C=-C*(E=2)-(C*G+E-4)*(E>3ANDE<G+4):PRINTMID$("BDH",F+1,1)":";:D=C:FORI=11*(F=0)-4TO0:J=G^I:X=INT(D*J):PRINTMID$(V$,X+4,1);:D=D-X/J:NEXT:PRINT:GOTO1




  the more full featured version
  1 PRINT"<ENTER>:BASE <DEL>:CLEAR":PRINT"<+> inc <-> decr":V$=" "+ 
CHR$(13)+"-"+ CHR$(8)+ "+0123456789ABCDEF"
  2 C=0
  3 C=C+E-4:C=C*(C<2^16)*(C>-1)
  4 F=(F-(E=2)) MOD 4:G = INT((F^3)*(4/3) - (F^2)*6 + F*(32/3) + 2):PRINT:PRINT 
MID$("BINOCTDECHEX",3*F+1,3);":";:IF F THEN Z= INT(C/256):D =Z:GOSUB 8:D 
=C-Z*256:GOSUB 8
  5 IF F\2 OR F=0  THEN D = C: GOSUB 10
  6 S$=INKEY$:E=INSTR(LEFT$(V$,5+G),S$):ON E+1 GOTO 
6,6,4,3,2,3:K=C*G+E-6:C=-K*(K<2^16):PRINT S$;:GOTO 6
  8 PRINT" ";
  9 PRINT CHR$(D AND D>31 OR 32 AND D<32);
  10 PRINT" ";:FOR I= 11*(F=0)-4 TO 0:J=G^I:X=INT(D*J):PRINT 
MID$(V$,X+6,1);:D=D-X/J:NEXT:RETURN


  Steve







  On Wed, Oct 26, 2022 at 10:22 AM Will Senn <[email protected]> wrote:

    Hi All,

    For those of you following my previous BASIC memory dump discussion, I have 
posted the code and some commentary on my blog at: 
http://decuser.blogspot.com/2022/10/notoriously-slow-basic.html

    Take a look and if you have suggestions for improving it or find any 
errors, please let me know. I'll be working on its efficiency in the meantime 
and adding to the post as I figure stuff out.

    Thanks,

    Will

Reply via email to