Jump to content
IGNORED

5200 Programming Part 2


Tempest

Recommended Posts

Ok, to try and keep the load times to a min. I'm starting a new thread for 5200 programming.

 

I think I understand how the graphics are stored, but I'm still having a little bit of trouble implimenting it. As far as I understand each pixle is represented by a 2 bit color code, so if you wanted 8 pixles of color 1 (01) you would input $55,$55 (0101 0101 0101 0101) right?

 

Assuming I'm not totally insane, this would mean if you were inputting a line of graphics in mode 3 (antic 8) you would need 80 of those stupid little byte pairs ($55,$55,$55,$55, etc.) since has 40 squares of 8 pixles each. That's a damn lot!

 

That aside, I'm still having trouble getting it to display right. To display my first three lines of my screen (2 text 0, 1 blank) I simply made a loop that loaded my byte block that looked like this:

 

screenloop

lda screentop,y

sta $1800,y

cpy #$27

iny

bne screenloop

ldy $00

 

 

And I had all the info in one of those byte blocks. One thing I can't figure out about this loop is how it loads the second line of graphics after it reaches the end of the first 40 characters (at the end of the counter). When I look back at this loop I can't figure out why it doesn't just repeat the first line over and over again (I reset Y after 40 characters).

 

Anyway, can I use a loop like that to load my graphics for the next three lines or do I need to do something totally different? In Dan's example he keeps storing stuff in $80 and I can't figure out why. I'm so confused...

 

Tempest

Link to comment
Share on other sites

Tempest I'm going to have to see your code to figure out why you're getting this second line of data on your screen.

 

Now for displaying a line in graphics mode 3 you would need 20 byte pairs. Now I'm going off of memory here because I can't get to the Arari Archieve site but the byte pairs represent 2 pixels. So if you only wanted 2 pixels colored and not 4 you would use #$50. And yes you could set this up in a loop. Something like:

 

lda #$55

ldy #$14 ; 20 in hex

drawline

sta scrloc,y

dey

bne drawline

 

Now I don't know why Dan chose to use $8000 as a pointer to his screen location. He could have used $1800 just as well.

Link to comment
Share on other sites

Ok, I'll send you the code when I get home. I actually want to get the second line of data, it's just I can't figure out why it does it (I guess it's just one of those good errors).

 

I'd only need 20 byte pairs? If each byte pair is two pixles and graphics 3 displays 40 8 pixle blocks wouldn't I need 80? I think I'm confused about something here.

 

Once that diplay loop gets to the end of the line how does it then jump to and display the next line?

 

Tempest

 

[ 06-04-2001: Message edited by: Tempest ]

Link to comment
Share on other sites

After looking at the resolution for ANTIC 8 there are 10 bytes per line and not 20 like I originally thought. Each nibble represents 4 bytes so $F0 will display the first 4 bytes in color 3 and the last 4 bytes in the background color. So to do a line in ANTIC 8 with color 1 you could do:

 

lda #$55

ldy #$09 ; I forgot about #$00 in my last post

drawline

sta scrloc,y

dey

bne drawline

 

To skip to the next line you would need to add #$0A to the start of screen memory since there are 10 bytes per line. Or if you just filled the line with data just continue adding data since you are already #$0A past your starting point.

Link to comment
Share on other sites

Yes it will wrap around. Remember that printing or displaying on the screen is an offset from the screen origin. So if you have aready advanced the width of the screen it will wrap around to the next line. This is of course assuming you don't restart by repointing to the start of screen memory.

  • Like 2
Link to comment
Share on other sites

How embarassing! I cannot even get Dan BOris' example to work! Help me! Here's what I'm doing:

 

I run in DOS DASM.EXE like this:

 

DASM 52PM.TXT

 

This produces a default output file name A.OUT. When I try to run this using VSS like this:

 

5200 A.OUT

 

I get an error because VSS only works with 5200 binary images that are either 16384 or 32768 bytes long. And A.OUT is not. As you can see, I'm not well versed in doing this sort of thing yet.

Link to comment
Share on other sites

Heh, this is getting fun. I'm a bit behind you, Tempest.

 

Run a version of Dan's PMtest but replace the pm bitmap with this:

pm1 .byte %11111100

.byte %11001111

.byte %11011101

.byte %11011101

.byte %11001111

.byte %11111100

.byte %11111100

.byte %01111000

Link to comment
Share on other sites

Can't you run those emus...in a dos box in a window? and then just hit the print screen button that way? You would get the windowed session and windows...sure..but then you would also get a screen grab.

 

Unless that is what you meant...but I don't use Alt+Printscreen...I just hit PrintScreen...then use MS paint to pull up the picture doing a Cntl+V then save as BMP to edit with Photoshop...Paintshop Pro...whatever.

Link to comment
Share on other sites

Hehe... That's what I did for my first demo (although my player was a square that I plan to use in my game).

 

Now that I know you can take screen shots I'll put up a WIP page of my own. I'll get it up tonight sometime, it will be at: http://www.msu.edu/user/reicher6/cypher.htm

 

Tempest

Link to comment
Share on other sites

Is there any way to save a screen picture while running these things via DOS?

 

I tried the usual ALT+PrintScrn but it kept giving me memory errors -- and I have tons of RAM. Any suggestions? It's be great to be able to show some pictures as we develop!

Link to comment
Share on other sites

If you again click the link to my 5200 development page above, you'll see what I accomplished last night. I was able to change the coffee cup into a right and left arrow, changing it before each loop which moved it horizontally back & forth. I also fooled around with the shape of the three color bars in the background and made them look more like columns.

 

A few things I couldn't figure out:

 

1. Is the arrow (which was a face in Dan's original example) a Player or a missile. Or is it called a Player Missile?

 

2. How do I move the arrow vertically? I see that HPOSP0 controls horizontal plotting. I messed around with the base address of the PM, with the SIZEP0 value (which never seemed to have any effect on the demo, no matter what I made it!).

 

Any thoughts on that?

Link to comment
Share on other sites

I can't get my graphics to display. For some reason anything past the three lines of Text 0 I have won't display.

 

I'll have to look over dan's code again, but I couldn't get Player size to do anything either. I think the face is the player graphic.

 

As for moving it vertically, you've got me. On the 2600 you would just draw the player on a higher scan line but then agian it didn't use display lists. I'll have to check on that one.

 

Tempest

Link to comment
Share on other sites

I'm not ready to mix Graphics modes yet. I'm sticking with Dan Boris' demo example and learning how to do the basics, then I'll get fancy.

 

Is the following correct?

 

The PM demo is in Antic Mode 8. That means there are 8 scan lines per mode line. It also means there are 40 pixels on each line. the dlist starts with $70, $70, $70 which means 24 blank lines. I assume that somehow $70 means 8 blank lines then. Why?

 

Then the dlist has .byte $48,$00, $18 which means Antic mode 8 and Load Memory Scan (LMS) of $1800. It then has 23 $08's, for a total of 24 Mode 8 lines on the screen, which make up those colored bars.

 

Okay, if I wanted to make a display list in Antic Mode A, which has 4 colors (like Antic Mode 8) but 4 scan lines per mode line and 80 pixels per line (double Mode 8's pixels). If I used this mode,

 

1. Would I still (regardless) start my dlist with .byte $70,$70,$70 ?

2. Would the next line be: .byte $4A,$00,$18 (I'm assuming if $48 is Antic mode 8, then $4A is ANtic Mode A) ? Starting at screen memory location of $1800 again, simply for the reason that I'm mimicking Boris's example.

3. Since I have 4 scan lines per mode line, if I divide 4 into 192 scan lines I get a total of 48 Mode Lines available in Antic

Mode A. Correct?

4. The pm in the Boris example (Antic Mode 8) is 8 by 8. Is that because there are 8 scan lines per mode line? If so, would my pm's in Antic mode A have to be 4 by 8? or 4 by 4? or what?

 

I'll stop with my questions there. I'd appreciate if Tempest or Debro could try to offer a few answers to these!

Link to comment
Share on other sites

I think you've got it right. I don't know what $70 is 8 blank lines but it is and you always need 3 of them at the start of a display list (for the vertical blank).

 

1. Yep you need all 3 of those $70's

2. Yes. Look at chapter 2 of that book, there's a table there that tells the hex values of the graphic modes.

3. Sounds good.

4. Don't know, I haven't gotten that far yet.

 

Tempest

Link to comment
Share on other sites

Hey guys I'm sorry I hadn't responded or contributed today. Things are getting heated at work right now. Anyway, Tempest I looked at your code briefly today and was able to get the graphics to display. I had to change your display list. It seems as if there was some overlapping or something. Not really sure until I go through it a little closer. I also noticed you are trying to do the graphics starting at $18A0 and I think this is where your Text mode 2 graphics start. I will have to look into the color changes though. It does look a little strange. hopefully I'll get a little free time tomorrow and get back to you.

 

As for Dan's code the character is a player. A player is (by definition) 8 bits wide and (this may sound confusing) the full height of the screen. You can change the width of the player to normal=0, double=1, or quadruple=3. Looking at Dan's example it looks as if he has the wrong address for player0 size. It should be $C008 and not $C001. To change a players vertical location you should just be able to change it's starting address and it will shift up or down depending on the value.

 

Things look good so far guys. Keep up the good work. Maybe we'll see a new 5200 cartridge for it's 20th birthday

 

Also just a note, if you are going to display the 5200 startup screen then (by the A.N.A.L.O.G. article) you won't have to do the "zeroing routine" Dan uses.

Link to comment
Share on other sites

Yeah I figured that address thing out last night and I was able to get my grpahics to display. I had to use PF Color 0 instead of 2 because that also controlled the background color on the text. Can you change these in the middle of the program? When I tried it changed it for the entire screen, not just the portion I was drawing (not good).

 

The more I look at my program, the more I realize the Graphics 3 isn't going to work because I need a thin black line around the white blocks (a boarder if you will). So I guess I'm going to have to do something with a little more detail.

 

Is there a way to display a white square in text mode? I looked in the Ascii table butI didn't see anything. I was thinking I could put my pattern in between the score info if I did it in Text 0 (I wouldn't have to change modes then) but I can't find any ascii values that work. I'd need to put a boarder around it anyway which would mean changing graphics modes so I guess it's a moot point anyway. I'll figure something out.

 

Sounds like the Player sprite behaves jsut like it does on the 2600, maybe I can reuse some of my code.

 

What zeroing routine are you talking about?

 

Tempest

Link to comment
Share on other sites

You may have to redefine your character set (at least one character) to get a solid box in text mode 0.

 

Now the color register issue was mentioned by Atari as a "feature". They gave the programmer the ability to change a color by just changing a register and not having to redraw the screen. There might be a way though. Maybe tricking the display list somehow (you know that stuff I'm still looking for). One day I'll be able to go through my boxes and find something...I hope.

 

Yeah the players in the 5200 do act like the players in Stella. I forgot you dabbled in Stella a little.

 

The "zeroing routine" I'm talking about is when he clears RAM, GTIA, ANTIC, POKEY, and sets the vector pointers. I haven't looked at it that closely but the startup screen is suppose to clear these things for you. If you care (and probably not since you do have a whopping 16K instead of 4K like in Stella) you might want to look at the article.

 

What would really be cool is if you could create a display that displayed the same but gave you the flexability of using a 4 digit year. I think I remember seeing a similar display programmed in an Antic magazine but I'm not sure though. But as you said from the beginning, that would be eye candy If I get time I'll see if I can come up with something for you guys.

 

Oh another suggestion. You and Cafeman might want to get together and come up with a header file like vcs.h for the 5200. Maybe vss.h or pam.h. There are a lot of registers but it would help you guys in being consitent in naming them.

 

Keep up the great work.

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...