1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-28 10:51:14 +00:00
C02/x16/veraregs.c02

153 lines
4.8 KiB
Plaintext
Raw Normal View History

2019-09-29 01:59:58 +00:00
/*************************************************
* VERAREGS - Display Contents of Vera Registers *
*************************************************/
//Specify System Header using -H option
#include <stddef.h02>
#include <stdlib.h02>
#include <intlib.h02>
#include <stdio.h02>
#include <stdiox.h02>
#include <memory.h02>
#include <nybble.h02>
#include <screen.h02>
#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-29 01:59:58 +00:00
/* Globals */
char i,j,k; //Loop Indexes
char aa,yy,xx; //Function Paramaters
2019-10-27 18:25:30 +00:00
char zz; //Function Variable
2019-09-29 01:59:58 +00:00
int yx; //Function Paramater
/* Display Composer */
char vmode,mono,field; //Video Output Mode, Monochrome Flag, Current Field
char hscale,vscale; //Video Scaling
char bcpidx; //Border Color Palette Index
int bcolor; //Border Color Value
int hstart,hstop; //Horizontal Start and Stop
int vstart,vstop; //Vertical Start and Stop
/* Layer 0/1 */
char layer; //Layer Number
char lmode; //Layer Mode
char height,width; //Map/Tile Height and Width
//Print Vera Address
void prtadr(aa,yx) {
puts("ADDRESS: $"); putnyb(aa); putwrd(yx);
}
2019-10-27 18:25:30 +00:00
//Print Masked Bits (byte, mask)
void prtmsk(aa,yy) {
xx = $80;
do {
zz = (aa&xx) ? '1' : '0';
if (yy&xx) putchr(zz);
xx>>;
} while(xx);
}
2019-09-29 01:59:58 +00:00
//Print Three Values Enclosed in Parentheses
void prtprn(aa,yy,xx) {
printf(aa,"($%x"); printf(yy,",$%x"); printf(xx,",$%x)");
2019-09-29 01:59:58 +00:00
}
main:
clrscr(); //Clear Screen
putln("DISPLAY COMPOSER");
puts(" VIDEO MODE: ");
vmode,mono,field = getvid();
select (vmode) {
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");
if (field) puts(", ODD"); else puts(", EVEN"); putln(" FIELD");
bcpidx = getbdr(); printf(bcpidx, " BORDER PALETTE INDEX: $%x");
2019-09-29 01:59:58 +00:00
bcolor = getclr(bcpidx); puts(setdst(bcolor)); printf(", COLOR=$%w ");
prtprn(clrrgb(bcolor)); newlin();
hscale,vscale = getscl(); hstart = gethsr(); hstop = gethsp(); vstart = getvsr(); vstop = getvsp();
2019-10-27 18:25:30 +00:00
printf(hscale, " HORIZONTAL SCALE: %d, "); setdst(hstart); printf("START: %i, "); setdst(hstop); printf("STOP: %i%n");
printf(vscale, " VERTICAL SCALE: %d, "); setdst(vstart); printf("START: %i, "); setdst(vstop); printf("STOP: %i%n");
2019-09-29 01:59:58 +00:00
2019-10-27 18:25:30 +00:00
setdst(getiql()); printf(" IRQ LINE: $%i%n");
2019-09-29 01:59:58 +00:00
newlin();
/*************************************************************************/
putln("PALETTE COLORS");
putrps(5); i=0 ;do {printf(i," %x "); i=i+16; } while(i) ; newlin();
2019-09-29 01:59:58 +00:00
for (i=0;i<16;i++) {
printf(i," %x ");
2019-09-29 01:59:58 +00:00
j=0; do {
k = i + j; setdst(getclr(k)); printf(k,"%q ");
j = j + 16;
} while (j);
newlin();
}
newlin();
/*************************************************************************/
for (layer=0; layer<2; layer++) {
2019-10-27 18:25:30 +00:00
printf(layer, "LAYER %d%n");
2019-09-29 01:59:58 +00:00
puts(" MODE: "); lmode = getmod(layer);
select(getmod(layer)) {
case 0: puts("16 COLOR TEXT");
case 1: puts("256 COLOR TEXT");
case 2: puts("TILE 2BPP");
case 3: puts("TILE 4BPP");
case 4: puts("TILE 8BPP");
case 5: puts("BITMAP 2BPP");
case 6: puts("BITMAP 4BPP");
case 7: puts("BITMAP 8BPP");
default: puts("UNDEFINED");
}
if (getenb(layer)) putln(", ENABLED"); else putln(", DISABLED");
width, height = getmsz(layer);
2019-10-27 18:25:30 +00:00
setdst(mapsiz(width)); printf(width," MAP WIDTH: %d (%i PIXELS)");
setdst(mapsiz(height)); printf(height,", HEIGHT: %d (%i PIXELS)%n");
2019-09-29 01:59:58 +00:00
width, height = gettsz(layer);
2019-10-27 18:25:30 +00:00
printf(width," TILE WIDTH: %d"); printf(tilsiz(width)," (%d PIXELS)");
printf(height,", HEIGHT: %d"); printf(tilsiz(height)," (%d PIXELS)%n");
2019-09-29 01:59:58 +00:00
setdst(getmbs(layer)); printf(" MAP BASE: $%w, ");
prtadr(getmba(layer)); newlin();
setdst(gettbs(layer)); printf(" TILE BASE: $%w, ");
prtadr(gettba(layer)); newlin();
2019-10-27 18:25:30 +00:00
setdst(gethsc(layer)); printf(" HORIZONTAL SCROLL: $%i");
setdst(getvsc(layer)); printf(", VERTICAL SCROLL: $%i%n");
2019-09-29 01:59:58 +00:00
printf(getbpo(layer)); printf(" BITMAP PALETTE OFFSET: $%x%n");
2019-09-29 01:59:58 +00:00
newlin();
}
/*************************************************************************/
2019-10-27 18:25:30 +00:00
//puts("SPRITES "); if (getspe()) puts("ENABLED"); else puts("DISABLED");
//puts(", COLLISION STATUS: %"); putmsk(getsps(),$0f); newlin();
2019-09-29 01:59:58 +00:00
goto exit;