MINIGRAFIK batch processing suite

Basic and Machine Language

Moderator: Moderators

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

Post by Mike »

Here's another small utility which allows to prepend a MG picture as intro or splash screen to a BASIC program, which itself would not use MINIGRAFIK (contained in the *.d64 of the MG batch suite):

Code: Select all

1 INPUT"SOURCE PRG";S$:INPUT"MG PICTURE";P$:INPUT"TARGET PRG";T$:OPEN2,8,2,P$+",P,R"
2 OPEN3,8,3,T$+",P,W":GET#2,A$,A$:PRINT#3,CHR$(1)CHR$(18);:FORT=1TO4086:GET#2,A$
3 PRINT#3,LEFT$(A$+CHR$(0),1);:NEXT:CLOSE2:OPEN2,8,2,S$+",P,R":GET#2,A$,A$:FORT=1TO30
4 READA:PRINT#3,CHR$(A);:NEXT:FORP=-1TO0:GET#2,A$:P=ST=0:PRINT#3,LEFT$(A$+CHR$(0),1);
5 NEXT:CLOSE2:CLOSE3:DATA76,0,34,2,254,254,235,0,12,32,24,229,169,21,133,43,169,34,133
6 DATA44,32,51,197,32,89,198,76,174,199,0
You specify the source program, the name of the MG picture to prepend, and the name of the target. The combine procedure of the two files then takes a few minutes. I didn't really bother to make this a ML program. :P

When you LIST the result, you'll see a SYS statement. The picture is displayed, and after a key press, the screen display is returned to normal and your program is started.

Such a combined program needs at least a +8K expansion, and when the program is run, the screen start address also corresponds to +8K or more, i.e. screen at 4096, colour RAM at 37888. The BASIC program is now located at $2215, and the remaining range from $1200 to $2213 is free for other uses, for example to store UDGs (up to $1FFF) or ML code parts. If you want to use a program for the unexpanded VIC-20, add these commands at the very beginning of your program:

Code: Select all

POKE648,30:SYS58648
... which will move the screen start address to 7680 and colour RAM to 38400. Furthermore, if the program/game uses UDGs, remove all POKEs that allocate memory from the top, i.e. POKE55,xxx:POKE56,xxx (and POKE51,xxx:POKE52,xxx if you happen to use them). Otherwise the program is stopped with an '?OUT OF MEMORY' error.

The utility was used to add the title screen to the game 'Takeover'.

Greetings,

Michael
Last edited by Mike on Fri Nov 30, 2012 6:41 pm, edited 1 time in total.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

This time, I converted and 'adapted' another picture; it was pixeled by Lackey, 'priestlyb' (also found on pixeljoint):

Image
(download)

The original apparently was drawn in Picasso, so I had to shift some part of the picture in the top right corner to accommodate the different screen sizes (176x176 in Picasso vs 160x192 in MG/MP). I did the conversion with a program similar to that one used for the RoQ3 splash screen. In MP, I then finally moved the brooch a little bit to the left, as it looked a bit displaced.
Last edited by Mike on Thu Feb 20, 2014 4:29 pm, edited 2 times in total.
User avatar
GreyGhost
Vic 20 Nerd
Posts: 525
Joined: Wed Oct 05, 2005 11:10 pm

Post by GreyGhost »

Here is a program I converted from a PC graphics demo from K-Power Feb.1984 called Symphony to work with MG.

Code: Select all

;==Vic 20 version of Symphony using Minigrafik
;==K-Power Feb.1984 pg.44(sounds generated may not be right)
10 dim n(8):poke36878,7
20 @on:@clr
40 forx=0to7:readn(x):next
50 @clr
60 a=n(int(rnd(1)*8)):ifa=aothen60
70 ao=a
80 poke36876,a
90 c=int(rnd(1)*80):q=int(rnd(1)*80)
110 j=int(rnd(1)*80):f=int(rnd(1)*80)
130 @1,c,ftof,q:@1,f,qtoq,j
150 @1,q,jtoj,c:@1,j,ctoc,f
170 c=c+2:f=f+4
180 ifc>191orf>159then50
190 goto 130
3000 data 243,217,193,182,162,144,128,121
Later,
Rob
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Nice! :) Here's a similar one I wrote some time ago:

Code: Select all

10 POKE36879,0:POKE646,0:@ON:@CLR
11 A=INT(RND(1)*160):B=INT(RND(1)*192):C=INT(RND(1)*160):D=INT(RND(1)*192)
12 E=INT(RND(1)*13)-6:IFE=0THEN12
13 F=INT(RND(1)*21)-10:IFF=0THEN13
14 G=INT(RND(1)*13)-6:IFG=0THEN14
15 H=INT(RND(1)*21)-10:IFH=0THEN15
16 IFA+E<0ORA+E>159THENE=-E
17 IFB+F<0ORB+F>191THENF=-F
18 IFC+G<0ORC+G>159THENG=-G
19 IFD+H<0ORD+H>191THENH=-H
20 IFPTHEN:@0,A(R),B(R)TOC(R),D(R)
21 @1,A,BTOC,D:A(R)=A:B(R)=B:C(R)=C:D(R)=D:A=A+E:B=B+F:C=C+G:D=D+H
22 POKE36879,16*(INT(RND(1)*15)+1):R=R+1:IFR>10THENR=0:P=1
23 GETA$:IFA$=""THEN16
24 RUN
... a QIX screensaver! Finally I found a good use for the inverse video bit in register 36879. :mrgreen:

I added the program to the MG batch suite. (download)

Cheers,

Michael
Last edited by Mike on Thu Feb 20, 2014 4:30 pm, edited 1 time in total.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Today I wrote a small program, which plots the Barnsley fern (download):

Code: Select all

1 FORI=0TO3:READA(I),B(I),C(I),D(I),E(I),F(I):NEXT
2 POKE36879,8:POKE646,5:@ON:@CLR:X=0:Y=0
3 @1,16*Y,39.5*X+86.5:P=RND(1):I=-(P>.01)-(P>.86)-(P>.93)
4 U=A(I)*X+B(I)*Y+E(I):V=C(I)*X+D(I)*Y+F(I):X=U:Y=V:GOTO3
5 DATA  0   , 0   , 0   ,0.16,0,0
6 DATA  0.85, 0.04,-0.04,0.85,0,1.6
7 DATA  0.2 ,-0.26, 0.23,0.22,0,1.6
8 DATA -0.15, 0.28, 0.26,0.24,0,0.44
Here's the result. Fortunately most of the fractal is plotted before the RND() function loops. :roll:

Image
Last edited by Mike on Thu Feb 20, 2014 4:30 pm, edited 1 time in total.
User avatar
darkatx
Vic 20 Afficionado
Posts: 470
Joined: Wed Feb 04, 2009 2:17 pm
Location: Canada

Post by darkatx »

I was using this for the very first time 2 days ago in fact. The interface looked a bit intimidating at first but after a few goes with the tutorial I got the hang of it.
Nice Barnsley Fern. :)
Learning all the time... :)
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Here we have a viewer for MG pictures, that runs on an unexpanded VIC-20! (download)

Code: Select all

10 FORT=320TO450:READA:POKET,A:NEXT:SYS320
11 :
12 DATA 169,1,166,186,160,0,32,186,255,162,6,189,188,1,32,210,255,202,208,247,134,88,32
13 DATA 207,255,157,0,2,232,201,13,208,245,202,138,162,0,160,2,32,189,255,169,0,162,1
14 DATA 160,16,32,213,255,162,16,134,90,142,174,31,142,180,31,162,31,134,89,142,160,31
15 DATA 142,224,31,202,134,91,162,96,142,184,31,142,242,31,32,152,31,32,218,31,162,15
16 DATA 160,255,32,232,195,24,169,16,168,153,240,15,105,12,144,2,233,239,200,208,244,32
17 DATA 228,255,240,251,169,0,141,0,16,32,68,198,0,32,63,69,76,73,70
18 :
19 REM ** VIEW3K WRITTEN 2013-04-28 BY MICHAEL KIRCHER
The *.d64 image in the archive contains some sample images, just enter their name at the 'FILE?' prompt. Here's one of them:

Image

The display routine of the viewer resides in the stack area. Once the viewer has been exited by pressing a key, it can be restarted with SYS320 to load another picture.

Of course, all the example pictures also still load fine into MINIGRAFIK and MINIPAINT. :)

Cheers,

Michael
Last edited by Mike on Thu Feb 20, 2014 4:31 pm, edited 1 time in total.
User avatar
orion70
VICtalian
Posts: 4337
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Post by orion70 »

Another hit Mike--- you should build a time machine and go back to 1981, showing all your applications... (then, the C64 never appeared, and new VICs with more RAM and improved video chips lasted well into the Nineties... )
Last edited by orion70 on Mon Apr 29, 2013 6:40 am, edited 1 time in total.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

C64? What C64?

;)
matsondawson
The Most Noble Order of Denial
Posts: 343
Joined: Fri May 01, 2009 4:44 pm

Post by matsondawson »

I wonder if given an unlimited size drive of some sort what sort of video you could get out of the vic20. Obviously it would be RAW, but what is the best resolution you could come up with? Or even with 24k of ram, maybe a looping animation.
User avatar
orion70
VICtalian
Posts: 4337
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Post by orion70 »

Didn't write anything about a thing called "the C64", whatever you mean with this term.. Sorry, now I must go working on my VIC2013 :)
User avatar
darkatx
Vic 20 Afficionado
Posts: 470
Joined: Wed Feb 04, 2009 2:17 pm
Location: Canada

Post by darkatx »

Just awesome! :)
Learning all the time... :)
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

matsondawson wrote:I wonder if given an unlimited size drive of some sort what sort of video you could get out of the vic20. Obviously it would be RAW, but what is the best resolution you could come up with? Or even with 24k of ram, maybe a looping animation.
Feel free to try it out. I don't own a monopoly on graphics oriented programs for the VIC-20.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Today I ported a display hack over to the VIC-20, which I had originally programmed on the C128 some 25 years ago. Its name, 'Munching Squares', is an hommage to a similar program which saw the light of day on the PDP-10 as early as 1962!

Here's the BASIC source. The *.d64 file (download) features a boot loader and a copy of MINIGRAFIK, so it easily autostarts in VICE:

Code: Select all

1 POKE55,43:POKE56,60:CLR:FORT=0TO17:READA:POKE16366+T,A:NEXT:POKE15403,169:POKE15404,0
2 POKE15405,170:AD=15406:FORX=0TO19:FORY=0TO7:P=4352+192*X+Y:H=INT(P/256):L=P-256*H
3 POKEAD,93:POKEAD+1,L:POKEAD+2,H:POKEAD+3,157:POKEAD+4,L:POKEAD+5,H:AD=AD+6:NEXT:NEXT
4 POKE36879,8:POKE646,1:@ON:@CLR:@1,0,0TO159,159:@1,159,0TO0,159:SYS15403:DATA 232,232
5 DATA 232,232,232,232,232,232,224,192,240,3,76,46,60,76,43,60
When the program is started, it first writes a ML program to memory. That takes a few seconds. It then draws a simple geometric figure on screen, which then is animated with the ML code.

The screenshot below really doesn't do the effect justice. The animation runs at ~30 frames/sec.!

Image

Cheers,

Michael
Last edited by Mike on Thu Feb 20, 2014 4:31 pm, edited 1 time in total.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Another one for a rainy Sunday - the rendition of a broken Penrose tribar with MINIGRAFIK: (download)

Image

Here's the listing. The assignment 'A=5/3' in line 11 refers to PAL, NTSC users should replace it with 'A=3/2' to compensate for the different pixel aspect ratio:

Code: Select all

10 DIMX(11),Y(11),L(12,1)
11 A=5/3:INPUT"ANGLE";P0:P0={PI}*P0/180
12 FORT=0TO11:READX(T),Y:Y(T)=SQR(3)*Y:NEXT
13 FORT=0TO12:READL(T,0),L(T,1):NEXT
14 POKE36879,110:POKE646,1:@ON:@CLR
15 P=P0:GOSUB18:P=P0+2*{PI}/3:GOSUB18:P=P0-2*{PI}/3:GOSUB18
16 FORQ=-1TO0:GETA$:Q=A$="":NEXT:@RETURN:END
17 :
18 C=COS(P):S=SIN(P):FORT=0TO12
19 L=L(T,0):GOSUB23:X1=X2:Y1=Y2
20 L=L(T,1):GOSUB23:@1,X1,Y1TOX2,Y2
21 NEXT:RETURN
22 :
23 X2=6*(C*X(L)-S*Y(L))/A+80.5:Y2=96.5-6*(S*X(L)+C*Y(L)):RETURN
24 :
25 DATA 1,-1,3,-3,13,-3,8,2,4,2,7,-1,1,-5,11,-5,2,0,3,-1,0,-2,0,-4
26 DATA 0,1,1,2,2,3,3,4,4,5,5,0,1,6,6,7,7,2,4,8,8,9,0,10,6,11
27 :
28 REM ** TRIBAR WRITTEN 2013-05-12 BY MICHAEL KIRCHER
Post Reply