Subject: Re: [stella] Kirk tutorial question|
From: "Gary Szwiec" <gszwiec@xxxxxxxxxxx>
Date: Mon, 15 Jul 2002 09:33:21 -0500
Actually I can compile and I do have the line HMM0 = $22 in my vcs.h file. I just don't see anything when I run it.
From: Maxime Beauvais <maximebeauvais@xxxxxxxxx> Reply-To: stella@xxxxxxxxxxx To: stella@xxxxxxxxxxx Subject: Re: [stella] Kirk tutorial question Date: Mon, 15 Jul 2002 06:27:21 -0700 (PDT)
I had the same problem with this red line program.
Check my previous email concerning the vcs.h file.
I was missing one line and that was the reason why I was not able to compile!!!!!
--- Gary Szwiec <gszwiec@xxxxxxxxxxx> wrote: > Thanks for your help. > > Here is the code. Clock does compile and run fine. > > I am using DASM V2.12.04 and running Stella 1.1.a > > ++++++++++++++++++++ > ; thin red line by Kirk Israel > ; > ; (anything after a ; is treated as a comment and > ; ignored by DASM) > ; > ; First we have to tell DASM that we're > ; coding to the 6502: > ; > > processor 6502 > > ; > ; then we have to include the "vcs.h" file > ; that includes all the "convenience names" > ; for all the special atari memory locations... > ; > include vcs.h > > ; > ; now tell DASM where in the memory to place > ; all the code that follows...$F000 is the preferred > ; spot where it goes to make an atari program > ; (so "org" isn't a 6502 or atari specific > command... > ; it's an "assembler directive" that's > ; giving directions to the program that's going to > ; turn our code into binary bits) > ; > > org $F000 > > ; > ; Notice everything we've done so far is "indented" > ; Anything that's not indented, DASM treats as a > "label" > ; Labels make our lives easier...they say "wherever > the > ; next bit of code ends up sitting in physical > memory, > ; remember that location as 'labelname'. That way > we > ; can give commands lke "JMP labelname" rather than > ; "JMP $F012" or what not. > ; So we'll call the start of our program "Start". > ; Inspired genius, that. Clever students will have > ; figured out that since we just told DASM "put the > ; next command at $F000", and then "Call the next > memory > ; location 'Start':, we've implicitly said that > ; "Start is $F000" > ; > > Start > > ; > ; The next bit of code is pretty standard. When the > Atari > ; starts up, all its memory is random scrambled. So > the first > ; thing we run is "SEI" "CLD" and "TXS". > ; Look these up if you want, > ; for now know that they're just good things to > cleanse > ; the palette... > > SEI ;Disable Any Interrupts (hey look! we can put > comments here) > CLD ; Clear BCD math bit. > LDX #$FF ; put X to the top... > TXS ; ...and use it reset the stack pointer > > ; > ; Now this is another pretty standard bit of code to > start > ; your program with..it makes a noticeable delay > when your > ; atari program starts, and if you're a hot shot you > could consider > ; zeroing out only the memory locations you care > about, but > ; for now we're gonna start at the top of memory, > walk our way > ; down, and put zeros in all of that. > ; > ; One thing you may notice is that a lot of atari > programming > ; involves starting at a number, and counting your > way down > ; to zero, rather than starting at zero and counting > your > ; way up. That's because when you're using a > Register to > ; hold your counter, it's faster/easier to compare > that > ; value to zero than to compare it to the target > value > ; you want to stop at. > ; > ; So X is going to hold the starting memory location > ; (top of memory, $#FF), the "A"ccumulator is going > to > ; hold what we put into each memory location (i.e. > zero) > > LDX #$FF ;X is top of memory > LDA #0 ;Put Zero into A > ClearMem > STA 0,X ;Now, this doesn't mean what you think... > DEX ;decrement X (decrease X by one) > BNE ClearMem ;if the last command resulted in > something > ;that's "N"ot "Equal" to Zero, branch back > ;to "ClearMem" > ; > ; Ok...a word of explanation about "STA 0,X" > ; You might assume that that said "store zero into > the memory > ; location pointed to by X..." but rather, it's > saying > ; "store whatever's in the accumulator at the > location pointed > ; to by (X plus zero)" > ; > ; So why does the command do that? Why isn't there > just a > ; "STA X" command? (Go ahead and make the change if > you want, > ; DASM will give you an unhelpful error message when > you go > ; to assemble.) Here's one explanation, and it has > to do with > ; some handwaving I've been doing...memory goes from > $0000-$FFFF > ; but those first two hex digits represent the > "page" you're dealing > ; with. $0000-$00FF is the "zero page", $0100-$01FF > is the first > ; page, etc. A lot of the 6502 commands take up > less memory > ; when you use the special mode that deals with the > zero page, > ; where a lot of the action in atari land takes > place. > ; ...sooooo, STA $#nnnn would tell it to grab the > next two bytes > ; for a full 4 byte address, but this mode only > grabs the one > ; value from the zero page > ; > > ; > ; Now we can finally get into some more interesting > ; stuff. First lets make the background black > ; (Technically we don't have to do this, since > $00=black, > ; and we've already set all that memory to zero. > ; But one easy experiment might be to try different > two > ; digit hex values here, and see some different > colors > ; > LDA #$00 ;load value into A ("it's a black > thing") > STA COLUBK ;put the value of A into the > background color register > > ; > ; Do the same basic thing for missile zero... > ; (except missiles are the same color as their > associated > ; player, so we're setting the player's color > instead > ; > > LDA #33 > STA COLUP0 > > ; > ; Now we start our main loop > ; like most Atari programs, we'll have distinct > ; times of Vertical Sync, Vertical Blank, > ; Horizontal blank/screen draw, and then Overscan > ; > ; So every time we return control to Mainloop. > ; we're doing another television frame of our humble > demo > ; And inside mainloop, we'll keep looping through > the > ; section labeled Scanloop...once for each scanline > ; > > MainLoop > ;*********************** VERTICAL SYNC HANDLER > ; > === message truncated ===
__________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com ---------------------------------------------------------------------------------------------- Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
---------------------------------------------------------------------------------------------- Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/