Scaling an entire screen

Anything QL Software or Programming Related.
User avatar
bwinkel67
QL Wafer Drive
Posts: 1187
Joined: Thu Oct 03, 2019 2:09 am

Scaling an entire screen

Post by bwinkel67 »

So as an NTSC user of the QL I get the joys of using only 192 of the 256 lines when using composite out -- well, color composite since my LCD seems to handle monochrome composite in its full PAL glory. Back in the late 80's and early 90's when all I had was a TV to plug my QL into I don't even know if the monochrome composite would have worked (I didn't realize it existed, otherwise I would have tried it).

So there are many programs that are not fully usable because the bottom gets cut off. Now if I run it in monitor mode and have an RGB to SCART cable and up-convert it to HDMI, all should be good, except maybe loosing some pixels on the left (QL-VGA will fix that).

In any case, I've played around with the SCALE keyword but it doesn't quite work for everything, only graphics, so if you mix modes, I don't think you can magically just re-scale things and have it fit...plus you lose width in that case too I think. So I wanted to run the QBQLSounds program on my LCD tv in color and if I run it as is, things get cut off. So I did some mods to it (as minimal in the actual code as possible since I didn't want to spend weeks learning how it works) and turned it from this:
PAL.png
To this:
NTSC.png
I remapped the following calls, renaming the originals by appending a D and anyplace that the TO keyword was used I just did multiple calls since I don't know if DEFine can handle these type of variable parameters in SuperBASIC (i.e. LINE a,b TO c,d TO e,f became LINE a,b to c,d: LINE c,d TO e,f which could then be replaced by DLINE a,b,c,d: DLINE c,d,e,f). Note that with a JSU ROM, the characters are only 8 pixels in height (compared to 10 in JS) so that works out with text (and why the PSION suite worked similarly on NTSC machines since they re-worked their software to fit on the screen -- pretty smart by them but it's only the 4 apps as even QL Chess doesn't do that).

Here are all the newly defined procedures:

Code: Select all

10 hs=.84
1100 DEFine PROCedure DBLOCK(ch,x1,y1,x2,y2,c)
1110 BLOCK #ch,x1,INT(y1*hs),x2,INT(y2*hs),c
1120 END DEFine 
1200 DEFine PROCedure DLINE (x1,y1,x2,y2)
1210 LINE x1,INT(y1*hs) TO x2,INT(y2*hs)
1220 END DEFine 
1230 DEFine PROCedure DLINE_R (x,y)
1240 LINE_R TO x,INT(y*hs)
1250 END DEFine 
1300 DEFine PROCedure DCURSOR (ch,x,y)
1310 CURSOR #ch,x,INT(y*hs)
1320 END DEFine
1330 DEFine PROCedure DCURSOR_G (gx,gy,x,y)
1340 CURSOR gx,INT(gy*hs),x,INT(y*hs)
1350 END DEFine
1400 DEFine PROCedure DCIRCLE (x,y,r)
1410 CIRCLE x,INT(y*hs),r
1420 END DEFine 
1430 DEFine PROCedure DCIRCLE_F (x,y,r,d,a)
1440 CIRCLE x,INT(y*hs),r,d,a
1450 END DEFine 
1460 DEFine PROCedure DCIRCLE_R (x,y,r)
1470 CIRCLE_R TO x,INT(y*hs),r
1480 END DEFine 
1500 DEFine PROCedure DARC_R (x,y,r)
1510 ARC_R TO x,INT(y*hs),r
1520 END DEFine 
1600 DEFine PROCedure DWINDOW (ch,w,h,x,y)
1610 WINDOW #ch,w,INT(h*hs),x,INT(y*hs)
1620 END DEFine 
1700 DEFine PROCedure DSCALE (s,x,y)
1710 SCALE INT(s*hs),x,y
1720 END DEFine
It would have been a nice feature where you could have specified a re-mapping of screen geometry. Maybe a command like MAP 512,256,0,0 TO 512,192,0,0 that would have done that. But that likely would have added a lot of overhead to the ROM. Not sure if non SuperBASIC would have worked with that. But still, having grown up with the NTSC shortcoming it would have been nice (though I realize the market for that is so tiny).


EmmBee
Trump Card
Posts: 240
Joined: Fri Jan 13, 2012 5:29 pm
Location: Kent

Re: Scaling an entire screen

Post by EmmBee »

This could make an ideal task for QLiberator. The new commands could be compiled as QLIB Externals, to be LRESPRd in the boot file.
Also, In the boot file, the original SuperBASIC commands could be redirected to use the new ones, using something like ...

Code: Select all

100 DEFine PROCedure redirect(a$, b$)
110 LOCal a, a_ptr, b, b_ptr
120  a = LOOKUP%(a$) : IF a<0 : PRINT #0,a$!!; : REPORT a : STOP
130  b = LOOKUP%(b$) : IF b<0 : PRINT #0,b$!!; : REPORT b : STOP
140  a_ptr = a*8 + BASIC_L(24)
150  b_ptr = b*8 + BASIC_L(24)
160  IF BASIC_B%(a_ptr)<8 : PRINT #0,a$!!"is not a resident PROC/FN" : STOP
170  IF BASIC_B%(a_ptr)<>BASIC_B%(b_ptr): PRINT #0,b$!!"is not the same type": STOP
180  BPOKE_L a_ptr+4, BPEEK_L(b_ptr+4)
190 END DEFine redirect
200 :
210 redirect "BLOCK" TO "DBLOCK"
220 redirect "LINE" TO "DLINE"
230 redirect "LINE_R" TO "DLINE_R"
240 etc.
I don't know about the .84 value, which might have to be made an environment variable unless this is just written directly in each of the commands.
An interesting point is where and which toolkits you may require to get such keywords as LOOKUP%, BASIC_L and BPOKE_L, etc.
I seem to recall Dilwyn quite recently wrote such a program to find these details.

EmmBee


User avatar
BSJR
Trump Card
Posts: 182
Joined: Sun Oct 18, 2015 12:53 pm
Location: Amsterdam
Contact:

Re: Scaling an entire screen

Post by BSJR »

EmmBee wrote:This could make an ideal task for QLiberator. The new commands could be compiled as QLIB Externals, to be LRESPRd in the boot file.
Also, In the boot file, the original SuperBASIC commands could be redirected to use the new ones, using something like ...

Code: Select all

100 DEFine PROCedure redirect(a$, b$)
110 LOCal a, a_ptr, b, b_ptr
120  a = LOOKUP%(a$) : IF a<0 : PRINT #0,a$!!; : REPORT a : STOP
130  b = LOOKUP%(b$) : IF b<0 : PRINT #0,b$!!; : REPORT b : STOP
140  a_ptr = a*8 + BASIC_L(24)
150  b_ptr = b*8 + BASIC_L(24)
160  IF BASIC_B%(a_ptr)<8 : PRINT #0,a$!!"is not a resident PROC/FN" : STOP
170  IF BASIC_B%(a_ptr)<>BASIC_B%(b_ptr): PRINT #0,b$!!"is not the same type": STOP
180  BPOKE_L a_ptr+4, BPEEK_L(b_ptr+4)
190 END DEFine redirect
200 :
210 redirect "BLOCK" TO "DBLOCK"
220 redirect "LINE" TO "DLINE"
230 redirect "LINE_R" TO "DLINE_R"
240 etc.
I don't know about the .84 value, which might have to be made an environment variable unless this is just written directly in each of the commands.
An interesting point is where and which toolkits you may require to get such keywords as LOOKUP%, BASIC_L and BPOKE_L, etc.
I seem to recall Dilwyn quite recently wrote such a program to find these details.
The LOOKUP% and BPOKE_L keywords are part of the DIY Toolkit (part-B), BASIC_B% is from the Turbo Toolkit.
The S*Basic DLINE Procedure should be renamed as it's already claimed by QDOS and will delete S*Basic lines, not really what you want.


User avatar
bwinkel67
QL Wafer Drive
Posts: 1187
Joined: Thu Oct 03, 2019 2:09 am

Re: Scaling an entire screen

Post by bwinkel67 »

Without creating a separate library, I'm actually going to give a try to compile the entire BASIC program in order to create a single executable. Which BASIC compiler would make this the most seamless and give me that single executable with no need to LRESPR anything else?

Code: Select all

100 REMark QBSoundsv5 (QBITS Exploring QL Sounds 2021)
101 :
102 MODE 4:hs=.84:CLS:QLSounds:Init_Keys:QBITS_Menu
103 :
104 DEFine PROCedure QBITS_Menu
105 ac=0:ar=0:sl=0:sn=0:ds=12:bn=1:mn=200
106 mp=1:kg=0:kn=12:ka=143:ku=52:m=1:KMode
107 OVER#3,-1:DCURSOR 3,ka,ku:PRINT#3,'*':OVER#3,0
108 :
109 REPeat Mlp
110 IF m=0 AND sx=1:BPrt:BWave
111 k=CODE(INKEY$(-1))
112  SELect ON k
113   =192:IF kn>0 :KChange -1:BRead:SChange 0    :REMark Cursor Left
114   =200:IF kn<23:KChange  1:BRead:SChange 0    :REMark Cursor Right
115   =208:IF m=1 AND ds> 0   :SChange -1         :REMark Cursor Up
116   =216:IF m=1 AND ds<15   :SChange  1         :REMark Cursor Down
117   =196:IF m=0:AChange -1:ELSE NChange mp,-1   :REMark Cursor Shift Left
118   =204:IF m=0:AChange  1:ELSE NChange mp, 1   :REMark Cursor Shift Right
119   =212:IF m=0:PChange -1:ELSE LChange -1      :REMark Cursor Shift Up
120   =220:IF m=0:PChange  1:ELSE LChange  1      :REMark Cursor Shift Down
121   =  9:IF kg=0:kg=1:ELSE kg=0:END IF :TChange :REMark Tab Toggle A/B Grp
122   = 10:IF m=0::BPrt:BWave:ELSE SEnt           :REMark Enter Sounds/Score
123   = 27:BRead:BEEP d,p,h,t,s,w,f,r:PAUSE 50:BEEP :REMark Test Sound
124   = 32:IF m=0:BEEP:ELSE IF mp=1:mp=-1:ELSE mp=1:END IF :NChange mp,0
125   =77,109:KMode                                :REMark (M)ode BEEP/Score
126   =76,108:KLoad:IF m=1:LChange 0               :REMark (L)oad
127   =83,115:KSave                                :REMark (S)ave
128   =84,116:IF m=1:Tempo                         :REMark (T)empo
129   =69,101:EXIT Mlp                             :REMark (E)xit
130   =78,110:IF m=1:SNew:l=1                      :REMark (N)ew
131   =80,112:IF m=0:BEEP d,p:ELSE PScore          :REMark (P)itch/(P)lay
132   =72,104:IF m=0:BEEP d,p,h,t,s                :REMark +(H)armonic
133   =87,119:IF m=0:BEEP d,p,h,t,s,w              :REMark +(W)raps
134   =70,102:IF m=0:BEEP d,p,h,t,s,w,f            :REMark +(F)uzz
135   =82,114:IF m=0:BEEP d,p,h,t,s,w,f,r          :REMark +(R)andom
136   =49:IF ar=0:ar=1:ELSE ar=0:END IF :SChange 0 :REMark (1)Staccato
137   =50:IF ar=0:ar=2:ELSE ar=0:END IF :SChange 0 :REMark (2)Tenuto
138  END SELect 
139 END REPeat Mlp
140 CLOSE#3:CLOSE#4:PAPER 0:CLS
141 PRINT#0,'Bye...':STOP :REMark NEW
142 END DEFine 
143 :
144 DEFine PROCedure KChange(change)
145 OVER#3,-1:DCURSOR 3,ka,ku:PRINT#3,'*':OVER#3,0
146 kn=kn+change:ka=16
147 IF kn> 2:ka=26
148 IF kn> 7:ka=35
149 IF kn>14:ka=44
150 IF kn>19:ka=53
151 ka=ka+kn*9:ar=0:SChange 0
152 SELect ON kn:=1,4,6,9,11,13,16,18,21,23:ku=36:ac=1
153 SELect ON kn:=0,2,3,5,7,8,10,12,14,15,17,19,20,22:ku=52
154 OVER#3,-1:DCURSOR 3,ka,ku:PRINT#3,'*':OVER#3,0
155 IF m=0:INK 3:FOR kp=0 TO 7:PPram
156 IF m=0:kp=0:INK 7:PPram
157 END DEFine 
158 :
159 DEFine PROCedure SChange(change)
160 na=10:nu=18:IF m=0:RETurn 
161 DBLOCK 1,26,62,14,145,4:DBLOCK 1,100,10,0,208,0:INK 7
162 FOR i=0 TO 12 STEP 3:DLINE 7,18+i, 15,18+i
163 ds=ds+change:DSymbol:INK 7:DCURSOR 1,2,208:PRINT N$
164 END DEFine 
165 :
166 DEFine PROCedure SNew
167 DBLOCK 1,444,62,46, 76,4:FOR i=0 TO 12 STEP 3:DLINE 20,56+i, 198,56+i
168 DBLOCK 1,444,62,46,145,4:FOR i=0 TO 12 STEP 3:DLINE 20,18+i, 198,18+i
169 FOR l=0 TO 9
170  FOR n=0 TO 23
171    FOR a=0 TO 4:Score(l,n,a)=0
172  END FOR n
173 END FOR l
174 GClef:l=0:DCURSOR 1,48,78:PRINT l:DCURSOR 1,48,146:PRINT l+1
175 sn=0:NChange 1,0:bn=1:mn=200:TPrt
176 END DEFine 
177 :
178 DEFine PROCedure NChange(mp,change)
179 sn=sn+change:IF sn<0 OR sn>23:sn=0
180 DBLOCK 1,426,6,64,139,0:INK 2:ma=42+sn*6.5:mu=42
181 DBLOCK 1,20,10,24,134,0:DCURSOR 1,26,134:PRINT sn
182 FILL 1:DLINE ma-2,mu, ma,mu+mp: DLINE ma,mu+mp, ma+2,mu: DLINE ma+2,mu, ma-2,mu:FILL 0:INK 7
183 END DEFine 
184 :
185 DEFine PROCedure SEnt
186 IF mp=1:nu=56:l=sl
187 IF mp=-1:nu=18:l=sl+1
188 na=42+sn*6.5:Score(l,sn,0)=kn:Score(l,sn,1)=ds
189 IF ar=1 OR ar=2:Score(l,sn,3)=ar:ELSE Score(l,sn,3)=0
190 DSymbol:Score(l,sn,4)=nv:ac=0:ar=0:SChange 0
191 sn=sn+1:IF sn>23:sn=23:NChange mp,0:ELSE NChange mp,0
192 END DEFine 
193 :
194 DEFine PROCedure PScore
195 LOCal l:mp=1:nt=kn
196 IF k=112:lmin=sl:lmax=sl+1:ELSE lmin=0:lmax=9:sl=0:LChange 0
197 FOR l=lmin TO lmin+1
198  IF l=lmin:mp=1:ELSE mp=-1
199  FOR n=0 TO 23
200    ds=Score(l,n,1):IF ds<3:NEXT n
201    kn=Score(l,n,0)
202    nv=Score(l,n,4):dur=3000*nv/mn:sn=n:NChange mp,0:del=5
203    IF Score(l,n,3)=1:del=8:dur=dur-1
204    IF Score(l,n,3)>1:del=2:dur=dur+2
205    IF ds<8:PAUSE dur+del
206    IF ds>7:BRead:BEEP d,p,h,t,s,w,f,r:PAUSE dur:BEEP:PAUSE del
207  END FOR n
208 END FOR l
209 IF lmax=9 AND lmin<8:lmin=lmin+2:LChange 2:GO TO 197
210 BEEP:kn=nt:sn=0:ds=12:SChange 0:mp=1:NChange 1,0
211 END DEFine 
212 :
213 DEFine PROCedure LChange(change)
214 sl=sl+change:tn=kn
215 IF sl<0:sl=0
216 IF sl>8:sl=8
217 IF sl<9:DCURSOR 1,48,78:PRINT sl:DCURSOR 1,48,146:PRINT sl+1
218 FOR sn=0 TO 23
219   na=42+sn*6.5
220   nu=56:kn=Score(sl,sn,0):ds=Score(sl,sn,1):ar=Score(sl,sn,3):DSymbol
221   nu=18:kn=Score(sl+1,sn,0):ds=Score(sl+1,sn,1):ar=Score(sl+1,sn,3):DSymbol
222 END FOR sn
223 kn=tn:ds=12:sn=0:NChange 1,0:TPrt
224 END DEFine 
225 :
226 DEFine PROCedure DSymbol
227 SSpace:INK 0:ac=0
228 IF ds>7:SELect ON kn=1,4,6,9,11,13,16,18,21,23:ac=1
229 IF ds>7 AND MKey(0,kn,8)=-3  :lu=nu-3:Ledger
230 IF ds>7 AND MKey(0,kn,8)=-4.5:lu=nu-3:Ledger:lu=lu-3:Ledger
231 IF ds>7 AND MKey(0,kn,8)=-6  :lu=nu-3:Ledger:lu=lu-3:Ledger
232 IF ds>7:nu=nu+MKey(0,kn,8)
233 SELect ON ds
234  = 0:nv=0  :N$='Space'
235  = 1:nv=0  :EBar   :N$='End Bar'
236  = 2:nv=0  :SBar   :N$='Bar Seperator'
237  = 3:nv=4  :SBRest :N$='Semibreve Rest'
238  = 4:nv=2  :MRest  :N$='Minim Rest'
239  = 5:nv=1  :CRest  :N$='Crotchet Rest'
240  = 6:nv=.5 :QRest  :N$='Quaver Rest'
241  = 7:nv=.25:QRest:SRest   :N$='SemiQuaver Rest '
242  = 8:nv=4  :Semibreve     :N$='Semibreve'
243  = 9:nv=3  :Minim    :Dot :N$='Minim+Dot'
244  =10:nv=2  :Minim         :N$='Minim'
245  =11:nv=1.5:Crotchet :Dot :N$='Crotchet+Dot'
246  =12:nv=1  :Crotchet      :N$='Crotchet'
247  =13:nv=.75:Quaver:Dot    :N$='Quaver+Dot'
248  =14:nv=.5 :Quaver        :N$='Quaver'
249  =15:nv=.25:Semiquaver    :N$='Semiquaver'
250 END SELect 
251 IF ac=1:Sharp:ac=0
252 IF ar=1:Staccato
253 IF ar=2:Tenuto
254 END DEFine 
255 :
256 DEFine PROCedure SSpace
257 LOCal x,y,su:x=na-2.5:y=nu+22:INK 4
258 FILL 1:DLINE x,y, x+6.5,y: DLINE x+6.5,y, x+6.5,y-33: DLINE x+6.5,y-33, x,y-33: DLINE x,y-33, x,y:FILL 0
259 INK 7:FOR su=0 TO 12 STEP 3:DLINE x,nu+su, x+7,nu+su
260 END DEFine 
261 :
262 DEFine PROCedure Ledger
263 INK 7:DLINE na-2,lu, na+5,lu:INK 0
264 END DEFine 
265 :
266 DEFine PROCedure EBar
267 SBar:FILL 1
268 DLINE na+1,nu, na+1,nu+12: DLINE na+1,nu+12, na+1.6,nu+12: DLINE na+1.6,nu+12, na+1.6,nu: DLINE na+1.6,nu, na+1,nu
269 FILL 0
270 END DEFine 
271 :
272 DEFine PROCedure SBar
273 DLINE na,nu, na,nu+12.5
274 END DEFine 
275 :
276 DEFine PROCedure SBRest
277 FILL 1:DLINE na-1,nu+7.5, na-1,nu+7.5
278 DLINE_R 3,0: DLINE_R 0,1: DLINE_R -3,0: DLINE_R 0,-1:FILL 0
279 END DEFine 
280 :
281 DEFine PROCedure MRest
282 FILL 1:DLINE na-1,nu+6.2, na-1,nu+6.2
283 DLINE_R 3,0: DLINE_R 0,1: DLINE_R -3,0: DLINE_R 0,-1:FILL 0
284 END DEFine 
285 :
286 DEFine PROCedure CRest
287 DLINE na+2,nu+4.5, na+2,nu+4.5:FILL 1
288 DARC_R -2,-3,3*PI/4: DARC_R 1,4,-3*PI/4
289 DLINE_R -2,1:DARC_R 0,4.5,3*PI/4
290 DLINE_R 3,-2:DARC_R 1,-4.5,3*PI/4:FILL 0
291 END DEFine 
292 :
293 DEFine PROCedure QRest
294 DLINE na+.8,nu+3, na+2,nu+9:DLINE_R -2,-2,
295 FILL 1:DCIRCLE_R 0,.6,.6:FILL 0
296 END DEFine 
297 :
298 DEFine PROCedure SRest
299 DLINE na,nu, na+1.5,nu+6: DLINE na+1.5,nu+6, na-.5,nu+3.5
300 FILL 1:DCIRCLE_R 0,.8,.6:FILL 0
301 END DEFine 
302 :
303 DEFine PROCedure Head
304 DCIRCLE_F na,nu,1.5,.6,-PI/4
305 END DEFine 
306 :
307 DEFine PROCedure Stem
308 IF kn>13
309  DLINE na-1.1,nu-.5, na-1.1,nu-6
310 ELSE 
311  DLINE na+1.2,nu+.5, na+1.2,nu+6
312 END IF 
313 END DEFine 
314 :
315 DEFine PROCedure Flag1
316 IF kn>13
317  DLINE_R 2,1.5: DLINE_R 0,2.5
318 ELSE 
319  DLINE_R 2,-1.5: DLINE_R 0,-2.5
320 END IF 
321 END DEFine 
322 :
323 DEFine PROCedure Flag2
324 IF kn>13
325   DLINE_R 0,-1: DLINE_R -2,-1
326 ELSE 
327   DLINE_R 0,1: DLINE_R -2,1
328 END IF 
329 END DEFine 
330 :
331 DEFine PROCedure Semibreve
332 DCIRCLE_F na,nu,1.4,.7,PI/2
333 END DEFine 
334 :
335 DEFine PROCedure Minim
336 Head:Stem
337 END DEFine 
338 :
339 DEFine PROCedure Crotchet
340 FILL 1:Head:FILL 0:Stem
341 END DEFine 
342 :
343 DEFine PROCedure Quaver
344 Crotchet na,nu:Flag1
345 END DEFine 
346 :
347 DEFine PROCedure Semiquaver
348 Quaver na,nu:Flag2
349 END DEFine 
350 :
351 DEFine PROCedure Sharp
352 OVER 1:DCURSOR_G na-2.5,nu+5,0,0:PRINT '#':OVER 0
353 END DEFine 
354 :
355 DEFine PROCedure Dot
356 FILL 1:DCIRCLE na+2.5,nu,.6:FILL 0
357 END DEFine 
358 :
359 DEFine PROCedure Staccato
360 INK 0:FILL 1
361 IF kn>13:DCIRCLE na+1,nu+2.8,.6:ELSE DCIRCLE na+.3,nu-2.8,.6
362 FILL 0:INK 7
363 END DEFine 
364 :
365 DEFine PROCedure Tenuto
366 IF kn>13:DLINE na,nu+4, na,nu+4:ELSE DLINE na,nu-3, na,nu-3
367 INK 0:FILL 1
368 DLINE_R 2,0: DLINE_R 0,-.5: DLINE_R -2,0: DLINE_R 0,.5
369 FILL 0:INK 7
370 END DEFine 
371 :
372 DEFine PROCedure GClef
373 INK 0:DLINE 25,59.75, 25,59.75:DARC_R 1,4.5,-PI
374 DARC_R 0,-6,-PI: DARC_R -3,7,-3*PI/4
375 DLINE_R 5,7:DARC_R -2,0,PI
376 DLINE_R 0,-17.5:FILL 1:DCIRCLE_R -1,0,.8:FILL 0:INK 7
377 END DEFine 
378 :
379 DEFine PROCedure Tempo
380 DCURSOR 1,160,52:PRINT 'Beat º Ω'
381 DCURSOR 1,188,64:PRINT 'æøº':DBLOCK 1,2,4,206,66,7
382 REPeat Tlp
383  k=CODE(INKEY$(-1))
384  SELect ON k
385    =192:IF bn>1:bn=bn-1:TPrt
386    =200:IF bn<7:bn=bn+1:TPrt
387    =208:IF mn<240:mn=mn+10:TPrt
388    =216:IF mn> 30:mn=mn-10:TPrt
389    = 10:EXIT Tlp
390  END SELect 
391 END REPeat Tlp
392 DBLOCK 1,48,10,160,52,0:DBLOCK 1,24,10,188,64,0
393 END DEFine 
394 :
395 DEFine PROCedure TPrt
396 DCURSOR 1,160,64:PRINT mn;' '
397 SELect ON bn
398   =1:na=32:nu=56:SSpace:RETurn 
399   =2:b1$='2':b2$='2'
400   =3:b1$='2':b2$='4'
401   =4:b1$='4':b2$='4'
402   =5:b1$='3':b2$='4'
403   =6:b1$='3':b2$='8'
404   =7:b1$='6':b2$='8'
405 END SELect 
406 CSIZE 2,0:INK 0:STRIP 4
407 DCURSOR_G 30,67,0,0:PRINT b1$:DCURSOR_G 30,62,0,0:PRINT b2$
408 CSIZE 0,0:INK 7:STRIP 0
409 END DEFine 
410 :
411 DEFine PROCedure TChange
412 IF kg=0:T$='A':ELSE T$='B'
413 DCURSOR 3,232,4:PRINT#3,T$:KChange 0
414 END DEFine 
415 :
416 DEFine PROCedure PChange(change)
417 INK 3:PPram
418 kp=kp+change:IF kp<0 OR kp>7:kp=0
419 INK 7:PPram
420 END DEFine 
421 :
422 DEFine PROCedure PPram
423 DCURSOR 1,76,62+kp*10:PRINT '   '
424 DCURSOR 1,76,62+kp*10:PRINT MKey(kg,kn,kp) TO 14
425 END DEFine 
426 :
427 DEFine PROCedure BRead
428 d=MKey(kg,kn,0):p=MKey(kg,kn,1):h=MKey(kg,kn,2)
429 t=MKey(kg,kn,3):s=MKey(kg,kn,4):w=MKey(kg,kn,5)
430 f=MKey(kg,kn,6):r=MKey(kg,kn,7)
431 END DEFine 
432 :
433 DEFine PROCedure AChange(change)
434 MKey(kg,kn,kp)=MKey(kg,kn,kp)+change:BRead
435 IF d<0 OR d>235:d=0:MKey(kg,kn,0)=d
436 IF p<0 OR p>255:p=0:MKey(kg,kn,1)=p
437 IF h<0 OR h>255:h=0:MKey(kg,kn,2)=h
438 IF t<0 OR t>235:t=0:MKey(kg,kn,3)=t
439 IF s<-8 OR s>7 :s=0:MKey(kg,kn,4)=s
440 IF w<0 OR w>15 :w=0:MKey(kg,kn,5)=w
441 IF f<0 OR f>15 :f=0:MKey(kg,kn,6)=f
442 IF r<0 OR r>15 :r=0:MKey(kg,kn,7)=r
443 INK 7:PPram
444 END DEFine 
445 :
446 DEFine PROCedure BPrt
447 DCURSOR 4,8,4:BRead:d=INT(d*10000/72):t=INT(t*10000/72)
448 PRINT#4,'BEEP: ';d;'  ';p;' [ ';h;'  ';t;'  ';s;' ] ';w;'  ';f;'  ';r;' ':CLS#4,4
449 END DEFine 
450 :
451 DEFine PROCedure BWave
452 DBLOCK 1,468,24,12,180,0:DBLOCK 1,180,30,300,148,0:STRIP 4:INK 0
453 DCURSOR 1,12,170:PRINT 'Pitch & Harmonics                    Wave Forms'
454 FOR i=0 TO 452 STEP p:DBLOCK 1,1,20,20+i,182,2
455 IF h>0 AND s<>0
456    bs=SQRT(s*s):h2=INT((h-p)/bs):IF bs>h-p:h2=1
457    FOR i=0 TO 450 STEP h :DBLOCK 1,1,12,21+i,190,6
458    FOR i=0 TO 450 STEP h2:DBLOCK 1,1, 6,21+i,196,4
459 END IF 
460 IF s>0
461    bs=s:ba=308:bu=156
462    FOR i=0 TO bs:DBLOCK 1,2,2,ba+i*4,bu+i*2,2
463    ba=308+bs*4:bu=156+bs*2
464    FOR i=0 TO bs:DBLOCK 1,2,2,ba+i*4,bu-i*2,2
465 END IF 
466 IF s<0
467    bs=SQRT(s*s):ba=308:bu=156+bs*2
468    FOR i=0 TO bs:DBLOCK 1,2,2,ba+i*4,bu-i*2,2
469    ba=308+bs*4:bu=156
470    FOR i=0 TO bs:DBLOCK 1,2,2,ba+i*4,bu+i*2,2
471 END IF 
472 IF w<=8 AND w>0
473   bw=w:wa=bw*4:wu=156
474   FOR i=0 TO bw:DBLOCK 1,2,2,400+i*4,wu+i*2,2
475   DBLOCK 1,2,2*bw,400+bw*4,wu,2:DBLOCK 1,2,2*bw,400+bw*8,wu,2
476   FOR i=0 TO bw:DBLOCK 1,2,2,400+wa+i*4,wu+i*2,2
477 END IF 
478 IF w>8
479    bw=w-8:wa=bw*4:wu=156+bw*2
480    FOR i=0 TO bw:DBLOCK 1,2,2,400+i*4,wu-i*2,2
481    DBLOCK 1,2,2*bw,400+bw*4,156,2:DBLOCK 1,2,2*bw,400+bw*8,156,2
482    FOR i=0 TO bw:DBLOCK 1,2,2,400+wa+i*4,wu-i*2,2
483 END IF 
484 STRIP 0:INK 6
485 END DEFine 
486 :
487 DEFine PROCedure KMode
488 IF m=0
489  m=1:INK 7
490  DBLOCK 1,212,166,0,50,0:DBLOCK 1,444,62,46,76,4:DBLOCK 1,444,62,46,145,4
491  FOR i=0 TO 12 STEP 3:DLINE 20,56+i, 198,56+i
492  FOR i=0 TO 12 STEP 3:DLINE 20,18+i, 198,18+i
493  INK 6:DCURSOR 1,4,64:PRINT 'Score Sheet     Metronome ';mn;' '
494  CSIZE 2,0:DCURSOR 1,0,84:PRINT '  æ'\\\\'  ø'\'ºΩ'
495  DCURSOR 1,0,160:PRINT 'æ'\'º'\'ø':DBLOCK 1,2,4,10,172,6
496  CSIZE 0,0:DBLOCK 1,16,3,46,140,6:OVER -1
497  DCURSOR 1,0,94:PRINT '  Row/'\'Column'\' Shift':OVER 0
498  DCURSOR 1,100,208:PRINT '(1)Staccato (2)Tenuto (N)ew (P)lay all or (p)age':CLS 4
499  GClef:SChange 0:LChange 0:KChange 0
500 ELSE 
501  DBLOCK 1,212,24,0,52,0:DBLOCK 1,490,142,0,76,0:DBLOCK 1,488,62,2,145,4
502  INK 6:DCURSOR 1,180,120:PRINT 'Explore QL Sounds'
503  DCURSOR 1,36,52:PRINT 'Shift ºæøΩ º':DBLOCK 1,2,4,108,54,6:INK 5
504  DCURSOR 1,4, 62:PRINT 'Duration  :     (0-235)' :REMark d
505  DCURSOR 1,4, 72:PRINT 'Pitch     :     (0-255)' :REMark p
506  DCURSOR 1,4, 82:PRINT 'Harmonic  :     (0-255)' :REMark h
507  DCURSOR 1,4, 92:PRINT 'Time step :     (0-235)' :REMark t
508  DCURSOR 1,4,102:PRINT 'Pitch Step:     (-8-+7)' :REMark s
509  DCURSOR 1,4,112:PRINT 'Wraps     :     (0-15)'  :REMark w
510  DCURSOR 1,4,122:PRINT 'Fuzz      :     (0-15)'  :REMark f
511  DCURSOR 1,4,132:PRINT 'Random    :     (0-15)'  :REMark r
512  INK 6:DCURSOR 1,380,208:PRINT 'Cancell BEEP':DBLOCK 1,16,3,458,212,6
513  DCURSOR 1,20,208:PRINT 'Play (P)itch +(H)armonic +(W)rap +(F)uzz +(R)andom'
514  m=0:BRead:KChange 0:BPrt:BWave
515 END IF 
516 END DEFine 
517 :
518 DEFine PROCedure QLSounds
519 OPEN#5,scr_10x10a0x0: DWINDOW 5,512,256,0,0:PAPER#5,0:CLS#5
520 OPEN#4,scr_10x10a0x0: DWINDOW 4,284,24,14,150:PAPER#4,4:INK#4,0:CSIZE#4,0,1
521 DWINDOW 2,496,220,8,4:PAPER#2,0:INK#2,7:CSIZE#2, 0,0:CLS#2
522 DWINDOW 1,496,220,8,4:PAPER 0:BORDER 1,2
523 DWINDOW 0,496,30,8,224:PAPER#0,0:INK#0,7:CSIZE#0,0,0
524 DIM Dv$(10,5):sx=0:RESTORE 525:FOR dn=1 TO 10:READ Dv$(dn)
525 DATA 'flp1_','flp2_','mdv1_','mdv2_','mdv3_','mdv4_','mdv5_','mdv6_','mdv7_','mdv8_'
526 CSIZE 2,1:OVER 1
527 FOR i=3 TO 5:INK i:DCURSOR 1,96+i,20+i-2:PRINT 'QBITS Exploring QL Sound'
528 OVER 0:CSIZE 0,0
529 INK 6:DCURSOR 1,156,60:PRINT 'Select Default Device æø':dn=5
530 INK 5:DCURSOR 1,138,74:PRINT 'Then Press <Spacebar> to continue...'
531 DCURSOR 1,156,86:PRINT 'or try <ESC> for speedy QL"s':INK 6:DCURSOR 1,48,120
532 PRINT 'Navigate with Cursor keys ºæøΩ Action with º Enter and    Spacebar'
533 DBLOCK 1,2,4,312,122,6:DBLOCK 1,16,3,377,124,6:INK 5
534 INK 5:DCURSOR 1,140,140:PRINT '( )ode ( )oad ( )ave ( )empo ( )xit':OVER 1
535 INK 7:DCURSOR 1,140,140:PRINT ' M      L      S      T       E':OVER 0
536 DCURSOR 1,90,160:PRINT 'Press Character keys in brackets for other Functions'
537 REPeat dlp
538  DCURSOR 1,304,60:PRINT Dv$(dn)
539  k=CODE(INKEY$(5))
540  SELect ON k
541    =208:IF dn<10:dn=dn+1
542    =216:IF dn>1:dn=dn-1
543    = 32:DBLOCK 1,260,30,120,60,0:EXIT dlp
544    = 27:DBLOCK 1,260,30,120,60,0:sx=1:EXIT dlp
545  END SELect 
546 END REPeat dlp
547 device_filename$=' ':CLS
548 CSIZE 1,1:OVER -1
549 FOR i=3 TO 5:INK i:DCURSOR 1,i,i-2:PRINT 'QBITS Exploring QL Sound'
550 Init_Keyboard:CSIZE 0,0:OVER 0:DSCALE 120,0,0:INK 7
551 DCURSOR 1,2,24:PRINT '(M)ode (L)oad (S)ave (T)empo (E)xit'
552 END DEFine 
553 :
554 DEFine PROCedure Init_Keyboard
555 OPEN#3,scr_10x10a0x0: DWINDOW 3,276,74,224,6 :PAPER#3,0:BORDER#3,1,2:CLS#3
556 FOR i=0 TO 13:DBLOCK 3,16,36,12+i*18,26,7
557 FOR i=0 TO 14
558   IF i=2 OR i=5 OR i=9 OR i=12
559   ELSE 
560     DBLOCK 3,16,20,3+i*18,26,0
561     DBLOCK 3,12,19,5+i*18,26,2
562   END IF 
563 END FOR i
564 OVER#3,1:CSIZE#3,1,0:INK#3,6
565 FOR i=1 TO 2:DCURSOR 3,4+i,4:PRINT#3,'Micro Keyboard º Ω º     Tab'
566 OVER#3,0:CSIZE#3,0,0:INK#3,5:DBLOCK 3,2,4,164,6,6
567 DCURSOR 3,16,16:PRINT#3,' #a    #c #d    #f #g #a    #c #d    #f #g'
568 DCURSOR 3,16,62:PRINT#3,'a  b  c  d  e  f  g  a  b  c  d  e  f  g'
569 END DEFine 
570 :
571 DEFine PROCedure SelPath
572 INK 7:file=0:SD$='QBSDat_'
573 REPeat FSel
574   DCURSOR 1,12,36:PRINT 'Select: ';Dv$(dn)&SD$&file;' æøº (Esc)'
575   DBLOCK 1,2,4,162,38,7:k=CODE(INKEY$(5))
576   SELect ON k
577     =216:IF file>0:file=file-1
578     =208:IF file<9:file=file+1
579     = 10:ck=1:DBLOCK 1,200,10,0,36,0:EXIT FSel
580     = 27:ck=0:DBLOCK 1,200,10,0,36,0:RETurn 
581   END SELect 
582 END REPeat FSel
583 name$=Dv$(dn)&SD$&file:Gf$=SD$&file
584 END DEFine 
585 :
586 DEFine PROCedure FCheck
587 IF ck=0:RETurn 
588 DBLOCK 1,200,10,0,36,0:DCURSOR 1,12,36:PRINT 'Searching...'
589 PAUSE 20:DELETE Dv$(dn)&'FList'
590 OPEN_NEW#99,Dv$(dn)&'FList':DIR#99,Dv$(dn):CLOSE#99
591 OPEN_IN#99,Dv$(dn)&'FList'
592 REPeat dir_lp
593  IF EOF(#99)
594     CLOSE#99:DCURSOR 1,12,36:PRINT 'File Not Found...'
595     PAUSE 25:DBLOCK 1,200,10,0,36,0:file=0:ck=0:EXIT dir_lp
596  END IF 
597  INPUT#99,fchk$:IF fchk$==Gf$:CLOSE#99:EXIT dir_lp
598 END REPeat dir_lp
599 END DEFine 
600 :
601 DEFine PROCedure KLoad
602 SelPath:FCheck:IF ck=0:RETurn 
603 DCURSOR 1,12,36:PRINT 'Loading...'
604 OPEN_IN#99,name$
605 FOR kg=0 TO 1
606  FOR kn=0 TO 23
607    FOR kp=0 TO 8:INPUT#99,MKey(kg,kn,kp)
608  END FOR kn
609 END FOR kg
610 INPUT#99,mn\bn:kg=0:kn=12:kp=0:TChange
611 FOR sl=0 TO 9
612   DCURSOR 1,66+sl*6,36:PRINT '.':PAUSE 5
613   FOR sn=0 TO 23
614     FOR sp=0 TO 4:INPUT#99,Score(sl,sn,sp)
615   END FOR sn
616 END FOR sl
617 CLOSE#99:sl=0:sn=0:sp=0:KChange 0:PAUSE 50:DBLOCK 1,200,10,0,36,0
618 END DEFine 
619 :
620 DEFine PROCedure KSave
621 SelPath:IF ck=0:RETurn 
622 DCURSOR 1,12,36:PRINT 'Saving...'
623 DELETE name$:OPEN_NEW#99,name$
624 FOR kg=0 TO 1
625  FOR kn=0 TO 23
626   FOR kp=0 TO 8:PRINT#99,MKey(kg,kn,kp)
627  END FOR kn
628 END FOR kg
629 PRINT#99,mn\bn:kg=0:kn=12:kp=0:TChange
630 FOR sl=0 TO 9
631   DCURSOR 1,66+sl*6,36:PRINT '.':PAUSE 5
632   FOR sn=0 TO 23
633     FOR sp=0 TO 4:PRINT#99,Score(sl,sn,sp)
634   END FOR sn
635 END FOR sl
636 CLOSE#99:sl=0:sn=0:sp=0:KChange 0:PAUSE 50:DBLOCK 1,200,10,0,36,0
637 END DEFine 
638 :
639 DEFine PROCedure Init_Keys
640 REMark Mkey(kg,kn,kp)    =kg(0-1):=kn(0-23):=kp(0-8)
641 REMark Mkey(kg,kn,0 - 1) =d duration : =p Pitch
642 REMark Mkey(kg,kn,2 - 4) =h harmonic: =t time: =s Step
643 REMark Mkey(kg,kn,5 - 7) =w Wrap: =f Fuzzy : =r random
644 REMark Mkey(kg,kn,8)     =so Stave Offset -6 to +13.5 S
645 REMark Score(sl,sn,sp)   =sl(0-9):=sn(0-23):=sp(0-4)
646 REMark Score(sl,sn,0)    =kn Note number(0-23)
647 REMark Score(sl,sn,1)    =ds display symbol =0 to 23
648 REMark Score(sl,sn,2)    =   Spare
649 REMark Score(sl,sn,3)    =ar Articulation 1=Staccato 2=Tenuto(Legato)
650 REMark Score(sl,sn,4)    =nv Note/Rest value =0 or 4,3,2,1.5,1,0.75,0.5,0.25
651 :
652 DIM MKey(1,23,8),Score(9,23,4)
653 RESTORE 654
654 DATA 41,38,36,33,31,28,26,24,22,20,19,17,15,14,12,11,10,9,8,7,6,5,4,3
655 DATA -6,-6,-4.5,-3,-3,-1.5,-1.5,0,1.5,1.5,3,3
656 DATA 4.5,4.5,6,7.5,7.5,9,9,10.5,12,12,13.5,13.5
657 FOR kn=0 TO 23
658   READ p:MKey(0,kn,0)=0:MKey(0,kn,1)=p
659 END FOR kn
660 RESTORE 655:FOR kn=0 TO 23:READ so:MKey(0,kn,8)=so
661 DATA 0,82,164,1, 7,15,0,0     :REMark kn=0
662 DATA 0,76,152,1,-7, 7,0,0     :REMark kn=1
663 DATA 0,72,144,1, 7,15,0,0     :REMark kn=2
664 DATA 0,66,132,1,-7, 7,0,0     :REMark kn=3
665 DATA 0,62,124,1, 7,15,0,0     :REMark kn=4
666 DATA 0,56,112,1,-7, 7,0,0     :REMark kn=5
667 DATA 0,52,104,1, 7,15,0,0     :REMark kn=6
668 DATA 0,48, 96,1,-7, 7,0,0     :REMark kn=7
669 DATA 0,44, 88,1, 7,15,0,0     :REMark kn=8
670 DATA 0,40, 80,1,-7, 7,0,0     :REMark kn=9
671 DATA 0,38, 76,1, 7,15,0,0     :REMark kn=10
672 DATA 0,34, 68,1,-7, 7,0,0     :REMark kn=11
673 DATA 0,30, 60,1, 7,15,0,0     :REMark kn=12
674 DATA 0,28, 56,1,-7, 7,0,0     :REMark kn=13
675 DATA 0,24, 48,1, 7,15,0,0     :REMark kn=14
676 DATA 0,22, 44,1,-7, 7,0,0     :REMark kn=15
677 DATA 0,20, 40,1, 7,15,0,0     :REMark kn=16
678 DATA 0,18, 36,1,-7, 7,0,0     :REMark kn=17
679 DATA 0,16, 32,1, 7,15,0,0     :REMark kn=18
680 DATA 0,14, 28,1,-7, 7,0,0     :REMark kn=19
681 DATA 0,12, 24,1, 7,15,0,0     :REMark kn=20
682 DATA 0,10, 20,1,-7,14,0,0     :REMark kn=21
683 DATA 0, 8, 16,1, 7,15,0,0     :REMark kn=22
684 DATA 0, 6, 12,1,-7, 7,0,0     :REMark kn=23
685 RESTORE 661
686 FOR kn=0 TO 23
687   READ d,p,h,t,s,w,f,r
688   MKey(1,kn,0)=d:MKey(1,kn,1)=p
689   MKey(1,kn,2)=h:MKey(1,kn,3)=t:MKey(1,kn,4)=s
690   MKey(1,kn,5)=w:MKey(1,kn,6)=f:MKey(1,kn,7)=r
691 END FOR kn
692 kg=0:kn=12:DCURSOR 3,232,4:PRINT#3,'A'
693 END DEFine 
1100 DEFine PROCedure DBLOCK(ch,x1,y1,x2,y2,c)
1110 BLOCK #ch,x1,INT(y1*hs),x2,INT(y2*hs),c
1120 END DEFine 
1200 DEFine PROCedure DLINE (x1,y1,x2,y2)
1210 LINE x1,INT(y1*hs) TO x2,INT(y2*hs)
1220 END DEFine 
1230 DEFine PROCedure DLINE_R (x,y)
1240 LINE_R TO x,INT(y*hs)
1250 END DEFine 
1300 DEFine PROCedure DCURSOR (ch,x,y)
1310 CURSOR #ch,x,INT(y*hs)
1320 END DEFine 
1330 DEFine PROCedure DCURSOR_G (gx,gy,x,y)
1340 CURSOR gx,INT(gy*hs),x,INT(y*hs)
1350 END DEFine 
1400 DEFine PROCedure DCIRCLE (x,y,r)
1410 CIRCLE x,INT(y*hs),r
1420 END DEFine 
1430 DEFine PROCedure DCIRCLE_F (x,y,r,d,a)
1440 CIRCLE x,INT(y*hs),r,d,a
1450 END DEFine 
1460 DEFine PROCedure DCIRCLE_R (x,y,r)
1470 CIRCLE_R TO x,INT(y*hs),r
1480 END DEFine 
1500 DEFine PROCedure DARC_R (x,y,r)
1510 ARC_R TO x,INT(y*hs),r
1520 END DEFine 
1600 DEFine PROCedure DWINDOW (ch,w,h,x,y)
1610 WINDOW #ch,w,INT(h*hs),x,INT(y*hs)
1620 END DEFine 
1700 DEFine PROCedure DSCALE (s,x,y)
1710 SCALE INT(s*hs),x,y
1720 END DEFine 


EmmBee
Trump Card
Posts: 240
Joined: Fri Jan 13, 2012 5:29 pm
Location: Kent

Re: Scaling an entire screen

Post by EmmBee »

You can't go wrong with QLiberator, that's the compiler I would recommend.
I am using QPC2, and found that "del" is a keyword, so I changed that variable to "delay".
Also, to get it to work, I found that CURSOR #ch, x, y had to be changed to AT #ch, y DIV 10, x DIV 6.
The version I'm using is QPC2 v4.5. It could be that the latest v5.0 perhaps cures that problem.
Using QLiberator, this compiled straight off, with no problems, and it works well.
The cursor can be moved around the screen, and the sounds experienced.
Seems like a nice program.


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Scaling an entire screen

Post by tofro »

bwinkel67 wrote:Without creating a separate library, I'm actually going to give a try to compile the entire BASIC program in order to create a single executable. Which BASIC compiler would make this the most seamless and give me that single executable with no need to LRESPR anything else?
Both Turbo and Q-Liberator would be able to compile and create a self-contained program. The choice depends on your target platform and why you are actually compiling.

If your compiling with the target of having one self-cotained unit that is simple to distribute and load, bith Q-Liberator and Turbo are fine.

If you're compiling for speed and your target is SMSQ/E, don't try and use QLib - The finished binary is likely to be not faster, maybe even slower than the same program un-compiled in SBASIC. When compiling for QDOS, you can expect a significant performance gain even with QLib (simply because SuperBASIC is so much slower than SBASIC). Turbo will improve your program's performance on any platform, obviously much less on SMSQ/E.

Apart from that, the choice is simply a matter of taste and what you find easier. Most of the early Turbo deficencies have been lifted long ago, and, with very few exceptions the two compilers can basically compile the same set of program constructs.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
EmmBee
Trump Card
Posts: 240
Joined: Fri Jan 13, 2012 5:29 pm
Location: Kent

Re: Scaling an entire screen

Post by EmmBee »

tofro wrote:Most of the early Turbo deficencies have been lifted long ago
Hi tofro,

... Meaning there are still some issues still lurking in Turbo's code.
Would you like to document some of the remaining ones?
Of course, whenever we come across something that doesn't work right, we'll try to find a way around it.
And then, the issue gets forgotten about.

EmmBee


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Scaling an entire screen

Post by tofro »

The main one being untyped variables in PROC and FN actual parameters - supported by both S*BASIC and QLiberator, but not in Turbo - While both S*BASIC and QLIB determine the type of an actual parameter at run-time, Turbo insists in doing that at compile time, so you can write a Function like

Code: Select all

DEFine FuNction Max (a, b)
	IF a > b : RETurn a
	RETurn b
END DEFine Max

PRINT Max ("Hello", "World")
PRINT Max (10, 11)
a%=10 : b% = 11
PRINT Max (a%, b%)
in S*BASIC and call it with a pair of strings, or integers, or floating points - QLib will happily compile and run it, Turbo won't (or, rather, will only if you call it exclusively with FP variables. If you want to do the same thing with strings, you need to write a Max$(a$, b$), and when you need to compare integers, it must be a Max%(a%, b%) or Turbo wil happily present you a runtime error).


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
EmmBee
Trump Card
Posts: 240
Joined: Fri Jan 13, 2012 5:29 pm
Location: Kent

Re: Scaling an entire screen

Post by EmmBee »

As explained in the Turbo manual, the main concern is with the speed of its code and needs to generate fixed type parameters. So, with the design already built-in, this is hardly likely to be fixed.

What I was more concerned about is actual bugs in Turbo's code. For example, consider this 3 line program ...

Code: Select all

100 MANIFEST : TMAX = 23
110 DIM array(1)
120 DIM path$( (1+array(1)) * TMAX )
The above does not compile, which is rather surprising, as it's only 3 lines long and appears so simple. The recommended solution in these cases is to simplify the code. Here, array(1) could be assigned to a variable, which would simplify this piece. Trying this, we get ...

Code: Select all

100 MANIFEST : TMAX = 23
110 DIM array(1)
120 a = array(1) : DIM path$( (1+a) * TMAX )
130 PRINT #0,"DIMN(path$) = "; DIMN(path$)
140 PAUSE -1
150 STOP
The above now does successfully compile, and running this does produce the expected results. I have condensed the above so that it is more easily explainable. However, the problem I had was a bit more complicated. The need was to declare a local string, the size of which depended upon the first element of the incoming array. This is the real problem ...

Code: Select all

MANIFEST : TMAX = 23
:
REFERENCE                  array(0)
DEFine PROCedure something(array)
LOCal path$( (1+array(1)) * TMAX )
END DEFine
The above does not compile, and I cannot see any way around this. Locals have to follow procedure definitions, that's the rule. And there is no way of assigning the value of the array(1) anywhere. All I can do is to DIMension the string at some colossal length to make sure it won't fail in the future.
This is what I call a bug, Turbo is failing to evaluate what's in the brackets. According to the manual, Turbo can handle up to 20 brackets before it gets into difficulties. The error message that Turbo gives is about TMAX, but that is incorrect. I believe I did get around this bug by rearranging the order of terms between the brackets. To conclude, I would say there are bugs in all programs, and Turbo is no execption.


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Scaling an entire screen

Post by tofro »

Hmm. Your last example compiles nicely on my Turbo 5.02. It complains when I remove the REFERENCE to array (which it shouldn't), but otherwise compiles.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Post Reply