** New Frontiers in VIC-Hires-Graphics, Part 18

Basic and Machine Language

Moderator: Moderators

Post Reply
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

** New Frontiers in VIC-Hires-Graphics, Part 18

Post by tokra »

Image

Download

HFLI-mode (used in VICSTRIP)

A new graphics-mode for PAL combining high-resolution with BASIC-interoperability:

168x160 HFLI (8x2 colour-blocks and raster-splits for $900e and $900f every 2 lines).

Provided in the downloadable archive are
  • a Slide Show-disk image with some more pictures that shows how to easily show graphics from BASIC.
    Feel free to press RUN/STOP anytime and use the BASIC-editor to your liking
  • a version specifically for 35K-expansions that "hides" im RAM1/2/3 ($0400-$0ff) and BLK5 ($a000-$bfff) providing as much BASIC-RAM as possible.
  • Mike's converter for the mode. First save your desired image as an .PPM-file in 168x160 pixel-resolution and name it "input.ppm". Then execute hfli_quant.cmd to start the conversion.The resulting files must then be processed with "ppm import" on a VIC-20 (preferably in VICE). In VICE disable True Drive Emulation and enable Virtual Device traps. Then just drop the "boot"-file from the same directory into VICE and it should start automatically. Make sure all the files stay within the same directory. The resulting target file can then be loaded as shown in the Slide Show-BASIC program.
  • the source-files for the graphics-mode are included as well for anyone interested
Instructions for the graphics-mode:

+24K-version:
SYS 9192: Turn on mode and copy colours
SYS 9195: Copy colours
SYS 9198: Turn off mode

+35K-version:
SYS 40960: Turn on mode and copy colours
SYS 40963: Copy colours
SYS 40969: Turn off mode

Note: Set volume-register ($900e) before activating graphics-mode. Because this register is shared with the auxiliary color it cannot be changed when the graphics-mode is active. Its value will be copied into the executed code when turning on the graphics.

Technical background:

- 21 x Color-RAM-Update = 126 Cycles
- 900e Update = 6 Cycles
- 900f Update = 6 Cycles
- 9002 Update = 4 Cycles
= 142 Cycles (2x71) (71 cycles in a PAL-rasterline)

Memory layout:

$1000 .. $10D1: Screen 1
$10D2 .. $11E4: Splitscreen 11 text-lines of 25 characters
$11E5 .. $11FF: free (27 Bytes)
$1200 .. $12D1: Screen 2
$12D2 .. $12DF: free (14 Bytes)

$12E0 .. $1FFF: Characters $2E .. $FF (exactly 210 Characters)
$2000 .. $2347: Color-RAM (lower nibble: lines 1,2,5,6,9,10,13,14,... -> $9600
higher nibble: lines 3,4,7,8,11,12,15,16,... -> $9400 )
$2348 .. $2397: $900f (80 Bytes)
$2398 .. $23e7: $900e (80 Bytes)

+24K-version:
$23e8 .. $4f8e: Code

+35K-version
$0400 .. $0ffe: Code
$a000 .. $bfc7: Code
User avatar
Rich
Vic 20 Hobbyist
Posts: 137
Joined: Mon Nov 29, 2021 4:15 pm

Re: ** New Frontiers in VIC-Hires-Graphics, Part 18

Post by Rich »

What can I say but WOW!!!!!!!! Well done I don`t know how you make a Vic do this!
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: ** New Frontiers in VIC-Hires-Graphics, Part 18

Post by Mike »

Rich wrote:[...]
The HFLI display mode presented here is part of an ongoing series, where tokra and I explore the capabilities of the VIC-I chip to show bitmapped high resolution graphics, with the focus on either a maxed out screen area or increased colour resolution. The latter means more simultaneous colours within a given screen area than just a new foreground colour every 8x8 or 8x16 hires pixels (this is the normal size of the colour RAM attribute cells).

A common theme of all these modes is they rely on CPU assistance. The video chip would not be able to display these modes on its own, rather the CPU is employed to shuffle bitmap or colour RAM data from expansion memory to the internal RAM, the latter which is the only memory besides the character ROM that is accessible by the video chip. Additionally, the VIC registers for the background, border and auxiliary colours are changed during the frame scan (so-called raster splits). These changes of the display memory and VIC registers are carefully timed so they are always already in effect when the video chip is about to access the changed data!

For quite some of these modes, that CPU assistance monopolizes the CPU for display. The user program is halted while the picture is shown, and is only continued upon a key press. That kind of modes of course is only usable for static displays. Other modes allow to continue the processing of a user program in the foreground and are more suitable for games or other applications that call for a dynamic display.

The newly presented mode increases the width of the display area compared to Wide FLI (168 instead of 104 pixels) at the expense of the vertical resolution (only 160 instead of 256 pixels) and colour resolution (8x2 attribute cells instead of 8x1, and colour registers only changed every two rasters instead of every raster). This however results in a display area which is more suited to landscape oriented image motifs. Additionally, the graphics mode supports a text split screen attached below the graphics area and, equally important, that text area can easily be used from BASIC.

Tokra and I have thoroughly documented how all these new graphics modes came into existence over the last years. Please refer to the sticky hub post "New Frontiers in VIC-Hires-Graphics Series" in the Programming section, from which you can read the whole story.

Greetings,

Michael
Post Reply