Browse Source

commit latest changes

import/raw
doug 13 years ago
parent
commit
12611a3f3d
  1. BIN
      branches/dwg/Apps/core/map.com
  2. 4
      branches/dwg/Apps/n8vidtst/build.sub
  3. 67
      branches/dwg/Apps/n8vidtst/n8vidtst.c
  4. BIN
      branches/dwg/Apps/n8vidtst/n8vidtst.cpm
  5. 18
      branches/dwg/Apps/n8vidtst/readme.txt
  6. 637
      branches/dwg/Apps/n8vidtst/tms9918.h

BIN
branches/dwg/Apps/core/map.com

Binary file not shown.

4
branches/dwg/Apps/n8vidtst/build.sub

@ -1,4 +0,0 @@
cc $1
as $1
ln $1.o -lc


67
branches/dwg/Apps/n8vidtst/n8vidtst.c

@ -1,67 +0,0 @@
/* n8video.c 9/11/2012 dwg - derived from Wayne's TESTV5.BAS */
/* Simple VIDEO test for N8; I/O Base assumed as 128 */
#include "applvers.h"
#include "tms9918.h"
char szTemp[128];
char linenum;
char counter;
char outer;
char inner;
char limit;
int main(argc,argv)
int argc;
char *argv[];
{
int i;
char szTemp[64];
unsigned char chardex;
vdp_clr16k();
vdp_setregs();
vdp_modes();
vdp_pnt();
vdp_pgt();
vdp_colors();
vdp_load_set450();
if(outer == 3) style = TRIPLE;
vdp_main_frame("N8VIDTST(dwg)");
chardex = 0;
for(outer=0;outer<4;outer++) {
linenum = 4;
for(inner=0;inner<6;inner++) {
if(inner < 5) limit=11;
else limit=9;
for(i=0;i<limit;i++) {
sprintf(szTemp,"%c",chardex);
vdp_display(linenum,2+(i*3),szTemp);
sprintf(szTemp,"%02x",chardex++);
vdp_display(linenum+1,2+(i*3),szTemp);
}
linenum += 3;
if(inner==5) {
sprintf(szTemp,"Pg %d/4",outer+1);
vdp_display(20,29,szTemp);
}
}
if(outer < 3) {
vdp_display(22,2," Press any key to continue");
gets(szTemp);
}
}
vdp_display(22,1,"Execution complete,returned to CP/M");
if(argc == 2) {
sprintf(szTemp,"%c",atoi(argv[1]));
vdp_display(1,WIDTH-2,szTemp);
}
}


BIN
branches/dwg/Apps/n8vidtst/n8vidtst.cpm

Binary file not shown.

18
branches/dwg/Apps/n8vidtst/readme.txt

@ -1,18 +0,0 @@
readme - n8vidtst
The n8vidtst program is a preliminary test program to help determine
that the TMS9918 chip on the N8 is working correctly in text mode.
It displays four screens on the composite video, each displaying 64
of the possible 256 characters in my prelimiinary character set.
Everything is soft with the TMS9918, and the font is a set of character
array initializers in TMS9918.H.
Aztec C for CP/M-80 is used to compile and link this program.
The file N8VIDTST.CPM should be downloaded and renamed to n8vidtst.com
to run under CP/M on the N8.
Questions? Ask doug@goodall.com, or use the N8VEM Forum on google.

637
branches/dwg/Apps/n8vidtst/tms9918.h

@ -1,637 +0,0 @@
/* tms9918.h 9/11/2012 dwg - information from TI Docs */
/* http://www1.cs.columbia.edu/~sedwards/papers/TMS9918.pdf */
/* To DO: fIX UPPER CASE T */
/* TMS9918 Modes:
Graphics I
Grtaphics Mode I provides 256x192 pixel display for generating
pattern graphics in 15 colors plus transparent.
Graphics II
Graphics mode II is an enhancement of Graphics Mode I, allowing
it to generate more complex color and pattern displays.
Multicolor
The Muylticolor mode provides an unrestricted 64x48
color-dot display employing 15 colors plus transparent.
Text Mode
The Text Mode provides twenty-four 40-character in two colors
and is intended to maximize the capacity of the TV screen to
display alphanumeric characters. (24 lines of forty blocks (each 8x8).
*/
/*
#define DEBUG
*/
#define WIDTH 37
#define HEIGHT 24
#define GUTTER 3
#define BASE 128
#define DATAP (BASE+24)
#define CMDP (BASE+25)
#define WO_R0
#define WOR0B6
#define VDP_TRANSPARENT 0
#define VDP_BLACK 1
#define VDP_MED_GREEN 2
#define VDP_LGREEN 3
#define VDP_DBLUE 4
#define VDP_LBLUE 5
#define VDP_DRED 6
#define VDP_CYAN 7
#define VDP_MRED 8
#define VDP_LRED 9
#define VDP_DYELLOW 10
#define VDP_LYELLOW 11
#define VDP_DGREEN 12
#define VDP_MAGENTA 13
#define VDP_GRAY 14
#define VDP_WHITE 15
#define SINGLE 11
#define TRIPLE 0
char style; /* can be SINGLE or TRIPPLE */
unsigned char vdp_regen[24*40];
unsigned char charset[256*8] = {
/* 10000 */ 0,0,0,0,0,0,0,0,
/* 10001 */ 0,0,0,60,60,48,48,48,
/* 10002 */ 0,0,0,240,240,48,48,48,
/* 10003 */ 48,48,48,60,60,0,0,0,
/* 10004 */ 48,48,48,240,240,0,0,0,
/* 10005 */ 48,48,48,48,48,48,48,48,
/* 10006 */ 0,0,0,255,255,0,0,0,
/* 10007 */ 0,32,112,248,112,32,0,0,
/* 10008 */ 248,216,136,0,136,216,248,0,
/* 10009 */ 0,0,0,0,0,0,0,0,
/* 10010 */ 0,0,0,0,0,0,0,0,
/* 10011 */ 24,24,32,96,144,96,0,0,
/* 10012 */ 32,80,32,32,112,32,0,0,
/* 10013 */ 0,0,0,0,0,0,0,0,
/* 10014 */ 0,0,0,0,0,0,0,0,
/* 10015 */ 168,80,80,216,80,80,168,0,
/* 10016 */ 48,48,48,252,252,48,48,48,
/* 10017 */ 16,48,112,240,112,48,16,0,
/* 10018 */ 32,112,32,32,32,112,32,0,
/* 10019 */ 80,80,80,80,0,80,0,0,
/* 10020 */ 120,168,168,104,40,40,0,0,
/* 10021 */ 48,48,48,252,252,0,0,0,
/* 10022 */ 0,0,0,252,252,48,48,48,
/* 10023 */ 48,48,48,240,240,48,48,48,
/* 10024 */ 32,112,32,32,32,32,32,32,
/* 10025 */ 48,48,48,60,60,48,48,48,
/* 10026 */ 0,16,24,252,24,16,0,0,
/* 10027 */ 0,32,96,252,96,32,0,0,
/* 10028 */ 0,0,0,0,0,0,0,0,
/* 10029 */ 0,0,0,0,0,0,0,0,
/* 10030 */ 0,0,0,0,0,0,0,0,
/* 10031 */ 0,0,0,0,0,0,0,0,
/* 10032 */ 0,0,0,0,0,0,0,0,
/* 10033 */ 48,120,120,48,0,48,0,0,
/* 10034 */ 216,216,80,0,0,0,0,0,
/* 10035 */ 72,72,252,72,72,252,72,72,
/* 10036 */ 32,120,160,120,36,248,32,0,
/* 10037 */ 0,200,208,32,88,152,0,0,
/* 10038 */ 48,72,72,80,96,144,120,0,
/* 10039 */ 48,48,64,0,0,0,0,0,
/* 10040 */ 16,32,32,32,32,32,16,0,
/* 10041 */ 32,16,16,16,16,16,32,0,
/* 10042 */ 32,168,112,248,112,168,32,0,
/* 10043 */ 0,32,32,248,32,32,0,0,
/* 10044 */ 0,0,0,0,0,48,48,64,
/* 10045 0,0,0,252,0,0,0,0, */
/* 10045 */ 0,0,0,112,0,0,0,0,
/* 10046 */ 0,0,0,0,0,48,48,0,
/* 10047 */ 4,8,16,32,64,128,0,0,
/* 10048 */ 112,152,168,168,168,200,112,0,
/* 10049 */ 32,96,32,32,32,32,248,0,
/* 10050 32,80,16,32,64,128,248,0, */
/* 10050 */ 112,136,8,16,96,128,248,0,
/* 10051 */ 112,136,8,112,8,136,112,0,
/* 10052 */ 48,80,144,248,16,16,16,0,
/* 10053 */ 248,128,128,240,8,136,112,0,
/* 10054 */ 56,64,128,240,136,136,112,0,
/* 10055 */ 248,8,16,32,32,32,32,0,
/* 10056 */ 112,136,136,112,136,136,112,0,
/* 10057 */ 112,136,136,120,8,136,112,0,
/* 10058 */ 0,48,48,0,48,48,0,0,
/* 10059 */ 0,48,48,0,48,48,96,0,
/* 10060 */ 16,32,64,128,64,32,16,0,
/* 10061 */ 0,0,252,0,252,0,0,0,
/* 10062 */ 64,32,16,8,16,32,64,0,
/* 10063 */ 112,136,8,48,32,0,32,0,
/* 10064 */ 112,136,184,176,128,128,112,0,
/* 10065 */ 32,80,136,248,136,136,136,0,
/* 10066 */ 240,72,72,112,72,72,240,0,
/* 10067 */ 112,136,128,128,128,136,112,0,
/* 10068 */ 240,72,72,72,72,72,240,0,
/* 10069 */ 248,136,128,224,128,136,248,0,
/* 10070 */ 248,136,128,240,128,128,128,0,
/* 10071 */ 112,136,128,184,136,136,112,0,
/* 10072 */ 136,136,136,248,136,136,136,0,
/* 10073 */ 248,32,32,32,32,32,248,0,
/* 10074 */ 28,8,8,8,8,136,112,0,
/* 10075 */ 136,144,160,192,160,144,136,0,
/* 10076 */ 128,128,128,128,128,136,248,0,
/* 10077 */ 136,216,168,136,136,136,136,0,
/* 10078 */ 136,200,168,168,168,152,136,0,
/* 10079 */ 112,136,136,136,136,136,112,0,
/* 10080 */ 240,136,136,240,128,128,128,0,
/* 10081 */ 112,136,136,136,168,152,120,4,
/* 10082 */ 240,136,136,240,160,144,136,0,
/* 10083 */ 112,136,64,32,16,136,112,0,
/* 10084 */ 248,32,32,32,32,32,112-64-16,0,
/* 10085 */ 136,136,136,136,136,136,112,0,
/* 10086 */ 136,136,136,80,80,80,32,0,
/* 10087 */ 136,136,136,168,168,168,80,0,
/* 10088 */ 136,136,80,32,80,136,136,0,
/* 10089 */ 136,136,80,32,32,32,32,0,
/* 10090 */ 248,136,16,32,64,136,248,0,
/* 10091 */ 120,64,64,64,64,64,120,0,
/* 10092 */ 0,128,64,32,16,8,0,0,
/* 10093 */ 120,8,8,8,8,8,120,0,
/* 10094 */ 32,80,136,0,0,0,0,0,
/* 10095 */ 0,0,0,0,0,0,252,0,
/* 10096 */ 96,96,16,0,0,0,0,0,
/* 10097 */ 0,0,240,8,120,136,112,0,
/* 10098 */ 128,128,128,240,136,136,240,0,
/* 10099 */ 0,0,0,112,128,128,112,0,
/* 10100 */ 8,8,8,120,136,136,120,0,
/* 10101 */ 0,0,112,136,248,128,112,0,
/* 10102 */ 0,48,72,224,64,64,64,0,
/* 10103 */ 0,0,56,72,72,56,8,112,
/* 10104 */ 0,128,128,176,200,136,136,0,
/* 10105 */ 0,0,32,0,96,32,112,0,
/* 10106 */ 0,8,0,24,8,8,72,48,
/* 10107 */ 128,128,144,160,192,160,144,0,
/* 10108 */ 32,32,32,32,32,32,32,0,
/* 10109 */ 0,0,0,80,168,168,136,0,
/* 10110 */ 0,0,0,176,200,136,136,0,
/* 10111 */ 0,0,0,112,136,136,112,0,
/* 10112 */ 0,0,112,72,72,112,64,64,
/* 10113 */ 0,96,56,72,72,56,8,8,
/* 10114 */ 0,0,0,176,200,128,128,0,
/* 10115 */ 0,0,96,128,96,16,96,0,
/* 10116 */ 0,0,64,224,64,64,32,0,
/* 10117 */ 0,0,0,144,144,144,104,0,
/* 10118 */ 0,0,0,136,136,80,32,0,
/* 10119 */ 0,0,0,136,168,168,80,0,
/* 10120 */ 0,0,0,72,48,48,72,0,
/* 10121 */ 0,0,136,80,32,64,128,0,
/* 10122 */ 0,0,248,16,32,64,248,0,
/* 10123 */ 16,32,32,64,32,32,16,0,
/* 10124 */ 32,32,32,0,32,32,32,0,
/* 10125 */ 64,32,32,16,32,32,64,0,
/* 10126 */ 108,144,0,0,0,0,0,0,
/* 10127 */ 112,80,80,80,80,80,112,0,
/****************************************************************/
/* These are Douglas Goodall's personal tri-plex semi graphics */
/* 10128 */ 252,128,188,160,172,168,168,168, /* upper left */
/* 10129 */ 252,0,252,0,252,0,0,0, /* top horz */
/* 10130 */ 252,4,244,20,212,84,84,84, /* upper right */
/* 10131 */ 84,84,84,84,84,84,84,84, /* right vert */
/* 10132 */ 84,84,84,212,20,244,4,252, /* lower right */
/* 10133 */ 0,0,0,255,0,255,0,255, /* bottom horz */
/* 10134 */ 168,168,168,172,160,188,128,252, /* lower left */
/* 10135 */ 168,168,168,168,168,168,168,168, /* left vert */
/* 10136 */ 168,168,172,160,172,168,168,168, /* left joint */
/* 10137 */ 84,84,212,20,212,84,84,84, /* right joint */
/* 10138 */ 0,0,252,0,252,0,0,0, /* inner horz */
/****************************************************************/
/****************************************************************/
/* These are Douglas Goodall's personal uni-plex semi graphics */
/* 10139 */ 252,128,128,128,128,128,128,128, /* upper left */
/* 10140 */ 252,0,0,0,0,0,0,0, /* top horz */
/* 10141 */ 252,4,4,4,4,4,4,4, /* upper right */
/* 10142 */ 4,4,4,4,4,4,4,4, /* right vert */
/* 10143 */ 4,4,4,4,4,4,4,252, /* lower right */
/* 10144 */ 0,0,0,0,0,0,0,252, /* bottom horz */
/* 10145 */ 128,128,128,128,128,128,128,252, /* lower left */
/* 10146 */ 128,128,128,128,128,128,128,128, /* left vert */
/* 10147 */ 128,128,128,252,128,128,128,128, /* left joint */
/* 10148 */ 4,4,4,252,4,4,4,4, /* right joint */
/* 10149 */ 0,0,0,252,0,0,0,0, /* inner horz */
/****************************************************************/
/* 10150 */ 0,0,0,0,0,0,0,0,
/* 10151 */ 0,0,0,0,0,0,0,0,
/* 10152 */ 0,0,0,0,0,0,0,0,
/* 10153 */ 0,0,0,0,0,0,0,0,
/* 10154 */ 0,0,0,0,0,0,0,0,
/* 10155 */ 0,0,0,0,0,0,0,0,
/* 10156 */ 0,0,0,0,0,0,0,0,
/* 10157 */ 0,0,0,0,0,0,0,0,
/* 10158 */ 0,0,0,0,0,0,0,0,
/* 10159 */ 0,0,0,0,0,0,0,0,
/* 10160 */ 32,64,240,8,120,136,112,0,
/* 10161 */ 16,32,0,96,32,32,248,0,
/* 10162 */ 16,32,0,112,136,136,112,0,
/* 10163 */ 16,32,0,136,136,136,116,0,
/* 10164 */ 16,32,0,176,200,136,136,0,
/* 10165 */ 16,32,0,200,168,152,136,0,
/* 10166 */ 112,136,136,124,0,252,0,0,
/* 10167 */ 112,136,136,112,0,252,0,0,
/* 10168 */ 32,0,32,32,64,136,112,0,
/* 10169 */ 0,0,0,0,252,128,128,128,
/* 10170 */ 0,0,0,0,252,4,4,4,
/* 10171 */ 136,144,168,84,136,28,0,0,
/* 10172 */ 136,144,168,88,184,8,0,0,
/* 10173 */ 48,0,48,120,120,48,0,0,
/* 10174 */ 20,40,80,160,80,40,20,0,
/* 10175 */ 160,80,40,20,40,80,160,0,
/* 10176 */ 84,170,84,170,84,170,84,170,
/* 10177 */ 170,84,170,84,170,84,170,84,
/* 10178 */ 182,108,218,182,108,218,182,108,
/* 10179 */ 24,24,24,24,24,24,24,24,
/* 10180 */ 24,24,24,24,248,24,24,24,
/* 10181 */ 24,24,24,248,24,248,24,24,
/* 10182 */ 108,108,108,108,236,108,108,108,
/* 10183 */ 0,0,0,0,252,108,108,108,
/* 10184 */ 0,0,0,252,108,236,108,108,
/* 10185 */ 108,108,236,12,236,108,108,108,
/* 10186 */ 108,108,108,108,108,108,108,108,
/* 10187 */ 0,0,252,14,238,108,108,108,
/* 10188 */ 108,108,236,12,252,0,0,0,
/* 10189 */ 100,100,252,0,0,0,0,0,
/* 10190 */ 48,48,240,48,48,240,0,0,
/* 10191 */ 0,0,0,0,240,48,48,48,
/* 10192 */ 48,48,48,48,60,0,0,0,
/* 10193 */ 48,48,48,48,252,0,0,0,
/* 10194 */ 0,0,0,0,252,48,48,48,
/* 10195 */ 48,48,48,48,60,48,48,48,
/* 10196 */ 0,0,0,0,252,0,0,0,
/* 10197 */ 48,48,48,48,252,48,48,48,
/* 10198 */ 48,48,60,48,60,48,48,48,
/* 10199 */ 216,216,220,216,216,216,216,216,
/* 10200 */ 216,216,216,220,192,252,0,0,
/* 10201 */ 0,0,0,252,192,220,216,216,
/* 10202 */ 216,216,216,220,192,0,252,0,
/* 10203 */ 0,0,0,0,0,0,252,0,
/* 10204 */ 216,216,216,220,192,220,216,216,
/* 10205 */ 0,0,0,252,0,252,0,0,
/* 10206 */ 216,216,216,220,0,220,216,216,
/* 10207 */ 48,48,48,252,0,0,252,0,
/* 10208 */ 216,216,216,252,0,0,0,0,
/* 10209 */ 0,0,252,0,0,252,48,48,
/* 10210 */ 0,0,0,0,0,252,216,216,
/* 10211 */ 216,216,216,252,0,0,0,0,
/* 10212 */ 48,48,48,60,48,48,60,0,
/* 10213 */ 0,0,0,62,48,62,48,48,
/* 10214 */ 0,0,0,0,0,252,216,216,
/* 10215 */ 216,216,216,216,220,216,216,216,
/* 10216 */ 48,48,252,0,0,252,48,48,
/* 10217 */ 48,48,48,240,0,0,0,0,
/* 10218 */ 0,0,0,60,48,48,48,48,
/* 10219 */ 252,252,252,252,252,252,252,252,
/* 10220 */ 0,0,0,252,252,252,192,192,
/* 10221 */ 192,192,192,192,192,192,192,192,
/* 10222 */ 12,12,12,12,12,12,12,12,
/* 10223 */ 12,12,12,12,252,252,252,0,
/* 10224 */ 0,0,0,104,144,144,104,0,
/* 10225 */ 112,136,136,176,136,136,240,64,
/* 10226 */ 240,144,128,128,128,128,128,0,
/* 10227 */ 248,80,80,80,80,72,0,0,
/* 10228 */ 248,136,64,32,64,136,248,0,
/* 10229 */ 0,0,0,124,136,136,112,0,
/* 10230 */ 0,0,0,136,136,136,112,128,
/* 10231 */ 0,0,116,152,16,16,28,0,
/* 10232 */ 252,16,56,68,56,16,252,0,
/* 10233 */ 48,204,204,252,204,204,56,0,
/* 10234 */ 120,132,132,132,72,72,132,0,
/* 10235 */ 60,64,56,68,68,68,56,0,
/* 10236 */ 0,0,108,146,146,108,0,0,
/* 10237 */ 0,0,0,56,88,104,112,0,
/* 10238 */ 56,64,128,248,128,64,56,0,
/* 10239 */ 0,0,48,204,204,204,204,0,
/* 10240 */ 252,0,0,252,0,0,252,0,
/* 10241 */ 16,16,124,16,16,0,254,0,
/* 10242 */ 32,16,8,16,32,0,254,0,
/* 10243 */ 16,32,64,32,16,0,254,0,
/* 10244 */ 24,52,48,48,48,48,48,48,
/* 10245 */ 48,48,48,48,48,48,176,112,
/* 10246 */ 48,48,0,252,0,48,48,0,
/* 10247 */ 0,100,152,0,100,152,0,0,
/* 10248 */ 56,68,68,56,0,0,0,0,
/* 10249 */ 0,56,56,0,0,0,0,0,
/* 10250 */ 0,0,56,0,0,0,0,0,
/* 10251 */ 14,8,8,72,40,24,8,0,
/* 10252 */ 0,0,0,176,72,72,72,0,
/* 10253 */ 0,0,240,60,64,128,248,0,
/* 10254 */ 252,252,252,252,252,252,252,252,
/* 10255 */ 0,0,0,0,0,0,0,0
};
vdp_read()
{
char c,v;
for(c=0;c<17;c++) {
v = in(DATAP);
printf("0x2x ",v);
}
}
vdp_display(line,column,string)
int line;
int column;
char * string;
{
char index;
vdp_write_ram(GUTTER+(line*40)+column);
for(index=0;index<strlen(string);index++) {
out(DATAP,string[index]);
}
}
vdp_pad(line,column,string)
int line;
int column;
char * string;
{
char index;
vdp_write_ram(GUTTER+(line*40)+column);
for(index=0;index<strlen(string);index++) {
out(DATAP,string[index]);
}
if(40>strlen(string)) {
for(index=strlen(string);index<40;index++) {
out(DATAP,' ');
}
}
}
vdp_hz_join(line)
int line;
{
char i;
char szTemp[2];
sprintf(szTemp,"%c",0x8a+style);
for(i=1;i<WIDTH-1;i++) {
vdp_display(line,i,szTemp);
}
sprintf(szTemp,"%c",0x88+style);
vdp_display(line,0,szTemp);
sprintf(szTemp,"%c",0x89+style);
vdp_display(line,WIDTH-1,szTemp);
}
vdp_main_frame(name)
char * name;
{
char i;
char szTemp[48];
sprintf(szTemp,"%c",0x81+style);
for(i=1;i<WIDTH-1;i++) {
vdp_display(0,i,szTemp);
}
sprintf(szTemp,"%c",0x85+style);
for(i=1;i<WIDTH-1;i++) {
vdp_display(HEIGHT-1,i,szTemp);
}
sprintf(szTemp,"%c",0x87+style);
for(i=1;i<HEIGHT-1;i++) {
vdp_display(i,0,szTemp);
}
sprintf(szTemp,"%c",0x83+style);
for(i=1;i<HEIGHT-1;i++) {
vdp_display(i,WIDTH-1,szTemp);
}
sprintf(szTemp,"%c",0x80+style);
vdp_display(0,0,szTemp);
sprintf(szTemp,"%c",0x82+style);
vdp_display(0,WIDTH-1,szTemp);
sprintf(szTemp,"%c",0x84+style);
vdp_display(HEIGHT-1,WIDTH-1,szTemp);
sprintf(szTemp,"%c",0x86+style);
vdp_display(HEIGHT-1,0,szTemp);
sprintf(szTemp,"%s %d/%d/%d Ver %d.%d.%d",
name,A_MONTH,A_DAY,A_YEAR,A_RMJ,A_RMN,A_RUP);
vdp_display(1,(WIDTH-strlen(szTemp))/2,szTemp);
vdp_hz_join(2);
vdp_hz_join(HEIGHT-3);
}
vdp_clr16k()
{
unsigned int a;
#ifdef DEBUG
printf("Let's set VDP write address to #0000 \n");
#endif
out(CMDP,0); /* 0x00 - a6 a7 a8 a9 a10 a11 a12 a13 - all zeroes */
out(CMDP,64); /* 0x40 - 01 a0 a1 a2 a3 a4 a5 - all zeroes */
#ifdef DEBUG
printf("Now let's clear first 16Kb of VDP memory\n");
#endif
for(a=0;a<16384;a++) {
out(DATAP,0);
}
}
vdp_setregs()
{
#ifdef DEBUG
printf("Now it's time to set up VDP registers\n");
#endif
out(CMDP,0); /* 0x00 - 000000 - 0 M3 M3 of 0 required text mode */
/* 0 EX EX of 0 disables extVDP inp */
out(CMDP,128); /* 0x80 - 1 0000 000 - reg 0 */
}
vdp_modes()
{
#ifdef DEBUG
printf("Select 40 column mode, ");
printf("enable screen and disable vertical interrupt\n");
#endif
out(CMDP,80); /* 0x50 - 0101 0000 - 0 4/16K Select 4027 RAM operation */
/* 1 BLANK Enables the active display */
/* 0 IE Disables VDP interrupt */
/* 1 M1 M1 of 1 is required for text mode */
/* 0 M2 M2 of zero is required for text mode */
/* 0 n/a */
/* 0 SIZE 0 sprites 8x8 */
/* 0 MAG 0 sprites 2X */
out(CMDP,129); /* 0x81 - 1 0000 001 - reg 1 */
}
vdp_pnt()
{
#ifdef DEBUG
printf("Set pattern name table to #0000\n");
#endif
out(CMDP,0); /* 0x00 - 0000 0000 - name table base addr 0 */
out(CMDP,130); /* 0x82 - 1 0000 010 - reg 2 */
}
vdp_pgt()
{
#ifdef DEBUG
printf("Set pattern generator table to #800\n");
#endif
out(CMDP,1); /* 0x01 - 00000 001 - pattern generator base addr 1 */
out(CMDP,132); /* 0x84 - 1 0000 100 - reg 4 */
}
vdp_colors()
{
#ifdef DEBUG
printf("Set colors to white on black\n");
#endif
out(CMDP,240); /* 0xF0 - 1111 0000 - (text=1111 bkgd=0000 */
out(CMDP,135); /* 0x87 - 1 0000 111 - reg 7 */
}
vdp_load_set()
{
int c,d,index;
#ifdef DEBUG
printf("Let's set VDP write address to #800 so ");
printf("that we can write character set to memory\n");
#endif
out(CMDP,0); /* 0x00 - a6 a7 a8 a9 a10 a11 a12 a13 - all zeroes */
out(CMDP,72); /* 0x48 - 01 a0=0 a1=0 a2=1 a3=0 a4=0 a5=0 */
/* a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 */
/* 0 0 0 1 0 0 0 0 0 0 0 0 0 0 */
/* 000 1000 0000 0000 */
#ifdef DEBUG
printf("Create a character set\n");
#endif
index=0;
for(c=0;c<256;c++) {
for(d=0;d<8;d++) {
out(DATAP,charset[index++]);
}
}
}
vdp_fill()
{
int c;
char d;
#ifdef DEBUG
printf("Let's set write address to start of name table\n");
#endif
out(CMDP,0);
out(CMDP,64); /* 0x40 */
#ifdef DEBUG
printf("Let's put characters to screen\n");
#endif
d = 0;
for(c=0;c<(40*24);c++) {
out(DATAP,d);
d++;
if(128 == d) d=0;
}
}
vdp_sync_vdp_regen()
{
int c,d;
#ifdef DEBUG
printf("Let's set write address to start of name table\n");
#endif
out(CMDP,0);
out(CMDP,64); /* 0x40 */
#ifdef DEBUG
printf("Let's put characters to screen\n");
#endif
d = 0;
for(c=0;c<(40*24);c++) {
out(DATAP,vdp_regen[c]);
}
}
func700()
{
out(CMDP,0);
out(CMDP,0);
}
vdp_clr_vdp_regen()
{
unsigned int index;
for(index=0;index<(24*40);index++) {
vdp_regen[index] = ' ';
}
}
vdp_set_vdp_regen()
{
unsigned int index;
for(index=0;index<40*24;index++) {
vdp_regen[index]=index&0x7f;
}
}
vdp_num_vdp_regen()
{
unsigned int index;
for(index=0;index<40*24;index++) {
vdp_regen[index]=0x30+(index%10);
}
}
vdp_write_vram(offset)
int offset;
{
unsigned char byte1;
unsigned char byte2;
byte1 = offset & 255;
byte2 = (offset >> 8) | 0x40;
out(CMDP,byte1);
out(CMDP,byte2);
}
/* eof - tms9918.h */

Loading…
Cancel
Save