Max possible graphics resolution 160 * 240 (?)

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

Max possible graphics resolution 160 * 240 (?)

Post by tokra »

I've always been interested in maxing out the VIC-20 graphic powers. For years I thought 160 * 192 would be the max possible resolution.

Then I saw some of the VIC-20 demos that use the RAM in $0000-$03ff and that got me thinking. 128 x 256 is possible with putting the video-ram at $0200 or $0000 and the char-ram at $1000-$3fff - of couse BASIC is no longer an option when messing with the lower 1K. 184 x 176 is also a nice resolution possible that way.

However I always wondered if it was possible to max out all the 5K the VIC-chip can use from $0000-$03ff and $1000-$3fff (sadly the 3K block from $0400-$0fff can't be seen by the VIC even if expansion memory is present)

Anyway, I came up with a working example of a 160 * 240 resolution. This is done by using a standard 160 * 192 video and then switching the video and char ram from $1000 to $0000 at the right raster line, providing an extra 160*48 graphic and switching back once through with the extra video.

I realize this mode is probably not good for anything else than showing pictures. Calculating a pixel position is tough, since the memory layout is pretty weird.

Source code for activating the mode below. A (poor) example that fills the screen with random noise (= the recent raster line) attached as well. Load ,8,1 - start with SYS 8192 - oh yes, this is for PAL-VIC only. Actually I only tested it in VICE and would love feedback if it works on a REAL VIC.

http://www.tokra.de/vic/rasterhires.prg
http://www.tokra.de/vic/rasterhires.asm

http://www.tokra.de/vic/hiresdemo.prg

The code below was done with the VIC 20 Prog Gen. Does anyone know how to do a sta $00ec,x without having it translating to a zeropage sta $ec,x ? Any other comments/improvments on the code are welcome, I'm just starting to re-learn 6502 assembler.

Code: Select all

; Raster-Split-Hires - True 160 * 240 pixels
; only for PAL-VIC 20
; Video-Ram Top: 4096-4351 = 240 double height chars
; Char-Ram  Top: 4352-8191 = 3840 Byte = 30720 pixels(standard 160*192 res)
; Char-Ram Bottom1: 0-239 = 240 Byte = 1920 pixels
; Video-Ram Bottom: 240-299 = 60 double height chars
; Char-Ram Bottom2: 304-1023 = 720 Byte = 5760 pixels
*=$2000
	sei		; Set Interrupt Flag
	ldy	#$10
	ldx	#$00
	txa
clear1
	sta	$1000,x
	inx
	bne	clear1
	inc	clear1+2
	dey
	bne	clear1
	lda	#$10
	sta	clear1+2
	ldy	#$04
	lda	#$00
clear2
	sta	$0300,x
	sta	$9700,x
	inx
	bne	clear2
	dec	clear2+2
	dec	clear2+5
	dey
	bne	clear2
	lda	#$03
	sta	clear2+2
	lda	#$97
	sta	clear2+5
charmap1
	ldx	#$10
loop1	txa
	sta	$0ff0,x
	inx
	bne	loop1
charmap2	txa
	sta	$f0,x
	inx
	cpx	#$0f
	bne	charmap2
	ldx	#$13
loop2	txa
	byte	$9d ; sta $00ec,x (since x = $13 from $00ff)
	byte	$ec
	byte	$00
	inx
	cpx	#$40
	bne	loop2
show
	lda	#$0e
	sta	$9000
	lda	#$19
	sta	$9001
	lda	#$1f
	sta	$9003
	ldx	#$14
	stx	$9002
loop	ldy	#$cc
	sty	$9005
	ldy	#$88
	lda	#$79
raster	cmp	$9004
	bne	raster
	sty	$9005
	lda	#$91
raster2	cmp	$9004
	bne	raster2
	beq	loop
User avatar
Mike
Herr VC
Posts: 4831
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

If you can live with a tile-based graphic display, something like 208x256 is possible, as shown in Kananga's vim VIC GUI (which was inspired by Hyper-Graphics in a 64'er special issue, FYI). Of course, not every pixel can be freely set, so this isn't a bitmap.

For a bitmapped display, however weird the address function, your idea of 160x240 seems to be the highest resolution one can get from a unmodded VIC. However ...
tokra wrote:I realize this mode is probably not good for anything else than showing pictures.
... this pretty much sums it up, methinks.

You include the vector table at $0300 ff., especially the NMI vector at ($0318), so pressing the RESTORE key crashes the VIC. And you can neither do anything anymore with BASIC or KERNAL, as all system data is overwritten. :(
I've always been interested in maxing out the VIC-20 graphic powers.
It's not only a matter of putting a maximum number of pixels on-screen. Providing a dynamic display, and interoperability to BASIC, and KERNAL are also important.
Actually I only tested it in VICE and would love feedback if it works on a REAL VIC.
While I, ATM, cannot test on a real VIC-20 either, the lastest version 2.2 of VICE is pretty accurate in that regard.
Kananga
Vic 20 Afficionado
Posts: 317
Joined: Mon Mar 08, 2010 2:11 pm

Post by Kananga »

What is the maximum resolution that is usable on a real NTSC-Vic-20?
In Vice it is possible to set something like 24x30 characters (i.e. 192x240), but is it visible on NTSC TVs/Monitors?
Buy the new Bug-Wizard, the first 100 bugs are free!
User avatar
Mike
Herr VC
Posts: 4831
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Carlsson has posted some images of a 22, and 24 column screen of an NTSC VIC here:

http://www.sleepingelephant.com/ipw-web ... 61&start=9

Looks like 24 columns are already at the limit, and maybe 2 extra lines at top & bottom, i.e. 27 lines.
Post Reply