Search the Community
Showing results for tags 'functions'.
-
Hi all, I'm new to 7800 programming. I'll let you know some of the things I know (and maybe you can correct me). And I also have some questions. .a78 files are the machine language files that run directly in an Atari or an emulator such as Mess. How does one assemble such files? Is there an assembler I can download that can convert a ".S" or a ".a" into the machine code file that I can run on an Atari or emulator? What is the difference between a ".S" file and a ".a" file? I downloaded source code from atarimuseum.com for a game such as Dig Dug, and all of the files are ".S" files, which seem to just be assembly files. I also downloaded a game called INV+ (http://www.dos486.com/atari/index.shtml), which came in the form of a ".a" file, which seems to be an assembly file with some other assignments such as "BombDelay = $C6" at the beginning of the file; are these assignments just defining things so that the code is easier to read? INV+ also had a ".bin" file, which seemed to just be machine code (so a ".bin" file can also be run on an emulator or an Atari?). Now, when it comes to BASIC files, the extension is ".bas". The games that came in the 7800basic download such as simple and adventurer had ".bas" files. The 7800basic is a compiler that takes in a ".bas" file as input and produces a ".a78" machine code file. Whenever I run 7800basic on a file such as "adventurer.bas", it outputs a 7800.asm file (which is an assembly file) and a "a78info.cfg" file. But there is no adventurer.bas.a78. Am I just not waiting long enough for the compiler? How long should it take? Finally, are interpreters useful to use on a BASIC file rather than a compiler? Thanks if you answer any of these questions!
- 14 replies
-
- compiling
- interpreting
-
(and 3 more)
Tagged with:
-
Operating from a Windows PC development environment, I would like to be able to test my 6502 Assembly code. So, for example: I might have this code: org $0600 CLC LDA #5 ADC #3 STA 203 <end of code> I would like to be able to execute a command from the PC which will check that the above code puts the value of '8' into memory location 203. It may run Altirra or a 6502 emulator in the background, but I need to be able to extract that memory location and then report it back to the calling program. At the end I want "Test passed" or "Test failed" or something similar displaying. This way I can build up an automated test suite for all of my procedures / sections of code / macros. I have no problem with it bringing up windows whilst testing is going on, but I want all of the windows closed at the end of the tests. Any ideas of the best way of implementing this? I guess I'd need to automatically dump the memory contents and then extract the memory values that I require...
-
Prelude: Hello to all! I've recently had an epiphany of how wonderful game design can be, so I'm doing a little exercise to try to build my programming and artistic skills. Specifically, I'm starting with the Atari 2600 and then trying to work my way up with some other older consoles before settling again on modern engines. It seems like a good, fun exercise in rapid game development, since Atari 2600 games are relatively small. Keep in mind that I'm a novice programmer and this is meant to be a learning exercise to get me used to "thinking like a programmer." Problems: I sat down last night to crank out a simplified version of a game that I recently designed for GameJam and it's been going fairly well so far, thanks to visual bB and the manual that came with bataribasic. However, there are a number of problems and questions I have, so I hope that you good folks with all the knowledge can help me out: 1. First of all, I know that there are serious limitations on what can be done, but why are they THIS limiting? Maximum of two sprites? Any more requires significant slow-down and flicker as you teleport them from place to place? What about, for instance, (which is very similar to the game I'm trying to make)? You've got a ball that does not share the same color as the playfield (and, for that matter, a playfield that is not one solid color) and a series of "blocks" that I assume are sprites, yet there is no noticeable flicker. Or, for another example, Pitfall, which not only seems to have multiple different sprites on screen, but also sprites with multiple colors (the man) and a playfield consisting of much greater pixel quantity/density than is available to me in Visual bB. What gives? 2. It seems like most loops and functions don't really work. For instance, I wrote this: rem randomize color values 10 for temp = 0 to 15 step 1 temptwo=colorfun(f) goto storecolors next function colorfun if rand < 81 then return 1 if rand > 80 && rand < 161 then return 2 if rand > 160 && rand < 251 then return 3 if rand > 251 then return 4 rem get and assign numbers for variables - red, yellow, blue, white end storecolors if temp = 0 then one = temptwo if temp = 1 then two = temptwo if temp = 2 then three = temptwo if temp = 3 then four = temptwo if temp = 4 then five = temptwo if temp = 5 then six = temptwo if temp = 6 then seven = temptwo if temp = 7 then eight = temptwo if temp = 8 then nine = temptwo if temp = 9 then ten = temptwo if temp = 10 then eleven = temptwo if temp = 11 then twelve = temptwo if temp = 12 then thirteen = temptwo if temp = 13 then fourteen = temptwo if temp = 14 then fifteen = temptwo if temp = 15 then sixteen = temptwo return The intention is for-loop to count from 0 to 15, each time calling the function colorfun[ction] to generate one of four numbers (which will be used to determine the colors of things later on) and saving the value in a temporary variable, then sending it into an appropriate holding variable for later. The problem is, when I don't get a ROM out of space error on this (even though I have ~ 1.2K of ROM left), the screen is simply black, like the program is having trouble crunching the numbers in this fairly simple set-up. It's like batariBASIC can't handle nested functions/loops. Is there some way to get this kind of stuff working? The required workarounds--that is, using goto commands, is very wasteful of preciously scarce programming space. 3. Is there some way to name variables in ways that I can access easily through loops? Taking the above example, I have sixteen variables that hold a number from 1 to 4 denoting the color to be assigned to sixteen pfpixels (I would use sprites, but in my experience so far, the processing requirements to have sixteen sprites on screen at once makes the game such a flickering mess, it's unplayable), with an additional two variables used as bit operations to determine whether a given block should be "on" or "off" (that is, whether it's alive or has been destroyed). I would LOVE to be able to somehow count through the variables with a loop without specifying specifically, one by one, what to do, as if it were an array along the lines of: array[temp] = temptwo That would be so much simpler and more efficient. On a similar note, I wish I could do: for temp = 0 to 7 step 1 bit_op{temp} = 1 next ... Or something along those lines. That is, use variables to denote other variable names so I can quickly and efficiently count through them and determine/set a number of variables without wasting the space with dozens of if-then statements for every possible iteration. This is especially important for later on, since, after I've established which pfpixels get which colors and whether they are on or off, I'll need to program in collision (or some semblance thereof) so that getting hit by a ball (or missile) kills a pfpixel (a la Breakout). That would be difficult enough, BUT it gets harder: Basic Game Explanation: The pfpixels need to rotate their values, since the primary gameplay mechanic is the player moving the blocks to meet the ball, rather than the other way around. I'll need for loops to store the current and next color value of the blocks, swap the new value in while preserving the old, check to see whether that block is on or off, affect the collision appropriately, etc. Maybe that explanation is confusing, so I'll try to represent it visually. The one-sixteen variables hold a color value from 1 to 4, which will possibly end up being 1 to 7, if I have my way. This is important, because only balls of a certain color can cake out blocks of a certain color, so there will need to be if-then statements comparing the stored value of the color of the ball with the stored value of the color of the brick to see if they are a match or not, then flip the appropriate bit operator. This can be represented with sixteen bit operations (between two variables) and sixteen actual variables (though it could possibly be done with bit operations, though it would be complicated): 1 1 0 1 1 1 1 1 1 0 1 0 1 1 1 1 0 - Bit Operation (on/off = alive/dead) 1 2 3 2 4 3 1 3 4 1 2 3 4 1 3 4 3 - Variables (number = color) ---------------------------------------> - Direction that the values must be shifted for each joystick right <--------------------------------------- - Direction that the values must be shifted for each joystick left Meanwhile, balls of three colors are being created on a loop, rather than randomly: pulse = pulse +1 if pulse = 15 then color = color + 1:pulse = 0:beat = 0 if color = 3 then color = 0 if color = 0 then COLUPF=64 if color = 1 then COLUPF=28 if color = 2 then COLUPF=146 Which, when joystick trigger is hit, creates a ball with a color value based on the color variable and stores it for that ball so that it doesn't change. When collision happens between a pfpixel and a ball (perhaps manually determined by a range of values that denote the pfpixel's location?), the ball's stored color value is checked in an if-then statement against the values in the brick being collided with: if ballcolor = [variable containing block color value] then [set block bit operation to 0 to "kill" it and give the player points] if [variable containing block color value] = 4 then [set block bit operation to 0 to "kill" it and give the player points, since these blocks can be killed regardless of the color of the ball hitting them] else life = life - 1: goto [somewhere] If need be, I could try using six variables as bit operations (instead of sixteen) to denote red, yellow, and blue colors and a function to generate the color number when needed , for instance: for count = 0 to 7 step 1 if red{count} = 1 && yellow{count} = 1 && blue{count} = 1 then color = 4 if red{count} = 1 && yellow{count} = 0 && blue{count} = 0 then color = 1 if red{count} = 0 && yellow{count} = 1 && blue{count} = 0 then color = 2 if red{count} = 0 && yellow{count} = 0 && blue{count} = 1 then color = 3 Though I'd need two versions of it, since there are two bit operation groups at play, since there are sixteen blocks, so I'd have to run it again for the second half. This would be nice because it's scaleable if I want to expand the number of possible colors: if red{count} = 1 && yellow{count} = 1 && blue{count} = 0 then color = 5 if red{count} = 0 && yellow{count} = 1 && blue{count} = 1 then color = 6 if red{count} = 1 && yellow{count} = 0 && blue{count} = 1 then color = 7 As is probably apparent, I haven't gotten to these latter parts yet due to the difficulties I'm having getting loops and functions to work correctly. So, after all that, if anyone can offer me some advice as to what's going wrong or how I can make my dreams come true in an efficient way, it would be very much appreciated! TL;DR: Help me!
- 224 replies
-
- visual batari basic
- functions
-
(and 4 more)
Tagged with: