PETSCII drawing program

Basic and Machine Language

Moderator: Moderators

Post Reply
adric22
Vic 20 Hobbyist
Posts: 143
Joined: Fri Mar 11, 2005 6:54 pm

PETSCII drawing program

Post by adric22 »

How many of you used to sit around on your VIC-20 and C64 and draw things using the built-in screen editor? I know I did. I also know there were some programs available for drawing and saving such graphics for intent of use with BBS. However, at the moment I can't find one and I'm not sure those ever existed for the VIC-20.

So my intent is to create one. One feature I really wanted that wasn't available before is the ability to select a PETSCII character easily without having a real Commodore keyboard. I'm sure many of you have noticed how difficult it can be to find the right character when using an emulator. So I designed a screen where you can see the characters and pick them manually.

I'm designing it first for the C64 but I see no reason why it shouldn't port easily to the VIC-20. Just a matter of changing screen locations and various size constants.

One thing that has proven to be very complicated is designing a "pixel edit" mode.. really not using pixels, just using PETSCII characters to simulate a 80x50 dot matrix (on the VIC it would be 44x46) I've spent the last week trying to figure out exactly how to do it.. So far my best guess is to take each character cell and treat it like a 4-bit number and map each bit combination to a specific PETSCII character. That way I can turn on or off a specific "pixel" using AND and OR functions.. I'm writing in BASIC right now just as a test, but once I've figured out exactly how it should all work, I might re-do it in ML.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

It reminds me about a C64 program in Your Computer that adds commands (well, SYS statements rather but it is only a matter of overhead to add a parser) to plot 1/4 characters, i.e. a resolution of 80x50. It includes commands to plot, remove or test for dots, as well as giving them a colour within the limits of colour clash.

I don't know if these routines would be useful to anyone. If you like, I could dig them up and perhaps even convert to VIC-20. I think it would be a piece of cake once doing it.
Anders Carlsson

Image Image Image Image Image
adric22
Vic 20 Hobbyist
Posts: 143
Joined: Fri Mar 11, 2005 6:54 pm

Post by adric22 »

carlsson wrote: I don't know if these routines would be useful to anyone. If you like, I could dig them up and perhaps even convert to VIC-20. I think it would be a piece of cake once doing it.
That would be great, but the source code would be even better!
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

That is what recomment is for. :)
Anders Carlsson

Image Image Image Image Image
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

adric22 wrote:[...] One thing that has proven to be very complicated is designing a "pixel edit" mode.. really not using pixels, just using PETSCII characters to simulate a 80x50 dot matrix (on the VIC it would be 44x46) [...]
You might try this program to double the horizontal resolution. Type 'POKE 44,26:POKE6656,0:NEW' beforehand (>= +8K RAM expansion recommended):

Code: Select all

10 DIM B(15)
11 FOR A=0 TO 15:READ B(A):NEXT
12 AD=4096
13 FOR X=0 TO 15
14 FOR Y=0 TO 15
15 FOR Z=0 TO 3
16 POKE AD+8*(16*Y+X)+Z,B(X)
17 POKE AD+8*(16*Y+X)+4+Z,B(Y)
18 NEXT
19 NEXT
20 NEXT
21 POKE648,24:SYS58651:POKE36869,236
22 DATA 0,3,12,15,48,51,60,63,192,195,204,207,240,243,252,255
adric22
Vic 20 Hobbyist
Posts: 143
Joined: Fri Mar 11, 2005 6:54 pm

Post by adric22 »

What is that program supposed to do? I typed it in and it just displays garbage on my screen. Actually, the first time I typed it in, it erased itself because I didn't see those instructions you gave above the program.. and I have no idea what any of it does.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

adric22 wrote:What is that program supposed to do?
The program defines a new char-set, dividing the characters into 4x2 (i.e., eight) pieces. All 2^8=256 characters are used for this.
it just displays garbage on my screen
...
and I have no idea what any of it does
:? ...

Michael
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

I think Adric forgot the initial POKE to move start of Basic, which caused the program to overwrite itself with graphic data?
Anders Carlsson

Image Image Image Image Image
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

This looks like Adric tried it at least twice:
adric22 wrote:Actually, the first time I typed it in, it erased itself because I didn't see those instructions you gave above the program...
Still, the move to user defined characters is one of the first things a VIC user can do to advance beyond the limits of the standard PETSCII display.

Doodling displays is really a thing I gave up almost immediately. There are seldom more frustrating things than a work which is wiped out by CLR, or power-off, and cannot be saved - if you don't incorporate your ideas into PRINT statements.

Michael
adric22
Vic 20 Hobbyist
Posts: 143
Joined: Fri Mar 11, 2005 6:54 pm

Post by adric22 »

Mike wrote: Doodling displays is really a thing I gave up almost immediately. There are seldom more frustrating things than a work which is wiped out by CLR, or power-off, and cannot be saved - if you don't incorporate your ideas into PRINT statements.
Another benefit of this program I'm writing.. It will be able to save the screens.
Post Reply