class ZXUtils::Gallery
ZXUtils::Gallery
.¶ ↑
A program to load from tape and display various ZX Spectrum screen formats.
Supported ULAplus formats:
format type size mode colors palette /------------------^-------^------------^--------^---------\ | standard screen | 6912 | screen 0 | 15 | default | | standard plus | 6976 | screen 0 | 64 | static | | standard HAM256 | 7680 | screen 0 | 256 | dynamic | | high color | 12288 | hi-color | 15 | default | | high resolution | 12289 | hi-res | 2 | bright | | hi-color plus | 12352 | hi-color | 64 | static | | hi-res plus | 12353 | hi-res | 2 | static | | hi-color HAM256 | 13056 | hi-color | 256 | dynamic | | stand. interlace | 13824 | screen 0/1 | 15 | default | \------------------+-------+------------+------------------/
See: faqwiki.zxnet.co.uk/wiki/ULAplus#Extension_to_the_SCR_format
This gem provides a tool zxgallery that can be used to create a gallery .TAP file from .SCR files.
Example:
The following will produce test_gallery.tap file with the program and the .SCR files as TAP bytes.
zxgallery *.scr -o test_gallery.tap
This program can be also used as a library.
Example:
require 'zxlib/basic' require 'zxutils/gallery' class GalleryProg include Z80 include Z80::TAP import ZXUtils::Gallery screen import_file "some_screen.scr" screen_end label end program_code = GalleryProg.new 0xC000 start = program_code[:start] screen = program_code[:screen] screen_end = program_code[:screen_end] program = ZXLib::Basic.parse_source <<-EOB 1 DEF FN d(a,s)=USR #{start}: DEF FN l(a)=USR #{start}: DEF FN x()=USR #{start} 20 BORDER 0: PAPER 0: INK 7: CLS 30 RANDOMIZE FN d(#{screen},#{screen_end - screen}) 99 BORDER 7: PAPER 7: INK 0: CLS 9998 STOP: GO TO 10 9999 CLEAR #{0x6000 - 1}: LOAD ""CODE : PRINT USR #{start}: RUN EOB program.save_tap("gallery", line: 9999) program_code.save_tap("gallery", append: true)
Constants
- SCR_MAX_SIZE
The size of the largest .SCR file format supported.
Public Instance Methods
USR start
click to toggle source
DEF FN x()=USR start
DEF FN l(a)=USR start
DEF FN d(a,s)=USR start
Gallery
API.
This endpoint should be invoked from the ZX Basic directly via USR or indirectly via FN.
REM checks for hardware version: 48k or 128k and sets up appropriate delays for HAM256 LET detected=USR start: REM returns 48, 128 or 0 if could not determine REM sets screen mode to 0, resets palette mode, clears screen attributes RANDOMIZE FN x() REM loads the file from the tape and returns its size LET size=FN l(address): REM provide an address to load the screen at REM displays the screen RANDOMIZE FN d(address,size): REM provide an address of the screen and its size
# File lib/zxutils/gallery.rb, line 130 ns :start do call find_def_fn_arg # is this an FN call with arguments? jr C, hw_detect_and_setup # called directly via USR jr NZ, clear # called via FN () end