About light pen..

The Oric video chip is not an easy beast to master, so any trick or method that allows to achieve nice visual results is welcome. Don't hesitate to comment (nicely) other people tricks and pictures :)
Post Reply
User avatar
peacer
Flight Lieutenant
Posts: 350
Joined: Wed Jun 09, 2010 9:23 pm
Location: Turkey
Contact:

About light pen..

Post by peacer » Thu Jul 25, 2013 12:22 pm

I searched through the net but can not find much knowledge about lightpen usage and programming under emulator.

I examine rush hour game code and a few web page including oriculator web page.

Only information I got is, when light pen ise emulated , X coordinate of pen is located in PEEK(#3E0) and Y coordinate is in PEEK(#3E1)

What I plan to do is to build a program to edit pictures using light pen under emulator.

I believe, writing a PC program to load oric graphics , edit, and save is much harder than writing a oric-based utility. Under Oric, I can manage screen memory, colors and attributes. Creating subrouines to draw circle, ellipse, box etc and painting is just a matter of basic.

There are some obstacles :
- Is there a memory location which shows lightpen (mouseclick) is up and down state other than X and Y coordinates? It seems that only when left mouse button is clicked x and y coordinates are updated.
- When paper is selected as black (0) it does not detect the localisation of lightpen coordinates. Is there a solution for detection of lightpen when background is black.

So, do you have any more information about lightpen programming? Do we have any other tool other than peeking X and Y coordinates when the "pen" is clicked?

I have created a simple drawing program to show possibilities.

Please set lightpen on in hardware options of emulator before running the program.

During the program :
- Press 1 if you want to draw on the screen
- press 2 if you want to stop drawing
- Press 3 if you want to erase the cursor position
Attachments
LIGHTPENPAINT.tap
(649 Bytes) Downloaded 393 times

User avatar
Symoon
Archivist
Posts: 1160
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Re: About light pen..

Post by Symoon » Thu Jul 25, 2013 8:02 pm

peacer wrote:I searched through the net but can not find much knowledge about lightpen usage and programming under emulator.
Ah, had some docs on my dead website. Here they are zipped.
Beware that my own programming was far from good, try understanding Fabrice's work instead of mine ;-)
If you want to check my own bad programming, see "Ex-Sip" on Oric.org. I think with Rush Hour, these were (until yours, and one little test I never released) the only 2 programs using the light pen.
peacer wrote:- Is there a memory location which shows lightpen (mouseclick) is up and down state other than X and Y coordinates? It seems that only when left mouse button is clicked x and y coordinates are updated.
The mouse clic on the emulator means "I put the lightpen on screen", nothing more.
The way the lightpen works: when it detects light (being put on light colors on screen), it updates coordinates. To detect a "click", you have to check if one of the coordinates have changed from their previous position. IIRC, you can't detect another "click" at the exact same position as the coordinates don't change, and you can't POKE 0 in #3E0 or #3E1 to re-initialize.
All this is from memory, double-check how Fabrice did, he's smarter than me ;-)
peacer wrote:- When paper is selected as black (0) it does not detect the localisation of lightpen coordinates. Is there a solution for detection of lightpen when background is black.
No, and reality is even worse : on a real Oric, red color is almost not detected either!
The lightpen actually reacts when there is... Light. So if you point on some dark areas (black, red, IIRC dark blue worked more or less), coordinates are not updated.
The emulator is a bit "cooler" than reality and lets you detect red.

And, even worse: I don't think the light pen will work with LCD screens.

I used to see lots of interesting potential with the light pen, but modern technologies seem to drive it right to the trash (unless you don't care about your program working with "real" machine's limitations)
Attachments
Symoon_lightpen_docs.zip
(25.68 KiB) Downloaded 384 times

User avatar
peacer
Flight Lieutenant
Posts: 350
Joined: Wed Jun 09, 2010 9:23 pm
Location: Turkey
Contact:

Re: About light pen..

Post by peacer » Thu Jul 25, 2013 9:29 pm

Simon, that's my mistake not to tell that I checked your program "ex-sip" too. As my french is not better than my Japan (!) I just clicked on the screen randomly to see what happens :)

I also came accross a usenet topic on comp.sys.oric where you talked about it with jonathan but the files you mentioned was lost from your site. I really appreciate now , thank you very much.

These are really helpful. As my aim is only to create emulator-only program to edit graphics transferred from PC, disadvantages of real light pen can be omitted as I will probably never see a real light pen :)

Now I have another question : As far as I know, telestrat has mouse support. Is there any documentation about that? Can we use pc mouse on telestrat booted emulator?

I tried to boot oriculator in telestrat mode. I insert startsed disk supplied in oric.free.fr for telestrat but something weird happens . Emulator starts and loads the disk image but after choosing hyper-basic or tele-ass, screen scrolls up continuously as if I am pressing the enter key. I am using windows 8. Maybe its related to oriculator. I can't run euphoric anymore as my system is 64 bit windows. Can you boot telestrat on Oriculator normally?

User avatar
Symoon
Archivist
Posts: 1160
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Re: About light pen..

Post by Symoon » Thu Jul 25, 2013 10:38 pm

No idea about Telestrat, I have never used it much, an expert will have to answer you ;)

User avatar
peacer
Flight Lieutenant
Posts: 350
Joined: Wed Jun 09, 2010 9:23 pm
Location: Turkey
Contact:

Re: About light pen..

Post by peacer » Fri Jul 26, 2013 1:01 am

Hope so :D

User avatar
Xeron
Emulation expert
Posts: 382
Joined: Sat Mar 07, 2009 5:18 pm
Contact:

Re: About light pen..

Post by Xeron » Fri Jul 26, 2013 7:45 am

Telestrat emulation in Oricutron is not finished and doesn't really work. I was hoping that someone with better telestrat knowledge would be able to help fix it, but nobody has.

User avatar
peacer
Flight Lieutenant
Posts: 350
Joined: Wed Jun 09, 2010 9:23 pm
Location: Turkey
Contact:

Re: About light pen..

Post by peacer » Fri Jul 26, 2013 8:05 am

Hmm.. thank you very much for the information.

Does pravetz emulation have problems too? When I choose pravetz, oricutron closes itself.

User avatar
Xeron
Emulation expert
Posts: 382
Joined: Sat Mar 07, 2009 5:18 pm
Contact:

Re: About light pen..

Post by Xeron » Fri Jul 26, 2013 9:38 am

If you are using the latest SVN revision (494) Pravetz emulation is pretty good, but you may have a missing ROM file. Both pravetz.rom and 8dos.rom are required, but 8dos.rom wasn't included in the 0.9 release because 0.9 didn't support Pravetz disk drive. Just copy "8dos.rom" into the roms folder.

User avatar
peacer
Flight Lieutenant
Posts: 350
Joined: Wed Jun 09, 2010 9:23 pm
Location: Turkey
Contact:

Re: About light pen..

Post by peacer » Fri Jul 26, 2013 1:10 pm

Yes, those files were missing.

I found pravetzt.rom from oricutron for macos 7.0 archive but 8dos.rom is still missing. It does boot for pravetz though without 8dos.com rom anyway. Thanks.

User avatar
Xeron
Emulation expert
Posts: 382
Joined: Sat Mar 07, 2009 5:18 pm
Contact:

Re: About light pen..

Post by Xeron » Fri Jul 26, 2013 1:29 pm

There will be a new release of Oricutron pretty soon. I just need to make some changes to the Pravetz disk emulation, and add support for Pravetz disks in the snapshot format.

User avatar
iss
Flight Lieutenant
Posts: 491
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: About light pen..

Post by iss » Fri Jul 26, 2013 2:14 pm

@peacer, attached are ROM files you need.
IMHO it's better to use Atmos emulation - I think you are more familiar with Atmos than with Pravetz
and Pravetz is just the same as Atmos, but with Cyrillic and exotic disk drive system.

P.S.
I just checked in Oricutron with Pravetz emulation (svn ver.494) and

10 PRINT PEEK(992);" ";PEEK(993)
20 GOTO 10

seams to work as expected when mouse is pressed in emulator window.

I tested LIGHTPENPAINT.tap too and it works and is very fun!
This the first time I use light pen with Oric (after so many years!) Thanks!
Attachments
pravetzt.rom.zip
pravetzt rom file
(12.62 KiB) Downloaded 353 times
8dos.rom.zip
8dos rom file
(508 Bytes) Downloaded 357 times

User avatar
peacer
Flight Lieutenant
Posts: 350
Joined: Wed Jun 09, 2010 9:23 pm
Location: Turkey
Contact:

Re: About light pen..

Post by peacer » Fri Jul 26, 2013 4:18 pm

Thank you very much for the roms :)

What does it say instead of ready. Is it bulgarian word for "ready"?

Its just the curiosity how pravetz looks like. Atmos emulation is surely the one to prefer.

Happy to hear you like it. I am improving lightpenpaint. Soon I am planning to give better version including :
- Mouse cursor according to selected tool ( Pen, draw, eraser etc.)
- Cırcle, ellipse, box, qadrangle, text tools
- Fast machine code paint routine that I found from here : http://www.doperoms.com/roms/oric/Paint ... ow%20.html
- Color fill an area
- Paint and ink attribute changes before selected pixel areas
- Copying an area and paste to another
- Zooming part of the screen to edit fine details
- Loading and saving the screen to and from the disc.
- etc. etc.

I've added a little advanced version of penpaint. There's a problem when "cursor" changes it leaves pixels behind but I am working on it. It has paint function too now :)


Lightpen emulation is very helpful for creating such utilities. Character generators and sprite editors can be created too.
Attachments
penpaint.dsk
(1 MiB) Downloaded 362 times

User avatar
Symoon
Archivist
Posts: 1160
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Re: About light pen..

Post by Symoon » Sun Aug 18, 2013 10:14 pm

Symoon wrote:If you want to check my own bad programming, see "Ex-Sip" on Oric.org. I think with Rush Hour, these were (until yours, and one little test I never released) the only 2 programs using the light pen.
I was wrong: Twilighte also made a quick test he sent to Dbug and me in 2006, called Otracker. Just a kind of utility main screen and when clicking on menu items, it made them flash (nothing else, it wasn't a real utility).

User avatar
Symoon
Archivist
Posts: 1160
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Re: About light pen..

Post by Symoon » Sun Aug 25, 2013 2:05 pm

BTW, we almost already had the same discussion (about lightpen / mouse, along with Fabrice Frances) in 1999 (published in CEO-Mag #111).
Are we getting older? :wink:
I guess it was on the mailing-list, or on comp.sys.oric.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests