﻿ rem ------------------------------------------------------ 
 rem - GameLoader PROTOTYPE demo program                ---   
 rem --Atari 2600 Video Game Program running on C64     ---
 rem ------------------------------------------------------
 rem 20220427 RelationalFramework  
 rem ----------------------------------------------
 rem ---init section, runs once: ------------------
 rem ----------------------------------------------
 
 BITIndex=0:rem CAM x coordinate
 
 rem print a binary string in view of the cam...

 print %11111111(virtualworld,2)
 print %10101011(virtualworld,14)
 print %10101011(virtualworld,26)
 print %11111111(virtualworld,38)
 virtualworld(13)=255
 g=0:j=0
 u=1:z=1:rem initial directions for scrolling and weaving
 x=5:y=0
 vwpixel(5,2,on)
 vwpixel(6,3,on)
 vwpixel(7,4,flip)

 
 rem ------------------------------------------------
 rem end init section (implicit return)--------------
 rem ------------------------------------------------

 rem ------------------------------------------------
 rem ---:the next comment line is used by the compiler
 rem ---gameloop subroutine, runs every frame:    ---
 rem ------------------------------------------------
 rem j=1-j:rem toggle j between 1 and 0
 rem if j=0 then return


 rem 20220430 testing joystick control
 scrollvirtualworldtoggle=0
 if joy0right=1 then BITIndex=BITIndex+1:scrollvirtualworldtoggle=1:return
 if joy0left=1 then BITIndex=BITIndex-1:scrollvirtualworldtoggle=1:return
 if joy0down=1 then BYTErowoffset=BYTErowoffset+12:scrollvirtualworldtoggle=1:return
 if joy0up=1 then  BYTErowoffset=BYTErowoffset-12:scrollvirtualworldtoggle=1:return
 rem uncomment next line for joystick test...
 rem return

 rem bounce camera:
 if BYTErowoffset=48 then u=0
 if BYTErowoffset=0 then u=1
 if u=1 then BYTErowoffset=BYTErowoffset+ 12 else BYTErowoffset=BYTErowoffset-12


 rem MBR test: use 60 Hz/30 fps display panning right
 rem and 30 Hz/30 fps display panning left
 rem if q=0 BITIndex=BITIndex+1:scrollvirtualworldtoggle=0 else BITIndex=BITIndex-1:scrollvirtualworldtoggle=1
 if z=1 then BITIndex=BITIndex+1:scrollvirtualworldtoggle=1
 rem drop black filter going back:
 if z=0 then BITIndex=BITIndex-1:scrollvirtualworldtoggle=0:gosub MBRdemo

 rem bounce CAM back and forth
 if BITIndex=71 then z=0
 if BITIndex=0 then z=1 

 rem change background?
 g=g+1
 if g<100 then return
 rem c64 specific tile changeup:
 y=BITIndex
 for x=0 to 3:BackgroundTileCharacters(x)=y:y=y+1:next


 return

MBRdemo

 rem test the full screen 60 Hz scroll Without Display Lists 
 rem C64 Overload Atari 2600 test: (rolls on a real Atari)

 " jsr pushabstractextendedplayfield ; remove MBR filter " 
 return

 rem -------------------------------------------------------------
 rem end game loop (implicit return)-----------------
 rem -------------------------------------------------------------

 rem /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ - TOP/BOTTOM VERTICAL BLANK DIVIDER!

 rem -------------------------------------------------------------
 rem ---gameloop2 subroutine, runs every frame:    --
 rem ------------------------------------------------
 rem ------------------------------------------------
 rem ------------------------------------------------

 rem -------------------------------------------------------------
 rem end gameloop2 (implicit return)----------------- 
 rem ------------------------------------------------

 rem -------------------------------------------------------------
 rem ---KITCHENSINK subroutine, runs when scrollvirtualworldtoggle=1
 rem -------------------------------------------------------------
 
 rem end kitchensink events----------------------------------------------



virtualworld
............................................................................................
............................................................................................
............................................................................................
............................................................................................
....................xxx.xxx.xxx..xxx..x.xxxx.xx...xxxx.xxxxxxxx..xx....x.x.xxxx.............
....................x.x..x..x.x..x.x..x.x.xx.xx...x..x.x..xx..xx.xx....x...xx...............
....................x.x..x..x.x..x.x..x..xxx.xx...x..x.x..xx..xx.xx...xx...xxxx.............
...................xxxx..x..xxxx.xxxx.x.xx...xxxx.x.xx.x.xxxx.xx.xx...xx...xxxx.............
...................xx.x..x..xx.x.xx.x.x.xx...xx.x.x.xx.x.xxxx.xx.xxxx.xx.....xx.............
...................xx.x..x..xx.x.xx.x.x.xxxx.xxxx.xxxx.xxxxxxxx..xxxx.xx...xxxx.............
............................................................................................
............................................................................................
............................................................................................
............................................................................................
............................................................................................
............................................................................................
............................................................................................
............................................................................................
............................................................................................
............................................................................................

sprites
0
.x....x.
..xxxx..
.x.xx.x.
..xxxx..
...xx...
..xxxx..
.x.xxxx.
x..x.xxx
8
........
..xxxx..
.x.xx.x.
xxxxxxxx
..x..x..
.x..xxx.
.x.xx.x.
x.x..xxx
16
..xxxx..
.xXXXXx.
XX.xx.XX
XxxxxxXX
x.XXXX.x
XX....XX
.xxxxxx.
..xxxx..

chiptunes
7,27,7,27,8
7,13,7,13,8
7,6,7,6,8
0,0,0,0,4
7,27,7,27,8
7,6,7,6,8
7,6,7,6,8

8, 24, 8, 20, 4
10,24, 10, 20, 4
8, 24, 8, 20, 4
10,24, 10, 20, 4
8, 24, 8, 20, 4
10,24, 10, 20, 4
8, 24, 8, 20, 2
10,24, 10, 20, 2
8, 24, 8, 20, 15
10,24, 10, 20, 2
8, 24, 8, 20, 2
10,24, 10, 20, 2
8, 24, 8, 20, 2
1,0, 0, 0, 10
0,0, 0, 0, 7
0,0, 0, 0, 7
0,0, 0, 0, 7
0,0, 0, 0, 7

7,27,7,27,8
7,13,7,13,8
7,6,7,6,8
0,0,0,0,4
7,27,7,27,8
7,6,7,6,8
7,6,7,6,8


1, 18, 1, 18, 8
1, 23, 1, 23, 12
1, 31, 1, 31, 12
1, 18, 1, 18, 14
1, 15, 1, 15, 12
1, 14, 1, 14, 15
1, 18, 1, 18, 15
1, 9, 1, 9, 18
1, 8, 1, 8, 29
0, 0, 0, 0, 222
1, 9, 1, 9, 12
1, 8, 1, 8, 16     
7,24,0,0,12
12, 24, 0, 0, 24
12, 19, 0, 0, 12
12, 15, 0, 0, 12
12, 14, 0, 0, 18
12, 15, 12, 19, 24
12, 15, 0, 0, 12
12, 19, 0, 0, 12
12, 15, 12, 19, 120
0, 0, 0, 0, 254  
3, 5, 3, 12, 8
15, 17, 15, 19, 8
15, 5, 15, 12, 8
15, 17, 15, 19, 8
15, 5, 15, 12, 8
15, 17, 15, 19, 16
7, 5, 7, 12, 30
3, 5, 3, 12, 15
15, 17, 15, 19, 10
15, 5, 15, 12, 10
15, 17, 15, 19, 10
15, 5, 15, 12, 10
15, 5, 15, 12, 15
0, 0, 0, 0, 68

7,27,7,27,8
7,6,7,6,8
7,6,7,6,8

8, 24, 8, 20, 4
10,24, 10, 20, 4
8, 24, 8, 20, 4
10,24, 10, 20, 4
8, 24, 8, 20, 4
10,24, 10, 20, 4
8, 24, 8, 20, 2
10,24, 10, 20, 2
8, 24, 8, 20, 15
0,0,0,0,0
8, 24, 8, 20, 4
10,24, 10, 20, 4
8, 24, 8, 20, 4
10,24, 10, 20, 4
8, 24, 8, 20, 4
10,24, 10, 20, 4
8, 24, 8, 20, 2
10,24, 10, 20, 2
8, 24, 8, 20, 15
0,0,0,0,0

