Skip to content

Commit

Permalink
scroller done
Browse files Browse the repository at this point in the history
  • Loading branch information
slesinger committed Nov 19, 2024
1 parent 4c78c46 commit 93a90c6
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 187 deletions.
307 changes: 154 additions & 153 deletions planety_bmpdata.asm

Large diffs are not rendered by default.

12 changes: 0 additions & 12 deletions scroller.asm
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
#else
// This has to happen only when starting separately

// .var music = LoadSid("Ucieczka_z_Tropiku.sid") // music is loaded in previous part. Separately is disabled
// *=music.location "Part2_music"
// .fill music.size, music.getData(i)

*= install "loader_install" // same as install jsr
.var installer_c64 = LoadBinary("tools/krill194/loader/build/install-c64.prg", BF_C64FILE)
installer_ptr: .fill installer_c64.getSize(), installer_c64.get(i)
Expand All @@ -58,14 +54,6 @@
.var loader_c64 = LoadBinary("tools/krill194/loader/build/loader-c64.prg", BF_C64FILE)
loader_ptr: .fill loader_c64.getSize(), loader_c64.get(i)

// .var planet_bitmap = LoadBinary("planet_bitmap.prg", BF_C64FILE) // is loaded during this part
// *=$2000 "Part5_bitmap_data"
// .fill planet_bitmap.getSize(), planet_bitmap.get(i)

// .var planet_color = LoadBinary("planet_color.prg", BF_C64FILE) // is loaded during this part
// *=$0400 "Part5_bitmap_color"
// .fill planet_color.getSize(), planet_color.get(i)

BasicUpstart2(start)
#endif
//---
Expand Down
Binary file added tools/assets/scroller/path-lower.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tools/assets/scroller/path-upper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tools/c64fy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Save as RGB PNG file in Gimp and convert to `planety_bmpdata.a`
./c64fy.py -hires 1 planety.png
```

Then, rename `planety_bmpdata.a` to <project root folder, next to scroller.asm>/planety_bmpdata.asm`
Then, move `planety_bmpdata.asm` to <project root folder, next to scroller.asm>/planety_bmpdata.asm`

Edit the file to get such structure:
```asm
Expand Down
39 changes: 30 additions & 9 deletions tools/c64fy/c64fy.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import PIL.Image
import sys
import os
import random
from rlencode import RLEncode
import c64fylib
Expand Down Expand Up @@ -476,8 +477,11 @@ def sprite_recode_byte(b, hiresmode):
if not quiet:
Show(im)


def hexstr(v):
return '$' + ('00' + hex(v)[2:])[-2:]


def dumpbytes(v):
n = 0
z = ''
Expand All @@ -490,6 +494,23 @@ def dumpbytes(v):
n += 16
return z


def dumpbytes_swapped(v):
n = 0
z = ''
while n < len(v):
m = min(n + 16, len(v))
z += '.byte '
for i in range(n, m):
val = v[i]
lo = val & 0x0f
hi = val >> 4
val_swapped = (lo << 4) + hi
z += hexstr(val_swapped) + ', '
z = z[:-2] + '\n'
n += 16
return z

# In charmode reduce all "code" blocks to the given maximum number.
# Try to reduce overall error when replacing codeblocks by others.
# Codeblocks are already unique from byte coding.
Expand Down Expand Up @@ -687,16 +708,16 @@ def Compute2ndBestBlockError(myheap, removedflags, idx):
dfl += inputbasefilename + '_fixcolors\n'
dfl += '.byte '
dfl += hexstr(fixindices[0]) + ', ' + hexstr(fixindices[1]) + ', ' + hexstr(fixindices[2]) + '\n'
f = open(outputbasefilename + '_fixcolors.a','wt')
f = open(outputbasefilename + '_fixcolors.a', 'wt')
f.writelines(dfl)
f.close()
dfl = ''
if usedatalabels:
dfl += '\n!align 255,0\n' + inputbasefilename + '_charsetdata\n'
if firstchar > 0:
dfl += '!src "' + inputbasefilename + '_chardata0_' + str(firstchar-1) +'.a"\n'
dfl += '!src "' + inputbasefilename + '_chardata0_' + str(firstchar-1) + '.a"\n'
dfl += dumpbytes(charsetbytes)
f = open(outputbasefilename + '_chardata.a','wt')
f = open(outputbasefilename + '_chardata.a', 'wt')
f.writelines(dfl)
f.close()
dfl = ''
Expand All @@ -706,7 +727,7 @@ def Compute2ndBestBlockError(myheap, removedflags, idx):
num_tiles_x = num_char_x // tilex
num_tiles_y = num_char_y // tiley
num_tiles = num_tiles_x * num_tiles_y
print('Tile count',num_tiles_x,'*',num_tiles_y,', #CharBlocks',len(codeblocks),'of max',num_char_x*num_char_y)
print('Tile count', num_tiles_x,'*', num_tiles_y,', #CharBlocks', len(codeblocks), 'of max', num_char_x*num_char_y)
tiledata = []
for y in range(0, num_tiles_y):
for x in range(0, num_tiles_x):
Expand Down Expand Up @@ -768,14 +789,14 @@ def Compute2ndBestBlockError(myheap, removedflags, idx):
if not hiresmode:
dfl += inputbasefilename + '_backgroundcolor\n.byte '
dfl += hexstr(backgroundindex)
dfl += '\n\n' + inputbasefilename + '_bitmapdata\n'
dfl += '\n\n//' + os.path.basename(inputbasefilename) + '_bitmapdata:\n'
dfl += dumpbytes(bitmapbytes)
dfl += '\n\n' + inputbasefilename + '_chardata\n'
dfl += dumpbytes(chardata)
dfl += '\n\n' + os.path.basename(inputbasefilename) + '_chardata:\n'
dfl += dumpbytes_swapped(chardata)
if not hiresmode:
dfl += '\n\n' + inputbasefilename + '_colordata\n'
dfl += '\n\n' + os.path.basename(inputbasefilename) + '_colordata:\n'
dfl += dumpbytes(colordata)
f = open(outputbasefilename + '_bmpdata.a', 'wt')
f = open(outputbasefilename + '_bmpdata.asm', 'wt')
f.writelines(dfl)
f.close()
# RLE encoding of data
Expand Down
12 changes: 0 additions & 12 deletions video.asm
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@
// Started as whole compilation of parts
#else
// This has to happen only when starting separately
// .var music = LoadSid("Ucieczka_z_Tropiku.sid")
// *=music.location "Part2_music" // $1000
// .fill music.size, music.getData(i)

// .var font = LoadBinary("data/video_font.bin", BF_C64FILE)
// *=$2000 "Part4_font1"
// .fill font.getSize(), font.get(i)

// // Include Fryba
// .var fryba5 = LoadBinary("data/F5.bin", BF_C64FILE)
// *=$6400 "Part4_Fryba5.bin"
// .fill fryba5.getSize(), fryba5.get(i)

*= install "loader_install" // same as install jsr
.var installer_c64 = LoadBinary("tools/krill194/loader/build/install-c64.prg", BF_C64FILE)
Expand Down

0 comments on commit 93a90c6

Please sign in to comment.