Sunday, 10 December 2017

Digital C

Digital C is a version of small C that was sold by Digital Precision up to and including the closing sale of the QL Collection back in the early to mid 1990s if memory serves QL Heaven correctly.
The collection comprised 10 disks containing zipped copies of a digital precision programs and their manuals. Digital C is now freeware and can be downloaded from Dilwyn Jones site. The sources are also available.

Digital C was QLHeaven's easy introduction to C programming. Digital C although complex was easier for the tyro to get in to that the more powerful C68 package. QL Heaven is a 14 day C programmer. A book was bought titled teach yourself C programming in 21 days. QLHeaven got to day 14, skipped the rest and got down to programming.

Some screen savers and a program to display some graphic file formats were the results. Yesterday checking through the QL sites bookmarked in QLHeaven's browser to remove those that had been taken down, a post on Tim Swenson's site caught the eye. A smsqe-zine  from earlier this year where Tim Swenson had been playing around with Digital C and found that Digital C could only use the standard QL colours. This is not actually the case as Digital C contains functions to access QL Traps including trap#3. So here is a Digital C program running on a Q60 with grey and brown for its paper, ink and border colours. Why these colours were chosen is now beyond the ken of QLHeaven. Anyway here are some pics.





Thursday, 30 November 2017

SMSQ/E modules again

Here below is a further development of the SBASIC program written by Tony Tebby to explain the modular structure of smsqe. This time the program not only lists the modules in a version of smsq/e it also allows the extraction of a given module and/or its header element. Why - simply to see how it works.

The first image below shows how a module is selected, then when selected the second image shows the extraction menu.

The bottom window in the image shows how the screen shots were captured as gifs using a program called engif. This is an amazing little program. It only understands mode 4 and mode 8 colours but it can cope with display sizes more that 512x256. It comes in a package with ungif which can show a gif on a mode4 or mode 8 QL display.

Finally below is the listing.





1000 REMark - scan bootloader file
1010 DIM version$(4): version$(0)=4 :
1020 OPEN #0,CON_512x420a20x16: CLS#0: BORDER#0,1,4
1030 height = 52 : DIM d$(height,84) : pg=1
1040 INPUT#0,'SMSQ file>';f$ : IF f$="":QUIT
1050 OPEN_IN #3,f$
1060 fln = FLEN(#3) : PRINT#0,CHR$(10)&HEX$(fln,32)&" length of file"&CHR$(10)
1070 LGET #3\fln-$18+$4,mod_ptr : REMark - get length of host module
1080 PRINT#0,HEX$(mod_ptr,32)&" length of host module"&CHR$(10)
1090 LGET #3\fln-$18+$14,bln    : REMark - length of bootloader file
1100 PRINT#0,HEX$(bln,32)&" length of bootloader file"&CHR$(10)
1110 IF bln: mod_ptr = mod_ptr + fln - bln
1120 FOR i=1 TO 9999
1130   LGET #3\(mod_ptr),mbase,mlength
1140   IF NOT mbase: modules=i-1:EXIT              : REMark - end of file
1150   IF NOT i MOD height: Inc : pg=pg+1 : INPUT a$;  : REMark - pause at screen full
1160   WGET#3\(mod_ptr+$16),name_rel: REMark - relative pointer to name
1170   GET#3\(mod_ptr+$16+name_rel),name$  : REMark - fetch module name
1180   IF LEN (name$)&&1: BGET#3,a : REMark - odd length name is padded
1190   BGET #3,version$(1 TO 4)    : REMark - get version, if any
1200   PRINT#0,HEX$(mod_ptr,32) !!!! HEX$(mbase,24) !! HEX$(mlength,24) !! version$ ! name$
1210   d$(i)=HEX$(mod_ptr,32)&"    "&HEX$(mbase,24)&"  "&HEX$(mlength,24)&"  "&version$&" "&name$
1220   mod_ptr = mod_ptr + mbase + mlength
1230 END FOR i
1240 CLOSE #3 : PRINT#0,CHR$(10)&HEX$(mod_ptr,32)&" end of file"
1250 PRINT#0,\"Save data as text file (S/s), Extract a module (X/x), Header Info (I/i)"
1256 PRINT#0,\"                   or ESC to Quit program"
1260 REPeat Main
1264   in=INKEY$(#0,-1) INSTR 'SsQqxXIi'&CHR$(27): REMark wait to close program
1270   SELect ON in
1280     =1,2
1284            OPEN#1,"con_":OUTLN#1,320,210,96,130 : BORDER#1,1,4 : CLS#1
1286            AT#1,1,1:INPUT#1,'save file name>';sf$ : IF sf$="":QUIT
1288            WREST#1
1290     =5,6 : SelectModule
1300     =7,8 : SelectModule
1310     =9   : QUIT
1320   END SELect
1324   IF sf$<>""
1330     OPEN_NEW#3,sf$ : PRINT#3,f$\\HEX$(fln,32)&" length of file"&CHR$(10)
1340     FOR i=1 TO height : IF d$(i)<>"": PRINT#3,d$(i) : END FOR i
1350     PRINT#3,\\HEX$(mod_ptr,32)&" end of file"
1360     CLOSE#3 :sf$=""
1366   END IF
1378 END REPeat main
1370 :
1380 DEFine PROCedure Inc
1390   LOCal z$(height*pg),j
1400   FOR j=1 TO height*pg : z$(j)=d$(j)
1410   DIM d$(height*pg)
1420   FOR j=1 TO height*pg :d$(j)=z$(j)
1430 END DEFine
1440 :
1450 DEFine PROCedure SelectModule
1460 wndoline=8 : txtline=1 : up=208 : dn=216
1470 REPeat choose
1480   key=CODE(INKEY$(#0))
1490   SELect ON key
1500     = 27 : EXIT choose
1510     = up
1520       AT#0,wndoline,0 : INK#0,4:PRINT#0,d$(txtline)
1530       wndoline=wndoline-1 : IF wndoline<8 : wndoline=modules+7
1540       txtline=txtline-1 : IF txtline<1 : txtline=modules
1550     = dn
1560       AT#0,wndoline,0 : INK#0,4:PRINT#0,d$(txtline)
1570       wndoline=wndoline+1 : IF wndoline>modules+7 : wndoline=8
1580       txtline=txtline+1 : IF txtline>modules : txtline=1
1590     =10,32
1600       SELect ON in
1610         = 5,6 : DoExtraction
1620         = 7,8 : ShowHeaderInfo
1630       END SELect
1634       AT#0,wndoline,0 : INK#0,4:PRINT#0,d$(txtline)
1636       RETurn
1640   END SELect
1650   AT#0,wndoline,0 : INK#0,7: PRINT#0,d$(txtline)
1660 END REPeat choose
1670 END DEFine eXtractModule
1680 :
1690 DEFine PROCedure DoExtraction
1700 ptr=HEX(d$(txtline,1 TO 8)):hdr=HEX(d$(txtline,13 TO 18)):sze=HEX(d$(txtline,21 TO 26))
1710 strngmax=32000 : Xmod$=GetName
1720 OPEN#1,"con_":OUTLN#1,320,210,96,130 : BORDER#1,1,4 : CLS#1
1730 AT#1,1,2: INK#1,7: PRINT#1,"Module:- ";Xmod$
1740 AT#1,3,5: PRINT#1,"a: Extract header and module"
1750 AT#1,5,5: PRINT#1,"h: Extract header only"
1760 AT#1,7,5: PRINT#1,"m: Extract module only"
1770 AT#1,9,5: PRINT#1,"Q: Back to list without extraction"
1780 ky=INKEY$(#1,-1) INSTR 'AaHhMmQq'&CHR$(27)
1790   SELect ON ky
1800     =1,2 : all=hdr+sze
1810     =3,4 : all=hdr
1820     =5,6 : all=sze : ptr=ptr+hdr : REMark move pointer to module
1830   END SELect
1840   IF ky>0 AND ky <7 :AT#1,12,2 : INPUT#1,'save file name>';mf$ : IF mf$="": WREST#1 : RETurn
1850 WREST#1
1854 IF ky < 7
1858   OPEN_IN#3,f$ : OPEN_OVER#4,mf$
1860   IF all <= strngmax
1870     DIM mod$(all) : BGET#3\ptr,mod$(1 TO all) : PRINT#4,mod$(1 TO all);
1880   ELSE
1890     DIM mod$(strngmax)
1900       REPeat getbits
1910        BGET#3\ptr,mod$(1 TO strngmax) : PRINT#4,mod$(1 TO strngmax); : IF all=0 : EXIT getbits
1920        all=all-strngmax : IF all <strngmax : strngmax=all :all=0
1930      END REPeat
1940   END IF
1950   CLOSE#3 : CLOSE#4
1956 END IF
1960 END DEFine DoExtraction
1970 :
1980 DEFine FuNction GetName
1990 LOCal first,last,j,t$,md$
2000 m$=d$(txtline,29 TO ) : j=1
2010 REPeat first
2020   IF m$(j)<>" " : m$=m$(j TO) : EXIT first
2030   j=j+1
2040 END REPeat first
2050 j=LEN(m$)
2060 REPeat last
2070   IF m$(j)<>" " : m$=m$(1 TO j) : EXIT last
2080   j=j-1
2090 END REPeat last
2100 RETurn m$
2110 END DEFine GetName
2120 :
2130 DEFine PROCedure ShowHeaderInfo
2140 Xmod$=GetName : DIM mod$(24)
2150 ptr=HEX(d$(txtline,1 TO 8))
2160 OPEN_IN#3,f$ : rem BGET#3\ptr,mod$(1 to 24)
2162 LGET#3\ptr,hl,ml,rl,ck,sl
2166 BGET#3\(ptr),lvl : WGET#3\(ptr+2),nme
2170 OPEN#1,"con_":OUTLN#1,320,210,96,130 : BORDER#1,1,4 : CLS#1
2180 AT#1,1,2: INK#1,7: PRINT#1,"Header Info:- ";Xmod$
2190 AT#1,3,5: PRINT#1,"Header Length",HEX$(hl,32),hl
2200 AT#1,5,5: PRINT#1,"Module Length",HEX$(ml,32),ml
2210 AT#1,7,5: PRINT#1,"Relocate Length",HEX$(rl,32),rl
2220 AT#1,9,5: PRINT#1,"Checksum     ",HEX$(ck,32),ck
2230 AT#1,11,5: PRINT#1,"Select Code Offset",HEX$(sl,32),sl
2240 AT#1,13,5: PRINT#1,"Module Level",HEX$(lvl,8),,lvl
2250 AT#1,15,5: PRINT#1,"Offset to Name",HEX$(nme,16),,nme
2256 AT#1,19,5: PRINT#1,,"To return ESC or eXit"
2260 rt=INKEY$(#1,-1) INSTR "xX"&CHR$(27)
2270 WREST#1
2280 END DEFine


Friday, 24 November 2017

Q60 and QTOP Index

QLheaven is exceedingly pleased that some of this blog's posts have come to the attention of the QL Forum and have even stirred up some discussion.

The Q60 QTOP-index measurement of 108.88 mentioned in a previous post RPi and QL emulator speeds that was considered to be wrong. This post was actually about the speeds of QL emulation on a Raspberry Pi using either uqxl or smsqmulator. This post showed that these 2 emulators on the modest RPi could perform better than many of the old QL type hardware systems.

Figures for the Q60 and QPC2 were thrown in for context and perhaps some more information regarding the set up of the Q60 could have been given as this was given for the surprisingly very high QPC2 speed which was largely down the PC hardware.

QLHeaven was itself surprised by the relatively low figure of 108.88 that QTOP had produced for the the Q60. But many factors can affect the production of benchmark figures. In the case of the Q60 the setting for the 68060 processors caches will markedly affect this as will the screen size and graphics mode in use. Other software running at the same time as the bench marking software tends to have a significantly lesser effect on the benchmark level produced.Although the slightly better performace of the Q60 with write through caches and 16 bit colour at 1024x512 is thought to be due to improvements in smsq/e over the 18 months or so since the last tests.

QLHeaven will freely confess to routinely using the write through cache setting instead of the faster copyback setting as copyback often screws up compiled SBASIC, such as QLiberated programs making copyback difficult to live with. Secondly the Q60 is almost always used in 16bit colour 1024x512 screen resolution, so it seemed fair to use a QTOP index with these settings. And here is the evidence of the effect of screen resolution,size and cache settings.

                 
                   Q60 80mHz QTOP speed test results

 
Screen Size
Screen Mode
Cache
QTOP Index

1024x512
16 bit
Writethrough
110.635
1024x512
16 bit
Copyback
122.523
1024x512
16bit
Copyback*
138.096
512x256
16 bit
Writethrough
110.006
512x256
16 bit
Copyback
137.756
512x256
mode 4
Writethrough*
148.326
512x256
mode 4
Copyback*
194.845
 
* Only software running - TINDEX

As can be seen the key influences on the TINDEX result are the cache mode, screen resolution and colour mode.


































Sunday, 19 November 2017

Eye Candy for the Q60

For the Qx0 - Qcdeze's colour scheme has got updated. See Dilwyn Jones website.






Friday, 17 November 2017

QL World File Finder Update - Wild Search

 Some time ago it was suggested here in QLHeaven that the File Finder program from QL World in 1989 was worthy of an update. At the moment there are several file finder programs on Dilwyn Jones website. QLHeaven has had a look at most of them. Many have drawbacks, some are complex and none are as simple as the original file finder program. So QLHeaven was pleased to discover that it had been updated.

The update is still a SBASIC listing that can be launched with EX. It needs SMSQE, and uses the WMAN colours. It also uses one QPTR keyword. As QPTR is now freeware and downloadable from Dilwyn Jones site this should not be an issue. The program is also FI2 capable. The advantage of it being a SBASIC listing is that it could be tweaked if need be. For example if for some reason a search pulled up more files that the arrays used in the program are designed for then they could be expanded. Although a search that pulls up more than 2k items surely cannot be a discriminating or useful search. The lists of files found may be saved as text documents for future reference if needed, and file names can be placed in the stuffer buffer.  Files can be exed or read/edited via FI2 if required.

Below are some screen shots of the program running on an Aurora system, a Q60 system and QPC2.





Thursday, 9 November 2017

Quanta version of Jan Jones Superbasic Handbook

While working on a small SBASIC program QLHeaven had a need to consult on the usage of a superbasic keyword in a copy of Jan Jones Superbasic handbook that had been bought from Quanta. Pages 171 and 172 which contained the crucial information were missing. No evidence that they had ever existed in the book. This was not a big deal as there was also a copy of RWAP's SBASIC Reference manual to hand. But QLHeaven wonders if any other copies of Quanta's version of Jan Jones book were missing pages or if indeed this was a rare copy of the book that could be worth a fortune in years to come!

Tuesday, 19 September 2017

Some Small Things

Firstly the price of the new Q68 QL clone is :



Q68 board, 4Gb SDHC Card, SMSQ/E: £150.00 Black Case: £20 Belkin Black PS/2 spliter: £2.00

General Release date: 09/10/2017. Derek Stewart is making a register of interested buyers.

Secondly, non destructive pop up windows in programs. There have been many ways of doing this. There was and is a DIY toolkit set of keywords that will let Superbasic, QDOS programmers make and store and replace windows, W_STORE, W_CRUNCH, W_SHOW etc. The Turbo toolkit came with some Superbasic demos that could help do the same. Then there are the QPTR and Easypointer toolkits. Each way of making non destructive windows seems quite complex. Yet in SBASIC, the keyword OUTLN does the  job.

10 OPEN#1,"con_":OUTLN#1,xsize,ysize,xpos,ypos: CLS#1 does the job. The question is how to restore the previous screen contents. Again this is simple. The QPTR keyword WREST does the job.
20 WREST#1 restores the content overwritten by OUTLN.

Both keywords originally appeared in the QPTR toolkit. This puzzle is why only OUTLN became a standard SBASIC keyword.