Jump to content
IGNORED

5200 Programming Help


Tempest

Recommended Posts

I've decided to try my hand at programming the 5200. Are there any sites dedicated to 5200 programming? I've found Dan Boris's site, but that's all.

 

I know that programming the Atari 400/800 is similar (very similar) to the 5200 and much of that info can be used, but I'm looking for some pure Atari 5200 programming information.

 

Anyone else interested in programming the 5200? It seems everyone is doing the 2600 nowdays.

 

 

Tempest

Link to comment
Share on other sites

I started looking at the 2600 when I discovered the Stella list. I always wanted to program something for the 2600 and finally did (Happy Birthday Patrick!) even though it's not a game. I am looking into actually doing a game this time though if time permits. I find the 2600 interesting and challenging and that's why I want to program for it.

 

Now the 5200 in my opinion is not as challenging because I could write a game for the 5200 in ArariBASIC. True it might not be as fast or visually complicated as a ML game but I had a 800XL years ago and I can remember some arcade quality games written in AtariBASIC. Just look at J.D. Casten's games that were published in Antic as an example (BTW anyone know what ever happened to him).

 

If you're looking for sites that focus on 5200 programming I don't know if there is one. I looked a while back and couldn't find one either. But if I remember correctly there is a document on Dan's site that mentions how to convert an Atari 8-bit computer program to run on the 5200. If that does exist then all you need is documentation on the Atari 8-bit computer. The best source I can think of right of hand is "Mapping the Atari" which was republished in Antic Magazine. This should give you at least a start.

 

Anyway that's just my 2 cents. Of course my opinion is not the opinion of everyone else.

Link to comment
Share on other sites

One reason I gave up ont he 2600 was because of the TIA crap you have to do. Plus the 2600 is damn difficult (I got a movable sprite and I as all happy).

 

One reason I wanted to do something for the 5200 was because no one was doing anything for it. Everyone and their momma is programming the 2600 now, and I wanted to be different. Plus, I grew up with an Atari 400, not a 2600 (more memories).

 

I don't want to do anything in BASIC because it would get too slow. I want to go for assembly. Besides, I don't think the 5200 can read basic, it has to be done in ASM.

 

Tempest

Link to comment
Share on other sites

You are right that the 5200 would have to read binary and not BASIC but there was a program published in A.N.A.L.O.G. Magazine that converted your AtariBASIC program to binary format. It wouldn't speed up your program but it was a binary that could be automatically run by renaming it AUTORUN.SYS.

 

I did look at Dan's site today briefly though and I might have to retract my last post. Being that the 5200 doesn't have the exact same hardware as the Atari 8-bit computers it might be a little more difficult than writing the game on an Atari 8-bit and changing somethings.

 

Another down side to programming for the 5200 is that AWFUL joystick. I can't believe Atari put something like that out. Hmmm...now there's a start of a new project idea. Changing the 5200 joystick to be self centering (if it can be done). This was my main factor in not getting one back in the 80s.

 

Anyway Tempest you have sparked some thinking. I might just venture over to the 5200. But I will have to finish some other projects I'm looking into. See another reason I looked into doing programming for the 2600 was my son. I wanted to get him a 2600 to play with instead of the new systems right off the bat (he's 1 1/2 now). I figured one button so he can't get confused and the games are cheap. And wouldn't it just add to the fun if Daddy created games for him to play?

Link to comment
Share on other sites

Yeah the joystick is pretty bad, but I just found some new working ones and I've started getting back into it. There are some games that work better with this weird analog stick. But one reason I put my 5200 into the closet in the first place was that most of the Atari 400/800 games are exactly the same (with a better stick) and I had twice as many. But with all the cool prototypes I have and all the rest on the multi-cart I'm developing a new fondness for it. Plus the start up screen looks really cool.

 

Speaking of which, do you know how you program the startup screen? The two demo's on Dan's page seem to bypass it.

 

Cafeman and I have a little competition going on the DP board. We're both trying to get working demo's for the 5200 done by the beginning of June or so. We're hoping it will help attract more people to 5200 programming.

 

Tempest

Tempest

Link to comment
Share on other sites

Tempest you placed a challenge to me even if you didn't know it I had to stop doing my job work and get that 5200 startup screen displayed.

 

If you look on Dan's page to the reference to the A.N.A.L.O.G. article you'll kind of see a break down of the 5200 does on reset. Anyway instead of going through a long drawn out discussion here I'll email you my binary and source change to "Hello World". When you run the binary you will see the 5200 startup screen with "Hello World Demo" displayed and a copyright year of 1999. Hmmm seems like the 5200 is not Y2K compliant

Link to comment
Share on other sites

Well I now have the start-up screen saying the name of my game (@ is a space BTW) and I spliced in the graphics demo so my little character now moves in front of and behind those three colored bars.

 

Now I'm trying to figure out how the playfield graphics work for the 5200. On the 2600 you just loaded a pattern into PF0,PF1, and PF2. I think I've found an old Antic article that might help but it's huge so I'll print it out at work.

 

Any hints on playfield graphics?

 

Tempest

Link to comment
Share on other sites

Have you ever dabbled with Player/Missile Graphics before? (I don't know anything about 2600 programming).

 

I could be wrong here (correct me if so), but I think you have a number of options with character / bg options.

 

You can redefine the character set which basically saves you RAM.

 

Or you can just make display lists in your ASM program to define how each player/missile looks. Or use a combination of both?

 

As far as backgrounds, you need to decide if you will scroll or have a static screen, or do page-flipping (like in Pitfall).

 

I'm sure that post was of little help. What graphics mode are you going to use for your main game, Tempest? Perhaps a combination of graphics modes?

 

My first hurdle will be getting away from the Peek and Poke world of Atari Basic, and into the ASM world of registers, memory addresses, and display lists.

 

I've been going through some sample Antic ASM listings. Is there a map of which memory locations are what to the Os?

 

For example, it seems to me that you can't use memory $0000 - $0018, or $0200 - $021B because that is reserved for the 5200 monitor pgm and shadows/RAM vectors. However, just which shadows are at which addresses? How will we know? And just what is a 'shadow' anyway, a temp storage copy?

 

The 5200's RAM is mapped from $000 to $3FFF overall.

 

Cartridge ROM is in memory $4000 - $BFFF and can be up to 32K long. HOwever, since we are creating these via the emulator, how much K can we use for our virtual 'ROM' code?

 

Any and all answers are welcome.

Link to comment
Share on other sites

Wow this thread is getting long Maybe someone should create a PAMlist.

 

Tempest if you haven't changed the byte data I originally sent you to display the "HELLO WORLD DEMO" title you might want to change it to:

;

;

; The A.N.A.L.O.G. article that discusses the differences between

; the 5200 and the 8-bit Atari computer mentions that if $FF is found

; in location $BFFD then the 5200 skips the cartridge start up

; sequence ($BFFE).

 

; Place the cartridge title (20 characters) in location $BFE8

; These are the ATASCII values for the characters.

org $bfe8

.byte $00,00,$68,$65,$6C,$6C,$6F,$00 ; " HELLO " in ATASCII

.byte $77,$6F,$72,$6C,$64,$00 ; "WORLD " in ATASCII

.byte $64,$65,$6D,$6F ; "DEMO" in ATASCII

 

; Place the copyright year (2 characters) in location $BFFC

; Wow the 5200 is not Y2K complient

org $bffc

.byte $59,$59 ; "99" in ATASCII

 

; Start the cartridge

org $bffe

.byte $00,$40

 

; Start Dan's original code

; org $bffd

; .byte $FF ;Don't display Atari logo

; .byte $00,$40 ;Start code at $4000

 

That way the ATASCII character values are more straight forward.

 

The 5200's playfields are different from the 2600's. The 2600 has 3 playfield registers PF0, PF1, and PF2 which are pretty much static. And without some really tricky code the bytes in the registers will have the same color.

 

Now the 5200 (if like the 8-bits) has 4 playfield colors (shadow locations $00C0-$00F0). You can place these anywhere on the screen you want. The trick is to have a pointer to the screen memory location (I think its $1800) and place you're bits in different offset locations.

 

And as Cafeman stated in the 5200 you can redefine the character set and use character fonts to design your playfield. This is a big advantage over Stella. The 5200 actually has fonts so you don't have create your own to display scores

 

Anyway to possibly help you out Cafeman look at the A.N.A.L.O.G. article on Dan's site. It has answered my questions as far as different register locations. Also another good site for playfield answers is Chapter 3 of "Atari Graphics and Arcade Design". The Atari Archives is a great source for 8-bit information.

 

Also try changing the bytes in the title screen for HELLO WORLD to be a -#$40 off the original for a "flashy" display. For example change $59 to $19 This will give an example of playfield colors

 

Hope this helps

Link to comment
Share on other sites

Tempest, I will be fairly unreachable for a while, just letting you know. I should be back around June 1 at the latest with some news of my progress. Just letting you know I'm not disappearing of the end of the earth or anything.........

 

(_)3 Caféman !

Link to comment
Share on other sites

I'm getting ready to switch positions at my job in a week (I'll be managing requirements and writing micro charters), so I probably won't have anymore progress until after I get settled in. I have to read that book first anyway.

 

Tempest

Link to comment
Share on other sites

I guess we all will be doing a little reading/studying this weekend.

 

Wow this is exciting!! Tempest you've pulled me from my Stella projects by sparking my curiousity. Besides this thread with only 3 people has more activity right now than the Stella list

 

I'm not saying I'll make a 5200 game but I am interested in the inter workings. Plus firing up my old archieves of 8-bit information and possibly my old/new (from eBay) 130XE.

 

This really brings back the good old days of the Atari 8-bit (sorta).

 

Keep those posts coming...I look on the board periodically to see messages from you guys. I've even ventured over to DP in case you were posting there.

 

Anyway let us know of your progress.

Link to comment
Share on other sites

I just printed off that whole Arcade Design book. Now I just need to read it. I'm more familiar with 2600 programming, I'm not too knowledgable about these new concepts like shadow registers and page pointers and such. I guess I'll have to learn on the fly.

 

BTW, I made the start up screen display properly by using the same loop as Dan did to display the hello world message on the blue screen, I loaded each character, added (or was it subtracted?) 40, and then stored the chracter again. Seemed to work just fine.

 

I've been using 1965 as the copyright since 65 is 101 in hex therefore it would be 1900+101=2001. Well sorta... It's better than putting 1999. I've also been thinking of just putting 19xx.

 

Tempest

 

[ 05-22-2001: Message edited by: Tempest ]

 

[ 05-22-2001: Message edited by: Tempest ]

Link to comment
Share on other sites

My game has changed. I've decided my Hop To It game would be too hard for a first game (maybe next game) so I've come up with a new idea.

 

I was playing Computer War last night when it occured to me that the shooting down the missile part of the game sucks and the only reason I played it was the really cool find the pattern part you do when you have to disarm the computer at the end of each round. I've decided to expand on that concept a bit and make it harder and a bit more interesting. This game should be alot easier to program (stationary screen, one player at a time, no real computer AI just some pattern changing). I'm calling it Cypher for right now, we'll see how far I get.

 

Tempest

Link to comment
Share on other sites

Considering the DP board vs this one, we ought to just use this one for the 5200 tech stuff and questions, don't you agree? It gets too tough searching both!

 

Once we get some demo's going, we can show at DP some pictures of our work or whatever. Let's just stick to one place!

Link to comment
Share on other sites

Works for me, although a PAM Programming list isn't a bad idea either (but we'd need more than 3 people).

 

I've been reading that book I printed off yesterday, I think it's going to answer most of my questions. But one thing has been bothering me:

 

In almost every 2600 program I've seen there's been a main loop of sub-routines that the program follows. This makes it really easy to follow the flow of the program:

 

MainLoop

JSR VerticalBlank ;Execute the vertical blank.

JSR CheckSwitches ;Check console switches.

JSR GameCalc ;Do calculations during Vblank

JSR DrawScreen ;Draw the screen

JSR OverScan ;Do more calculations during overscan

JMP MainLoop ;Continue forever.

 

I haven't seen anything like this in a 400/800 or 5200 program. Why not?

 

 

Tempest

Link to comment
Share on other sites

In essence you have something similar.

 

Most homebrewed 2600 games follow the outline that was supplied by Nick (great example of starting 2600 coding too I may add). As for the 5200 the programmer doesn't have to hold the "computers hand" to paint the screen. So what you may have in your loop for the 5200 are game calculations, check console switches, and screen updates such as the player moved 2 moves to the left.

 

For example, in Dan's "Hello World" programming example he does have an infinite loop. It's at the end of the program labeled wait. Since there are no updates to the screen, no calculation, and no switches to check for this demo all he needs to tell the computer to do is draw the screen once and loop until the machine (or emulator) is stopped.

 

Now in his player/missle example there are screen updates but for the player only and not the playfield (unlike Stella). So he draws the playfield once and loops (mvloop1) to update the position of the player.

Link to comment
Share on other sites

I'm trying to get my display list going but I'm having some troubles...

 

I want to display a line of text in Text Mode 2 in the middle of the screen. So I figured I would start the list like this:

 

$70 x 3 ;Three for VBlank

 

$70 x 11 ;Skip 88 lines to get to center of screen

 

$47 ;Start Text Mode 2

 

$70 x 12 ;Skip to end of screen

 

$41 ;Jump and wait for VBlank

 

$70 ;Finish up and get to line 192

 

 

Why doesn't this work? All I get is a blank screen. What am I doing wrong? These damn display lists are hard!

 

Tempest

Link to comment
Share on other sites

Matt,

 

When I first started looking at this I was like "WHY ISN'T THIS WORKING!?" I set up my display list and I kept getting a blank screen. Then it dawned on me...I didn't set the color of the playfield. Duh. Sometimes things are so obvious we over look them

 

I made some changes to the "Hello World Demo" with comments so I hope they help you in creating your game.

 

I hope no one gets up set with me posting source code

 

Enjoy

 

; Atari 5200 "Hello World" sample code

; Written by Daniel Boris (dboris@home.com)

;

; Assemble with DASM

;

 

processor 6502

 

DMACTL equ $D400 ;DMA Control

sDMACTL equ $07 ;DMA Control Shadow

DLISTL equ $D402 ;Display list lo

DLISTH equ $D403 ;Display list hi

sDLISTL equ $05 ;Display list lo shadow

sDLISTH equ $06 ;Display list hi shadow

CHBASE equ $D409 ;Character set base

CHACTL equ $D401 ;Character control

NMIEN equ $D40E ;NMI Enable

COLOR0 equ $0C

COLOR1 equ $0D ;Color 1 shadow

COLOR2 equ $0E ;Color 2 shadow

 

org $4000 ;Start of cartridge area

sei ;Disable interrupts

cld ;Clear decimal mode

Start

ldx #$00

lda #$00

crloop1

sta $00,x ;Clear zero page

sta $D400,x ;Clear ANTIC

sta $C000,x ;Clear GTIA

sta $E800,x ;Clear POKEY

dex

bne crloop1

ldy #$00 ;Clear Ram

lda #$02 ;Start at $0200

sta $81

lda #$00

sta $80

crloop2

lda #$00

crloop3

sta ($80),y ;Store data

iny ;Next byte

bne crloop3 ;Branch if not done page

inc $81 ;Next page

lda $81

cmp #$40 ;Check if end of RAM

bne crloop2 ;Branch if not

 

ldx #$14 ;Reduced because only 12

;scanlines can be displayed

;for ANTIC 7

 

dlloop ;Create Display List

lda dlist,x ;Get byte

sta $1000,x ;Copy to RAM

dex ;next byte

bpl dlloop

 

lda #$03 ;point IRQ vector

sta $200 ;to BIOS routine

lda #$FC

sta $201

lda #$B8 ;point VBI vector

sta $202 ;to BIOS routine

lda #$FC

sta $203

lda #$B2 ;point Deferred VBI

sta $204 ;to BIOS routine

lda #$FC

sta $205

lda #$03

sta CHACTL ;Set Character Control

 

; Now we set the color of PF0 to light orange??

lda #$0F ;Set color PF0

sta COLOR0

 

; We really don't need PF1 or PF2 for this but...

lda #$84 ;Set color PF2

sta COLOR2

lda #$0F ;Set color PF1

sta COLOR1

lda #$00 ;Set Display list pointer

sta sDLISTL

sta DLISTL

lda #$10

sta sDLISTH

sta DLISTH

lda #$f8 ;Set Charcter Set Base

sta CHBASE

lda #$22 ;Enable DMA

sta sDMACTL

lda #$40 ;Enable NMI

sta NMIEN

 

print

ldy #$00

cld

prloop

lda text1,y ;Get character

sec

sbc #$20 ;Convert to ATASCII

 

; The next line was changed from Dan's original code. The

; video memory start at $1800 so to print "HELLO WORLD"

; centered on a ANTIC mode 7 screen we must offset from the

; origin. Since ANTIC mode 7 uses 16 scan lines we divide

; 192 (number of scan lines for the screen) by 16 and get 12

; available scanlines for ANTIC 7. Now we half that. Since

; ANTIC 7 has 20 bytes per line we multiply 20 * 6 to get the

; text on the center vertical line. Now we find where we need

; to center the text ((20 bytes - 11 characters) / 2) which is

; 4.5 but to make it look okay I fudged and used 4. Now we

; take these values (124 decimal, $7C hex) and add them to

; our start of video memory to store it in the center of the

; screen. Whew

sta $187C,y ;Store in video memory

 

iny ;Next character

cpy #11

bne prloop

wait

jmp wait

 

;Display list data

org $b000

dlist .byte $70 ; Typical display list will

.byte $70 ; 3 * 8 blank lines for the

.byte $70 ; the overscan

.byte $47 ; Display ANTIC mode 7 (text 2)

.byte $00 ; Low byte of screen location

.byte $18 ; High byte of screen location

; Next lines are 12 ANTIC mode 7 lines

.byte $07,$07,$07,$07,$07,$07,$07,$07,$07,$07,$07,

.byte $41,$00,$10 ; Jump to start at $1000

 

;Text data

org $b100

text1 .byte "HELLO WORLD"

 

;

;

; The A.N.A.L.O.G. article that discusses the differences between

; the 5200 and the 8-bit Atari computer mentions that if $FF is found

; in location $BFFD then the 5200 skips the cartridge start up

; sequence ($BFFE).

 

; Place the cartridge title (20 characters) in location $BFE8

; These are the ATASCII values for the characters.

org $bfe8

.byte $00,00,$68,$65,$6C,$6C,$6F,$00 ; " HELLO " in ATASCII

.byte $77,$6F,$72,$6C,$64,$00 ; "WORLD " in ATASCII

.byte $64,$65,$6D,$6F ; "DEMO" in ATASCII

 

; Place the copyright year (2 characters) in location $BFFC

; Wow the 5200 is not Y2K complient

org $bffc

.byte $59,$59 ; "99" in ATASCII

 

; Start the cartridge

org $bffe

.byte $00,$40

 

; Start Dan's original code

; org $bffd

; .byte $FF ;Don't display Atari logo

; .byte $00,$40 ;Start code at $4000

Link to comment
Share on other sites

YES! I got my title screen working, although all it is is a line of text (I noticed that it looks just like Frisky Tom's title screen. Interesting...)

 

Now I want to slowly change each letter in the title so it looks like it's being decoded and eventually have it end up saying the name of my game (Cypher). I'm having trouble making the letters change slow enough so they don't go by in a blur. Any ideas on how I can accomplish this?

 

What's the first memory location that I can use? I don't want to over write something.

 

Tempest

Link to comment
Share on other sites

OMG, this is just the kind of stuff I wanted to see! Thank goodness DEBRO is around to help us out, get us started quicker, eh Tempest?

 

I'm on vacation for a few more days, just checking in. I'll start my stuff around June 1! "Maze Chase Prototype #1" is (ahem) my title for now.....

 

Back in the 80's I made a mazechase in Basic/ASM where I built random mazes filled with hearts and a little running Dragon would grab them. You had to get all the hearts before a timer ran out. He would "roar" when he beat a level (there were 3 rounds, each with different mazes). I had a crappy home-brew version of "Sweet Georgia Brown" playing as the mazes randomly were built, and I used character graphics (it was all in Graphics 0 I think, the text mode) to animate the dragon.

 

I may, for fun, try something like that in ASM in a different graphics mode.

 

Any suggestions as to which Graphics mode was primarily used for the game graphics of the real 5200 games? Or which you'd recommend, DEBRO?

Link to comment
Share on other sites

As for what memory location to start using the A.N.A.L.O.G article on Dan's site mentions that $0000 - $0018 are used by the monitor, $0100 - $01FF are used by the stack, and $0200 - $021B are for shadows and RAM vectors. So you could start at $0019 - $00FF and then pick up at $021C - $3FFF.

 

As for the "blur" of characters in your title you may want to use some time wasting code to slow it down. One option would be to use NOP within a loop.

 

As for which graphics mode to use that's a tough question to answer (IMO). It would depend on how you want things displayed. Such as how many colors are needed for your playfield and how many pixels are needed for your playfield. I've seen differnct options. I've seen the top lines done in graphics mode 2, the second lines (for the score digits) done in graphics mode 1, and seen the actual game/playfield in a variety of modes. I hope this helps.

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