2019-09-29 01:59:58 +00:00
|
|
|
/************************************
|
|
|
|
* TESTVERA - Test All Vera Modules *
|
|
|
|
************************************/
|
2019-09-23 23:57:03 +00:00
|
|
|
|
|
|
|
//Specify System Header using -H option
|
|
|
|
#include <stddef.h02>
|
|
|
|
#include <stdlib.h02>
|
|
|
|
#include <intlib.h02>
|
|
|
|
#include <stdio.h02>
|
|
|
|
#include <stdiox.h02>
|
2019-09-25 19:56:26 +00:00
|
|
|
#include <memory.h02>
|
2019-09-23 23:57:03 +00:00
|
|
|
#include <nybble.h02>
|
2019-09-29 01:59:58 +00:00
|
|
|
#include "include/veramem.h02" //Vera Memory Access
|
|
|
|
#include "include/veradsp.h02" //Vera Display Controller
|
|
|
|
#include "include/veraclr.h02" //Vera Color Palette
|
|
|
|
#include "include/veralyr.h02" //Vera Layer Control
|
2019-10-27 18:25:30 +00:00
|
|
|
#include "include/veraspr.h02" //Vera Sprites
|
2019-09-23 23:57:03 +00:00
|
|
|
#include "include/vera.h02"
|
|
|
|
|
2019-09-25 19:56:26 +00:00
|
|
|
const char abcdef = {1,2,3,4,5,6};
|
|
|
|
char buffer[255]; //Buffer for getmem
|
|
|
|
|
2019-10-27 18:25:30 +00:00
|
|
|
char d,e,f,i,j,k; //Index Variables
|
|
|
|
char b,h,l,m,n,p,w; //Temporary Variables
|
|
|
|
char bank,msb,lsb; //Vera Memory Address
|
|
|
|
int addr,bytes,size; //16-bit Address and Sizes
|
|
|
|
int height,width; //16-bit Height and Width Value
|
|
|
|
|
2019-09-23 23:57:03 +00:00
|
|
|
char hscale,vscale; //Video Scaling
|
2019-09-25 19:56:26 +00:00
|
|
|
char hrzvrt[5]; //Horizontal and Vertical Register Contents
|
2019-09-23 23:57:03 +00:00
|
|
|
char index; //Color Palette Index
|
|
|
|
char mode,mono,field; //Video Output Mode, Monochrome Flag, Current Field
|
|
|
|
char red,green,blue; //Color Components
|
2019-09-25 19:56:26 +00:00
|
|
|
char enabld; //Layer Enabled
|
2019-09-23 23:57:03 +00:00
|
|
|
|
2019-09-25 19:56:26 +00:00
|
|
|
int color,colour;
|
2019-09-23 23:57:03 +00:00
|
|
|
int hstart,hstop; //Horizontal Start and Stop
|
|
|
|
int vstart,vstop; //Vertical Start and Stop
|
|
|
|
int irqlin; //IRQ Line#
|
2019-09-25 19:56:26 +00:00
|
|
|
|
2019-10-27 18:25:30 +00:00
|
|
|
char spenbl; //Sprite Enabled
|
|
|
|
char spmode; //Sprite Mode (Bits Per Pixel)
|
|
|
|
int spaddr; //Sprite Attributes Address
|
|
|
|
int spsize; //Sprite Data Size
|
|
|
|
struct sprite spattr; //Sprite Attributes (Read)
|
|
|
|
struct sprite spattw; //Sprite Attributes (Write)
|
|
|
|
|
2019-09-25 19:56:26 +00:00
|
|
|
/* Layer 0/1 */
|
|
|
|
|
2019-09-29 01:59:58 +00:00
|
|
|
const char msizel = {32,64,128,0};
|
|
|
|
const char msizeh = { 0, 0, 0,1};
|
|
|
|
const char tsizel = {8,16};
|
|
|
|
|
2019-09-25 19:56:26 +00:00
|
|
|
char layer; //Layer Number
|
|
|
|
char layer0[9]; //Layer 0 Register Contents
|
|
|
|
char layer1[9]; //Layer 1 Register Contents
|
2019-09-29 01:59:58 +00:00
|
|
|
char tsize; //Tile Size in Pixels
|
|
|
|
int msize; //Map Size in Pixeks
|
2019-09-25 19:56:26 +00:00
|
|
|
int mbase0,mbase1; //Map Base, Layer 0 and 1
|
|
|
|
int tbase0,tbase1; //Tile Base, Layer 0 and 1
|
|
|
|
int mbaddr,tbaddr; //Map and Tile Base Address
|
|
|
|
int hscrl0,hscrl1; //Horizontal Scroll, Layer 0 and 1
|
|
|
|
int vscrl0,vscrl1; //Vertical Scroll, Layer 0 and 1
|
|
|
|
|
2019-10-27 18:25:30 +00:00
|
|
|
|
|
|
|
char aa,xx,yy; //Functions Parameters/Variables
|
2019-09-23 23:57:03 +00:00
|
|
|
|
2019-09-25 19:56:26 +00:00
|
|
|
void failed() {
|
|
|
|
putln(" FAILED");
|
|
|
|
}
|
|
|
|
|
2019-09-23 23:57:03 +00:00
|
|
|
void passed() {
|
|
|
|
putln(" PASSED");
|
2019-09-25 19:56:26 +00:00
|
|
|
//newlin();
|
|
|
|
}
|
|
|
|
|
2019-10-27 18:25:30 +00:00
|
|
|
void padint(aa,yy,xx) {
|
|
|
|
if (xx&96) putc(aa);
|
|
|
|
if (yy < 4) putc(aa);
|
2019-09-23 23:57:03 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 18:25:30 +00:00
|
|
|
void prtadr(aa,yy,xx) {
|
|
|
|
putc('$'); prhex(aa); prbyte(yy); prbyte(xx);
|
|
|
|
}
|
2019-09-23 23:57:03 +00:00
|
|
|
|
2019-10-27 18:25:30 +00:00
|
|
|
void prtflg(aa,yy,xx) {
|
|
|
|
if (aa) setdst("TRUE"); else setdst("FALSE");
|
|
|
|
printf(aa,yy,xx);
|
|
|
|
}
|
|
|
|
|
|
|
|
void prtreg(aa,yy,xx) {
|
|
|
|
printf(aa,"(%d,"); printf(yy,"%d,"); printf(xx,"%d) ");
|
|
|
|
}
|
|
|
|
|
|
|
|
void prtrgb(aa,yy,xx) {
|
|
|
|
prbyte(aa); putchr(',');
|
|
|
|
prbyte(yy); putchr(',');
|
|
|
|
prbyte(xx); putspc();
|
2019-09-23 23:57:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void prtscl() {
|
2020-09-30 16:28:00 +00:00
|
|
|
printf(hscale, "HSCALE=%x, ");
|
|
|
|
printf(vscale, "VSCALE=%x%n");
|
2019-09-23 23:57:03 +00:00
|
|
|
}
|
|
|
|
|
2019-10-27 18:25:30 +00:00
|
|
|
/*Print Sprite Attributes */
|
|
|
|
void prtspr() {
|
|
|
|
printf(setdst(spattr.addr),"ADR=$%w, ");
|
|
|
|
printf(setdst(spattr.horz),"HRZ=%i, ");
|
|
|
|
printf(setdst(spattr.vert),"VRT=%i, ");
|
2020-09-30 16:28:00 +00:00
|
|
|
printf(spattr.ctrl,"CTL=$%x, ");
|
|
|
|
printf(spattr.size,"SIZ=$%x%n");
|
2019-10-27 18:25:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void prttmp() {
|
2020-09-30 16:28:00 +00:00
|
|
|
printf(temp0, "TEMP0=$%x%n");
|
|
|
|
printf(temp1, "TEMP1=$%x%n");
|
|
|
|
printf(temp2, "TEMP2=$%x%n");
|
|
|
|
printf(temp3, "TEMP3=$%x%n");
|
2019-10-27 18:25:30 +00:00
|
|
|
}
|
|
|
|
|
2019-09-23 23:57:03 +00:00
|
|
|
void prtvid() {
|
|
|
|
select (mode) {
|
|
|
|
case 0: puts("DISABLED");
|
|
|
|
case 1: puts("VGA");
|
|
|
|
case 2: puts("NTSC");
|
|
|
|
case 3: puts("RGB");
|
|
|
|
default: puts("UNDEFINED");
|
|
|
|
}
|
|
|
|
if (mono) puts(" MONOCHROME"); else puts(" COLOR");
|
|
|
|
puts(", ");
|
|
|
|
if (field) puts("ODD"); else puts("EVEN");
|
|
|
|
putln(" FIELD");
|
|
|
|
}
|
|
|
|
|
2019-10-27 18:25:30 +00:00
|
|
|
int toint(.,yy,xx) {}
|
|
|
|
|
2019-09-23 23:57:03 +00:00
|
|
|
void xerror() {
|
2019-09-29 01:59:58 +00:00
|
|
|
putln(" ERROR ENCOUNTERED");
|
2019-09-23 23:57:03 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
main:
|
|
|
|
newlin();
|
|
|
|
|
2019-10-27 18:25:30 +00:00
|
|
|
|
|
|
|
|
2019-09-25 19:56:26 +00:00
|
|
|
puts("TESTING GETMEM() AND SETMEM()");
|
|
|
|
setadr($20,&0); setmem(@abcdef,&abcdef);
|
|
|
|
setadr($20,&0); getmem(@abcdef,&buffer);
|
|
|
|
setdst(&abcdef); if (memcmp(@abcdef,&buffer)) xerror();
|
|
|
|
passed();
|
|
|
|
|
|
|
|
puts("TESTING GETVID() AND SETVID()");
|
2019-09-23 23:57:03 +00:00
|
|
|
for (i=0;i<4;i++) {
|
|
|
|
for (j=1;j:+;j--) {
|
|
|
|
//inline $ff;
|
|
|
|
setvid(i,j);
|
|
|
|
mode,mono,field = getvid();
|
|
|
|
//prtvid();
|
|
|
|
if (mode<>i or mono&j<>j) xerror();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
2019-09-25 19:56:26 +00:00
|
|
|
puts("TESTING GETBDR() AND SETBDR()");
|
2019-10-27 18:25:30 +00:00
|
|
|
i=0; do {
|
2019-09-23 23:57:03 +00:00
|
|
|
setbdr(i);
|
|
|
|
index = getbdr();
|
|
|
|
if (index<>i) xerror();
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(index, "BORDER=%x%n");
|
2019-09-23 23:57:03 +00:00
|
|
|
i++;
|
|
|
|
} while(i);
|
|
|
|
passed();
|
|
|
|
|
2019-09-25 19:56:26 +00:00
|
|
|
puts("TESTING GETSCL() AND SETSCL()");
|
2019-10-27 18:25:30 +00:00
|
|
|
i=1; do {
|
2019-09-23 23:57:03 +00:00
|
|
|
j=1;
|
|
|
|
do {
|
2019-09-29 01:59:58 +00:00
|
|
|
setscl(i,j); hscale,vscale = getscl();
|
2019-09-23 23:57:03 +00:00
|
|
|
if (hscale<>i or vscale<>j) xerror("ERROR IN GETSCL()/SETSCL()");
|
|
|
|
j<<;
|
|
|
|
} while (j);
|
|
|
|
i<<;
|
|
|
|
} while (i);
|
|
|
|
passed();
|
|
|
|
|
2019-09-25 19:56:26 +00:00
|
|
|
//putln("SAVING START AND STOP REGISTERS");
|
|
|
|
setadr($1F, &$0004); getmem(5, &hrzvrt);
|
2020-09-30 16:28:00 +00:00
|
|
|
//for (i=0;i<5;i++) printf(hrzvrt[i], "%x "); newlin();
|
2019-09-25 19:56:26 +00:00
|
|
|
|
|
|
|
puts("TESTING GETHSR() AND SETHSR()");
|
|
|
|
sethsr(&$024C);
|
|
|
|
hstart = gethsr();
|
|
|
|
//setdst(hstart);printf("HSTART=%w%n");
|
|
|
|
if (>hstart<>$02 or <hstart<>$4C) xerror(); else passed();
|
|
|
|
|
|
|
|
puts("TESTING GETHSP() AND SETHSP()");
|
|
|
|
sethsp(&$025D); hstop = gethsp();
|
|
|
|
//setdst(hstop);printf("HSTOP=%w%n");
|
|
|
|
if (>hstop<>$02 or <hstop<>$5D) xerror(); else passed();
|
|
|
|
|
|
|
|
puts("TESTING GETVSR() AND SETVSR()");
|
|
|
|
setvsr(&$016E); vstart = getvsr();
|
|
|
|
//setdst(vstart);printf("VSTART=%w%n");
|
|
|
|
if (>vstart<>$01 or <vstart<>$6E) xerror(); else passed();
|
|
|
|
|
|
|
|
puts("TESTING GETVSP() AND SETVSP()");
|
|
|
|
setvsp(&$017F); vstop = getvsp();
|
|
|
|
//setdst(vstop);printf("VSTOP=%w%n");
|
|
|
|
if (>vstop<>$01 or <vstop<>$7F) xerror(); else passed();
|
2019-09-23 23:57:03 +00:00
|
|
|
|
2019-09-25 19:56:26 +00:00
|
|
|
//putln("RESTORING START AND STOP REGISTERS");
|
|
|
|
setadr($1F, &$0004); setmem(5, &hrzvrt);
|
|
|
|
|
|
|
|
puts("TESTING GETIRL() AND SETIRL()");
|
2019-09-23 23:57:03 +00:00
|
|
|
for (i=0;i<2;i++) {
|
|
|
|
j=0;
|
|
|
|
do {
|
|
|
|
setiql(0,i,j);
|
|
|
|
irqlin = getiql();
|
|
|
|
//setdst(); printf("IRQ LINE=%w%n");
|
|
|
|
if (>irqlin<>i or <irqlin<>j) xerror();
|
|
|
|
j++;
|
|
|
|
} while (j);
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
2019-10-27 18:25:30 +00:00
|
|
|
newlin();
|
|
|
|
|
2019-09-29 01:59:58 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
|
2019-09-25 19:56:26 +00:00
|
|
|
puts("TESTING RGBCLR() AND CLRRGB()");
|
2019-10-27 18:25:30 +00:00
|
|
|
for (red=7;red<255;red=red+8) {
|
|
|
|
for (green=7;green<255;green=green+8) {
|
|
|
|
for (blue=7;blue<255;blue=blue+8) {
|
2019-09-25 19:56:26 +00:00
|
|
|
color = rgbclr(red,green,blue);
|
2019-10-27 18:25:30 +00:00
|
|
|
i,j,k = clrrgb(color);
|
|
|
|
if (red&$f0<>i or green&$f0<>j or blue&$f0<>k) {
|
|
|
|
prtrgb(red,green,blue);
|
|
|
|
putwrd(color); putspc();
|
|
|
|
prtrgb(i,j,k); newlin();
|
|
|
|
xerror();
|
|
|
|
}
|
2019-09-23 23:57:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
2019-09-25 19:56:26 +00:00
|
|
|
puts("TESTING GETCLR() AND SETCLR()");
|
2019-09-23 23:57:03 +00:00
|
|
|
for (i=16; i<32; i++) {
|
|
|
|
//puthex(i); putspc();
|
2019-09-25 19:56:26 +00:00
|
|
|
color = getclr(i);
|
|
|
|
//putwrd(color); putspc();
|
|
|
|
if (i&15<>>color or nybdup(i)<><color) xerror();
|
2019-09-23 23:57:03 +00:00
|
|
|
//if (i&7==7) newlin();
|
|
|
|
}
|
2019-09-25 19:56:26 +00:00
|
|
|
//passed();
|
2019-09-23 23:57:03 +00:00
|
|
|
|
2019-09-25 19:56:26 +00:00
|
|
|
//puts("TESTING SETCLR()");
|
2019-10-27 18:25:30 +00:00
|
|
|
for (i=128; i<160; i++) {
|
2019-09-23 23:57:03 +00:00
|
|
|
//puthex(i); putspc();
|
2019-10-27 18:25:30 +00:00
|
|
|
red = i; green = i + 32; blue = i + 64;
|
2019-09-23 23:57:03 +00:00
|
|
|
//prhex(red); prhex(green); prhex(blue); putspc(); putspc();
|
2019-09-25 19:56:26 +00:00
|
|
|
color = rgbclr(red,green,blue);
|
|
|
|
setclr(i,color);
|
|
|
|
colour = getclr(i);
|
|
|
|
//putwrd(colour); putspc();
|
|
|
|
if (<colour<><color or >colour<>>color) xerror();
|
2019-09-23 23:57:03 +00:00
|
|
|
//if (i&7==7) newlin();
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
2019-10-27 18:25:30 +00:00
|
|
|
puts("TESTING GETRGB() AND SETRGB()");
|
|
|
|
for (l=128; l<160; l++) {
|
|
|
|
red = l; green = l + 32; blue = l + 64;
|
|
|
|
setidx(i); setrgb(red,green,blue);
|
|
|
|
setidx(l); i,j,k = getrgb();
|
|
|
|
if (red&$f0<>i or green&$f0<>j or blue&$f0<>k) {
|
|
|
|
puthex(l); putspc();
|
|
|
|
prtrgb(red,green,blue);
|
|
|
|
putwrd(color); putspc();
|
|
|
|
prtrgb(i,j,k); newlin();
|
|
|
|
xerror();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
newlin();
|
|
|
|
|
2019-09-29 01:59:58 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
|
2019-09-25 19:56:26 +00:00
|
|
|
//putln("SAVING LAYER REGISTERS");
|
|
|
|
setadr($1F,&$2000); getmem(@layer0,&layer0);
|
|
|
|
setadr($1F,&$3000); getmem(@layer1,&layer1);
|
|
|
|
|
2019-09-29 01:59:58 +00:00
|
|
|
printf("TESTING GETENB() AND SETENB()");
|
|
|
|
setenb(0,$00); if (getenb(0)<>$00) xerror();
|
|
|
|
setenb(0,$FF); if (getenb(0)<>$FF) xerror();
|
|
|
|
setenb(1,$00); if (getenb(1)<>$00) xerror();
|
|
|
|
setenb(1,$FF); if (getenb(1)<>$FF) xerror();
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETMOD() AND SETMOD()");
|
|
|
|
for (i=0;i<2;i++) {for (j=0;j<8;j++) {
|
|
|
|
setmod(i,j); if (getmod(i)<>j) goto reslyr; //xerror();
|
|
|
|
} }
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETMSZ() AND SETMSZ()");
|
|
|
|
for (i=0;i<2;i++) {for (j=0;j<4;j++) {for (k=0;k<4;k++) {
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(j,"%nJ=%x, "); printf(k,"K=%x");
|
2019-10-27 18:25:30 +00:00
|
|
|
setmsz(i,j,k); w, h = getmsz(i);
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(w," WIDTH=%x, "); printf(h,"HEIGHT=%x");
|
2019-10-27 18:25:30 +00:00
|
|
|
if (w<>j or h<>k) xerror();
|
2019-09-29 01:59:58 +00:00
|
|
|
}}}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETTSZ() AND SETTSZ()");
|
|
|
|
for (i=0;i<2;i++) {for (j=0;j<2;j++) {for (k=0;k<2;k++) {
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(j,"%nJ=%x, "); printf(k,"K=%x");
|
2019-10-27 18:25:30 +00:00
|
|
|
settsz(i,j,k); w, h = gettsz(i);
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(w," WIDTH=%x, "); printf(h,"HEIGHT=%x");
|
2019-10-27 18:25:30 +00:00
|
|
|
if (w<>j or h<>k) xerror();
|
2019-09-29 01:59:58 +00:00
|
|
|
}}}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING MAPSIZ() AND TILSIZ()");
|
|
|
|
for (i=0; i<@msizel; i++) {
|
|
|
|
msize = mapsiz(i);
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(i,"%nMAP SIZE %x = "); setdst(msize); printf("$%w PIXELS");
|
2019-09-29 01:59:58 +00:00
|
|
|
if (<msize<>msizel[i] or >msize<>msizeh[i]) xerror();
|
|
|
|
}
|
|
|
|
for (i=0; i<@tsizel; i++) {
|
|
|
|
tsize = tilsiz(i);
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(i,"%nTILE SIZE %x = "); printf(tsize, "$%x PIXELS");
|
2019-09-29 01:59:58 +00:00
|
|
|
if (tsize<>tsizel[i]) xerror();
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETMBS() AND SETMBS()");
|
2019-09-25 19:56:26 +00:00
|
|
|
setmbs(0,&$1234); mbase0 = getmbs(0);
|
|
|
|
setmbs(1,&$5678); mbase1 = getmbs(1);
|
|
|
|
//setdst(mbase0); printf("%nMBASE0=$%w, "); setdst(mbase1); printf("MBASE1=$%w%n");
|
|
|
|
if (>mbase0<>$12 or <mbase0<>$34) xerror();
|
|
|
|
if (>mbase1<>$56 or <mbase1<>$78) xerror();
|
|
|
|
passed();
|
|
|
|
|
2019-09-29 01:59:58 +00:00
|
|
|
printf("TESTING GETTBS() AND SETTBS()");
|
2019-09-25 19:56:26 +00:00
|
|
|
settbs(0,&$90AB); tbase0 = gettbs(0);
|
|
|
|
settbs(1,&$CDEF); tbase1 = gettbs(1);
|
|
|
|
//setdst(tbase0); printf("%nTBASE0=$%w, "); setdst(tbase1); printf("TBASE1=$%w%n");
|
|
|
|
if (>tbase0<>$90 or <tbase0<>$AB) xerror();
|
|
|
|
if (>tbase1<>$CD or <tbase1<>$EF) xerror();
|
|
|
|
passed();
|
|
|
|
|
2019-09-29 01:59:58 +00:00
|
|
|
printf("TESTING GETMBA() AND GETTBA()");
|
2019-09-25 19:56:26 +00:00
|
|
|
i,j,k = getmba(0); if (i<>$00 or j<>$48 or k<>$D0) xerror();
|
|
|
|
i,j,k = getmba(1); if (i<>$01 or j<>$59 or k<>$E0) xerror();
|
|
|
|
i,j,k = gettba(0); if (i<>$02 or j<>$42 or k<>$AC) xerror();
|
|
|
|
i,j,k = gettba(1); if (i<>$03 or j<>$37 or k<>$BC) xerror();
|
|
|
|
passed();
|
|
|
|
|
2019-09-29 01:59:58 +00:00
|
|
|
printf("TESTING GETHSC() AND SETHSC()");
|
2019-09-25 19:56:26 +00:00
|
|
|
sethsc(0,&$1357); hscrl0 = gethsc(0);
|
|
|
|
sethsc(1,&$2468); hscrl1 = gethsc(1);
|
|
|
|
//setdst(hscrl0); printf("%nHSCRL0=$%w, "); setdst(hscrl1); printf("HSCRL1=$%w%n");
|
|
|
|
if (>hscrl0<>$13 or <hscrl0<>$57) xerror();
|
|
|
|
if (>hscrl1<>$24 or <hscrl1<>$68) xerror();
|
|
|
|
passed();
|
|
|
|
|
2019-09-29 01:59:58 +00:00
|
|
|
printf("TESTING GETVSC() AND SETVSC()");
|
2019-09-25 19:56:26 +00:00
|
|
|
setvsc(0,&$9BDF); vscrl0 = getvsc(0);
|
|
|
|
setvsc(1,&$0ACE); vscrl1 = getvsc(1);
|
|
|
|
//setdst(vscrl0); printf("%nVSCRL0=$%w, "); setdst(hscrl1); printf("VSCRL1=$%w%n");
|
|
|
|
if (>vscrl0<>$9B or <vscrl0<>$DF) xerror();
|
|
|
|
if (>vscrl1<>$0A or <vscrl1<>$CE) xerror();
|
|
|
|
passed();
|
|
|
|
|
2019-09-29 01:59:58 +00:00
|
|
|
printf("TESTING GETBPO() AND SETBPO()");
|
|
|
|
i = 0; do {
|
|
|
|
setbpo(0,i); if (getbpo(0)<>i) xerror();
|
|
|
|
setbpo(1,i); if (getbpo(1)<>i) xerror();
|
|
|
|
i = i + 16;
|
|
|
|
} while (i);
|
|
|
|
passed();
|
|
|
|
|
|
|
|
reslyr:
|
2019-09-25 19:56:26 +00:00
|
|
|
setadr($1F, &$2000); setmem(@layer0, &layer0);
|
|
|
|
setadr($1F, &$3000); setmem(@layer1, &layer1);
|
|
|
|
|
2019-10-27 18:25:30 +00:00
|
|
|
newlin();
|
2019-09-25 19:56:26 +00:00
|
|
|
|
2019-10-27 18:25:30 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
printf("TESTING GETSPE() AND SETSPE()");
|
|
|
|
setspe(#FALSE); if (getspe()) xerror();
|
|
|
|
setspe(#TRUE); if (!getspe()) xerror();
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETSPO() AND SETSPO()");
|
|
|
|
addr = &$5000;
|
|
|
|
for (i=0; i<#MAXSPR;i++) {
|
|
|
|
for (j=0;j<8;j++) {
|
|
|
|
spaddr = getspo(i,j);
|
|
|
|
//printf(i,"%nSPRITE %r "); printf(j,"OFFSET %d ADDRESS=$"); putwrd(spaddr);
|
|
|
|
if (<spaddr <> <addr or >spaddr <> >addr) xerror();
|
|
|
|
if (setspo(i,j)<>8) xerror(); //Returns number of attribute bytes per sprite
|
|
|
|
b,m,l = getadr();
|
|
|
|
//puts(", $"); putexh(b,m,l);
|
|
|
|
if (b <> $1F or l <> <addr or m <> >addr) xerror();
|
|
|
|
addr++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETSPR() AND SETSPR()");
|
|
|
|
bank=$1f;msb=$50; lsb=$00;
|
|
|
|
for (i=0; i<#MAXSPR;i++) {
|
|
|
|
lsb=lsb+8; if (!lsb) msb++;
|
|
|
|
/* Set Sprite Attributes */
|
|
|
|
spattw[0]=i^$FF; spattw[1]=i|$80; //Sprite Address & Mode
|
|
|
|
spattw[2]=i|$80; spattw[3]=0; spattw.horz<<; spattw.horz<<;
|
|
|
|
spattw[4]=i^$FF; spattw[5]=0; spattw.vert<<; spattw.vert<<;
|
|
|
|
spattw[6]=(i&1) ? $80|i : i;//Sprite Control
|
|
|
|
spattw[7]=(i&1) ? i : $80|i; //Sprite Size
|
|
|
|
l = setspr(i,&spattw); if (l<>8) xerror();
|
|
|
|
b,m,l = getadr(); if (b<>bank or m<>msb or l<>lsb) xerror();
|
|
|
|
/* Get Sprite Attributes */
|
|
|
|
l = getspr(i,&spattr); if (l<>8) xerror();
|
|
|
|
b,m,l = getadr(); if (b<>bank or m<>msb or l<>lsb) xerror();
|
|
|
|
//printf(i, "SPRITE %r ATTRS: "); prtspr();
|
|
|
|
for (j=0; j<@spattr; j++) {if (spattr[j]<>spattw[j]) xerror();}
|
|
|
|
/* Clear Sprite Attributes */
|
|
|
|
clrspr(i); b,m,l = getadr(); if (b<>bank or m<>msb or l<>lsb) xerror();
|
|
|
|
getspr(i, &spattr); b,m,l = getadr(); if (b<>bank or m<>msb or l<>lsb) xerror();
|
|
|
|
for (j=0; j<@spattr; j++) {if (spattr[j]) xerror();}
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETSPD() AND SETSPD()");
|
|
|
|
spaddr=&$800; //Sprite Address Register Value
|
|
|
|
bank=1; msb=0; lsb=0; //Sprite Data Address (spaddr<<5)
|
|
|
|
for (i=0; i<#MAXSPR; i++) {
|
|
|
|
//printf(i,"%nSPRITE %r ");
|
|
|
|
setspg(i,1,$80); //Set Bit 7 of Register 1 (Mode)
|
|
|
|
setspd(i,spaddr);
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(getspg(i,1),"REG=$%x"); printf(getspg(i,0),"%x ");
|
2019-10-27 18:25:30 +00:00
|
|
|
if (!getspg(i,1)&$80) xerror(); //Check Bit 7 of Register 1
|
|
|
|
addr = getspd(i);
|
|
|
|
//printf(setdst(addr),"ADDRESS=$%w");
|
|
|
|
if (<addr <> <spaddr or >addr <> >spaddr) xerror();
|
|
|
|
b,m,l = getspa(i);
|
|
|
|
//printf(setdst(b,m,l)," ($%g%w)");
|
|
|
|
if (b<>bank or m<>msb or l<>lsb) xerror();
|
|
|
|
spaddr++;
|
|
|
|
lsb = lsb + $20; if (!lsb) msb++;
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING SETSPB() AND GETSPB()");
|
|
|
|
for (i=0; i<#MAXSPR; i++) {
|
|
|
|
//printf(i, "%nSPRITE %r ");
|
|
|
|
k=127-i; setspg(i,1,k); //Set Bits 0-6 of Register
|
|
|
|
for (j=1; j:+; j--) {
|
|
|
|
setspb(i,j);
|
|
|
|
spmode = getspb(i);
|
|
|
|
//printf(spmode,"MODE=%d ");
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(getspg(i,1),"REG=$%x ");
|
2019-10-27 18:25:30 +00:00
|
|
|
if (spmode<>j) xerror();
|
|
|
|
}
|
|
|
|
if (getspg(i,1)<>k) xerror(); //Check Bits 0-6 of Register
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETSPX() AND SETSPX()");
|
|
|
|
for (i=0; i<#MAXSPR; i++) {
|
|
|
|
//printf(i, "%nSPRITE %r ");
|
|
|
|
lsb = i&3; msb = i+64;
|
|
|
|
setspx(i, msb, lsb); l = getspg(i,2); m = getspg(i,3);
|
|
|
|
//printf(setdst(.,m,l),"REG=$%w ");
|
|
|
|
if (l<>lsb or m<>msb) xerror();
|
|
|
|
n,m,l = getspx(i);
|
|
|
|
//printf(setdst(.,m,l),"X=%i ");
|
|
|
|
if (m<>msb or l<>lsb) xerror();
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETSPY() AND SETSPY()");
|
|
|
|
for (i=0; i<#MAXSPR; i++) {
|
|
|
|
//printf(i, "%nSPRITE %r ");
|
|
|
|
lsb = i&3^3; msb = 192-i;
|
|
|
|
setspy(i, msb, lsb); l = getspg(i,4); m = getspg(i,5);
|
|
|
|
//printf(setdst(.,m,l),"REG=$%w ");
|
|
|
|
if (l<>lsb or m<>msb) xerror();
|
|
|
|
n,m,l = getspy(i);
|
|
|
|
//printf(setdst(.,m,l),"Y=%i ");
|
|
|
|
if (m<>msb or l<>lsb) xerror();
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETSPF() AND SETSPF()");
|
|
|
|
for (i=0; i<#MAXSPR; i++) {
|
|
|
|
//printf(i, "%nSPRITE %r ");
|
|
|
|
setspn(i,$ff); //Set All Bits in Control Register
|
|
|
|
for (j=1; j:+; j--) { //1 to 0
|
|
|
|
k = j-1; //#FALSE then #TRUE
|
|
|
|
setspf(i,k);
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(getspn(i),"REG=$%x ");
|
2019-10-27 18:25:30 +00:00
|
|
|
n = getspf(i);
|
2020-09-30 16:28:00 +00:00
|
|
|
//prtflg(n,"HFLIP=$%x (%s) ");
|
2019-10-27 18:25:30 +00:00
|
|
|
if (n<>k) xerror();
|
|
|
|
}
|
|
|
|
if (getspn(i)<>$ff) xerror();
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETSPV() AND SETSPV()");
|
|
|
|
for (i=0; i<#MAXSPR; i++) {
|
|
|
|
//printf(i, "%nSPRITE %r ");
|
|
|
|
setspn(i,$ff); //Set All Bits in Control Register
|
|
|
|
for (j=1; j:+; j--) { //1 to 0
|
|
|
|
k = j-1; //#FALSE then #TRUE
|
|
|
|
setspv(i,k);
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(getspn(i),"REG=$%x ");
|
2019-10-27 18:25:30 +00:00
|
|
|
n = getspv(i);
|
2020-09-30 16:28:00 +00:00
|
|
|
//prtflg(n,"HFLIP=$%x (%s) ");
|
2019-10-27 18:25:30 +00:00
|
|
|
if (n<>k) xerror();
|
|
|
|
}
|
|
|
|
if (getspn(i)<>$ff) xerror();
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETSPZ() AND SETSPZ()");
|
|
|
|
for (i=0; i<#MAXSPR; i++) {
|
|
|
|
//printf(i, "%nSPRITE %r ");
|
|
|
|
setspn(i,$ff); //Set All Bits in Control Register
|
|
|
|
for (j=0; j<4; j++) {
|
|
|
|
setspz(i,j);
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(getspn(i),"REG=$%x ");
|
2019-10-27 18:25:30 +00:00
|
|
|
n = getspz(i);
|
|
|
|
//printf(n,"ZDEPTH=%d ");
|
|
|
|
if (n<>j) xerror();
|
|
|
|
}
|
|
|
|
if (getspn(i)<>$ff) xerror();
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETSPM() AND SETSPM()");
|
|
|
|
for (i=0; i<#MAXSPR; i++) {
|
|
|
|
//printf(i, "%n%r ");
|
|
|
|
setspn(i,$ff); //Set All Bits in Control Register
|
|
|
|
for (j=0; j<16; j++) {
|
|
|
|
setspm(i,j);
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(getspn(i),"%x:");
|
2019-10-27 18:25:30 +00:00
|
|
|
n = getspm(i);
|
|
|
|
//printf(n,"%g ");
|
|
|
|
if (n<>j) xerror();
|
|
|
|
}
|
|
|
|
if (getspn(i)<>$ff) xerror();
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETSPP() AND SETSPP()");
|
|
|
|
for (i=0; i<#MAXSPR; i++) {
|
|
|
|
//printf(i, "%n%r ");
|
|
|
|
setsps(i,$ff); //Set All Bits in Control Register
|
|
|
|
for (j=0; j<16; j++) {
|
|
|
|
setspp(i,j);
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(getsps(i),"%x:");
|
2019-10-27 18:25:30 +00:00
|
|
|
n = getspp(i);
|
|
|
|
//printf(n,"%g ");
|
|
|
|
if (n<>j) xerror();
|
|
|
|
}
|
|
|
|
if (getsps(i)<>$ff) xerror();
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETSPH() AND SETSPH()");
|
|
|
|
for (i=0; i<#MAXSPR; i++) {
|
|
|
|
//printf(i, "%nSPRITE %r HEIGHT ");
|
|
|
|
setsps(i,$ff); //Set All Bits in Control Register
|
|
|
|
for (j=0; j<4; j++) {
|
|
|
|
setsph(i,j);
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(getsps(i),"[$%x] ");
|
2019-10-27 18:25:30 +00:00
|
|
|
n = getsph(i);
|
|
|
|
//printf(n,"%d ");
|
|
|
|
if (n<>j) xerror();
|
|
|
|
}
|
|
|
|
if (getsps(i)<>$ff) xerror();
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETSPW() AND SETSPW()");
|
|
|
|
for (i=0; i<#MAXSPR; i++) {
|
|
|
|
//printf(i, "%nSPRITE %r WIDTH ");
|
|
|
|
setsps(i,$ff); //Set All Bits in Control Register
|
|
|
|
for (j=0; j<4; j++) {
|
|
|
|
setspw(i,j);
|
2020-09-30 16:28:00 +00:00
|
|
|
//printf(getsps(i),"[$%x] ");
|
2019-10-27 18:25:30 +00:00
|
|
|
n = getspw(i);
|
|
|
|
//printf(n,"%d ");
|
|
|
|
if (n<>j) xerror();
|
|
|
|
}
|
|
|
|
if (getsps(i)<>$ff) xerror();
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETSPJ() AND GETSPK()");
|
|
|
|
l = 8; m = 3; //Size in Pixels, Shift Counter
|
|
|
|
for (i=0; i<4; i++) {
|
|
|
|
//printf(i,"%nSIZE %r =");
|
|
|
|
j,k = getspj(i);
|
|
|
|
//printf(j,"%r PIXELS, ");
|
|
|
|
//printf(k,"SHIFT COUNT %d");
|
|
|
|
if (j<>l or k<>m) xerror();
|
|
|
|
l<<; m++; //Multiply Size by Two, Increment Shift Counter
|
|
|
|
}
|
|
|
|
h = 8; height = &8; //Sprite Height in Pixels
|
|
|
|
for (i=0; i<4; i++) {
|
|
|
|
w = 8; //Sprite Width in Pixels
|
|
|
|
size = height; size<<; size<<; //Set Size to Height*4
|
|
|
|
for (j=0; j<4; j++) {
|
|
|
|
p = 4; //Bits Per Pixeg
|
|
|
|
bytes = size;
|
|
|
|
//printf(h,"%nSPRITE HEIGHT=%l"); printf(w,"WIDTH=%l");
|
|
|
|
for (k=0; k<2; k++) {
|
|
|
|
//printf(p,"%d BPP ");
|
|
|
|
spsize = getspk(j,i,k); //Calculate Sprite Data Size
|
|
|
|
//printf(setdst(spsize),"SIZE=%i "); padint(' ',spsize);
|
|
|
|
//printf(setdst(bytes),"[%i] "); padint(' ',bytes);
|
|
|
|
if (<spsize <> <bytes or >spsize <> >bytes) xerror();
|
|
|
|
p<<; bytes<<; //Multiply BPP, Size by 2
|
|
|
|
}
|
|
|
|
w<<; size<<; //Multiply Width, Size by 2
|
|
|
|
}
|
|
|
|
h<<; height<<; //Multiply Height by 2
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
printf("TESTING GETSPL() AND GETSPU()");
|
|
|
|
n = 0; //Sprite Index
|
|
|
|
h = 8; height = &8; //Sprite Height in Pixels
|
|
|
|
for (i=0; i<4; i++) {
|
|
|
|
setsph(n,i); //Set Sprite Height Specifier
|
|
|
|
w = 8; //Sprite Width in Pixels
|
|
|
|
size = height; size<<; size<<; //Set Size to Height*4
|
|
|
|
for (j=0; j<4; j++) {
|
|
|
|
setspw(n,j); //Set Sprite Width Specifier
|
|
|
|
p = 4; //Bits Per Pixeg
|
|
|
|
bytes = size;
|
|
|
|
//printf(h,"%nHEIGHT=%d "); if (!i) putspc();
|
|
|
|
//printf(w,"WIDTH=%d "); if (!j) putspc();
|
|
|
|
for (k=0; k<2; k++) {
|
|
|
|
setspp(n,k);
|
|
|
|
d,e,f = getspu(n);
|
|
|
|
//printf(p,"%dBPP "); prtreg();
|
|
|
|
if (d<>j or e<>i or f<>k) xerror();
|
|
|
|
spsize = getspl(n); //Get Sprite Data Size
|
|
|
|
//printf(setdst(spsize),"SIZE=%i "); padint(' ',spsize);
|
|
|
|
//printf(setdst(bytes),"[%i] "); padint(' ',bytes);
|
|
|
|
if (<spsize <> <bytes or >spsize <> >bytes) xerror();
|
|
|
|
p<<; bytes<<; //Multiply BPP, Size by 2
|
|
|
|
}
|
|
|
|
w<<; size<<; //Multiply Width, Size by 2
|
|
|
|
}
|
|
|
|
h<<; height<<; //Multiply Height by 2
|
|
|
|
n++; //Increment Sprite Index
|
|
|
|
}
|
|
|
|
passed();
|
|
|
|
|
|
|
|
newlin();
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
newlin();
|
|
|
|
|
2019-09-23 23:57:03 +00:00
|
|
|
goto exit;
|
2019-09-25 19:56:26 +00:00
|
|
|
|