Thanks for that; I'll have to check it out later. Meanwhile, I think if we're going to use a lookup table at all then I also prefer your use of an array for H$, but I'd load it a little differently (as John and I were discussing):
5 DIM H$(15):FOR T=0 TO 15:H$(T)=CHR$(48+T-(7*(T>9))):NEXT Tsk, tsk; you're cheating by inputting the range in decimal so you don't have to do a HEX to decimal conversion ;-) I suppose it makes sense though... More serious, using integers for the addresses restricts the dump to <8000H; I had the same problem first time around. Enjoying the thread... wonder if Will's getting anything out of it ;-) m ----- Original Message ----- From: B 9 To: m...@bitchin100.com Sent: Thursday, October 27, 2022 11:38 PM Subject: Re: [M100] Notoriously S.L.O.W BASIC posted - help speeding it up appreciated On Thu, Oct 27, 2022 at 3:04 PM John R. Hogerhuis <jho...@pobox.com> wrote: With hex it's a question though since MOD 16 can be done with AND 15 which is probably faster than a general integer 16 modulus. There's no bitshift operator so you still need a integer divide by 16%. Who knows how efficient an integer divide by 16 is in the interpreter versus 4096 (integer) divides. That's a good question about efficiency. Integer division by 4096 seems reasonably quick, but it would have been nice if BASIC had exposed the bit shift operators. (I'm presuming the 8085 had some, right?) I'm not sure it'd be any faster than division by 4096, but one could use the fact that we're using a 2-byte integer for the address and just look at each byte. hexit.do 1 TS$=TIME$ 5 DIM H$(15): FOR T=0 TO 9:H$(T)=CHR$(48+T): NEXT T: FOR T=ASC("A") TO ASC("F"): H$(T-55)=CHR$(T): NEXT 6 DIM R$(7): FOR T=0 TO 7: R$(T)=" ": NEXT 10 DEFINT A-F, P: D=0: P=VARPTR(D) 15 INPUT "Start"; ST% 16 INPUT "End"; EN% 20 FOR D=ST% TO EN% 30 IF (D MOD 8) = 0 THEN PRINT" ";: FOR T=0 TO 7: PRINT R$(T);: NEXT: PRINT: S=0: GOSUB 400 40 GOSUB 200 90 NEXT 100 REM Timing 110 TE$=TIME$ 115 PRINT 120 PRINT TS$ " to " TE$ 199 END 200 REM Print 2 hexits 201 ' Input: D is address of an 8-bit integer 202 ' Output: None, but 2 hexits are printed followed by a space 210 A=PEEK(D) 220 PRINT H$(A\16); H$(A MOD 16); " "; 230 IF A<32 THEN A=46 240 R$(S)=CHR$(A) 250 S=S+1 260 RETURN 400 REM Print 4 hexits 401 ' Input: P is address of a 16-bit little endian integer 402 ' Output: None, but 4 hexits are printed followed by a space 410 A=PEEK(P+1): B=PEEK(P) 420 PRINT H$(A\16); H$(A MOD 16); H$(B\16); H$(B MOD 16); " "; 430 RETURN ------------------------------------------------------------------------------ —b9