Log in

View Full Version : A Miracle (near) At newcoleco's Website?)



Aswald
11-05-2002, 08:13 PM
Believe it or not, I finally got one of the emulators to work here! All it did was play several CV games, but it did work.
Who knows- one day in 2003, I might even program a CV game...maybe...

newcoleco
11-06-2002, 03:55 PM
I'm happy! you finally got a working ColecoVision emulateur for your computer! I hope you will be able to produce great homebrew Colecovision games.

I hope your sudden luck is not because I'm very unlucky. My computer crash and I can't send you any sources like the one I have done with your Vic-20 BASIC game.

The backup I have done just before the big crash of my computer seems to be a no good backup. A friend of mine wasn't able to read my CDs ... so I suppose I lost everything.

Arcade Antics
11-06-2002, 04:27 PM
Who knows- one day in 2003, I might even program a CV game...maybe...

Woo hoo! We're hoping you do, new ColecoVision games are always a good thing! :D


The backup I have done just before the big crash of my computer seems to be a no good backup. A friend of mine wasn't able to read my CDs ... so I suppose I lost everything.

NOOOOOOOOO!!!!!!!!! We're keeping our fingers crossed for you, brother. Here's to hoping all is not (literally) lost. Good luck!

opcode
11-07-2002, 11:23 AM
HI!

I hope you start programming for ColecoVision soon. I think you will find that machine very enjoyable to program. If you need any help, can count on me! :D

Eduardo Mello

ManekiNeko
11-07-2002, 12:28 PM
I really wish I understood how to design ColecoVision games. I took a C++ class last summer, and the documentation on newColeco's site STILL seems really strange and confusing... I can't follow it at all. It's a shame, because I'd really like to make my own classic video games.

JR

opcode
11-07-2002, 05:52 PM
ColecoVision is one of the simplest classic machines to program, if not the simplest one. It contains a powerfull (at least for that time) Z80 processor, a very flexible arcade like (also, for that time) video display processor, beside a 3 channel programable audio generator.
There are a few C compilers for Z80, which would simplify programming when used along the several librarys on newColeco's site.
But I would suggest you first learn the basic concepts behind the hardware, so you could understand what you are getting into!
And if you are adventurous enough, you could start programming directly in machine language, so you can untap the real power of a ColecoVision! :D

Eduardo

Aswald
11-07-2002, 07:57 PM
That's a problem right there: I've only programmed for Commodore and IBM computers. Even I know that Z-80s are quite different. But, where can I find an instruction manual for programming on a ColecoVision? Screen maps, PRINTING, random number generation, putting things on the screen, colors, memory maps, etc....

Actually, seeing "Chateau Du Dragon" gave me the idea for my first game: "Island of Foxes." It was an all-text game I programmed for the Commodore-64 back in the latter half of the 1980s. Unfortunately, like almost everything else, the actual program was lost (a-la Vecktar). Only some old notes and diagrams remain, from some old college notebooks.

newcoleco, we're all REALLY sorry about what happened to you! We certainly hope that somehow your work was preserved after all, and you uncover it soon! Good luck!

opcode
11-08-2002, 06:21 PM
Doesn't Daniel (newColeco) have complete documentation about the ColecoVision? :?:
The ColecoVision has a pattern based (or tile based) video display. The video memory is separated from main memory, and is 16KB size. It allows for a 256x192 display, with 16 simultaneous colors. Each 8x8 pattern can show all the 16 colors, but just 2 per 8 pixels line (a foreground and a background color). So you will need a little creativity in order to circumvent this little limitation. Best of all, you can define a max of 768 pattern! Another weak point, the weaker one, is no hardware scroll. Sprites are a powerful feature too, 64 can be defined, 32 showed on screen, but no more than 4 per scanline. The VRAM is mapped 0000h-17FFh:pattern definition, 1800h-1AFFh:pattern placement, 1B00h-1B7Fh:sprite placement and attributes, 2000h-37FFh:pattern color definition, 3800h-3FFFh:sprite patterns. As you see, there is a "hole" between 1B80h-1FFFh, which you can use to store game variables (Space Invaders does it) . :)
Printing is pretty easy, you just need define the characters starting at 0000h, define the corresponding colors starting at 2000h, and map the chars on screen starting at 1800h. VRAM access is made via VDP, just sending data over output ports.
Pseudo random number generation is gonna require some programming, but you can find a few examples around in the net.

Good luck! :D

Aswald
11-09-2002, 02:18 PM
Thanks for the starting tips!
I noticed that your locations were in hexadecimal; all I ever used were decimal numbers. When I did use machine language subroutines on the Commodore-64, I just placed the numbers in their places with POKE commands, and referred to them with SYS commands. At no time have I ever used any sort of an assembler, so I know very little about them.

Since "Island of Foxes" is a text-based RPG, BASIC was more than fast enough to handle the game. Keep in mind that, in order to print something on a Commodore computer, you just did this:

20 IF A=3 THEN PRINT "YOU HAVE TAKEN 3 HIT POINTS OF DAMAGE!": HP=HP-3: GOTO 50

And that was it. I'll need documentation, including "how to" examples, if I'm ever going to figure out the ColecoVision. Random numbers are especially important for any game I've ever programmed; at this time, sprites are not needed. Yet.
I wonder- would a flicker method work on Mr. Do!...?

opcode
11-12-2002, 12:05 PM
Hi,

No panic! Hex numbers are very simple to understand. In fact, for computer tasks, they are simpler than decimal.
For example, lets say you want to display a char on screen. The first step would be defining the char pattern. For the ColecoVision hardware, a bit defines a pixel on screen. But the Z-80 works using bytes, not bits. So the bits are grouped to form a byte. Now, if a want to display:
XX--X--X , where X represent a active pixel, and - a turned off pixel

How would you represent this byte in decimal form? It isn't very simple. But using hex, you just need to divide the byte in half, get the first half (4 bits) and sum each active bit using the following rule:
8 4 2 1, that is, the left more bit sum 8, the second bit from left to right sum 4 and so forth. For the previous example, it would be:
8+4 for the first half and 8+1 for the second half. So you finish getting 12 and 9. But hex numbers are 0 1 2 3 4 5 6 7 8 9 A B C D E F, where A is like 10, B is like 11 and so forth. Then 12 9 is in truth C9 in hex! Simple! And you will find the greatest number you can get for a nibble (the 4 bits half part that we have been using) is F (8 + 4 + 2 +1 = 15 = Fh). How a coincidence!
Now try to calculate the decimal number for the previous example! It is going to be a lot harder.



20 IF A=3 THEN PRINT "YOU HAVE TAKEN 3 HIT POINTS OF DAMAGE!": HP=HP-3: GOTO 50

The previous line would be done using ASM as follow:



LD A,(MYVAR) ;this is a comment - MYVAR is a memory position
CP 03h ;if myvar=3
JP NZ,NEXT ;if false, goto NEXT (a label), if true, continue
LD HL,STRING_POSIT ;get the string position in memory
LD B,20h ;hypothetical string size (number of characters)
LOOP: LD A,(HL) ;load a string char. LOOP is a label
OUT (VDP_DTA),A ; put the char on screen (the screen position should be
;previously defined, but i have omitted it here
INC HL ;position of the next char in memory
DEC B ;a less char to print
JP NZ,LOOP ;goto loop if there still are chars to print
LD A,(HP) ;load the HP var
SUB 03h ;subtract 03
LD (HP),A ;save HP
JP LINE_50 ;goto 50, where LINE_50 is a label defined elsewhere
NEXT:......... ;here, NEXT is the label defined above. it represents
;the program flow in case the above if is false. You can think of it
;like the next line marker


As you can see, the program is a little more complicated than BASIC. And you can be tented to say it is longer, but it would be a false statement. I am sure that when interpreted, the actual machine code for your BASIC line would finish been a lot longer than this example.


There isn’t such thing as real random in digital world. That you see as random is in truth pseudo random, some kind of trick.
There are several ways to produce pseudo random numbers. You could generate a list beforehand; you could use a variable counting interrupts, and many others.
A variable counting interrupts would be a good way. It works as follow:
- The ColecoVision generates an interrupt every 1/60 seconds, that is, 60 times every second. If you count those interrupts using a variable, when the player executes any action and the game needs a random number, just check the value of the counter variable. It is your random number! Since users never execute the same action in the same exact instant twice, the numbers probably will be different every time. Also, you can limit values using masks or bit rotations.

Good luck!

Aswald
11-12-2002, 03:12 PM
Actually, I still have an easier time with decimals, but I do understand hexadecimal- base 16, 0-F.

I appreciate all of the help! As soon as I get a programmer's emulator running, I'll try it!

newcoleco
11-12-2002, 04:55 PM
binary is base 2 : 0,1
octal is base 8 : 0,1,2,3,4,5,6,7
decimal is base 10 : 0,1,2,3,4,5,6,7,8,9
hexadecimal is base 16 : 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

the letters are in decimal
A = 10, B = 11, C = 12, D = 13, E = 14, F = 15

the binary expression "10" is 2 in octal, decimal and hexadecimal
the octal expression "10" is "1000" in binary, 8 in decimal and hexadecimal.
the decimal expression "10" is "1010" in binary, 12 in octal, A in decimal.
the hexadecimal expression "10" is "10000" in binary, 20 in octal, 16 in decimal.

Example :

The decimal number 123 is in reality 1 * 10 * 10 + 2 * 10 + 3
The hexadecimal number ABC is in reality A * 10 * 10 + B * 10 + C, but 10 here is the hex value "10" (= 16 in decimal)

To convert HEXADECIMAL to DECIMAL, try this :

If you want to convert the hexadecimal 123 in decimal :
123 (hexadecimal number) : it's 1 * (16*16) + 2 * (16) + 3 = 291

The following binary values are data for a little space ship graphic.

00011000
10011001
00011000
10011001
10111101
11111111
10111101
10100101

The easy way to code these binary code into a programme is to convert data into decimal or hexadecimal values. The easy way is the HEX way.

All you have to do is to split the binary values into block of 4 bits like this

0001|1000
1001|1001
0001|1000
1001|1001
1011|1101
1111|1111
1011|1101
1010|0101

Then, associate each 4 bits with an HEX value.

0000 : 0
0001 : 1
0010 : 2
0011 : 3
0100 : 4
0101 : 5
0110 : 6
0111 : 7
1000 : 8
1001 : 9
1010 : A
1011 : B
1100 : C
1101 : D
1110 : E
1111 : F

So, this is the result binary to hexadecimal :

0001|1000 : 18
1001|1001 : 99
0001|1000 : 18
1001|1001 : 99
1011|1101 : BD
1111|1111 : FF
1011|1101 : BD
1010|0101 : A5

To make these HEX values become a space ship on screen, simply put them into the Video memory.

For a ColecoVision, this little space ship could be a caracter (cursor) graphic or a little sprite (8x8).

newcoleco
11-12-2002, 06:11 PM
20 IF A=3 THEN PRINT "YOU HAVE TAKEN 3 HIT POINTS OF DAMAGE!": HP=HP-3: GOTO 50

Ok, let me try to convert your example in a C language.

The following text is a real C file to be compiled with Hitech-C and Coleco library (and also my usefull GETPUT2 library).



#include <coleco.h>
#include <getput2.h>

int HP; /* Global variable */
/* like DIM HP in BASIC*/

void nmi_process(void) {} /* nothing to do during the NMI interrupt */

/****************/
/* GAME ROUTINE */
/****************/
static void game(void)
{
byte a; /* temporary variable */

/* Line 10 */
a = rnd_byte(1,3); /* Ok! it's not in your example! */
/* like a = INT(RND*3+1) in BASIC */

/* Line 20 */
if (a==3)
{
center_string (10,"YOU HAVE TAKEN");
center_string (11,"3 HIT POINTS OF DAMAGE!");
HP -= 3; /* or you can write it the same way as your basic code */
goto Line50;
}

/* Line 30 */
center_string (10,"NO DAMAGE!");

Line50:
HP=HP;

}

/****************/
/* MAIN ROUTINE */
/****************/

void main (void)
{
text(); /* init screen mode */
/* init graphics ... no graphics */
cls(); /* Clear Screen */
game(); /* play game routine */
pause(); /* wait for fire button to continue */
/* end of program (restart) */
}

/************************************************** ***********

In the Coleco library
-----------------------
byte

In the GetPut2 library
------------------------
center_string(y,"text");
text();
cls();
pause();
rnd_byte(min,max);

************************************************** ***********/

newcoleco
11-12-2002, 06:24 PM
(instructions for windows environment)
To compile my example in C , you have to :

1st - Download the hitech-C env plus 22nice emulator.
z80 folder "z80.zip" here :
http://www.geocities.com/newcoleco/help/indexen.html

2nd - Download my GETPUT2 library to be added in the z80 folder.
"getput23.zip" here :
http://www.geocities.com/newcoleco/tools.html

3rd - Create a sub-directory in the z80 folder named test to put the test.c file.

4th - Create two files named cc.bat and link.bat based on the ones in the ctrainer sub-directory.
cc.bat
@echo off
copy %1.C ..
cd ..
C -C -V -O %1.C
cd test

link.bat
@echo off
cd ..
link
copy test.rom test
cd test

5th - Create a "option.txt" file based on the one in the ctrainer sub-directory.
option.txt
-z -otest.rom -c -ptext=8000h/0,data,bss=7000h/ crtcv.obj getput2.obj test.obj libcv.lib libc.lib


6th - Open a DOS window, run the 22nice emulator then goto the test sub-directory. Look at the screenshots in the help web pages.

7th - compile test.c file by using the cc.bat, link.bat and option.txt files. Read the sample in my help web page to know how to use them.

URL for the help web page :
http://www.geocities.com/newcoleco/help/indexen.html

Aswald
11-13-2002, 12:04 PM
Regarding that example of a PRINT command....

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA!!!!!!!!!!!

newcoleco
11-13-2002, 02:25 PM
Are you scared? :o O.o

What "AAAAAAAAAAAAAAAAAAAAA" means? :eek:

newcoleco
11-13-2002, 02:31 PM
And about my computer... is dead.

I have not enough cash to pay another one
so can't continue doing Coleco projects.

Do you realize it's a big problem for a programmer
who like to porgram software to not be able to
program anything because his computer crash.

I'm writing this message by using a computer
at the university.

newcoleco
11-13-2002, 05:34 PM
This part of my C file is based on your example :



/* Line 20 */
if (a==3)
{
center_string (10,"YOU HAVE TAKEN");
center_string (11,"3 HIT POINTS OF DAMAGE!");
HP -= 3; /* or you can write it the same way as your basic code */
goto Line50;
}


The text mode I use : 32x24
It's why I cut in two parts your text.

I already programmed fonctions like "center_string" in my getput library so you don't have to think about where and how to put your text into the video memory.

If you think my C file is too complex for you, you must not start programming Coleco games in C like me.

Aswald
11-14-2002, 01:54 PM
You must keep in mind that the only computer experience I've ever had is with certain IBM and Commodore computers, using BASIC and directly poked-in machine language subroutines with a SYS command.
Obviously, what I know is mostly useless when applied to a ColecoVision. The only way I'm going to get it is if I can find some sort of "Programmer's Reference Guide" for it, with instructions.

Your current situation is like mine- I only have access to a computer in the local libraries, so I don't have much time to work or learn anything on them.

Isn't there anything anyone can do for your situation? Maybe some place that specializes in that sort of thing, and can maybe retrieve lost information? Is it still "in there" somewhere?

I'd really like to program a CV version of "Island of Foxes." It actually isn't that complex a program when you break it down; it just uses some clever methods, such as randomly generating mazes by putting together some "tiles" and converting 2-dimensional mazes into 1-dimensional "strings," to save some empty memory space. I also cut down on the use of variables by POKEing values into empty memory spaces, and using PEEK commands to reference them. You can add or subtract from them as needed. Values over 255 would use 2 memory spaces, although "Island of Foxes" rarely did.

By the way, the game would only use Keypad input.

newcoleco
11-15-2002, 01:55 PM
To avoid the unfriendly step to use a command line based interface to compile and link your project, I started a simple front-end interface based on my z80 folder structure (file "z80.zip").

I realize a first beta version who works for my Windows 98 fr.
I need someone to test this little front-end too.

If you are using a windows 9x or windows NT,2000 or XP in english version, then contact me now on MSN and/or Yahoo Messenger.
I will be only for only a few hours (today).

The little test include the "test.c" file I write here in this TOPIC.

By using MSN or Yahoo Messenger you will give me your feedback quickly and I will be able to fix bugs quickly too.

Aswald, I hope you will contact me... if you want to know how you can compile your first Coleco program in C.

Aswald
11-15-2002, 03:52 PM
I'll try it as soon as I can- but I cannot; not on this particular computer, today.