Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:52 01 May 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PicoMiteVGA DEMO

     Page 8 of 8    
Author Message
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 03:58pm 02 Apr 2025
Copy link to clipboard 
Print this post

Diagonal Scrolling Clock

Const Mode.N=2
Const Font.N=1
Const T.Scale=4
Const T.Size=Len(Time$)
MODE  Mode.N
Const X.Res=MM.HRES,Y.Res=MM.VRES
Font  Font.N
Const X.FSize=MM.Info(FONTWIDTH)
Const Y.FSize=MM.Info(FONTHEIGHT)
Const X.Offset=X.FSize*T.Scale*T.Size\2
Const Y.Offset=Y.FSize*T.Scale\2
Dim integer X.Dir=1,Y.Dir=1
Dim integer X.Pos=MM.HRES\2,Y.Pos=MM.VRES\2
Dim integer FC,BC
Dim Clr(15)=(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
Colour Map Clr(),Clr()
'=================================================
FRAMEBUFFER LAYER 0
FRAMEBUFFER WRITE L
Font 9
'------------------------------------------------
Do
If BC=0 Then
 BC=Int(Rnd*15)+1
 Colour Clr(BC)
 Print @(0,0);
 For n=1 To (X.Res\8)*(Y.Res\8)
   Print Chr$(32+Int(Rnd*3));
 Next
EndIf

If X.Dir=1 Then
 Blit READ  1, 0,0,1,MM.VRES
 Blit 1,0,0,0,MM.HRES-1,MM.VRES
 Blit Write 1, MM.HRES-1,0
Else
 Blit READ  1, MM.HRES-1,0,1,MM.VRES
 Blit 0,0,1,0,MM.HRES-1,MM.VRES
 Blit Write 1, 0,0
EndIf
Blit Close 1
If Y.Dir=1 Then
 Blit READ  1, 0,0,MM.HRES,1
 Blit 0,1,0,0,MM.HRES,MM.VRES-1
 Blit Write 1, 0,MM.VRES-1
Else
 Blit READ  1, 0,MM.VRES-1,MM.HRES,1
 Blit 0,0,0,1,MM.HRES,MM.VRES-1
 Blit Write 1, 0,0
EndIf
Blit Close 1
'------------------------------------------------
Pause 20
FRAMEBUFFER WRITE N
If FC=0 Then FC=Int(Rnd*15)+1
Text X.Pos,Y.Pos,Time$,"CM",Font.N,T.Scale,Clr(FC)
Inc X.Pos,X.Dir:Inc Y.Pos,Y.Dir
If X.Pos-X.Offset<0 Then X.Dir=1:FC=0
If X.Pos+X.Offset>MM.HRES Then X.Dir=-1:FC=0
If Y.Pos-Y.Offset<0 Then Y.Dir=1:BC=0
If Y.Pos+Y.Offset>MM.VRES Then Y.Dir=-1:BC=0
FRAMEBUFFER WRITE L
Loop While Inkey$=""
'================================================
DefineFont 9
04200808
80402010 08040201
01020408 10204080
08080808 08080808
End DefineFont
 
al18
Senior Member

Joined: 06/07/2019
Location: United States
Posts: 222
Posted: 06:05pm 02 Apr 2025
Copy link to clipboard 
Print this post

Nice - thanks for the program
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4811
Posted: 08:46am 03 Apr 2025
Copy link to clipboard 
Print this post

Hi javavi,

Scolling background can be made easier.

In your previous clock you perform these commands to copy data from top of the screen to bottom of the screen.
Blit READ  1, 0,0,MM.HRES,1
Blit 0,1,0,0,MM.HRES,MM.VRES-1
Blit Write 1, 0,MM.VRES-1
Blit Close 1


In PicoMite there is the SPRITE SCROLL command that scrolls a selected layer.
This command does the same as the above 4 lines.
Sprite scroll 0,1


The SPRITE SCROLL command can scroll all directions up/down/left/right. Individual, and simultaneous (diagonal).

Regards,

Volhout

P.s. in your later clocks you would replace
If X.Dir=1 Then
Blit READ  1, 0,0,1,MM.VRES
Blit 1,0,0,0,MM.HRES-1,MM.VRES
Blit Write 1, MM.HRES-1,0
Else
Blit READ  1, MM.HRES-1,0,1,MM.VRES
Blit 0,0,1,0,MM.HRES-1,MM.VRES
Blit Write 1, 0,0
EndIf
Blit Close 1
If Y.Dir=1 Then
Blit READ  1, 0,0,MM.HRES,1
Blit 0,1,0,0,MM.HRES,MM.VRES-1
Blit Write 1, 0,MM.VRES-1
Else
Blit READ  1, 0,MM.VRES-1,MM.HRES,1
Blit 0,0,0,1,MM.HRES,MM.VRES-1
Blit Write 1, 0,0
EndIf
Blit Close 1


with

Sprite scroll X.Dir,Y.Dir

Edited 2025-04-03 19:07 by Volhout
PicomiteVGA PETSCII ROBOTS
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 04:49pm 03 Apr 2025
Copy link to clipboard 
Print this post

  Volhout said  In PicoMite there is the SPRITE SCROLL command that scrolls a selected layer.
This command does the same as the above 4 lines.
Sprite scroll 0,1

The SPRITE SCROLL command can scroll all directions up/down/left/right. Individual, and simultaneous (diagonal).

Hi Volhout,
Thank you for the tip, I must have missed it. It makes it look much easier.
Regards,javavi.
Const Mode.N=2
Const Font.N=1
Const T.Scale=4
Const T.Size=Len(Time$)
MODE  Mode.N
Const X.Res=MM.HRES,Y.Res=MM.VRES
Font  Font.N
Const X.FSize=MM.Info(FONTWIDTH)
Const Y.FSize=MM.Info(FONTHEIGHT)
Const X.Offset=X.FSize*T.Scale*T.Size\2
Const Y.Offset=Y.FSize*T.Scale\2
Dim integer X.Dir=1,Y.Dir=1
Dim integer X.Pos=MM.HRES\2,Y.Pos=MM.VRES\2
Dim integer FC,BC
Dim Clr(15)=(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
Colour Map Clr(),Clr()
'=================================================
FRAMEBUFFER LAYER 0
FRAMEBUFFER WRITE L
Font 9
Do
If BC=0 Then
 BC=Int(Rnd*15)+1
 Colour Clr(BC)
 Print @(0,0);
 For n=1 To (X.Res\8)*(Y.Res\8)
   Print Chr$(32+Int(Rnd*3));
 Next
EndIf

Sprite scroll X.Dir,Y.Dir
Pause 20

FRAMEBUFFER WRITE N
If FC=0 Then FC=Int(Rnd*15)+1
Text X.Pos,Y.Pos,Time$,"CM",Font.N,T.Scale,Clr(FC)
Inc X.Pos,X.Dir:Inc Y.Pos,Y.Dir
If X.Pos-X.Offset<0 Then X.Dir=1:FC=0
If X.Pos+X.Offset>MM.HRES Then X.Dir=-1:FC=0
If Y.Pos-Y.Offset<0 Then Y.Dir=1
If Y.Pos+Y.Offset>MM.VRES Then Y.Dir=-1:BC=0
FRAMEBUFFER WRITE L
Loop While Inkey$=""
'================================================
DefineFont 9
04200808
80402010 08040201
01020408 10204080
08080808 08080808
End DefineFont
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 07:28pm 07 Apr 2025
Copy link to clipboard 
Print this post

Maze-Clock  

MODE  1
Const X.Res=MM.HRES,Y.Res=MM.VRES
Const Font.Addr=MM.Info(FONT ADDRESS 1)+4
Dim string  CH$ LENGTH 1
Dim string  ST$ LENGTH 8
Dim integer X.Dir=1,Y.Dir=1
Dim integer X.Pos=5,Y.Pos=15
Dim integer n,FC,BC
Dim CM(15)=(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
Colour Map CM(),CM()
'=================================================
Font 9
Print @(0,0);
For n=1 To (X.Res\8)*(Y.Res\8)
 Print Chr$(50+Int(Rnd*3));
Next

Do
If FC=0 Then
  FC=Int(Rnd*15)+1
  TILE 0,0,CM(FC),0,80,40
  If Cint(Rnd) Then CH$="1" Else CH$="0"
EndIf
ST$=Time$
PrintTime X.Pos,Y.Pos,ST$,CH$
Pause 250
PrintTime X.Pos,Y.Pos,ST$,"C"
Inc X.Pos,X.Dir
Inc Y.Pos,Y.Dir
If X.Pos<0 Then X.Dir=1:FC=0
If X.Pos+64>80 Then X.Dir=-1:FC=0
If Y.Pos<0 Then Y.Dir=1:FC=0
If Y.Pos+11>60 Then Y.Dir=-1:FC=0
Loop While Inkey$=""
End
'--------------------------------------
Sub PrintTime(X,Y,TXT$,CH$)
Local string T$ LENGTH 8
Local integer Ti,Xi,FA,FS,FD,FH,FW
X=X*8:Y=Y*8
Print @(X,Y);
For FH=0 To 10
 XI=X
 For Ti=1 To Len(TXT$)
   FS=Asc(Mid$(TXT$,Ti,1))-32
   FA=Font.Addr+FS*12+FH
   FD=PEEK(BYTE FA)
   T$=Bin$(FD,8)
   For FW=1 To 8
     If CH$="C" Then
       If Mid$(T$,FW,1)="1" Then Print @(Xi,Y)Chr$(50+Int(Rnd*3));
     Else
       If Mid$(T$,FW,1)="1" Then Print @(Xi,Y)CH$;
     EndIf
     Inc Xi,8
   Next
 Next
 Inc Y,8
 Print @(X,Y);
Next
End Sub
'--------------------------------------
DefineFont 9
05300808
00000000 00000000 FFFFFFFF FFFFFFFF
08080808 08080808 80402010 08040201
01020408 10204080
End DefineFont
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 05:56pm 20 Apr 2025
Copy link to clipboard 
Print this post

Perspective, Prospettiva, Perspicere

MODE 1
For Y=1 To 480
 For X=1 To 640
   Z=X-320
   If (Z*64)Mod Y=0 Then Pixel X,Y
 Next
Next
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 06:40pm 20 Apr 2025
Copy link to clipboard 
Print this post

MODE 1
XR=MM.HRES-1:YR=MM.VRES-1
For Y=1 To YR
 For X=1 To XR
   Z=X-320
   If (Z*64)Mod Y=0 Then Pixel X,YR
 Next
 Sprite scroll 0,1
Next
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2389
Posted: 10:07pm 20 Apr 2025
Copy link to clipboard 
Print this post

'map switching demo
Dim integer cmap(13)

'Clear the screen
MODE 2
Map reset
CLS rgb(black)

'Set up colours in the array
cmap(1)=RGB(white)
cmap(2)=RGB(black)
cmap(3)=RGB(black)
cmap(4)=RGB(black)
cmap(5)=RGB(black)
cmap(6)=RGB(black)

cmap(7)=RGB(white)
cmap(8)=RGB(black)
cmap(9)=RGB(black)
cmap(10)=RGB(black)
cmap(11)=RGB(black)
cmap(12)=RGB(black)

' Do an initial update of the Colour map to set up our colours
domap

hline=76:hy=1:mch=1
line 0,75,319,75,,RGB(white)

do'draw horizontal lines
 line 0,hline,319,hline,,map(mch)
 inc mch:if mch=7 then mch=1
 hline=hline+hy:hy=hy+0.6
loop until hline>240

xb=-149:xt=10:mch=7
do'draw vertical lines
 line xb,239,xt,75,,map(mch)
 inc mch:if mch=13 then mch=7
 xb=xb+8:xt=xt+4
loop until xb>=479

'
lr=0
do
cmap(0)=cmap(6)
 For i=5 To 0 Step -1' move horizontal lines
   cmap(i+1)=cmap(i)
 Next

 if lr<40 then
 cmap(6)=cmap(12)
 For i=11 To 6 Step -1' move vertical lines
   cmap(i+1)=cmap(i)
 Next
 else
 cmap(12)=cmap(7)
 For i=7 To 12' move vertical lines
   cmap(i)=cmap(i+1)
 Next
 end if
 inc lr:if lr>80 then lr=0

 domap
 pause 100
loop

end

Sub domap
Local integer i
Map (0)=RGB(black)
For i=1 To 12
  Map (i)=cmap(i)
Next
Map set
End Sub
 
javavi

Guru

Joined: 01/10/2023
Location: Ukraine
Posts: 436
Posted: 07:23pm 29 Apr 2025
Copy link to clipboard 
Print this post

XOR Patterns

MODE 2
Do
R1=Int(Rnd*10)+1
R2=Int(Rnd*10)+10
R3=Int(Rnd*10)+20
C1=Map(Int(Rnd*15)+1)
C2=Map(Int(Rnd*15)+1)
C3=Map(Int(Rnd*15)+1)
For Y=0 To 240
For X=0 To 320
Color 0: Pixel X,Y
K=X Xor Y
If K Mod R1=0 Then Color C1: Pixel X,Y
If K Mod R2=0 Then Color C2: Pixel X,Y
If K Mod R3=0 Then Color C3: Pixel X,Y
Next
Next
Loop
 
     Page 8 of 8    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2025