Beyond Super Gold Card

A place to discuss general QL issues.
User avatar
pjw
Super Gold Card
Posts: 676
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Beyond Super Gold Card

Postby pjw » Thu Mar 19, 2020 10:56 am

Well, you could try something like the rough routines below. They are general purpose, in that they - in theory - should work for any screen size. However, you may find that reloading such a screen with LoadScr may not work as expected with QPC2 > V4.05, although you can still BGIMAGE it.
With 512x256-sized screens, I suppose it should work in SMSQ/E across the board, however, I havent tried this. Let us know how you get on!

Code: Select all

100 DEFine FuNction SaveScr(fnm$)
110 LOCal ch, sz
120 ch = FOP_DIR(fnm$): IF ch < 0: RETurn ch
130 sz = SCR_LLEN * SCR_YLIM
140 IF DMEDIUM_FREE(#ch) * 512 < (sz + 128) THEN
150  CLOSE#ch: RETurn -11
160 END IF
170 CLOSE#ch
180 SBYTES fnm$, SCR_BASE, sz
190 RETurn 0
200 END DEFine SaveScr
210 :
220 DEFine FuNction LoadScr(fnm$)
230 LOCal ch
240 ch = FOP_IN(fnm$): IF ch < 0: RETurn ch
250 IF FLEN(#ch) <> SCR_LLEN * SCR_YLIM THEN
260  CLOSE#ch: RETurn -4
270 END IF
280 LBYTES fnm$, SCR_BASE
290 RETurn 0
300 END DEFine LoadScr
310 :


Per
Be wary of large West-Coast corporations bearing gifts!
- Ancient Trojan proverb
stevepoole
Gold Card
Posts: 305
Joined: Mon Nov 24, 2014 2:03 pm

Re: Beyond Super Gold Card

Postby stevepoole » Thu Mar 19, 2020 10:56 pm

Hi all,

After a day of thrashing around, I am begining to be able to convert saved QL screens for QPC2.
The program should only be used when the original QL paper colour was black.
First SBYTES your QL screens onto some suitable medium, say FLP1. Then transfer to say USB key DOS5_
The program converts QL ram bytes into QPC2 screen dots, but is not yet accurate in detail, but it is a start !
My QPC2 is preset at 512x256 graphics units, to make conversion possible.
I will have to work out how Marcel addresses pixels on the QPC2 screen to do better.
And also how TT addresses the QL screen exactly too.
Here is the method as far as I have got.
Do you know a better routine ?..... Steve.

100 REMark QL_to_QPC2_screen_swap
110 WINDOW 512,256,0,0: OVER 0: PAPER 0: INK 7 : CLS
120 S1=SCR_BASE : s2=ALCHP(32768): s3=ALCHP(32768)
130 LBYTES dos5_QL_globe_pic,s3 : see s3
150 LBYTES dos5_QL_spiral_pic,s2 : see s2
160 CLCHP
230 :
240 DEFine PROCedure see(se)
270 w=4: j=128: SCALE 512,0,0
280 FOR y= 0 TO 255 STEP w
290 FOR x= 0 TO 127 STEP w/2
300 f=y*j+x : pk=PEEK(se+f)
310 ik=pk MOD 8
320 IF ik: dot
330 END FOR x: END FOR y: PAUSE 200: END DEFine
340 :
350 DEFine PROCedure dot
360 INK 0: FILL 1: CIRCLE w*x*1.2,512-y*w/2,w: FILL 0
365 INK ik: FILL se=s2: CIRCLE w*x*1.2,512-y*w/2,w: FILL 0
370 END DEFine
380 :


User avatar
Peter
QL Wafer Drive
Posts: 1032
Joined: Sat Jan 22, 2011 8:47 am

Re: Beyond Super Gold Card

Postby Peter » Fri Mar 20, 2020 8:31 am

XorA wrote:
For me, figures like this prove again that ideas of native hardware with Raspberry as coprocessor are pointless.


I would have to agree with Peter on this.

And AROS (Amiga Research Operating System, an AmigaOS 3.1 compatible OS) proves you can take and old 68k OS and "convert" it to other CPUs. It even automagically runs a 68k emulator for old executables so they function on the new CPU seamlessly.

But AmigaOS is mainly written in C! Not 68K assembler! It is quite off-topic so I moved more of my reply here: https://qlforum.co.uk/viewtopic.php?f=12&t=3203


stevepoole
Gold Card
Posts: 305
Joined: Mon Nov 24, 2014 2:03 pm

Re: Beyond Super Gold Card

Postby stevepoole » Fri Mar 20, 2020 9:22 pm

Hi Folks,
Cloistered by COVID measures, more work done on the QL to QPC2 screen transfer program :

Pixel-level transfer achieved, but the visual result is still not perfect... it would appear that every other QL byte is output backwards !

Does anyone know where to find docs describing the QL bit arrangements per byte ? I seem to remember an article on this was printed in QL World, but mine are all in storage...

Best Wishes,
Steve.


User avatar
NormanDunbar
Forum Moderator
Posts: 1053
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: Beyond Super Gold Card

Postby NormanDunbar » Fri Mar 20, 2020 10:32 pm

Hi Steve,

Try this https://github.com/NormanDunbar/QLAssem ... nguage.pdf page 97 onwards - might help.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals - https://www.amazon.co.uk/Arduino-Softwa ... 1484257898, https://www.apress.com/gb/book/9781484257890
stevepoole
Gold Card
Posts: 305
Joined: Mon Nov 24, 2014 2:03 pm

Re: Beyond Super Gold Card

Postby stevepoole » Sat Mar 21, 2020 10:49 am

Hi Norman,

Many thanks for the pdf document, which gave me the details I needed to complete my program successfully.....

The program transfers (MODE 8) SBYTEd QL screens from QPC2 LBYTEd memory. It is now pixel perfect !
I could adapt it for mode four, which at present I don't need, and for resolutions other than 512x256 quite easily.
Best Wishes,
Steve.

100 :
110 REMark Transfer QL_screen to QPC2_screen for MODE 8 !
120 WINDOW 512,256,0,0: OVER 0: PAPER 0: INK 7
130 s1=SCR_BASE: s2=ALCHP(32768): s3=ALCHP(32768)
140 LBYTES dos5_spiral_pic,s2: LBYTES dos5_globe_pic,s3
170 CLS: swapem s3: swapem s2
440 :
530 DEFine PROCedure swapem(ad)
550 x=0: y=0: FOR f=0 TO 32766 STEP 2
560 greens=PEEK(ad+f): reds=PEEK(ad+f+1)
570 green$=BIN$(greens,8): red$=BIN$(reds,8)
580 FOR j=2 TO 8 STEP 2: green$(j)='9'
590 pos=0: FOR bit=1 TO 7 STEP 2
600 pix$=green$(bit) & red$(bit) & red$(bit+1): px=pix$
610 SELect px
620 =0 : ik= 0
630 =1 : ik= 1
640 =10 : ik= 2
650 =11 : ik= 3
660 =100: ik= 1
670 =101: ik= 2
680 =110: ik= 3
690 =111: ik= 7
700 END SELect
710 BLOCK 2,1,x+pos,y,ik: pos=pos+2
720 END FOR bit
730 x=x+8: IF x>511: x=0: y=y+1
740 END FOR f
750 END DEFine


User avatar
NormanDunbar
Forum Moderator
Posts: 1053
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: Beyond Super Gold Card

Postby NormanDunbar » Sat Mar 21, 2020 12:32 pm

stevepoole wrote:Hi Norman,

Many thanks for the pdf document, which gave me the details I needed to complete my program successfully.....


So, contrary to my wife's opinion, I do have my uses! ;)

Glad it was useful.


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals - https://www.amazon.co.uk/Arduino-Softwa ... 1484257898, https://www.apress.com/gb/book/9781484257890
martyn_hill
Super Gold Card
Posts: 568
Joined: Sat Oct 25, 2014 9:53 am

Re: Beyond Super Gold Card

Postby martyn_hill » Sat Mar 21, 2020 2:04 pm

Hi Steve

I have been reading your thread on loading QL screen-files in to QPC2 - very interesting.

However I'm left curious, as I have been doing this using the normal LBYTES approach without difficulty - as long as QPC2 is set to 512x256 and the relevant MODE to match the screen-file.

Rather than using DISP_SIZE to set the resolution, I instead have a 'QLDisplay' ini file that includes the 512x256 window dimensions pre-configured - and bypass the usual QPC2 Configuration dialogue at start-up. I switch between profiles by firing-up QPC with distinct ini files depending upon the sort of session I'm planning.

I use QPC_MAXIMIZE to fill my laptop display, but otherwise take no special action in order to display any of the QL screen-files I have to hand (mostly Spectrum SCREEN$ files that I have converted to QL display format.) The very same files load identically on my QLs as well...

Anyhow, just another approach - assuming that you only need the 512x256 resolution.


User avatar
tofro
QL Wafer Drive
Posts: 1936
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Beyond Super Gold Card

Postby tofro » Sat Mar 21, 2020 3:33 pm

There's also the QPC_QLSCREMU -1 command that allows you to load QL screens even in arbitrary resolutions and colour depths - It simply emulates the QL screen in the top left of the QPC screen.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
pjw
Super Gold Card
Posts: 676
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Beyond Super Gold Card

Postby pjw » Sat Mar 21, 2020 6:01 pm

tofro wrote:There's also the QPC_QLSCREMU -1 command that allows you to load QL screens even in arbitrary resolutions and colour depths - It simply emulates the QL screen in the top left of the QPC screen.
Thats the straightforwardest, of course. But straightforwardness is obviously not what is wanted here ;) The most versatile is to convert screen dumps to pics, or better still, to sprites. Im sure most of you already know how to do that, so this is strictly for those who dont:

Code: Select all

100 REMark Save screen mode 8 to sprite
110 :
120 fnm$ = 'win1_test8_'
121 base = 131072: REMark Perforce fixed forever on a BBQL
130 ssz = 2^15
140 rem SBYTES fnm$ & 'scr', SCR_BASE, ssz
141 SBYTES fnm$ & 'scr', base, ssz
150 spr = ALCHP(ssz + 24)
160 LBYTES fnm$ & 'scr', spr + 24
170 POKE   spr + 0,   1: REMark Sprite mode = QL
180 POKE   spr + 1,   1: REMark Colour mode: 0 or 1 (for 4 or 8)
190 POKE_W spr + 2,   0: REMark Etc
200 POKE_W spr + 4, 512: REMark X size (512 even in mode 8)
210 POKE_W spr + 6, 256: REMark Y size
220 POKE_L spr + 8,   0: REMark Origen offsets
230 POKE_L spr + 12, 12: REMark -> sprite
240 POKE_L spr + 16,  0: REMark No mask
250 POKE_L spr + 20,  0: REMark No next
260 SBYTES fnm$ & 'spr', spr, ssz + 24
270 RECHP spr
280 REMark DELETE fnm$ & 'scr'

The code above is just a crude hack!
In SMSQ/E you need some command to view the resulting sprite, like EasyPtr's SPRW or Qptr's WSPRT, or Knoware's stand-alone WSPT command.
The big advantage with this method is that it can be displayed on any platform that sports SMSQ/E, in any(?) mode, and on any screen size (provided the screen is at least as large as the sprite).


Per
Be wary of large West-Coast corporations bearing gifts!
- Ancient Trojan proverb

Who is online

Users browsing this forum: No registered users and 7 guests