Jump to content
Rybags

VBXE - programming, examples, programming queries

Recommended Posts

Just started this thread to help keep the other VBXE threads free.

 

I started playing about last night - a lot to get a grasp on.

 

Initial playing about has been with the memory control and colour map features via XDLs. Of course you need to know the memory control stuff before you can do anything useful with the other features of VBXE.

 

Here's my first example program in BASIC. It creates an XDL which sets up a colour map which covers the top part of the screen. The program takes a minute or so to run - the loop which sets the attributes is a bit slow. Once the program has run once you can change line 176 so the GOTO is executed to skip that part.

 

post-7804-125885775613_thumb.jpg

 

Downloadable BASIC program (unzip to a directory mounted as an APE ImageDrive): colmap2.zip

 

10 V=214*256
20 MEMCONTROL=V+94
30 MEMBANK=V+95
40 POKE MEMCONTROL,128+8:REM $8000, 4K, CPU ACCESS
50 POKE MEMBANK,128+0:REM BANK 0
60 XDL=32768
70 POKE XDL,40:REM COLORMAP ON, REPEAT
80 POKE XDL+1,14:REM SET MAP ADR/STEP, SET MAP PARAMETERS, SET ATTRIBUTES
90 POKE XDL+2,7:REM REPEAT 7 MORE
100 POKE XDL+3,0:POKE XDL+4,16:POKE XDL+5,0:REM ADR $4000 IN VBXE FOR COLORMAP
110 POKE XDL+6,160:POKE XDL+7,0:REM STEP BY 160 BYTES
115 POKE XDL+8,0:POKE XDL+9,0:POKE XDL+10,7:POKE XDL+11,7:REM H/VSCROL, MAP CELL SIZE
117 POKE XDL+12,2:POKE XDL+13,255:REM NORMAL WIDTH, OVERLAY PRIORITY>GTIA
120 FOR A=XDL+14 TO XDL+14+3*10 STEP 3
130 POKE A,40:REM COLORMAP/REPEAT
140 POKE A+1,0:POKE A+2,7:REM REPEAT 7
150 NEXT A
160 POKE A,0:POKE A+1,128:REM JVB
170 POKE MEMBANK,128+1:REM BANK 1
175 BC=0
176 REM GOTO 300
180 FOR Y=0 TO 12:CS=32768+Y*160:LUM=6:LS=1
185 FOR X=0 TO 39
190 C=CS+X*4
200 POKE C,0:REM PF0
210 POKE C+1,LUM:REM PF1
215 LUM=LUM+LS:IF LUM=15 OR LUM=6 THEN LS=-LS
220 POKE C+2,BC:BC=BC+16:IF BC>255 THEN BC=BC-255
225 POKE C+3,0
230 NEXT X
240 NEXT Y
300 POKE V+65,0:POKE V+66,0:POKE V+67,0:REM SET XDL ADDRESS
310 POKE V+64,3:REM ENABLE XDL, EXT COLOR

 

Quick hint - when playing around, it's fairly easy to get a screen that's near unreadable. Rather than pressing RESET to clear everything up, just set VIDEO_CONTROL to 00 or 02 to disable XLD processing. Value 02 disables XDL, but retains the extended colour ability, e.g. independant PF1/PF2 colours in hires.

  • Like 1

Share this post


Link to post
Share on other sites

Memory Control and BASIC (and other programming languages for that matter)

 

One of the problems existing since the 130XE came out is that in standard BASIC, using the RAM window from $4000-$7FFF is problematic in that if your program happens to grow such that it enters that window, then using bank-switching is hazardous at best.

 

In the example above, I've used MEMAC_A. VBXE retains the legacy feature of windowing it's RAM via MEMAC_B which performs banking in a similar fashion to the 130XE, ie the window is fixed at $4000-$7FFF and you can select 16K to view at a time.

 

MEMAC_A is much more versatile. In the example program, I've defined a 4K window which exists at $8000-$9000.

That allows scope for a large(ish) Basic program to exist, and also not have any problems with the Antic screen RAM being compromised.

Of course, a hires bitmap mode would be compromised.

The other thing is - we can set CPU and/or ANTIC access to be to main memory or VBXE RAM. But still the consideration exists that the CPU still needs acccess to main memory to draw to the screen.

Obviously the solution is that we should only switch on our window to VBXE RAM when we need to.

 

MEMAC_CONTROL resides at $D65E (for this discussion, assume we have VBXE using Page $D6)

The top 4 bits control the start address of the window, so any $1000 byte boundary is valid here - of course taking into account that any ROM or other RAM expansion will take precedence.

Bits 3 and 2 control whether the CPU and ANTIC access normal or VBXE RAM within the defined window.

Bits 1 and 0 control the window size, which can be 4, 8, 16 or 32K

 

As per the docs, it is best to setup MEMAC_CONTROL early on, then leave it and use MEMAC_BANK_SEL for controlling the window one set up.

 

MEMAC_BANK_SEL ($D65F) controls which area within VBXE RAM our window is accessing. The high bit should be set to enable the VBXE Memory Access. Once set, CPU and ANTIC access will be as per the bitsettings (3,2) of MEMAC_CONTROL.

 

The bank number we are accessing at any given time is stored right-justified in bits 6-0.

Share this post


Link to post
Share on other sites

to make it fully compatible with vbxe you should extend it by vbxe detection

this could be done using VBXE_BASE variable and simple peek and poke check

 

as for quickly restoring default screen colors you need to write any value above standard GTIA registers

ie poke 53310,0 should be pretty universal ($D01E + $20 - HITCLR shadow) - this will reset fx core registers to their default values

remember that altering default palette (pallette 0) cannot be undone - you need to reload it by hand, or reload core accessing VBXE controller, but this is beyond scope of this thread

Share this post


Link to post
Share on other sites

OK... first tryout of a fullscreen bitmap overlay. These are easy to setup, only a 10 byte XDL needed for this one.

 

Some corruption at top of pic... looks like I didn't strip the bitmap from the file quite right. Also strange blue bits in the trees, don't know how I managed that.

 

Oh well, nice and all. This stuff really shows up the weakness of the default disk drive speed.

 

Next up, might try a massive pic and do some scrolling around it.

 

post-7804-125886562023_thumb.jpg

 

Original source I used - a photo I took of the Australian Museum (from about 400 metres higher up). Colours are somewhat dull... it was a cloudy day.

 

eg1.bmp

Share this post


Link to post
Share on other sites

#VBXE 1.zip

 

Zipped ATR with the program for that picture (LOAD "D:SHOWPIC.BAS") - corruption included... fix it later.

 

Change the filespec in line 20 to point to the disk drive you're using before running the program.

 

It loads the palette a little slowly, but burst reads the picture, so the thing doesn't take too long.

 

It also has PF1 with higher priority, so once the program has run the picture will behave like wallpaper.

Share this post


Link to post
Share on other sites

Normal

post-7804-12588848051_thumb.jpg

 

Interlaced

post-7804-125888483027_thumb.jpg

 

First examples of full-fledged Interlaced VBXE pic. Camera shot doesn't really show the difference accurately, but trust me that those jaggies are substantially reduced compared to normal 240 pixel high rez.

 

So, we effectively have here a 320h x 480v display in 256 colours.

 

No executable yet... I knocked this together as a rough & ready thing. Picture data on it's own would be ~ 153K if it was a full 320x480.

 

I might try doing a multi-stage loader then run it through the compressor... something like 50-70K for such big pics would be much more acceptable than 150K+

Share this post


Link to post
Share on other sites

Gary: You definitly need a hard disk ;) Then compressing thing will mean literally slowing things down, but You could read Simonl blog entry, there is a VBXE graphics format proposal that is verry elastics and can accept up to 1024 simultanously on screen ;)

oh, btw - try to get some focus out of your 1084 ;) i would replace CRT unit with VGA one (0.27mm pitch per pixel compater to 0.85mm pitch of original CRT) but this is a bit complicated ;)

Anyways, if You open it, there are two knobs on black thing with thick red wire comming to the CRT glass, its called flyback transformer

lower knob is for Screen (overall brightness) and shouldn't be touched (up to 450V there)

higher is Focus - up to 2.5kV there, so use flat head scewdriver to set it

it pretty safe if everything is in good shape, but i would always undertake some precautions to avoid zapping :) not a pleasant experience ;)

 

Haeven: I'll send Your Atari in monday (tomorrow), we settle the shipment cost later

 

Mimo: soon ;)

Share this post


Link to post
Share on other sites

I'm fairly happy with the 1084 display... kinda missed the soft-focus of CRTs as I've been using LCD on the main machine for probably 5 years now.

 

I'm banging up the loader code for this Millenium Falcon pic - I don't think I'll have it finished until this time tomorrow at least - gotta try to sleep in 2 hours or so, then probably will only get a few hours playtime tomorrow.

 

With luck the compression utility might shrink the thing down somewhat... I guess in time we'll have a format worked out that's compact and reasonably quick.

 

If you talk with Simonl, just be sure to mention to cater for the double-sized pictures.

 

With VBXE anyway, it's just so much easier. Just toggle between 2 XDLs of about 10 bytes each, rather than the old way of needing huge amounts of LMS DList instructions if you wanted your interlaced picture stored in linear fashion.

 

XDL - just set the skip to 640 bytes, and offset the screen origin by 320 on the second field.

Share this post


Link to post
Share on other sites

Was just thinking earlier on... the colourmap function could produce some awesome zoom effects.

Has anyone done a demo as such yet?

Share this post


Link to post
Share on other sites

elaborate a bit on this ;)

how you could use color map for zoom?

there is plasma based on cmap, but thats it for now

TeBe is using cmap for most of his work, but for zoom?

Share this post


Link to post
Share on other sites

Since we have control over cell size (h/v pixels per cell), and other stuff like scrolling and step rate per row, it should mean you could just use it to represent an image, then zoom by changing size from 8x8 7x7 etc down to 2x2 then 1x1.

Share this post


Link to post
Share on other sites

sure, but still no fixed point accuracy, it goes the same for blitter, although some fixed point tricks are possible, just memory consuming :(

Share this post


Link to post
Share on other sites

My attempt... see this youtube link :

 

Despitefully youtube's compression makes everything blurry.... :roll: the cars you see on display are the vbxe overlay :)

Share this post


Link to post
Share on other sites

Rybags: Nice you got the 320x480i res working, looking forward to check it out here!

 

Thelen: Thats a cool 'attempt' (its already more than an attempt!), i hope it gets a complete game!

 

Candle: Kudos to the man who made VBXE2 available to the public a8 scene!ico_notworthy.gif

 

 

Have fun,

Beetle

Share this post


Link to post
Share on other sites

Just wondering... is there a way to easily generate the default Palette via a formula so it can easily be restored?

 

Done part of my Interlaced Pic loader... doubt I'll get finished today.

 

Really want to start playing with this zoomer... it'll be expensive on the RAM usage though as colourmap is 4 times that of a normal display if doing 1x1 pixels.

But I reckon it'll be able to do good effects, even from BASIC.

Share this post


Link to post
Share on other sites

I don't.

 

But, you should have the assumption that something/someone has messed it up before you, so it would be handy to be able to quickly restore it.

Share this post


Link to post
Share on other sites

palette is included in vbxe pack source files, so you could always write small utility to reset it

but fastes way would be to cycle the power ;)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...