samishal, on Thu Dec 15, 2011 5:18 PM, said:
Also if you know any sites that have any tutorials on this, that would also be useful.
I would have to say this forum is very useful... Start here:
http://www.atariage....ly-on-the-994a/
Here are two examples without dependencies:
DEF MAIN
VDPWD EQU >8C00 * VDP write data
VDPWA EQU >8C02 * VDP set read/write address
WS1 EQU >8300 * Workspace memory in fast RAM
R0LB EQU WRKSP+1 * Register zero low byte address
MSG1 TEXT 'HELLO WORLD'
MSG1E
EVEN
MAIN LIMI 0 * Disable interrupts
LWPI WRKSP * Load the workspace pointer to fast RAM
* Clear the screen
CLR R0 * Start at top left corner of the screen
LI R1,>2000 * Write a space (>20 hex is 32 decimal)
LI R2,768 * Number of bytes to write
MOVB @R0LB,@VDPWA * Send low byte of VDP RAM write address
ORI R0,>4000 * Set read/write bits 14 and 15 to write (01)
MOVB R0,@VDPWA * Send high byte of VDP RAM write address
CLS MOVB R1,@VDPWD * Write byte to VDP RAM
DEC R2 * Byte counter
JNE CLS * Check if done
* Write the text message to the screen
LI R0,395 * Screen location to display message
LI R1,MSG1 * Memory location of source data
LI R2,MSG1E-MSG1 * Length of data to write
MOVB @R0LB,@VDPWA * Send low byte of VDP RAM write address
ORI R0,>4000 * Set read/write bits 14 and 15 to write (01)
MOVB R0,@VDPWA * Send high byte of VDP RAM write address
DISP MOVB *R1+,@VDPWD * Write a byte of the message to the VDP
DEC R2 * Byte counter
JNE DISP * Check if done
LIMI 2 * Enable interrupts
INFLP JMP INFLP * Infinite loop
END
DEF MAIN
* VDP Memory Map
*
VDPRD EQU >8800 * VDP read data
VDPSTA EQU >8802 * VDP status
VDPWD EQU >8C00 * VDP write data
VDPWA EQU >8C02 * VDP set read/write address
* Workspace
WRKSP EQU >8300 * Workspace
R0LB EQU WRKSP+1 * R0 low byte reqd for VDP routines
* Data
MSG1 TEXT 'HELLO WORLD'
MSG1E
EVEN
* Program execution starts here
MAIN LIMI 0
LWPI WRKSP
* Clear the screen
LI R0,>0000 * Start at upper left corner of the screen, assume name table is at >0000
LI R1,>2000 * Write >20 (32 decimal), remember the MSB is sent to the VDP
LI R2,768 * 768 screen locations (32x24 tiles)
BL @VSMW * Write the space 768 times
* Write the text message to the screen
LI R0,395 * Screen location to display message
LI R1,MSG1 * Memory location of source data
LI R2,MSG1E-MSG1 * Length of data to write
BL @VMBW
LIMI 2
LP9999 JMP LP9999
*********************************************************************
*
* VDP Single Byte Multiple Write
*
* R0 Starting write address in VDP RAM
* R1 MSB of R1 sent to VDP RAM
* R2 Number of times to write the MSB byte of R1 to VDP RAM
*
* R0 is modified, but can be restored with: ANDI R0,>3FFF
*
VSMW MOVB @R0LB,@VDPWA * Send low byte of VDP RAM write address
ORI R0,>4000 * Set read/write bits 14 and 15 to write (01)
MOVB R0,@VDPWA * Send high byte of VDP RAM write address
VSMWLP MOVB R1,@VDPWD * Write byte to VDP RAM
DEC R2 * Byte counter
JNE VSMWLP * Check if done
B *R11
*// VSMW
*********************************************************************
*
* VDP Multiple Byte Write
*
* R0 Starting write address in VDP RAM
* R1 Starting read address in CPU RAM
* R2 Number of bytes to send to the VDP RAM
*
* R0 is modified, but can be restored with: ANDI R0,>3FFF
*
VMBW MOVB @R0LB,@VDPWA * Send low byte of VDP RAM write address
ORI R0,>4000 * Set read/write bits 14 and 15 to write (01)
MOVB R0,@VDPWA * Send high byte of VDP RAM write address
VMBWLP MOVB *R1+,@VDPWD * Write byte to VDP RAM
DEC R2 * Byte counter
JNE VMBWLP * Check if done
B *R11
*// VMBW
END