How do you save a screen

Discuss all aspects of programming here. From 8-bit through to modern architectures.
User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Sat Jan 07, 2017 8:55 am

Sorry if I am going off topic with this thread.....I might end up creating lots of threads though....

Someone posted a mouse driver which I have been using (from mdfs.net). I can't work out how to get the cursor showing on the screen. Can anyone help please? I am not sure it's possible.

I've also been trying with the AMX Superart rom to do this. When you do *SHOWPOINTER it hangs or does weird stuff. I've tried various configs in BeebEm( Master, BBC , BBC+). I am using the AMX Super art 3.61 Rom.

I don't have to see the pointer if it's a problem but some kind of blob or pointer that doesn't ruin the background picture would do!
Thanks for any help you can give to me.

SteveF
Posts: 516
Joined: Fri Aug 28, 2015 8:34 pm
Contact:

Re: How do you save a screen

Post by SteveF » Sat Jan 07, 2017 2:21 pm

I hope someone who knows about this will be along to help, but in case they're not...

I used to have AMX Super Art BITD and I seem to remember that it would support the use of the cursor keys on the keyboard or an analogue joystick to move the pointer as well as a real mouse. Could you maybe try one of those to see if it helps? That would at least rule out the emulator's mouse implementation as a source of problems.

Could you perhaps create a short test program (10-20 lines or so) which demonstrates the problem? If you could put the test program and the Super Art ROM on an SSD and post it here, people could easily try it out for themselves.

Edited to add: Another thought - BeebEm seems to support an "analogue mousestick", which I assume essentially translates the mouse coordinates into emulated analogue joystick positions. If you use that option, you can just read the mouse using ADVAL(1) and ADVAL(2) and won't need any driver as it's standard OS functionality. If you can live without a proper pointer, you could just draw a crosshair in EOR mode yourself to show the pointer position. Something like the following hack:

Code: Select all

MODE 2
REPEAT
X%=FNscale_x(ADVAL(1))
Y%=FNscale_y(ADVAL(2))
GCOL 3,7
FOR I%=1 TO 2
MOVE X%-50,Y%:DRAW X%+50,Y%
MOVE X%,Y%-50:DRAW X%,Y%+50
NEXT
GCOL 0,7
IF (ADVAL(0) AND 1)<>0 THEN PLOT 69,X%,Y%
UNTIL FALSE
END
DEF FNscale_x(C%)
C%=C%-48
C%=(65520-48)-C%
=1280*C%/(65520-48)
DEF FNscale_y(C%)
C%=C%-48
=1024*C%/(65520-48)
This seems to track the pointer position fairly well in BeebEm for me.

Also, do you know for sure that the AMX Super Art ROM supports mode 2? Does it work if you try it in mode 1 or 4? (I know that's no immediate use to you, but it might be a useful data point.)
Attachments
mousestick.zip
(690 Bytes) Downloaded 24 times
Last edited by SteveF on Sat Jan 07, 2017 2:39 pm, edited 2 times in total.

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Sat Jan 07, 2017 4:14 pm

Thanks a lot for coming to my rescue. I've been here all afternoon getting frustrated.
It is a good point.........I am not sure if the AMX rom allows mode 2 and draws pointers.
Having said that I am trying other modes and not having a lot of luck.
I either get hanging or garbled text on the screen or really weird messages.....(like Rrray for example) ...which suggests memory is getting corrupted?
I have tried switching Sideways ram on and off but had no luck.

I will have a look at those things you suggest and get back to you. Thanks again. Was getting a bit frustrated today .

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Sat Jan 07, 2017 5:04 pm

Well done Steve! That cursor is exactly what I want. Thanks!
It is really accurate as well..........much more than the AMX one and trying to judge the offsets. The cursor sits under the windows cursor. Ace!
That has given me some more wind in the sails to keep going!

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Sat Jan 07, 2017 7:56 pm

Well that is fab. Finally I have got the colours working and the fills! And I can see what I am doing with the cursor =D>
Please can I ask one more question .....how do you test for the middle mouse button and the right mouse button with your program?

I want to implement a basic draw dots type thing so I can fill in little gaps that are open so I can seal up before flood filling.
Cor I can't wait to start colouring in some pics!
At least with save states for now I can implement a crude undo until I am more savvy with sideways ram and swapping screens.....

It's very satisfying it is coming together...my program is really crude but it is doing what I want! Thank you to everyone so far who has taken some time to help me.

SteveF
Posts: 516
Joined: Fri Aug 28, 2015 8:34 pm
Contact:

Re: How do you save a screen

Post by SteveF » Sat Jan 07, 2017 8:56 pm

Glad to hear it's coming together!

As far as I can tell, the BeebEm "analogue mousestick" only supports one button :-( I'd have assumed - since it's emulating a joystick - the second button might be indicated as the fire button on the second joystick being pressed, but ADVAL(0) AND &FF doesn't ever return anything except 0 or 1 (if the left button is pressed). It might be possible to patch BeebEm to add support for this, but I don't know.

You might have to go back to "proper" mouse support to try to get this to work. Some random thoughts:
  • Does the AMX Super Art ROM allow you to read the mouse position/button state via an OSWORD/OSBYTE call? (Do you have a link to a copy of the manual? A quick web search didn't turn one up for me and my original one is at my parents' house...) If it does, you could perhaps use that instead of the ADVAL() code *but* continue to draw your own crosshair instead of trying to use the AMX ROM's own pointer. That might sidestep some of your problems (e.g. it shouldn't matter if the AMX ROM doesn't support mode 2).
  • Does it help the accuracy problem if you use the "Hide Cursor" option in BeebEm, so you can't see the Windows mouse pointer in BeebEm when it's over the BeebEm window? You'd still have your own crosshairs so you'd know where the emulated system though the mouse was, and it then might not matter if it doesn't agree with the Windows mouse pointer position.
  • As a temporary workaround, you could use CTRL and/or SHIFT as modifier keys (check with INKEY(-2) and INKEY(-1)) for the single mouse button supported on the analogue mousestick, and then change it later on if you figure out some way to read the mouse buttons properly.

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Sat Jan 07, 2017 9:12 pm

I found a link to the AMX mouse manual:

http://lists.cloud9.co.uk/pipermail/bbc ... 01821.html

It does let you read co-ordinates but I didn't understand it :lol:
When I tried *SHOWPOINTER to get going and *MOVEPOINTER I got a load of gobbledegook on screen.....? No idea :)

Your cursor is very accurate so I will stick with your routine I reckon. Thanks so much!


I don't understand adval and oswrch. I have no clue what they mean but I see them all the time!......is it a command to read a register or something like that? I never really got into assembler.

I can get by using they keyboard for now.

When I press B it draws a black block. When I press W a white one. So that is ok without the mouse buttons! But if we can get it working with the buttons even better as it's quicker when you are drawing.....

I had a go and painting tonight as soon as I got the cursor working and the fills. It was a Eureka moment for me! So here is Yoshi's Island Part 2!

I need to try and get my brushes going now and some kind of undo......sometimes when you fill onto white and white is part of your colour it seems to stop working ( I use save sates in Beeb Em before doing some of those fills :lol: )

Wow it's really cool to see this progressing!
Attachments
Progress.jpg

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Sat Jan 07, 2017 11:06 pm

Ok things are really going well now.
I've got different shades and brushes on the go. Really simple stuff but it works. Hoorah!

One thing I am stumped by is how to save screens with variables in the filename. So if I press S on the keyboard it increments a variable and then adds that to the name of the file e.g.

screen%=1
IF key$="S" screen%=screen+1
* SAVE mypict+screen% 3000 5000

So it will save

mypic1
mypic2
mypic3

That way I can go back a version if I need to.......how do you achieve that in basic please?

Sorry I did have a nose on the net but can't find the answer yet.....if anyone can help out there I would be grateful. Sunday is piccy colouring day!

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Sun Jan 08, 2017 12:50 am

Got some mellow Pete Namlook on tonight .........been using my program......harnessing the wonderful colours in this brilliant Acorn Graphics chip! :wink:
Very underrated Rom if you ask me............Acorn did a sterling job.
Attachments
Namlook.jpg

User avatar
lurkio
Posts: 2186
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: How do you save a screen

Post by lurkio » Sun Jan 08, 2017 1:22 am

pixelblip wrote:One thing I am stumped by is how to save screens with variables in the filename. So if I press S on the keyboard it increments a variable and then adds that to the name of the file e.g. screen%=1:IF key$="S" screen%=screen+1:* SAVE mypict+screen% 3000 5000
So it will save
mypic1
mypic2
mypic3
Try this:

Code: Select all

OSCLI "SAVE mypic"+STR$screen%+" 3000 5000"
pixelblip wrote:been using my program......harnessing the wonderful colours in this brilliant Acorn Graphics chip! :wink: Very underrated Rom if you ask me............Acorn did a sterling job.
Yes, I don't really know anything about this ROM, but you're certainly getting some great results!

=D> =D>

SteveF
Posts: 516
Joined: Fri Aug 28, 2015 8:34 pm
Contact:

Re: How do you save a screen

Post by SteveF » Sun Jan 08, 2017 2:29 am

pixelblip wrote:I found a link to the AMX mouse manual:

http://lists.cloud9.co.uk/pipermail/bbc ... 01821.html
I can see a (broken) link to the ROM itself on mdfs.net, and I've been able to find that on there now, but I can't see a link to the manual itself. Can you point it out for me explicitly please? :-)

I've had a quick play with BeebEm and b-em and the mouse driver ROM on mdfs.net here: http://mdfs.net/Software/BBC/Modules/

I've knocked up a simple test program (copy attached as SSD, which also includes the Mouse ROM for convenience):

Code: Select all

ON ERROR GOTO 100
*MOUSE ON
GOTO 200
100PRINT "*MOUSE ON failed; is the Mouse ROM loaded?"
END
200MODE 2
VDU 23;8202;0;0;0;
REPEAT
X%=ADVAL(7)
Y%=ADVAL(8)
B%=ADVAL(9)
FOR I%=1 TO 2
GCOL 3,7
MOVE X%-50,Y%:DRAW X%+50,Y%
MOVE X%,Y%-50:DRAW X%,Y%+50
NEXT
IF B%<>0 THEN GCOL 0,B%:PLOT 69,X%,Y%
UNTIL FALSE
I can see what you mean about the inaccuracy - both BeebEm and b-em are all over the place. I'm assuming my program isn't at fault, of course - it might be, I've never used this ROM before. For what it's worth, it *is* capable of reading the three buttons, the above program is a bit strange and chooses the colour of the point to plot based on which combination of three buttons is held down.

I do wonder if running the emulator in full screen mode might make this work. I haven't tried this myself, because I'm on Linux and every time I run a program in full screen there seems to be a 50% chance I won't be able to get back to my desktop properly and end up having to reboot. I'm speculating here, but since a real mouse doesn't report its X/Y position, but it reports *changes* in its X/Y position, all the emulator can really do is report changes from the Windows mouse as if they came from a real AMX hardware mouse. The emulated mouse position is therefore never going to line up properly with the Windows mouse cursor position. And I think once the Windows mouse cursor is outside the emulator window, the emulator stops reporting changes in its position - which is why I think full screen mode might work. (Or maybe this behaviour is because I'm running BeebEm under WINE on Linux.)
pixelblip wrote:I don't understand adval and oswrch. I have no clue what they mean but I see them all the time!......is it a command to read a register or something like that? I never really got into assembler.
ADVAL() is named because it allows you to read VALues from the Analogue to Digital converter, but it also allows reading various other values from the operating system. ADVAL(0) returns a value which represents the state of the joystick fire buttons plus some other information (which is why you need to do ADVAL(0) AND 3 or similar to query just the fire button state). ADVAL(1) and ADVAL(2) return the X and Y coordinates of the first joystick (assuming that's what's on the analogue port) and ADVAL(3) and ADVAL(4) do the same for the second joystick. As you can see, the Mouse ROM allows the use of ADVAL(7) and ADVAL(8) to query the mouse position.

OSWRCH is the operating system call to display a character; it's what's ultimately used by BASIC to implement things like PRINT and VDU. OSBYTE/OSWORD are a general purpose interface to the OS (and any sideways ROMs which extend its functionality); the AMX Super ROM adds some OSBYTE and OSWORD commands to allow you to read the mouse cursor position, save/restore areas of the screen (for pull-down menus), etc.

There's a lot more information on BeebWiki (http://beebwiki.mdfs.net) - you can search for ADVAL, OSBYTE etc using the search at the top right.

This is largely academic as I suspect the emulator mouse inaccuracy is going to mean that you won't have any luck with the AMX Super ROM anyway. But I might be wrong; I hope I am...
pixelblip wrote:I had a go and painting tonight as soon as I got the cursor working and the fills. It was a Eureka moment for me! So here is Yoshi's Island Part 2!
Good stuff! :-)
Attachments
mouserom-test.zip
(1.15 KiB) Downloaded 16 times

SteveF
Posts: 516
Joined: Fri Aug 28, 2015 8:34 pm
Contact:

Re: How do you save a screen

Post by SteveF » Sun Jan 08, 2017 2:36 am

pixelblip wrote:I need to try and get my brushes going now and some kind of undo......sometimes when you fill onto white and white is part of your colour it seems to stop working ( I use save sates in Beeb Em before doing some of those fills :lol: )
It's a bit of a hack, but if your program knows which of your pattern fills contain white, when using one of those it could first do a flood fill in another solid colour (say colour 8, which won't interfere with anything else on the screen), then fill over colour 8 with the desired pattern. (Remember to GCOL 0,128+8 in order to fill on top of colour 8 when doing the second fill.) I haven't tried this, but it would probably work. :-)

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Sun Jan 08, 2017 8:00 am

Morning.
Thanks to both of you for your help.
Sorry my link was wrong. I should have checked it. Doh! Apologies.

Here's the AMX Mouse manual. It's the older AMX mouse manual not the SuperArt one but the commands are the same.
https://www.manualslib.com/manual/797338/Amx-Mouse.html

I'll have a read of both your posts....thank you for explaining the commands in detail / taking the time out in our busy weekends.....

I was using Linux for a long time - it's interesting hearing your quirks in the emulators and Linux.

It's great to rediscover the BBC again 25 years later......if I'd tried programming this in another language I wouldn't have got very far. It shows you how good BBC Basic is.....

Let's see if I can sneak another piccy in today :)

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Sun Jan 08, 2017 10:38 am

Oh wow I got the Sideways Ram undo feature working. Cor! That is really good. So flood fills that spill out are no longer!

I have the filesystem saving working ( I call it that :lol: but it's a bit rich ) - but the only problem is when I save my pictures using *SAVE MIKEPIC1 FFFF3000+5000 it loads the picture ok but then it loads another bit of memory and ruins the picture.

If I try to save with *SAVE MIKEPIC1 3000+5000 it's only saving half the picture

So if someone can help me out here ( we've gone a full 360 and got back to the original topic 'How do you save a screen' :lol: :lol: ) I would be grateful. It is the last piece of this interesting puzzle!

In the meantime I will start my 'Nuclear Dump' pic. Expect to see lots more Beeb Mode 2 pictures as the year progresses!

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Sun Jan 08, 2017 10:44 am

PS Here is my program so far.
Please excuse the horrendous coding in it and the lack of indentation and care to describe what does what!. I am not familiar yet with the basic editor so this is really cobbled together to say the least.
It is probably quite shocking for programmers to see this and my hacks :lol:

You may see easier ways of me being able to code stuff ....like keypresses and stuff......more descriptive variables will help I know....I am just trying to get it done so I can get painting! It's great fun I have to say .......programming and seeing results!

The keys are 0-9 change patterns, QW AS to change colours , \zxc for coloured brush, VB for white brush, NM for black brush, P Save, U undo.....
I also wanted to press I to swap colours (sort of invert) but this isn't working and I will look at it later.

Code: Select all

   10 REM > ScrCopy
   20 REM Copy 20K screen in/out of SRAM
   30 :
   40 OSBYTE=&FFF4
   50 DIM mc% 130:src=&70:dst=&72:rom1=&74:rom2=&75
   60 FOR P=0 TO 1
   70   P%=mc%
   80   [OPT P*3
   90   \ A=0 store 1=fetch, X=bank 1, Y=bank 2
  100   .scrcopy
  110   BIT &FFFB:BMI exit
  120   STX rom1:STY rom2:CMP #1
  130   LDA #&30:BCC P%+4:LDA #&80
  140   STA src+1:EOR #&B0:STA dst+1
  150   LDA #1:JSR vram
  160   LDA &F4:PHA:LDX #&40:LDA rom1:CLC
  170   LDY #0:STY src:STY dst
  180   .lp1
  190   STA &F4:STA &FE30
  200   .lp2
  210   LDA (src),Y:STA (dst),Y:INY:BNE lp2
  220   INC src+1:INC dst+1:DEX:BNE lp2
  230   LDA src+1:BPL skip1:LDA #&80:STA src+1:.skip1
  240   LDA dst+1:BPL skip2:LDA #&80:STA dst+1:.skip2
  250   LDX #&10:ROL A:EOR #1:ROR A:LDA rom2:BCS lp1
  260   PLA:STA &F4:STA &FE30:LDA #0
  270   .vram
  280   PHA:LDA #&84:JSR OSBYTE:PLA:CPY #&80:BCC exit
  290   PHA:TAX:LDA #108:JSR OSBYTE
  300   PLA:INX:BNE exit
  310   EOR #1:TAX:LDA #111:JMP OSBYTE
  320   .exit
  330   RTS
  340   ]NEXT
  350width%=20
  360MODE 2
  370screen%=1
  380*LOAD NUCLBBC
  390ch%=6
  400c1%=1
  410c2%=1
  420c1sw%=c1%:c2sw%=c2%
  430key$="1"
  440x%=0
  450y%=0
  460recplot=&65
  470width%=10
  480REPEAT
  490mx%=FNscale_x(ADVAL(1))
  500my%=FNscale_y(ADVAL(2))
  510GCOL3,7
  520FOR I%=1 TO 2
  530MOVE mx%-50,my%:DRAW mx%+50,my%
  540MOVE mx%,my%-50:DRAW mx%,my%+50
  550NEXT
  560GCOL16,0
  570key$=INKEY$(0)
  580IF c1%>7 c1%=7
  590IF c2%>7 c2%=7
  600IF c1%<1 c1%=0
  610IF c2%<1 c2%=0
  620IF key$="I" c1%=c2sw%:c2%=c1sw%
  630IF key$="Q" c1%=c1%-1:PROCdrawblock(c1%,c2%,x%,y%,ch%)
  640IF key$="W" c1%=c1%+1:PROCdrawblock(c1%,c2%,x%,y%,ch%)
  650IF key$="A" c2%=c2%-1:PROCdrawblock(c1%,c2%,x%,y%,ch%)
  660IF key$="S" c2%=c2%+1:PROCdrawblock(c1%,c2%,x%,y%,ch%)
  670IF key$="1" ch%=1:PROCdrawblock(c1%,c2%,x%,y%,ch%)
  680IF key$="2" ch%=2:PROCdrawblock(c1%,c2%,x%,y%,ch%)
  690IF key$="3" ch%=3:PROCdrawblock(c1%,c2%,x%,y%,ch%)
  700IF key$="4" ch%=4:PROCdrawblock(c1%,c2%,x%,y%,ch%)
  710IF key$="5" ch%=5:PROCdrawblock(c1%,c2%,x%,y%,ch%)
  720IF key$="6" ch%=6:PROCdrawblock(c1%,c2%,x%,y%,ch%)
  730IF key$="7" ch%=7:PROCdrawblock(c1%,c2%,x%,y%,ch%)
  740IF key$="8" ch%=8:PROCdrawblock(c1%,c2%,x%,y%,ch%)
  750IF key$="9" ch%=9:PROCdrawblock(c1%,c2%,x%,y%,ch%)
  760IF key$="0" ch%=0:PROCdrawblock(c1%,c2%,x%,y%,ch%)
  770IF key$="V" GCOL0,7:MOVE mx%-1,my%-1:PLOT&65,mx%+1,my%+1
  780IF key$="B" GCOL0,7:MOVE mx%-4,my%-4:PLOT&65,mx%+4,my%+4
  790IF key$="N" GCOL0,0:MOVE mx%-1,my%-1:PLOT&65,mx%+1,my%+1
  800IF key$="M" GCOL0,0:MOVE mx%-4,my%-4:PLOT&65,mx%+4,my%+4
  810IF key$="\" GCOL16,0:MOVE mx%-1,my%-1:PLOT&65,mx%+1,my%+1
  820IF key$="Z" GCOL16,0:MOVE mx%-4,my%-4:PLOT&65,mx%+4,my%+4
  830IF key$="X" GCOL16,0:MOVE mx%-8,my%-8:PLOT&65,mx%+8,my%+8
  840IF key$="C" GCOL16,0:MOVE mx%-12,my%-12:PLOT&65,mx%+12,my%+12
  850IF key$="P" screen%=screen%+1:PROCsavescreen(screen%,A%,X%,Y%)
  860IF key$="U" PROCloadscreen(screen%,A%,X%,Y%)
  870IF (ADVAL(0) AND 1)<>0 THEN PROCtempsavescreen(screen%,A%,X%,Y%):GCOL 0,128+7:PLOT&85,mx%,my%
  880*FX21,0
  890UNTIL FALSE
  900END
  910DEF FNscale_x(C%)
  920C%=C%-48
  930C%=(65520-48)-C%
  940=1280*C%/(65520-48)
  950DEF FNscale_y(C%)
  960C%=C%-48
  970=1024*C%/(65520-48)
  980:
  990:
 1000ENDPROC
 1010 DEF PROCdrawblock(c1%,c2%,x%,y%,ch%)
 1020REMPRINT c1%,c2%,x%,y%,ch%
 1030 IF c1%>7 c1%=7
 1040 IF c2%>7 c2%=7
 1050  IF c1%<1 c1%=0
 1060  IF c2%<1 c2%=0
 1070 IF ch%=1 VDU 23,12,c1%,c1%,c1%,c1%,c1%,c1%,c1%,c2%
 1080 IF ch%=2 VDU 23,12,c1%,c1%,c1%,c1%,c1%,c1%,c2%,c2%
 1090 IF ch%=3 VDU 23,12,c1%,c1%,c1%,c1%,c1%,c2%,c2%,c2%
 1100 IF ch%=4 VDU 23,12,c1%,c1%,c1%,c1%,c2%,c2%,c2%,c2%
 1110 IF ch%=5 VDU 23,12,c1%,c1%,c1%,c2%,c2%,c2%,c2%,c2%
 1120 IF ch%=6 VDU 23,12,c1%,c1%,c2%,c2%,c2%,c2%,c2%,c2%
 1130 IF ch%=7 VDU 23,12,c1%,c2%,c2%,c2%,c2%,c2%,c2%,c2%
 1140 IF ch%=8 VDU 23,12,c2%,c2%,c2%,c2%,c2%,c2%,c2%,c2%
 1150 IF ch%=9 VDU 23,12,c1%,c2%,c2%,c1%,c1%,c2%,c2%,c1%
 1160 IF ch%=0 VDU 23,12,c1%,c2%,c1%,c2%,c2%,c1%,c2%,c1%
 1170 GCOL 16,0
 1180 MOVE x%,y%
 1190 PLOT recplot,x%+1280,y%+width%
 1200 MOVE x%,y%
 1210 PLOT recplot,x%+width%,y%+1024
 1220 MOVE x%,1024-width%
 1230 PLOT recplot,x%+1280,1024
 1240 MOVE 1280-width%,1024
 1250 PLOT recplot,1280,0
 1260 GCOL 16,0
 1270 MOVE x%,y%
 1280 DRAW x%+width%,y%+width%
 1290 DRAW x%,y%+width%
 1300 DRAW x%,y%
 1310 ENDPROC
 1320:
 1330 DEF PROCloadtempscreen
 1340*LOAD TEMP
 1350 ENDPROC
 1360:
 1370 DEF PROCtempsavescreen(screen%,A%,X%,Y%)
 1380 A%=0:X%=4:Y%=5:CALL scrcopy
 1390 ENDPROC
 1400:
 1410 DEF PROCsavescreen(screen%,A%,X%,Y%)
 1420 OSCLI "SAVE nuc"+STR$screen%+" 3000 5000"
 1430A%=0:X%=4:Y%=5:CALL scrcopy
 1440 ENDPROC
 1450:
 1460 DEF PROCloadscreen(screen%,A%,X%,Y%)
 1470IFscreen%<1 screen%=1
 1480 A%=1:X%=4:Y%=5:CALL scrcopy
 1490 ENDPROC
 1500:
Last edited by sydney on Sun Jan 08, 2017 12:27 pm, edited 1 time in total.
Reason: Move code into code block in order to tidy it up a bit

User avatar
tricky
Posts: 3772
Joined: Tue Jun 21, 2011 8:25 am
Contact:

Re: How do you save a screen

Post by tricky » Sun Jan 08, 2017 11:35 am

It doesn't look like your save is saving everything:

1420 OSCLI "SAVE nuc"+STR$screen%+" 3000 5000"

IIRC saves &3000..&4FFF (first 40% of the screen)

1420 OSCLI "SAVE nuc"+STR$screen%+" 3000 +5000"

would save &3000..&7FFF (the whole screen)

EDIT: try *INFO *.* to see how big each file is, they should look like $.nuc1 load run size sector, I think your size will be 002000 instead of 005000.

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Sun Jan 08, 2017 11:57 am

Ahhh thank you that worked .....a simple + . Super!

You have all been a great help.......

Let's see if I can get my pic done today. It's nice to do some painting !

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Sun Jan 08, 2017 12:09 pm

Ok here we go! :wink:
Attachments
Nuc1.jpg

User avatar
leenew
Posts: 3979
Joined: Wed Jul 04, 2012 3:27 pm
Location: Doncaster, Yorkshire
Contact:

Re: How do you save a screen

Post by leenew » Sun Jan 08, 2017 1:55 pm

I really like these pictures :D

Nothing more to say.

Lee.

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Sun Jan 08, 2017 2:31 pm

Thank you Lee. :)

I am going to give the Apple IIe , C64 ,CPC and Speccy a right run for their money in the graphics department this year I hope!

The Nuclear Wastedump pic is comin' is slowly comin' on!
Attachments
Nuc2.jpg

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Sun Jan 08, 2017 2:47 pm

In some ways having to use the keyboard to pick colours and brushes is good /fast as it forces you to use shortcuts ( a lost art that )......

I wouldn't mind later on being able to press R and it load up all the reds in a palette on the screen............so I can pick one......cycling through the colours is a bit time consuming at the moment ( and a bit laggy )......

Also it would be nice to be able to load and save pics from a menu.......but for now it's enough to get going....

I reckon there's so much untapped stuff with these old computers.......limitations are better............

I've even started thinking now hmmmmm could I produce some sound/ambient music using algorithms in the BBC itself to go with the piccies......hmmmmm ....that is food for thought as well! :wink:

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Sun Jan 08, 2017 9:34 pm

Tangerine Dream in my headphones is definitely helping this one along! Night !
Attachments
Mandala.jpg

User avatar
paulv
Posts: 3854
Joined: Tue Jan 25, 2011 6:37 pm
Location: Leicestershire
Contact:

Re: How do you save a screen

Post by paulv » Mon Jan 09, 2017 11:02 pm

I remember, the first time the penny dropped for me regarding how to actually save a screen to tape when I was 12 years old. I was actually asleep and it seems my brain was working the problem whilst asleep because I woke up with a start and "just understood" the memory map on the Beeb all of a sudden where I hadn't really got my head around it before.

This was one of my first programming epiphanies where the reward of working it out gave me such a buzz. Coincidentally, it was for an art package I wrote in BASIC from scratch that was inspired by Deluxe Paint on the Amiga and it supported dithered brushes so I could paint in a whole swathe of colour combinations to expand the Beeb's pallete somewhat.

Paul

User avatar
FourthStone
Posts: 816
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: How do you save a screen

Post by FourthStone » Tue Jan 10, 2017 1:34 am

Liking the style and vibrant colour you're achieving =D>
In some ways having to use the keyboard to pick colours and brushes is good /fast as it forces you to use shortcuts ( a lost art that )......

I wouldn't mind later on being able to press R and it load up all the reds in a palette on the screen............so I can pick one......cycling through the colours is a bit time consuming at the moment ( and a bit laggy )......

Also it would be nice to be able to load and save pics from a menu..
Thinking of ways this could be done with a small letter box menu system but may be stepping out of your comfort zone by having to introduce more assembler to make it fast enough, although you already have a code block there so adding to it wouldn't be too much of a problem (if someone will write it :D ).

A small portion of the screen would need to be saved to memory and then the menu drawn over it, once a menu option is selected the menu can be replaced with the saved portion from memory. Hotkeys could be used to activate each type of menu like colour, texture, save etc. and then use the mouse to select an option. The menu could have buttons to scroll to the next menu using the mouse or a hotkey, this way multiple options could be selected such as 'Color Red', 'Texture 2', 'Floodfill on click' for example.

I might mock something up and see if I can get a basic system working, if you like it maybe we could take it further.

Keep up the excellent drawing :-)
Nuc2_menu.png
Nuc2_menu.png (342.99 KiB) Viewed 1248 times
Image
Picture link added so it shows in post - Mark. Edited by 1024MAK 2017-01-14 21:03

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Tue Jan 10, 2017 6:16 am

Ahh great ........it would be good to see a menu in there.........and maybe I get to learn some assembler on the way..........

It's funny Paul mentioned Deluxe Paint ........that is close to my heart............it would be good to see a Beeb version of this somehow! The menu structure was very good in that indeed........I suppose AMX SuperArt was a lot like that .......it would be good to see SuperArt in Mode 2 so maybe we can get there doing something similar ......it would be nice to see your program PaulV but like many things back then I doubt it's around any more.......I did some very good mode1 pics back then - all faded into digital dust

User avatar
paulv
Posts: 3854
Joined: Tue Jan 25, 2011 6:37 pm
Location: Leicestershire
Contact:

Re: How do you save a screen

Post by paulv » Tue Jan 10, 2017 9:06 am

My art program is around, I still have it but it's on a CF card connected to a Datacentre inside a Beeb inside a Really Useful box, in storage...

We're getting closer to completing the house renovations now, the bathroom is in progress, we just have one bedroom and the landing, stairwell and lounge to go. We're thinking we'll be done by May (ish) at which point, I'll finally be able to look at getting my stuff out of storage and tinkering with my kit again. It's been almost two years of torture but the end is in sight...

Paul

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Tue Jan 10, 2017 1:14 pm

That is great Paul to hear it is still around. Well done! I wish I'd kept my stuff from years ago. Music 5000 tunes and AMX SuperArt Pics.
Well.... I have something to look forward to in May. I am very curious indeed.
Mike

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Tue Jan 10, 2017 8:55 pm

Started my homage to the great Deluxe Paint................
Sorry this is getting off topic from a programming thread now :lol:
I'll post some more programming at the weekend to make up!
Attachments
Tut.jpg

User avatar
FourthStone
Posts: 816
Joined: Thu Nov 17, 2016 2:29 am
Location: Brisbane, Australia
Contact:

Re: How do you save a screen

Post by FourthStone » Wed Jan 11, 2017 4:28 am

Nice Pharaoh!

Here's a little mock up of the (very small) menu, it's very early stages and doesn't select anything as yet, use 'T' to activate and hide. The idea is to use the left and right arrows and hotkeys to cycle through various menus so don't let the initial small size fool you, a lot could be squeezed into that tiny letterbox view :D

I had to shuffle things around a little and kept running out of memory so I've made a few changes that I thought might help like turning the cursor off and removing some redundant vars etc.. If you have Beyond Compare or similar you can compare the changes I've made. e.g. I took out the *LOAD near the top as I didn't have the NUCLBBC picture saved. After looking at the code for a long while I still couldn't work out how to paint anything at all :oops: !

I think if you wanted to use the menu system we need to consider rewriting parts of the program or using assembly as the program is already taking up a large part of available ram. e.g. The menu could be made bigger but it would require more ram, therefore would need to optimize other parts of the program... all possible and possibly fun.

Another thing I noticed was the the laggy keys is caused by the keyboard buffer getting cleared every loop, I've changed this to make the key repeat rate slower which hopefully will avoid multiple tool selects. Try it out and let me know.

Anyway, have a play and let me know what you think, nothing like a good side distraction to keep me from my own coding :wink: Plus playing with basic again and making things fit in ram is sadistically fun :twisted:

Code: Select all

   10 OSBYTE=&FFF4
   20 DIM mc% 180:src=&70:dst=&72:rom1=&74:rom2=&75:mon=&76
   30 DIM menu% 256
   40 FOR P=0 TO 1
   50   P%=mc%
   60   [OPT P*3
   70   \ A=0 store 1=fetch, X=bank 1, Y=bank 2
   80   .scrcopy
   90   BIT &FFFB:BMI exit
  100   STX rom1:STY rom2:CMP #1
  110   LDA #&30:BCC P%+4:LDA #&80
  120   STA src+1:EOR #&B0:STA dst+1
  130   LDA #1:JSR vram
  140   LDA &F4:PHA:LDX #&40:LDA rom1:CLC
  150   LDY #0:STY src:STY dst
  160   .lp1
  170   STA &F4:STA &FE30
  180   .lp2
  190   LDA (src),Y:STA (dst),Y:INY:BNE lp2
  200   INC src+1:INC dst+1:DEX:BNE lp2
  210   LDA src+1:BPL skip1:LDA #&80:STA src+1:.skip1
  220   LDA dst+1:BPL skip2:LDA #&80:STA dst+1:.skip2
  230   LDX #&10:ROL A:EOR #1:ROR A:LDA rom2:BCS lp1
  240   PLA:STA &F4:STA &FE30:LDA #0
  250   .vram
  260   PHA:LDA #&84:JSR OSBYTE:PLA:CPY #&80:BCC exit
  270   PHA:TAX:LDA #108:JSR OSBYTE
  280   PLA:INX:BNE exit
  290   EOR #1:TAX:LDA #111:JMP OSBYTE
  300   .exit
  310   RTS
  320   .showmenu
  330   LDY#0: LDA mon: BNE hidemenu: LDX#63
  340   .store
  350   LDA &3000,Y: STA menu%,Y: TXA: STA &3000,Y
  360   DEY: BNE store: LDA #1: STA mon
  370   RTS
  380   .hidemenu
  390   STY mon
  400   .retrieve
  410   LDA menu%,Y: STA &3000,Y: DEY: BNE retrieve
  420   RTS
  430   ]NEXT
  440MODE 2
  450VDU23;10,32;0;0;0;
  460screen%=1
  470ch%=6
  480c1%=1
  490c2%=1
  500c1sw%=c1%:c2sw%=c2%
  510x%=0
  520y%=0
  530?mon=0
  540*FX12,32
  550ox%=-1:oy%=0: crh%=50
  560REPEAT
  570PROCcursor(0)
  580GCOL 16,0
  590key$=INKEY$(0)
  600IF c1%>7 c1%=7
  610IF c2%>7 c2%=7
  620IF c1%<1 c1%=0
  630IF c2%<1 c2%=0
  640IF key$="T" PROCmenu
  650IF key$="I" c1%=c2sw%:c2%=c1sw%
  660IF key$="Q" c1%=c1%-1:PROCdrawblock
  670IF key$="W" c1%=c1%+1:PROCdrawblock
  680IF key$="A" c2%=c2%-1:PROCdrawblock
  690IF key$="S" c2%=c2%+1:PROCdrawblock
  700IF key$="1" ch%=1:PROCdrawblock
  710IF key$="2" ch%=2:PROCdrawblock
  720IF key$="3" ch%=3:PROCdrawblock
  730IF key$="4" ch%=4:PROCdrawblock
  740IF key$="5" ch%=5:PROCdrawblock
  750IF key$="6" ch%=6:PROCdrawblock
  760IF key$="7" ch%=7:PROCdrawblock
  770IF key$="8" ch%=8:PROCdrawblock
  780IF key$="9" ch%=9:PROCdrawblock
  790IF key$="0" ch%=0:PROCdrawblock
  800IF key$="V" GCOL0,7:MOVE mx%-1,my%-1:PLOT&65,mx%+1,my%+1
  810IF key$="B" GCOL0,7:MOVE mx%-4,my%-4:PLOT&65,mx%+4,my%+4
  820IF key$="N" GCOL0,0:MOVE mx%-1,my%-1:PLOT&65,mx%+1,my%+1
  830IF key$="M" GCOL0,0:MOVE mx%-4,my%-4:PLOT&65,mx%+4,my%+4
  840IF key$="\" GCOL16,0:MOVE mx%-1,my%-1:PLOT&65,mx%+1,my%+1
  850IF key$="Z" GCOL16,0:MOVE mx%-4,my%-4:PLOT&65,mx%+4,my%+4
  860IF key$="X" GCOL16,0:MOVE mx%-8,my%-8:PLOT&65,mx%+8,my%+8
  870IF key$="C" GCOL16,0:MOVE mx%-12,my%-12:PLOT&65,mx%+12,my%+12
  880IF key$="P" screen%=screen%+1:PROCsavescreen
  890IF key$="U" PROCloadscreen
  900IF (ADVAL(0) AND 1)<>0 THEN PROCtempsavescreen:GCOL 0,128+7:PLOT&85,mx%,my%
  910UNTIL FALSE
  920END
  930DEF FNscale_x(C%)
  940C%=C%-48
  950C%=65472-C%
  960=1280*C%/65472
  970DEF FNscale_y(C%)
  980C%=C%-48
  990=1024*C%/65472
 1000 DEF PROCdrawblock
 1010 IF c1%>7 c1%=7
 1020 IF c2%>7 c2%=7
 1030  IF c1%<1 c1%=0
 1040  IF c2%<1 c2%=0
 1050 IF ch%=1 VDU 23,12,c1%,c1%,c1%,c1%,c1%,c1%,c1%,c2%
 1060 IF ch%=2 VDU 23,12,c1%,c1%,c1%,c1%,c1%,c1%,c2%,c2%
 1070 IF ch%=3 VDU 23,12,c1%,c1%,c1%,c1%,c1%,c2%,c2%,c2%
 1080 IF ch%=4 VDU 23,12,c1%,c1%,c1%,c1%,c2%,c2%,c2%,c2%
 1090 IF ch%=5 VDU 23,12,c1%,c1%,c1%,c2%,c2%,c2%,c2%,c2%
 1100 IF ch%=6 VDU 23,12,c1%,c1%,c2%,c2%,c2%,c2%,c2%,c2%
 1110 IF ch%=7 VDU 23,12,c1%,c2%,c2%,c2%,c2%,c2%,c2%,c2%
 1120 IF ch%=8 VDU 23,12,c2%,c2%,c2%,c2%,c2%,c2%,c2%,c2%
 1130 IF ch%=9 VDU 23,12,c1%,c2%,c2%,c1%,c1%,c2%,c2%,c1%
 1140 IF ch%=0 VDU 23,12,c1%,c2%,c1%,c2%,c2%,c1%,c2%,c1%
 1150 GCOL 16,0
 1160 MOVE x%,y%
 1170 PLOT &65,x%+1280,y%+10
 1180 MOVE x%,y%
 1190 PLOT &65,x%+10,y%+1024
 1200 MOVE x%,1024-10
 1210 PLOT &65,x%+1280,1024
 1220 MOVE 1280-10,1024
 1230 PLOT &65,1280,0
 1240 GCOL 16,0
 1250 MOVE x%,y%
 1260 DRAW x%+10,y%+10
 1270 DRAW x%,y%+10
 1280 DRAW x%,y%
 1290 ENDPROC
 1300 DEF PROCloadtempscreen
 1310 PROCresetcursor
 1320*LOAD TEMP
 1330 ENDPROC
 1340 DEF PROCtempsavescreen
 1350 PROCresetcursor
 1360 A%=0:X%=4:Y%=5:CALL scrcopy
 1370 ENDPROC
 1380 DEF PROCsavescreen
 1390 PROCresetcursor
 1400 OSCLI "SAVE nuc"+STR$screen%+" 3000 5000"
 1410A%=0:X%=4:Y%=5:CALL scrcopy
 1420 ENDPROC
 1430 DEF PROCloadscreen
 1440IFscreen%<1 screen%=1
 1450 PROCresetcursor
 1460 A%=1:X%=4:Y%=5:CALL scrcopy
 1470 ENDPROC
 1480 DEF PROCmenu
 1490 PROCresetcursor
 1500 CALL showmenu
 1510 FOR P=0 TO 7
 1520 GCOL0,P: MOVE P*48+8,1019:DRAW P*48+8,999:DRAW P*48+39,999:DRAW P*48+39,1019:DRAW P*48+8,1019
 1530 NEXT
 1540 GCOL 0,0
 1550 MOVE 439,1019:DRAW 399,1011:MOVE 399,1007:DRAW 439,999
 1560 MOVE 463,1019:DRAW 503,1011:MOVE 503,1007:DRAW 463,999
 1570 REPEAT
 1580 PROCcursor(1)
 1590 key$=INKEY$(0)
 1600 IF (ADVAL(0) AND 1)<>0 PRINT TAB(0,2)"B1 - POS:";mx% DIV 48;" "
 1610 UNTIL key$="T"
 1620 PROCresetcursor
 1630 CALL showmenu
 1640 ENDPROC
 1650 DEF PROCcursor(Z%)
 1660 mx%=FNscale_x(ADVAL(1))
 1670 my%=FNscale_y(ADVAL(2))
 1680 IF Z%=0 GOTO 1710
 1690 IF mx%>511 mx%=511
 1700 IF my%<995 my%=995
 1710 IF ox%=mx% AND oy%=my% GOTO 1750
 1720 IF ox%=-1 GOTO 1740
 1730 PROCdrawcross(ox%,oy%)
 1740 PROCdrawcross(mx%,my%)
 1750 ox%=mx%: oy%=my%
 1760 ENDPROC
 1770 DEF PROCdrawcross(L%,M%)
 1780 GCOL3,7
 1790 MOVE L%-crh%,M%:DRAW L%+crh%,M%
 1800 MOVE L%,M%-crh%:DRAW L%,M%+crh%
 1810 ENDPROC
 1820 DEF PROCresetcursor
 1830 PROCdrawcross(mx%,my%)
 1840 ox%=-1
 1850 ENDPROC

User avatar
pixelblip
Posts: 1392
Joined: Wed Feb 04, 2015 7:19 pm
Location: London
Contact:

Re: How do you save a screen

Post by pixelblip » Wed Jan 11, 2017 6:06 am

Ahh that is great! Yeh just what is needed. Well done! =D>
Thank you for clearing the keyboard buffer as well - that has proved a real problem.
The keys to this program are 0-9 to select a shade .....\zxc to paint in different brush sizes, vb are white brushes / nm are black brushes and p to save to disc ( and increment file name) - U to undo.

Sorry I know the code is really awful!
I'll list the variables and what they do a bit later....that is good of you thank you it's really interesting and will be to learn a bit of code as well!

Post Reply