Jump to content
IGNORED

Just another Coleco Programer


Mike Harris

Recommended Posts

Actually, my largest work was 30 years ago or so with BBS'ng and making stupid games in Smart Basic.

 

However, I am now trying my hand at Homebrew and Assembly Language.

 

As I am studying others work and looking for examples with simple Hello World and what not I am really trying hard to follow.

Without proper examples I am running into road blocks such as.

 

Here is a snippet of Code to display a simple line of text and set the colors and for my understanding can someone direct me.

 

 

ld a,$6F
ld hl,$2000
ld de,32
call $1f82 ;BIOS Fill_VRAM

 

I can include this with all the other support routines and get red text with a white background. I can change any of those colors in the pallet.

 

My issue is how do I change the border color?
Back in the smartbasic days it would be something like poke 27384 for border and 27386 for screen color.
I may have these numbers wrong but you get the idea.

 

Can someone fill in the blanks like how to change the border so I don't have to use a blank screen

What is the ld hl, $2000 and the ld de, 32

 

Or maybe it is because I am using mode_1

 

Any help to get started.

I have looked on all the popular websites and have all the manuals, even the ones that you can't read, on OS5 and OS7

 

I know everyone has already figured all of this out but what I really need is example code in asm and a list of jump tables with the registers and examples.

 

If I had to guess I would figure it to be a simple register that you add a color value or leave it zero for blank being as there is nothing to program, you can't add graphics to the border as far as I know.

Edited by Mike Harris
Link to comment
Share on other sites

I was a bit in a rush, tms9918.pdf doesn't seem to be on the internet anymore... From my old experiment with assembly using tniasm. To change color border,

ld b,7
ld c,$F2
call WRITE_REGISTER

This will make the text white with green background.

 

Along with NewColeco devkit. There are 2 pdf. cv programming.pdf is what I used a lot. The jump tables os7 stuff are on page 99. Colecovision Coding Guide. The other one is new, which I never seen before is probably what you want if you're familiar with assembly. If you want to use C. The code to change background color to green is, paper(2);

To compile your project in C, type in Cygwin or a terminal

C:\sdcctest\CookMunc>sdcc -mz80 -c --std-c99 --oldralloc  CookMunch.c

CookMunch.c would be your project name. To link them and turn it into a ROM, type:

sdcc -mz80 --code-loc 0x8024 --data-loc 0x7000 --no-std-crt0 ../crtcv.rel ../cvlib.lib ../getput.lib ../comp.lib CookMunch.rel 

Then run,

C:\sdcctest\CookMunc>objcopy --input-target=ihex --output-target=binary crtcv.ihx result.rom 

This is copy and pasted from cci3. I use cygwin terminal for projects requiring more than 32KB, which I can copy and paste the command into and from, but I have to type the long command at least once.

And I'm hoping you can be less frustrated and more understand that programming for the Colecovision is a niche hobby. If you need help, I'm usually on this forum.

Link to comment
Share on other sites

Thanks for the help.

I did some research with my guide I bought back in 1984 which is the same thick book at Sac News.

 

This is what ultimately worked for anyone who wants to know.

 

LD A,$0A ; Border Color
LD C,A ; Copy A into register C
LD B,$07 ; B with register 7
Call $1FD9 ;Write to the Register

 

As I use these routines I am going to write them all down after I prove them to work then share them.
Unless there is a book with these already out there.
Sort of like a list of pokes and peeks back in the day that you would get out of a magazine.

Link to comment
Share on other sites

Changed to your example and actually saved 1 byte.

I was wondering why I had to move A to C when I could have just loaded c with the color directly.

 

As far as compiling I have really great results just dragging and dropping my .asm file on tniasm,exe and it creates a rom ready to go within less than a second.

Edited by Mike Harris
Link to comment
Share on other sites

I have an involved question which HAS to be taught in a class because I can't figure it out.

I have seen this in Amiga source code and I know it is possible but let me give you a quick example.


For giggles say this was my map data at the end of my code.

 

 

Screen1:

DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DB 0,0,0,1,1,1,1,1,1,1,0,0,0,0,0
DB 0,0,0,1,1,1,1,1,1,1,0,0,0,0,0
DB 0,0,0,1,1,1,1,1,1,1,0,0,0,0,0
DB 0,0,0,1,1,1,1,1,1,1,0,0,0,0,0
DB 0,0,0,1,1,1,1,1,1,1,0,0,0,0,0
DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

Is there a way to put that data to the screen at one time and at any color in assembly.

 

Such as

LD,HL,Screen1

LD, A, Color5

CALL FILLVRAM

 

 

Of course this is not to scale which would be 32x24 8 bit patterns.

I remember being able to save an image with paint master and be able to instantly send it to the screen with a few pokes in smartbasic.
I figured it out using The Hackers Guide to ADAM but that was a long time ago.

 

In this project I am working on I wanted to create a map like above and put it to the screen but the only way I can do it at the moment is one character at a time.
It does work but it also is not professional.

 

How can I build a colorful maze one 8 bit character in some loop at a time.
Using Mode 2 has also given me problems with the earlier border example as well.

Maybe I should go back to Mode 1

Edited by Mike Harris
Link to comment
Share on other sites

To place a block of data on to the name table, PUT_FRAME is the BIOS call for that.

PUT_FRAME
DESCRIPTION:
Puts a box of names (characters) on screen. It prevents bleeding outside visible screen.
INPUT:
HL = address of list of names (characters that compose the frame)
E = X_PAT_POS
D = Y_PAT_POS
C = X_EXTENT
B = Y_EXTENT

For example your screen1 data would be.

LD HL,Screen1
LD E, 2
LD D, 2
LD C,16
LD B,9
CALL PUT_FRAME(or $080B)

This will put series of tiles at screen position x=2, y=2. I use put_frame a lot in my project. Make sure to write graphic data to address 0000-000F, and put color table data to address 2000-200F, or nothing to show up. The graphic chip combine the chargen and color together into 1 nametable cell.

The other one like FULL_VRAM is to use WRITE_VRAM.

ld hl,NAME(source)
ld de,$1800(name table1 address)
ld bc,768(how much data)
call WRITE_VRAM

What we use for our Colecovision projects is the unofficial screen mode 2 and how to set that up is to use 3 character, 1 color table mode. I recommend try using ICVGM 303 to make your tile graphic data in graphic mode 2. It may be old but it really good and one of my favorite tileset maker for the Colecovision. You can read about it in the cv programming.pdf page 34.

ld b,2
ld c,$06;name 1800
call WRITE_REGISTER
ld b,3
ld c,$9f;color table 2000
call WRITE_REGISTER
ld b,4
ld c,$3;pattern generator 0000
call WRITE_REGISTER
ld b,5
ld c,$36;1b00
call WRITE_REGISTER
ld b,6
ld c,$07;sprites
call WRITE_REGISTER

That $9f is what to get that 1x8 color resolution mode working at address 0x2000, so this mode uses 2048 bytes. The official one documented in the TI book uses 64-192 bytes table and it would be 0x80 pointing at 0x2000. Kinda hard to explain what it is doing in that mode. If you have a single 1 bit image on the entire screen with the name tables in 0-255 order, it would be 2 color per horizontal row.

There is a bug using 1 pattern table and 1 color table screen 2 mode in regarding using sprites(on the real system, not emulation.). Sprites 0-7 aren't affected in that mode.

Edited by Kiwi
Link to comment
Share on other sites

Dude, you are AMAZING.

I was putting things to screen one 8 bit character at a time like we did back in basic days.
I knew that wasn't the way to do it either.

Truth be told I have been hung up over a simple JP NZ statement that I could just not get to work no matter what up until I went to bed.

Sometimes you need a break from staring at the screen for 20 minutes drooling and it's not porn.

I have no idea where my syntax is off or it is a bug in TniAsm v.45 and I don't have 1.0.
That's been the go to compiler only because I just drag and drop, rom is created and then I just load up the rom in any emulator handy.
It really cuts testing time down to milliseconds but...

Anyway, time to test out your lessons sensei.

Edited by Mike Harris
Link to comment
Share on other sites

Development is coming along.

I really want to share what I am doing but when it is done I will release it to the community as my first project.

Gather feedback and then my next project maybe I will sell.

 

From your experience if I port something from the Amiga like they did with Rick Dangerous, how does that play out if you want to make a few $$ of a port.

Link to comment
Share on other sites

Just finished 7 maze (room) designs, tested them to screen. Everything displays, everything aligns side by side.

I have over 20 more to do.

 

Now...
I have to use some compression techniques to reduce rom size.

I can compile it and it will work in an emulator but I a want this to work on a real colecovision.

 

So I am thinking of mirroring the data because all my mazes are mirrored like

 

db *0,0,1,0,0,1,0,0 0,0,1,0,0,1,0,0

 

As a quick representation.

 

I need to take the first 8 numbers, my case 16 of the 32 pattern positions per row and reverse them THEN put them to screen.

Also, there is a lot of dead space.

Not all of the screen needs to be filled and my original idea of placing one character on screen at a time is looking better at this point.

This is not like I am putting a picaso to screen, it is just a maze.

 

I am just blown away at the instantaneous display when I call that pattern to screen.

Edited by Mike Harris
Link to comment
Share on other sites

I remember when I decompiled Coleco Omega Race back around 198???

I was just a beginner back then and I discovered that they only had three data patterns for the ship and they were North, North East and East.
Everything else was mirrored to those 3.

If I am wrong then someone please correct me because I only found the 3 patterns at the time.

  • Like 1
Link to comment
Share on other sites

I don't accept new projects, sorry. Try CollectorVision.

 

Thanks, not looking for a publisher.

Was asking the legality of making $$ off of old roms being the port is yours.

You can even change the name from Puss in Boots to Cat in Shoes which seems to be the thing these days.

 

Like I say, this first one is a freebie for the community and my learning rom.

Later I will think about charging.

I come from the old school where Infocom was king and if I release a title it will be professional that comes with collectibles.

Edited by Mike Harris
  • Like 1
Link to comment
Share on other sites

I should just start a developer blog...

 

I wrote a routine today that will take any table at any length that can be put with a 16 bit register and mirror it so I only have to create patterns for one half of the screen.

Mostly done with a for loop but now I have to code it in z80.

 

Will keep everyone posted.

  • Like 1
Link to comment
Share on other sites

I remember when I decompiled Coleco Omega Race back around 198???

 

I was just a beginner back then and I discovered that they only had three data patterns for the ship and they were North, North East and East.

Everything else was mirrored to those 3.

 

If I am wrong then someone please correct me because I only found the 3 patterns at the time.

Right, it would be 3 images on cartridge, when it is loaded to vram, it would run routine to flip the images and write into the VRAM. I don't understand how to use the OS7 version of it, but wrote one in C. I used it in PONG and Rockcutter to copy, flip and paste the sprite to the other part VRAM. Out of all of the sprite based console I know, oddly TMS9918a cannot flip sprites via hardware.

Link to comment
Share on other sites

Major strides today.

Finally figured out how to create 256 separate characters (patterns) and apply the 2 colors per pattern or 1 color per line of the 8 lines of the pattern.

 

Heck, I could draw pictures and put them to screen or scramble them up this is so cool.

So now I have 15 colored blocks for my mazes, 0-9 another color while A-Z even another.

I am so proud of my work.

Now, if I could just figure out to change the border color in Mode 2. Easy in Mode 0 which was to change bit 7 I believe and write it.

  • Like 2
Link to comment
Share on other sites

Can someone explain why this is not logically sound?

TEMPADD: EQU 08

 

LD HL, LEVEL
LD DL, TEMPADD
LD BC, 08
LDIR

 

 

Level:

db 016,016,016,016,016,016,016,016

 

When it gets compiles that data does not transfer from LEVEL to TEMPADD

 

Just random garbage.

 

All I am trying to do is transfer one set of data into a temporary address and I have even tried LDDR with same result.

 

Being as I can't find a suitable TNIAsm replacement I have no idea if it is a bug in .45 because there is a v1

or if it is my syntax I had much the same result with JNZ using TNIAsm.

 

So if anyone has a drag and drop TNI replacement???

Edited by Mike Harris
Link to comment
Share on other sites

SO using DE then duplicating all the data in LEVEL to the address at HL would work?

Or do I have to reserve space such as

 

LD HL, LEVEL
LD DE, TEMPADD
LD BC, 08
LDIR

 

 

Level:

db 016,016,016,016,016,016,016,016

TEMPAD:

db 000,000,000,000,000,000,000,000

 

You would think this was a simple process just to load all of the data from LEVEL into TEMADD so you have identical data sets.

Link to comment
Share on other sites

I should have paid more attention in my pointer class back when I was taking C++.

I think one of my problems is that I am not loading data into the memory space where TEMPADD was defined.

 

if it is currently 000 for the first byte I am trying to replace the 000 with say 34.

 

I have tried everything I can learn about Assembly.

such as &TEMPADD and (TEMPADD)

Which I was shooting blindly in the dark.

When I looked HL after TEMPADD was declared it gave the address.

So I guess I have to point to the TEMPADD address and THEN poke the byte to that location?

 

Then increment my pointer to the next byte location which would be TEMPADD+1

 

I thought LDIR did all of that and was basically a copy command.

 

DE info to be copied

HL area to be copied to

BC how many byes to be copied

LDIR to execute

Edited by Mike Harris
Link to comment
Share on other sites

DE info to be copied

HL area to be copied to

BC how many byes to be copied

LDIR to execute

It's HL = Source address, DE = Target address, BC = Total bytes to be copied.

 

For it to work, DE must point to an area between $7000-$73ff (the RAM memory of Colecovision)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...