Jump to content
IGNORED

VBXE tutorials - summary of all VBXE topics


Recommended Posts

As requested, i have created a generic thread to discuss the VBXE and to summarize all of its topic. 

there are few other in-depth threads that cover specific areas of the VBXE so we do not want to interfere with those discussions. 

 

special thanks to everyone who chime in and help creating these tutorials.
as i consider myself as a VBXE beginner this tutorial will be edit over time, where more and more things will be added until we will create the ultimate user guide (a big challenge by itself).

 

Special thanks to @Stephen , @Mark2008 and @Thelen who did tremendous work so far and to all other atarians who chime in giving more broader picture on the VBXE. 

 

the first response to this thread will be my summary so please be patient :)  

Edited by Yaron Nir
  • Like 3
  • Thanks 2
Link to comment
Share on other sites

VBXE Overview

 

Revision History 

  • v.0.1 - Jan, 17th 2023 - document created 
  • v.0.2 - Jan, 17th 2023 - fix formatting 
  • v.0.3 - Jan, 19th 2023 - added step by step, added memory access sections, fixed formatting issues
  • v.0.4 - Jan, 20th 2023 - added code definition for the XDL registers
  • v.0.5 - Jan, 24th 2023 - added MADs examples for XDLC controls and chose better phrases for some of the definitions
  • v.0.6 - Jan, 24th 2023 - added XDLC second byte controls explanation

     

What is VBXE?

Video Board XE (VBXE) in an Atari 8bit machine hardware add on board which work as a is a piggyback chip in the ANTIC socket. It will work in Any XE (130XE, 65XE, 800XE, XEGS) Atari 8 bit machine and will provide RGB video out for whatever machine you install it in.

VBXE device info includes:

  • RGB output providing crisp clear picture using LCD TV or RGB monitor

  • up to 1024 colors on screen from 21 bit palette

  • graphics resolution up to 640x480i (640x240p) in 64 colours, 320x240p in 1024 colours, and 160x240p in 1024

  • true 80 char mode for text display

  • blitter with 7 modes of operations capable of zooming displayed data, transparency, collision detection and many other features

  • full downward compatible with GTIA chip

 

What are some of the VBXE use cases?

Developers use VBXE to enhance their graphics in their programs. There are several nice demos out there which present good graphics with nice resolution and nice colors. There are also few games that were developed using this board capabilities (not many games though, and this is my main purpose of this tutorial, so anyone can develop VBXE new games and ports from other machines and arcade).

What I've noticed is (and that is not set in stone, but my own opinion) that VBXE game developers, uses Antic mode 4 (char mode) to draw their game's background and on-top of that use a VBXE layer to draw the sprites. if i am not mistaken, this is how castelvania game works, developed by @Thelen, but i guess only him can confirm :) 

 

How to configure VBXE with your Altirra emulator

In your altirra, choose the 'System menu' in the menu bar, and select 'Configure system'

image.thumb.png.67a8e153f01276da45d843ede7f5b674.png

in the configure system options, search down for the 'Peripherals' and select 'Devices'

image.thumb.png.eba48032b0cc9bdf73e965dec3c0645f.png

On the right side, click the 'add' button to add a new device. search for 'VideoBoard XE (VBXE)' and select to add it.

image.thumb.png.4e0fbeac4a43af0a860e1acd19a3ed3b.png 

Select the address you wish your VBXE will reside on (either $D600 or $D700). you can just leave the default as-is and click 'OK'.

image.png.bde2889ed04c5a367f3ebc125621e8b1.png

You're all set. just make sure the VBXE was added to your devices list

image.png.b394f2e6685b8d5a011a6f4b101eb8b4.png

 

VBXE detection

As the first step when writing VBXE program, you must ensure the VBXE was installed successfully on your machine.
In order to do that you peek and poke VBXE memory area and check the results. 

you need to do 2 checks: one for base location $D600 and one for base location $D700. if both fails, it means there is no VBXE installed and you can exit your app as there is no reason to continue.
if $D600 check succeeds, you set your VBXE base address to $D600, if it fails you continue to check address $D700.

if $D700 check succeeds, you set your VBXE base address to $D700, if it fails, you exit your program.

in the step by step section below, you can find a code example on how to detect VBXE.


VBXE memory layout address space and banks

  • The VBXE memory size is 512KB.
  • The VBXE memory address space is between $000000 and $7FFFFF
  • The VBXE memory address is being categorized via banks
  • The VBXE bank size is defined by dividing 512KB with the size we choose for the VBXE window (that 'window' will be discussed below). For example, if we choose the VBXE window size to be 4K then each bank will be 512/4 = 128KB. If we choose the window size to be 8K then each bank will be 512/8 = 64KB etc....

 


VBXE components and memory layout consideration 


XDL

The extended display list. similar to the ANTIC display list, the XDL defines the screen type.

Could be placed anywhere in the VBXE address space but common practice puts the XDL in the the first bank (bank0) starting at VBXE memory $000000. The XDL can be of any size (with the limit of 4K/$1000). XDL size commonly used is 22 bytes but it can vary from few bytes to 5.2KB (22*240 - max of 240 scanlines). It mostly depend on type of screen you wish to create using the VBXE.
Will be discussed more in details below.


Blitter

The Blitter built into the VBXE core allows you to fast copy and fill the virtual RAM areas of any size.

The Blitter is controlled by the BlitterList which is a sequence of data loaded into the virtual RAM by the Atari CPU. The BlitterList consists of one or more BCBs (Blitter Control Blocks). The BCB is a set of information for the Blitter. Each BCB defines one blitter operation. A BCB is 21 bytes long. 


Sprite sheet

Holds the width and height size of the sprite sheet for several sprite frames. For example, 5 sprite frames with the size of 12 by 40. you will normally copy your sprites from the sprite sheet to the VBXE screen.

 

Screen ram

The screen memory address space. you should consider your screen memory based on the screen resolution and color you select. the screen memory address space should have a read and write access.

 

Buffers
Used for any RAM storage.

 

Window

The one and only way to communicate with the VBXE is through the VBXE window. The VBXE window must be aligned to a $1000 memory address. The VBXE window has 2 methods of access:
A user configurable size (MEMAC-A).
A pre-defined size (MEMAC-B).

MEMAC-A can be configured to any of the sizes 4KB, 8KB, 16KB and 32KB and could be anywhere in the VBXE address space. MEMAC-B uses a pre-defined size of 16KB and reside on the RAM location      $4000-$7FFF

 

Overlay modes

These are the screen modes you will use. for screen type there is either graphics type or text type. for resolution there are 3 horizontal modes: LR (Low resolution), SR (Standard resolution) and HR (High resolution). The SR mode is a pixel screen mode that can display 256/320/336 pixels in 256 colors per a scanline. The LR mode is a pixel screen mode that can display 128/160/168 pixels in 256 colors per a scanline. The HR mode is a pixel screen mode that can display 512/640/672 pixels in 16 colors. The vertical mode of the screen is defined by the XDL structure. 

 

The XDL

The XDL (eXtended Display List) is a list of commands that controls the display of the VBXE. it is similar to the ANTIC display list. The XDL is loaded to the VBXE memory using MEMAC registers and can be loaded to any location inside the 512KB VBXE virtual RAM. There are no limitations on the XDL’s size, and its structure is vertical.

 

After you copy the XDL into the VBXE memory you need to point VBXE address of the XDL to that memory location using the XDL_ADR0, XDL_ADR1, XDL_ADR2 registers. 

 

The VBXE will start processing the XDL once the bit XDL_ENALBED will be set to 1 in the VIDEO_CONTROL.  setting 0 for this bit in the VIDEO_CONTROL will disable the XDL. it is recommended to disable the XDL at the beginning of the program , before you initialize the VBXE. it is similar to turning off ANTIC display and turning it on once screen was initialized and ready.

 

The XDL structure is comprised from XDLC (XDL Control) which tells the type and nature (control) of the VBXE screen we want to use and an additional data to support the controls.

An example of XDL structure can look like this:

XDLC (2 bytes)
additional data (0-20 bytes)
XDLC (2 bytes)
additional data (0-20 bytes)
...
...
XDLC with the XDLC_END marker (2 bytes)
additional data (0-20 bytes)

 

The XDLC is 2 bytes long (word) and it describes the controls the screen would have.

 

XDLC first byte

The first byte of the XDLC is comprised out of the following bits: 
 

1. bit 0 - XDLC_TMON, Overlay text mode

2. bit 1 - XDLC_GMON, Overlay graphics mode

3. bit 2 - XDLC_OVOFF, disable overlay  

4. bit 3 - XDLC_MAPON, enable color attributes

5. bit 4 - XDLC_MAPOFF, disable color attributes

6. bit 5 - XDLC_RPTL, repeat for the next x scanlines

7. bit 6 - XDLC_OVADR, set the address of the Overlay display memory (screen memory) and the
           step of the overlay display (how many pixels per line) 

8. bit 7 - XDLC_OVSCRL, set scrolling values for the text mode

text mode, graphics mode, disable overlay and enable/disable color attributes are XDLC controls that do not have additional data. 

repeat, overlay address and overlay scroll are XDLC control that do have additional data.

 

XDLC_RPTL

With this control, you need to specify the number of scanline that will be exactly the same as you have defined (with the same controls).

A MADS assembly example of the control used with additional data, disable the overlay for the next 23 scanlines ($17):

XDL 
   dta XDLC_OVOFF | XDLC_RPTL
   dta $17

 

XDLC_OVADR

With this control, you need to specify 2 addresses: the screen memory, and the screen step for each line. The screen memory is 3 bytes long (the address goes from least significant byte to the more significant byte), the step is 2 bytes long (and goes also from LSB TO MSB).

for example, if our screen memory is at location $070800 (in the VBXE 512KB memory space), the 3 bytes will look like this: ADR0=$00,ADR1=$08,ADR2=$07

 

A MADS assembly example of the control used with additional data, setting screen memory address to $070800 and setting step to 320 ($140) pixels per scanline 

XDL 
   dta XDLC_GMON | XDLC_RPTL | XDLC_OVADR
   dta $BF
   dta $00
   dta $08
   dta $07
   dta $40
   dta $01

repeat 192 ($BF) times, set the address to $070800 and set step to 320 ($140) 

 

XDLC_OVSCRL

With this control, you need to specify 2 bytes: one for HSCROLL and one for VSCROLL.

as this control is used with text mode where each character is 8x8 pixels, the first byte (HSCROLL) can use bits 1-7 which indicates the number of pixels scrolled to the left. 0 - means no scroll.

the second byte (VSCROLL) works exactly the same but scrolls pixels up.

By default, at the top of the screen, hscroll = vscroll = 0. Scrolling values can be changed in every scanline. Setting the XDLC_OVSCRL does not enable the scroll (which is always on), but only sets the VALUES OF THE SCROLLING REGISTERS. These values will be used for every consecutive scanline until the XDL changes them. The horizontal scrolling unit is 1 pixel VBXE hires (or 0.5 pixel GR.8).

 

A MADS assembly example of the control used with additional data, scrolling 1 pixel to the left and no vertical scroll 

XDL 
   dta XDLC_TMON | XDLC_RPTL | XDLC_OVSCRL
   dta $BF
   dta $01
   dta $00

Define text graphics mode for 191 scanlines, with horizontal scroll with 1 pixel to the left

and no vertical scroll settings. 

 

 

XDLC second byte

The second byte of the XDLC is comprised out of the following bits: 

1. bit 0 - XDLC_CHBASE, sets the font (text mode)

2. bit 1 - XDLC_MAPADR, sets the address and step of the colour attribute map

3. bit 2 - XDLC_MAPPAR, sets the scrolling values, width and height of a field in the colour attribute map

4. bit 3 - XDLC_ATT, sets the display size(Narrow=256 pixels, Normal=320 pixels, Wide = 336 pixels)
                     the Overlay priority to the ANTIC display and the Overlay color modification

5. bit 4 - XDLC_HR, enables the high resolution mode, works only with graphics mode, 640 pixels with 16 colors supported 

6. bit 5 - XDLC_LR, enables the low resolution mode, works only with graphics mode, 160 pixels with 256 colors supported 

7. bit 6 - reserved (not is use)

8. bit 7 - XDLC_END, ends the XDL and wait for VSYNC to occur

 

All the XDLC controls in the second byte takes additional data.

 

bit 0 - XDLC_CHBASE

With this control, you need to specify 1 byte of the font address. The font should contain 256 characters, 8x8 pixels each and should be loaded into the VBXE memory. the font address must be aligned to 2K address space boundary. max of 256 fonts can be uploaded to the VBXE 512KB virtual RAM. the fonts are stored in memory using the MEMAC registers.

 

Here is a MADs assembly example of font:

[TBD]

 

bit 1 - XDLC_MAPADR

With this control, you need to specify 2 addresses: the address for the color attribute map (3 bytes) , and the step for each line (2 bytes).

The color attribute map may start at any location in the VBXE memory. 

 

Here is a MADs assembly example of font:

[TBD]

 

bit 2 - XDLC_MAPPAR

With this control, you set 4 bytes: scrolling values, width and height of a field in the color attribute map. the bytes order is as follows:

1. hscroll: 0 = line is not scrolled, 1..31 = line is scrolled X pixels to the left. 

2. vscroll: 0 = line is not scrolled, 1..31 = line is scrolled X pixels up.

3. widthThe width of the field in pixels, range is between 8 and 32 pixels (as in ANTIC GR.8)    

4. height: The height of the field in scanlines, range is between 1 and 32 lines

hscroll and vscroll for the map should never get greater than the respective values of width and height.

Default values (at the top of the screen) are: hscroll = vscroll = 0; height = width = 7; (the field size is 8x8) The field size and scrolling values may be changed in any scanline. The hscroll unit for the map is 1 pixel GR.8. Setting XDLC_MAPPAR does not enable the map to scroll (this function is always on), it only loads the scrolling registers. The values loaded will be used in consecutive scanlines until they are explicitly changed with XDL.

 

 Here is a MADs assembly example of font:

[TBD]

 

bit 3 - XDLC_ATT

With this control, you set 2 bytes: setting the display size (both Overlay and Color map) and Overlay priority to the ANTIC display. And Overlay color modification.

 

The first byte is comprised out of the following bits:

1. bit 0,1: OV_WIDTH, The Overlay width and attribute map width:
                                    00 = NARROW (256 pixels, as ANTIC narrow)
                                    01 = NORMAL  (320 pixels, as ANTIC normal)
                                    10 = WIDE      (336 pixels, as ANTIC wide. In this mode the display is 8 pixels

                                                            wider at both sides, than NORMAL)

                                    The default (at the top of the screen) width is NORMAL (320 pixels).

2. bit 2,3: not in use. 

3. bit 4,5XDL OV PALETTE, The palette for OVERLAY active from this screen line. By default, OVERLAY uses palette #1 from the top of the screen.

4. bit 6,7XDL PF PALETTE, The palette for PLAYFIELD and PMG active from this screen line. By default the PLAYFIELD and PMG use palette #0 from the top of the screen. 

 

if the attribute map is turned on, the palettes for OVERLAY and PLAYFIELD/PMG are selected by the corresponding attribute maps.

 

The second byte is comprised out of the following bits:

bits 0-7 - priority

1. bit 0 - Overlay window over PM0

2. bit 1 - Overlay window over PM1

3. bit 2 - Overlay window over PM2

4. bit 3 - Overlay window over PM3

5. bit 4 - Overlay window over PF0

6. bit 5 - Overlay window over PF1

7. bit 6 - Overlay window over PF2 and PF3

1. bit 7 - Overlay window over COLBK 

 

 Here is a MADs assembly example of XDLC_ATT for both first and second bytes:

XDL
	dta XDLC_GMON | XDLC_MAPOFF | XDLC_RPTL | XDLC_OVADR
	dta XDLC_ATT | XDLC_END
	dta .... ; here data for repeat and overlay addresses 
	.
	.
	.
	; first byte for XDLC_ATT
	dta XDLC_ATT_OV_WIDTH_NORMAL | XDLC_ATT_OV_PALETTE_10 | XDLC_ATT_PF_PALETTE_00 
	; second byte for XDLC_ATT
	dta XDLC_ATT_MAIN_PRIORITY_OVERLAY_PM0 | 
		XDLC_ATT_MAIN_PRIORITY_OVERLAY_PM1 | 
		XDLC_ATT_MAIN_PRIORITY_OVERLAY_PM2 |      
		XDLC_ATT_MAIN_PRIORITY_OVERLAY_PM3 |    
		XDLC_ATT_MAIN_PRIORITY_OVERLAY_PF0 |    
		XDLC_ATT_MAIN_PRIORITY_OVERLAY_PF1 |    
		XDLC_ATT_MAIN_PRIORITY_OVERLAY_PF2_PF3 |  
		XDLC_ATT_MAIN_PRIORITY_OVERLAY_COLBK    


;-----------------------------------------
; XDLC XDLC_ATT first byte attributes
; OV_WIDTH
XDLC_ATT_OV_WIDTH_NARROW equ %00000000 ; (256 pixels) bit 0,1=00
XDLC_ATT_OV_WIDTH_NORMAL equ %00000001 ; (320 pixels) bit 0,1=01
XDLC_ATT_OV_WIDTH_WIDE   equ %00000010 ; (336 pixels) bit 0,1=10
; XDL OV PALETTE
XDLC_ATT_OV_PALETTE_00   equ %00000000 ; bit 4,5=00
XDLC_ATT_OV_PALETTE_01   equ %00010000 ; bit 4,5=01
XDLC_ATT_OV_PALETTE_10   equ %00100000 ; bit 4,5=10
XDLC_ATT_OV_PALETTE_11   equ %00110000 ; bit 4,5=11
; XDL PF PALETTE
XDLC_ATT_PF_PALETTE_00   equ %00000000 ; bit 6,7=00
XDLC_ATT_PF_PALETTE_01   equ %01000000 ; bit 6,7=01
XDLC_ATT_PF_PALETTE_10   equ %10000000 ; bit 6,7=10
XDLC_ATT_PF_PALETTE_11   equ %11000000 ; bit 6,7=11
;-----------------------------------------
; XDLC XDLC_ATT second byte attributes
; MAIN_PRIORITY
XDLC_ATT_MAIN_PRIORITY_OVERLAY_PM0      equ %00000001 
XDLC_ATT_MAIN_PRIORITY_OVERLAY_PM1      equ %00000010 
XDLC_ATT_MAIN_PRIORITY_OVERLAY_PM2      equ %00000100 
XDLC_ATT_MAIN_PRIORITY_OVERLAY_PM3      equ %00001000 
XDLC_ATT_MAIN_PRIORITY_OVERLAY_PF0      equ %00010000 
XDLC_ATT_MAIN_PRIORITY_OVERLAY_PF1      equ %00100000 
XDLC_ATT_MAIN_PRIORITY_OVERLAY_PF2_PF3  equ %01000000 
XDLC_ATT_MAIN_PRIORITY_OVERLAY_COLBK    equ %10000000 

 

bit 4 - XDLC_HR

With this control, you enable hi resolution pixel mode. This bit is only taken into account, when XDLC_GMON is 1 (Graphics mode). The HR mode (or hi-res) has a resolution of 640 pixels horizontally for the NORMAL display width and can display 16 colors, from $00 to $0F, in the current Overlay palette.
 

 

 Here is a MADs assembly example of XDLC_HR:

TBD

 

 bit 5 - XDLC_LR

With this control, you enable low resolution pixel mode. This bit is only taken into account, when XDLC_GMON is 1 (Graphics mode). The HR mode (or hi-res) has a resolution of 160 pixels horizontally for the NORMAL display width. The number of displayable colors is the same as in the standard display mode (256).

 

 Here is a MADs assembly example of XDLC_LR:

TBD

 

 

 bit 6 - not in used

Skipped

 

 

bit 7 - XDLC_END

With this control, you end the XDL. This is the last XDL record. it waits for VBLANK.

 

 Here is a MADs assembly example of XDLC_END:

XDL
	dta XDLC_GMON | XDLC_MAPOFF | XDLC_RPTL | XDLC_OVADR
	dta XDLC_ATT  | XDLC_END
	dta .....

 

 

Below are all XDLC controls defined, in MADs assembly:

;-----------------------------------------
; XDLC controls definition

;-----------------------------------------
; first byte 
XDLC_TMON   equ %00000001 ; Overlay text mode
XDLC_GMON   equ %00000010 ; Overlay graphics mode
XDLC_OVOFF  equ %00000100 ; disable overlay  
XDLC_MAPON  equ %00001000 ; enable color attributes
XDLC_MAPOFF equ %00010000 ; disavble color attributes
XDLC_RPTL   equ %00100000 ; repeat for the next x scanlines
XDLC_OVADR  equ %01000000 ; set the address of the Overlay display memory (screen memory) and the step of the overlay display (how many pixels per line) 
XDLC_OVSCRL equ %10000000 ; set scrolling values for the text mode
;-----------------------------------------
; second byte 
XDLC_CHBASE equ %00000001 ; sets the font (text mode)
XDLC_MAPADR equ %00000010 ; sets the address and step of the colour attribute map
XDLC_MAPPAR equ %00000100 ; sets the scrolling values, width and height of a field in the colour attribute map
XDLC_ATT    equ %00001000 ; sets the display size(Narrow=256 pixels, Normal=320 pixels, Wide = 336 pixels) the Overlay priority to the ANTIC display and the Overlay color modification
XDLC_HR     equ %00010000 ; enables the high resolution mode, works only with graphics mode, 640 pixels with 16 colors supported 
XDLC_LR     equ %00100000 ; enables the low resolution mode, works only with graphics mode, 160 pixels with 256 colors supported 
; bit 6 in second byte is not in use (reserved)
XDLC_END    equ %10000000 ; ends the XDL and wait for VSYNC to occur


;-----------------------------------------
; XDLC XDLC_ATT first byte attributes
; OV_WIDTH
XDLC_ATT_OV_WIDTH_NARROW equ %00000000 ; bit 0,1=00(256 pixels)
XDLC_ATT_OV_WIDTH_NORMAL equ %00000001 ; bit 0,1=01(320 pixels)
XDLC_ATT_OV_WIDTH_WIDE   equ %00000010 ; bit 0,1=10(336 pixels)
; XDL OV PALETTE
XDLC_ATT_OV_PALETTE_00   equ %00000000 ; bit 4,5=00
XDLC_ATT_OV_PALETTE_01   equ %00010000 ; bit 4,5=01
XDLC_ATT_OV_PALETTE_10   equ %00100000 ; bit 4,5=10
XDLC_ATT_OV_PALETTE_11   equ %00110000 ; bit 4,5=11
; XDL PF PALETTE
XDLC_ATT_PF_PALETTE_00   equ %00000000 ; bit 6,7=00
XDLC_ATT_PF_PALETTE_01   equ %01000000 ; bit 6,7=01
XDLC_ATT_PF_PALETTE_10   equ %10000000 ; bit 6,7=10
XDLC_ATT_PF_PALETTE_11   equ %11000000 ; bit 6,7=11
;-----------------------------------------
; XDLC XDLC_ATT second byte attributes
; MAIN_PRIORITY
XDLC_ATT_MAIN_PRIORITY_OVERLAY_PM0      equ %00000001 
XDLC_ATT_MAIN_PRIORITY_OVERLAY_PM1      equ %00000010 
XDLC_ATT_MAIN_PRIORITY_OVERLAY_PM2      equ %00000100 
XDLC_ATT_MAIN_PRIORITY_OVERLAY_PM3      equ %00001000 
XDLC_ATT_MAIN_PRIORITY_OVERLAY_PF0      equ %00010000 
XDLC_ATT_MAIN_PRIORITY_OVERLAY_PF1      equ %00100000 
XDLC_ATT_MAIN_PRIORITY_OVERLAY_PF2_PF3  equ %01000000 
XDLC_ATT_MAIN_PRIORITY_OVERLAY_COLBK    equ %10000000 
XDLC_ATT_MAIN_PRIORITY_OVERLAY_ALL      equ %11111111%

 

You can use the operator OR (|) between the XDLC controls. 

 

 

The VBXE Window methods (MEMAC-A/MEMAC-B)

The access to the VBXE is mostly done by defining the memory of the VBXE window. 

There are 2 methods to define the VBXE window:
 

Method-1: MEMAC-A

In MEMAC-A method, the developer sets the VBXE window address. This address can be placed arbitrary inside the 6502 address space and must be aligned to $1000. so it can be from $0000 to $F000. the size of the window is also configured by the developer and it could be one of the following:
 

1. 4KB ($1000)

2. 8KB ($2000)

3. 16KB ($4000)

4. 32KB ($8000)

 

For example, as a developer I can use MEMAC-A method and define my VBXE window memory address to be $4000 and the size of my window would be 4KB.

 

A MEMAC-A window type can be one of the following:

1. off (standard RAM will be used rather than virtual RAM).

2. on for CPU (CPU sees the virtual RAM, ANTIC sees the standard RAM)

3. on for ANTIC (ANTIC sees the virtual RAM, CPU sees the standard RAM)

4. on for both CPU & ANTIC (both see virtual RAM)

 

MEMAC-A is controlled by 2 registers:

1. MEMAC_CONTROL (MEMC) - this register selects the base address of 
                           the VBXE window and also the window size. 

2. MEMAC_BANK_SEL (MEMS) - this register decides which part of the virtual RAM is available.
                            what it does is make a specific VRAM bank available. 

 

MEMC

You should use the MEMAC_CONTROL (MEMC), to enable your VBXE window.

The MEMC is one byte and has the following bits:

1. bit 0,1 - r/w sets the window size 00=4KB, 01= 8KB, 10=16KB, 11=32KB  

2. bit 2 - r/w (0 only) , MAE - MEMAC ANTIC ENABLE - when set, MEMAC A window will be accessible by ANTIC. 

3. bit 3 - r/w (0 only), MCE - MEMAC CPU ENABLE - when set, MEMAC A window will be accessible by 6502.  

4. bit 4,5,6,7 - r/w, Base address of MEMAC

 

MEMS

You should use the MEMAC_BANK_SEL (MEMS), to select the virtual RAM bank number that will be mapped to the Atari address space.

The MEMS is one byte and has the following bits:

1. Bit 0-6 - Selects VRAM bank number that will be mapped into Atari address space. 

2. Bit 7MGE,  MEMAC GLOBAL ENABLE,  enables MAMAC-A window as
                         previously defined in MEMAC_CONTROL register.
                         This global enable bit allows to use MEMAC_CONTROL register as configuration only,                             so the programmer can set it once at the beginning of the code, and use only                                       MEMAC_BANK_SEL register during the run.

 

 

Method-2: MEMAC-B

In MEMAC-B method the VBXE window base address is already set to $4000 and the window size is set to be 16KB ($4000).

 

A MEMAC-B window type can be one of the following:

1. off (standard RAM will be used rather than virtual RAM).

2. on for CPU (CPU sees the virtual RAM, ANTIC sees the standard RAM)

3. on for ANTIC (ANTIC sees the virtual RAM, CPU sees the standard RAM)

4. on for both CPU & ANTIC (both see virtual RAM)

 

 MEMAC-B is controlled by the following registers:

MEMAC_B_CONTROL (MEMB) - This register selects the base address of 
                         the VBXE window and also the window size. 

 

MEMAC_B_CONTROL (MEMB)

MEMAC-B method window configuration and bank selection is done using the MEMAC_B_CONTROL register (MEMB). This register is write only, and it is a legacy from the previous VBXE core version.

The MEMB is one byte and has the following bits:

1. bit 0-4 - write only,  The virtual bank number (32 banks, 16kB each gives access to whole 512k of                      virtual RAM) 

2. bit 5 - Not in use

3. bit 6 - write only, MBAE - MEMAC-B ANTIC ENABLE, when set, ANTIC can access the virtual RAM.

4. bit 7 - write only, MBCE - MEMAC-B CPU ENABLE - when set, CPU can access VRAM 

 

 

The VBXE main registers ($40-$5F)

The base address of the VBXE is either $D600 or $D700, the following register addresses are offsets to the base address of the VBXE:
BASE+40: READ - core version. WRITE - video control 

BASE+41,42,43: READ - 41=minor version, 42,43=255. WRITE - 3 bytes , XDL address reversed (example: $07800 base_41=$00, base+42=$08, base+43=$07)

BASE+44: READ - result 255. WRITE - CSEL (color select)

BASE+45: READ - result 255. WRITE - PSEL (palette select)

BASE+46,47,48: READ - result 255. WRITE - RGB color (46=CR, 47=CG, 48=CB)

BASE+49: READ - result 255. WRITE - COLMASK (color mask)

BASE+4A: READ - COLDETECT (collision detection), WRITE - COLCLR (color clear) 

BASE+4B,4C,4D,4E,4F: READ - result 255. WRITE - N/A

BASE+50,51,52: READ - 50=BLT_COLLISION_CODE, 51,52=255. WRITE - BL_ADR0-BL_ADR2 (the blitter list address) 

BASE+53: READ - BLITTER_BUSY. WRITE - BLITTER_START

BASE+54: READ - IRQ_STATUS. WRITE - IRQ_CONTROL 

BASE+55,56,57,58: READ - result 255. WRITE - P0-P3 (overlay-playfield/pmg priority)

BASE+59,5A,5B,5C: READ - result 255. WRITE - N/A

BASE+5D: READ - result 255. WRITE - MEMAC_B_CONTROL

BASE+5E: READ - MEMAC_CONTROL. WRITE - MEMAC_CONTROL

BASE+5F: READ - MEMAC_BANK_SEL. WRITE - MEMAC_BANK_SEL

 

 Here is an example in MADs assembly for the VBXE main registers definition:
 

;-------------------------------------------
; VBXE main registers 
; some of the registeres can be r/w  
VBXE_VIDEO_CONTROL equ $40  ; write
VBXE_CORE_VERSION  equ $40  ; read

VBXE_XDL_ADR0      equ $41  ; write
VBXE_MINOR_BERSION equ $41  ; read

VBXE_XDL_ADR1 equ $42 ; write
VBXE_XDL_ADR2 equ $43 ; write 

VBXE_CSEL equ $44 ; write 
VBXE_PSEL equ $45 ; write 

VBXE_CR equ $46 ; write
VBXE_CG equ $47 ; write
VBXE_CB equ $48 ; write 

VBXE_COLMASK equ $49 ; write

VBXE_COLCLR    equ $4A ; write
VBXE_COLDETECT equ $4A ; read

; 4B-4F skipped, no use

VBXE_BL_ADR0            equ $50 ; write 
VBXE_BLT_COLLISION_CODE equ $50 ; read

VBXE_BL_ADR1            equ $51 ; write 
VBXE_BL_ADR2            equ $52 ; write 

VBXE_BLITTER_START equ $53 ; write
VBXE_BLITTER_BUSY  equ $53 ; read 

VBXE_IRQ_CONTROL equ $54 ; write 
VBXE_IRQ_STATUS  equ $54 ; read 

VBXE_P0 equ $55 ; write
VBXE_P1 equ $56 ; write
VBXE_P2 equ $57 ; write
VBXE_P3 equ $58 ; write

; 59-5C skipped, no use

VBXE_MEMAC_B_CONTROL equ $5D ; write 
VBXE_MEMAC_CTRL      equ $5E ; write & read

VBXE_MEM_BANK_SEL equ $5F ; write & read 
;-----------------------------------------

 

 

The VBXE implementation step by step

 

Step 1 - check if VBXE is installed

as mentioned above, you need to check if the board is installed on your machine or not (or the add-on was added in your emulator). in order to do that you poke the Major and Minor version in VBXE memory. please refer to the example code above if you wish to see how one can detect VBXE.

 The code below follows the VBXE manual document and check for core and minor versions of the VBXE to determine if it is installed. another method i have seen for checking if VBXE is installed is peeking & poking screen memory area of the VBXE and see results. this methods was used by @Mark2008 and can be found on his VBXE thread.

 

;*********************************************************
; proc name:  check_vbxe
; parameters: none
; output:     none
; purpose:    as VBXE board has few versions, we need to 
;             check if locations $D600 or $D700 are used
;             if not --> vbxe is not installed 
;*********************************************************
.proc check_vbxe 
    ; set $D600 into base address ZP variable 
    mwa #VBXE_D600_BASE VBXE_BASE_ADDR
    jsr detect_vbxe 
    beq exit_check
    ; if $D600 was not recognized, check $D700
    inc VBXE_BASE_ADDR+1
    jsr detect_vbxe 
    beq exit_check 
    ; no VBXE installed --> set to 0 
    mva #$00 VBXE_BASE_ADDR 

exit_check
    rts 
.endp ;check_vbxe

;*********************************************************
; proc name:  detect_vbxe
; parameters: none
; output:     none
; purpose:    check major (core) and minor versions at
;             locations base+40 and base+41 respectively 
;*********************************************************
.proc detect_vbxe
    ; check FX 1.xx (location $40)
    ldy #VBXE_CORE_VERSION
    lda (VBXE_BASE_ADDR),y
    cmp #$10    
    bne exit_detect 
    iny ; MINOR_VERSION (location $41)
    lda (VBXE_BASE_ADDR),y
    and #$70
    cmp #$20    
exit_detect 
    rts
.endp; detect_vbxe

;-------------------------------------------
; D600/D700
VBXE_D600_BASE equ $D600 
VBXE_CORE_VERSION equ $40
VBXE_BASE_ADDR equ $A0

 

after the call to the check_vbxe, the VBXE_BASE_ADDR will hold either $D600 or $D700 if the VBXE is installed, or $00 if the VBXE is not installed.

It is recommended to set the video control to 0 before you do anything else (it disables the XDL). 

here is a code to disable the XDL:

;*********************************************************
; proc name:  disable_xdl
; parameters: none
; output:     none
; purpose:    xdl_disabled (Disable vbxe display list)
;*********************************************************
.proc disable_xdl
    ldy #VIDEO_CONTROL  
    mva #0  (VBXE_BASE_ADDR),y  
.endp ; disable_xdl

;------------------------------
VIDEO_CONTROL equ $40

 

 

Step 2 - Enable the VBXE window (MEMAC-A/MEMAC-B)

 

 

Step 3 - Clear VBXE screen memory 

If your screen memory address for example, is set to be in the address $8000, it should be cleared first (zeroed out). so if you're using a screen memory of 4K then you need to zero the memory from $8000 to $8FFF. here is a code example on how to zero the screen memory using MADs assembly:

 

;*********************************************************
; proc name:  clear_vbxe_sceen_mem
; parameters: none
; output:     none
; purpose:    put zeros in screen memory starting at $8000
;             and has 4K ($1000) size
;*********************************************************
.proc clear_vbxe_sceen_mem
    ldx #0
    lda #0
loop
:16 sta VBXE_MEM_SCR+#*256,x
    Dex
    bne loop
    
    rts 
.endp ;clear_vbxe_sceen_mem

Looping 16 times 256 bytes = 4K and setting 0 in the screen memory address starting at $8000 

 

Step 4 - Load the Extended Display List  

Copy the XDL structure into VBXE memory.

 

Step 4.1 - define the XDL screen structure you wish to use

Here is a code example of XDL definition, creating a graphics screens with 320x192 resolution and setting the graphics screen address to $071000. the screen also defines a top margin area to avoid over-scan :

 

;--------------------------------------------------------------------------------
xdl 
	; create top screen margin
	; no overlay for 23 ($17) scanlines 
	dta XDLC_OVOFF | XDLC_RTPL
	; the next byte data is for the repeat attribute (23 scanlines)
	dta $17
	
	; create graphics mode, 320 ($140) pixel over 191 ($BF) scanlines
	; and set the graphics screen address to $071000  
	dta XDLC_GMON | XDLC_RTPL | XDLC_OVADR | XDLC_END
	
	; the next byte data is for the repeat attribute (191 scanlines)
	; the attribute for the XDLC_RTPL value 
	dta $BF
	
	; the next 3 bytes are the graphics memory address $071000 reversed 
	; the attributes for the XDLC_OVADR value 
	dta $00 
	dta $01
	dta $07
	
	; the next 2 bytes are the graphics step between each scanline 320 pixels ($140)
	; the attributes for the XDLC_OVADR value 
	dta $40
	dta $01 
;-------------------------------------------------------------------------------
xdl_length equ *-xdl

 

Now we need to copy the XDL definition to the VBXE memory.

Here is a sample code to do that:

[TBD]

 

 

Step 5 - Load the Palette   

[TBD]

 

Step 6 - Load the Blitter Control Blocks (BCB)  

[TBD]

 

Step 7 - Load the Sprite Sheet  

[TBD]

 

 

[I will update this frequently till it will be mature enough to become a release candidate document.]

Edited by Yaron Nir
  • Like 4
Link to comment
Share on other sites

ok, work in progress, 6 revisions so far.

I am still in my learning curve, but i think the tutorial is shaping up to my satisfactory. 

 

i would be happy to receive feedback or mistakes or comments of any sort from anyone, so feel free to share your thoughts or if a section is not clear enough let me know and i will re-write it. i've done that so far for some of the sections as i wasn't happy with the result.

  • Like 1
Link to comment
Share on other sites

You can click report on the first post and ask an admin/moderator to edit, move, combine, or delete a thread for you as the original post maker. @Albert or one of the many others can take care of it from there. You can do the same on individual posts. What is the thread you want gone,this very one?

Edited by _The Doctor__
  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...