Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
someone awful.
Sep 7, 2007


Couldn't help cringing every time you fired a line of bullets into a self-defeating wall of inevitability. Great game.

Adbot
ADBOT LOVES YOU

Chokes McGee
Aug 7, 2008

This is Urotsuki.

FredMSloniker posted:

Visually atrocious, you say?
code:
10 DATA238,32,208,238,33,208,76,0,192
20 FORZZ=0TO8:READZX:POKE49152+ZZ,ZX:NEXT
30 PRINTCHR$(147):SYS49152
(Not gonna spoil what it does. Type it in if you're curious.)

I suspect I know and it's the time honored HEY GUYS WE'RE LOADING poo poo C64 effect :shobon:

But no. No, we need to go one step farther.

We have to.

Chokes McGee
Aug 7, 2008

This is Urotsuki.
I'm typing in Bassem (Gazette's assembler wedge) if anyone's interested. It's a long way from done, and I had to reduce the end address because Compute! didn't pay attention and it ran over the A000 cap. (It's all zeroes anyway so who cares)

I don't want this to turn into Let's Make C64 Games (although that sounds like an awesome idea for a thread if we don't have it already, which I think we do), but I do want to post something dumb just to go "hay guys machine language am I rite".

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.
Hex War: An Autopsy: Part 3

Welcome back! Last time, we mostly did prep work, making a joystick-reading subroutine, getting ready to redefine the font and to define a sprite, and setting some ease-of-use variables. Let's see where we go from here.
code:
26 FOR A = 54272 TO 54295: POKE A, 0: NEXT: POKE A, 15: POKE 54273, 40: POKE 54277, 25
The SID Chip

One of the Commodore 64's most memorable features is its Sound Interface Device, or SID. This chip is what produces the C64's signature sound, a sound that was used to create tons of memorable music and is still used to this day in the retro music scene. Here's an example from back in the day:

https://www.youtube.com/watch?v=1UzJUCPkCjo

And here's a more recent one, using some very fancy tricks to play actual samples on a chip never intended to do so:

https://www.youtube.com/watch?v=p6LYrQk5I7s

The SID chip, as you can see from the video, provides three channels of mono audio. It can make four basic waveforms - triangle, sawtooth, square, and noise - and offers oscillator synchronization, ring modulation, and low-, band-, and high-pass filters. You can control the attack speed, decay speed, sustain volume, and release length of each note. (The following graphic explains visually what those mean.)



You can also set the frequency, or pitch, of each note, and the pulse width (see the beginning of the Driller video to see the effects of adjusting that on the fly). Even if you don't understand any of that terminology, you should still get the idea that the SID chip was a very powerful sound-making tool for the time.

Hex War, Line 26

We aren't going to be doing a whole lot with the SID chip in this game, but we will have some sound. To that end, the FOR-NEXT loop in this program writes zeroes into the registers for all three voices (as they're called), turning them off completely, then writes 15 into address 54296 -

- wait, what?

FOR-NEXT Loops and Scope

Commodore BASIC provides a control structure to repeatedly run part of a program. The syntax is as follows (curly brackets indicate optional parts):

FOR variable = start TO end {STEP step}
{code to run repeatedly}
NEXT {variable}

At the start of the structure, variable is given the value start. The code, if any, between the FOR and the NEXT is run, and then variable has step added to it. (step can be negative. If the definition of step is omitted, it defaults to 1.) If variable is now greater than end (or less than end, if step is negative), the loop ends; otherwise, the loop repeats. (There's one exception to this, which I'll discuss a little later.)

A few instructive examples:
  • The loop FOR A = 1 TO 10 STEP 2 will run five times, with A equalling 1, 3, 5, 7, and 9.
  • The loop FOR A = 1 TO 10 STEP -1 will run once, with A equal to 1.
  • The loop FOR A = 1 to 10 STEP 0 will run forever, with A equal to 1 each time.
Why would you want something like the last loop? Well, that's where we get into scope.

Scope is the concept that things in a program only exist for a certain part of a program. For instance, the variables inside a subroutine only exist inside of that subroutine, so you can have a 'video' variable inside the subroutine and a 'video' variable in the program calling the subroutine and the two are completely different variables.

Scope in Commodore BASIC is extremely simple: it doesn't exist. All variables exist everywhere.

What does this mean? Well, for one thing, it means that any variable A we have before we start the FOR loops above is erased and given the value 1. It also means the variable A still exists after the loop, containing whatever value it had at the end of the loop. The third loop goes forever, but the first two end with A equal to 11 and 0, respectively. (Note well that this is not the value of end. It's the first value of A that satisfies the ending-loop condition.)

In addition, we can reassign the value of A inside the loop. If we wanted the third loop to end, all we would have to do is, at some point inside the loop, set A to a number greater than or equal to 10. (This is the exception I mentioned earlier. If step is 0, then variable being greater than or equal to end ends the loop.) It would then stop looping at the end of the current loop.

Why might this be useful? Well, here's one possibility.

FOR ZZ = 1 TO 500: GET K$: IF K$ <> "" THEN ZZ = 500: NEXT

This loop runs 500 times. Each time, it checks the keyboard for a single keystroke. If it gets one, then it sets ZZ to 500, which will cause the loop to end; otherwise, it keeps going until it's out of loops. Congratulations: you now have a way to give the player only a limited amount of time to press X to not die.

Hex War, Line 26, continued

So after the end of the loop, A is 54296. (It was 54295 during the last loop; we then added one, saw it was greater than the end value of 54295, and exited the loop.) Putting 15 into 54296 sets the SID chip's volume to maximum, turns off any band pass filters, and makes sure voice 3 is on. (You'd turn off voice 3 here if you wanted to use ring modulation, which multiplies - not adds - the waveforms of voice 1 and voice 3. Obviously, if you're doing this, you probably don't want to also hear voice 3.)

The next thing we do is put 40 into memory address 54273. Addresses 54272-54273 are the frequency of voice 1.

Big-Endian Versus Little-Endian

When you want to store a number that's larger than you can store in a single byte (0 - 255), you have to use multiple bytes to store it. Memory addresses for the C64, for instance, use two bytes. One of the two bytes is multiplied by 256, then added to the other, to give a number between 0 and 65535. In a Windows 32-bit system, four bytes are used; you multiply one by 256, add it to the second, multiply that by 256, and so on until you've added all four together and have a number between 0 and 4,294,967,295.

But what do we mean by 'the first byte'? Turns out there are two different approaches computers use to decide that sort of thing. In a big-endian system, the first byte is the one with the lowest memory address. If you wanted to store 31173 in two bytes starting at 42, you'd divide 31173 by 256, which gives 121 with a remainder of 197, and store 121 in memory address 42 and 197 in memory address 43.

The Commodore 64, however, is little-endian. That means that, if we wanted to store the same number in the same place, we'd store 121 in memory address 43 and 197 in memory address 42. The reasons some systems are big-endian and some are little-endian are complicated; if you really care, Wikipedia's article on endianness is instructive.

Hex War, Line 26, continued again

By storing 40 in memory address 54273, and having previously stored 0 in memory address 54272, we've put the number (40 * 256 + 0 =) 10240 in voice 1's frequency register. Note that this is not the frequency of the resulting note in cycles per second! (And a good thing, too; 10240 Hz is on the 'annoying dogs' end of the audio spectrum.) The exact equivalence of SID frequency to real-world frequency depends on whether you're using a PAL (European) Commodore 64 or an NTSC (US) one for Reasons, but the difference is only 3%. For an NTSC Commodore 64 (note that VICE emulates a PAL C64 by default, but you can change that), you divide the SID frequency by 16.4043934 to get the real-world frequency; in this case, it's about 624 Hz, which is almost exactly the D# above high C. (On a PAL C64, the note would be about halfway between D and D#.)

The last POKE on line 26 stores 25 in memory address 54277, which controls the attack and decay length of voice 1. 25, or binary 00011001, selects an attack of 8 milliseconds (the first half, 0001) and a decay of 750 milliseconds (the second half, 1001). We've already put 0 into 54278, which controls sustain volume and release length; since sustain volume is 0, that means that any note we play with this voice will hit full volume in 8 milliseconds, then fade to nothing in 750 milliseconds without us having to explicitly tell the SID chip that the note is over.

We aren't playing the note yet, though. We're just setting it up. To play it, we have to put a number into 54276, which controls a lot of aspects about voice 1. We'll talk more about that when we actually get to playing the note.

Whew! I was expecting to get a bit farther this time! Still, we've covered a lot of ground topic-wise, so this is a good place to stop. Until next time!

Chokes McGee
Aug 7, 2008

This is Urotsuki.
sawtooth or gtfo

qtiyd

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.

Chokes McGee posted:

sawtooth or gtfo

qtiyd

You'll be pleased to know that, when we get around to actually playing that note, it'll be a sawtooth.

Grimwit
Nov 3, 2012

Those eyes! That hair! You're like a movie star! I must take your picture!

FredMSloniker posted:

One of the Commodore 64's most memorable features is its Sound Interface Device, or SID. This chip is what produces the C64's signature sound, a sound that was used to create tons of memorable music and is still used to this day in the retro music scene. Here's an example from back in the day:

https://www.youtube.com/watch?v=1UzJUCPkCjo

And here's a more recent one, using some very fancy tricks to play actual samples on a chip never intended to do so:

https://www.youtube.com/watch?v=p6LYrQk5I7s


:allears: AAAHHH! That SOUND! That Chiptune Sound!
I used to record it and make play lists out of loading music when I was a kid!

Later on, when Chiptunes was still novel, my friend clued me into Machinae Supremacy who would use a C=64 along with their speed metal.
(Great music, not so great singer)
And I would :rock: out!

Sorry to gush, but THAT SOUND!

ToxicFrog
Apr 26, 2008


Grimwit posted:

:allears: AAAHHH! That SOUND! That Chiptune Sound!
I used to record it and make play lists out of loading music when I was a kid!

Later on, when Chiptunes was still novel, my friend clued me into Machinae Supremacy who would use a C=64 along with their speed metal.
(Great music, not so great singer)
And I would :rock: out!

Sorry to gush, but THAT SOUND!

:hfive:

I didn't even grow up with a C=64 and I still love the SID sound and SID metal.

Complexcalibur
Mar 11, 2007

NUOOOOAAAGH

ManxomeBromide posted:

This was great. I particularly like the fact that the first thing you need to know about Aardvarks from space is that they have 26 kinds of bombs.

I'd like to add this to the collection disk I'm making for the thread. Do you think you could upload the .D64 or .P00 that you saved it to somewhere, or possibly stick the text listing onto Pastebin?

Sure thing! Here's a Pastebin.

http://pastebin.com/74Am69rj

I had to go through and clean up the symbols that didn't translate over to the text version, so I just changed them back to what they had in the magazine. I don't think I missed anything, but if the text is weirdly spaced or colored wrong, that's why.

Incidentally, if the well ever runs dry in Compute!, we can always dip into Softside. The earliest issues are all listings for the TRS-80, which would be its own kind of special. On the other hand, it might all just be text based games, so they wouldn't be terribly exciting.

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.

Complexcalibur posted:

On the other hand, it might all just be text based games, so they wouldn't be terribly exciting.

*immediately starts searching for text-based games in Compute!'s Gazette*

ManxomeBromide
Jan 29, 2009

old school

Complexcalibur posted:

Sure thing! Here's a Pastebin.

http://pastebin.com/74Am69rj

I had to go through and clean up the symbols that didn't translate over to the text version, so I just changed them back to what they had in the magazine. I don't think I missed anything, but if the text is weirdly spaced or colored wrong, that's why.

Yeah, there were some issues with the paste but they weren't hard to fix. I suspect some of the things you corrected might have been overcorrected; petcat wants {rvon} and {rvof} instead of {RVS} and {OFF}, for instance, and there are some actual bugs in it where it won't correctly roundtrip characters like {CBM-*}.

Anyway. It's working and I've added it to the SA Gazette disk. We're caught up! :woop:

vvvvv It absolutely would; it's about half full now. A freshly formatted disk has 664 blocks free, and we're down to 292.

ManxomeBromide fucked around with this message at 06:41 on Mar 22, 2016

AlphaKretin
Dec 25, 2014

A vase to face encounter.

...Vase to meet you?

...

GARVASE DAY!

This is probably an ignorant as hell question, but would the SA Gazette disk theoretically fit on a real floppy?

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.
To expand on ManxomeBromide's answer, a .d64 file is an image of a Commodore-format floppy, in much the same way an .iso file is an image of a CD or DVD. With the right equipment, you could write it directly to a floppy and use it on a real Commodore 64. It also supports all the actual disk operations when attached on an emulator, so your programs can save and load data files. (Note that this does mean it's a good idea to keep backups of your .d64 files, much as you might a real floppy, if you're going to be doing so!)

Also! I don't want to be just 'the Hex War guy', so I'm gonna be covering another type-in game in my next big post. I just need to find a good one, and I have an idea in that regard; I'm still searching issues to find it, though.

AlphaKretin
Dec 25, 2014

A vase to face encounter.

...Vase to meet you?

...

GARVASE DAY!

Oh, wonderful. I wonder if I have any floppy drives that work with remotely modern computers lying around? :getin:

I probably don't but if I find one somehow before this thread is done and gone I might do a thing

Dareon
Apr 6, 2009

by vyelkin
I'm actually tempted to find an Apple ][ emulator and see if there are archived copies of 3-2-1 Contact. Maybe if I get a decent amount of free time.

ManxomeBromide
Jan 29, 2009

old school

AlphaKretin posted:

Oh, wonderful. I wonder if I have any floppy drives that work with remotely modern computers lying around? :getin:

I probably don't but if I find one somehow before this thread is done and gone I might do a thing

I've been making quiet inquiries and if the stars align I too might do a thing. Something that came up though about this was that apparently 1.2MB floppies don't work—you need to restrict yourself to single or double density disks. Despite that, the Commodore DOS was a lot worse about space efficiency than the PC was or something and only fit 160KB onto a disk side.

As for getting stuff onto the disks, there seem to be a few approaches for that but I can't make promises yet, beyond "there will be a tale of some kind, perhaps of my amazing failures".

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.

AlphaKretin posted:

Oh, wonderful. I wonder if I have any floppy drives that work with remotely modern computers lying around? :getin:

Commodore 64 floppies are not compatible with IBM-PC floppies, even if they're the same size - they're formatted differently - so don't go sticking a 5.25" drive in your Dell and expecting it to work. That said, they do sell a way to hook a 1541 drive to a PC because of course they do. (There's a retro computing thread on the forums if you want to go down that rabbit hole. I'd link, but I'm phone posting.)

Fake edit: I see ManxomeBromide is already diving down that rabbit hole. :v:

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.

ManxomeBromide posted:

I have a memory of an old game where you were running around a garden fumigating flowers, but I haven't seen anything like that in my scan of the magazines and don't even recall a title. It kind of felt like a type-in though, so if anyone has a better memory than me, it'd be great to see that again.

I'm about to make you very happy, Manxome.



Let's Play Pests!
Compute! Issue 49, Volume 6, Number 6, June 1984

Summary: You play as the world's most confused racist gardener, out to sweep the plague of 'coloreds' from your garden. To do this, you have a spraycan of white paint, which you must douse every flower in your garden with. Oh, and there are weeds to kill, and you lose if too many of them show up, but seriously, if there is one colored flower in your garden when time runs out, you lose.

Or you could be fumigating your flowers to keep them from catching some horrible rot. I dunno.

https://www.youtube.com/watch?v=CU1-zgYEJjM

What's good: It's a very short type-in for the amount of fun you can have. Juggling keeping the weed population under control and getting your flowers dosed before time runs out is genuinely tense. It also loads a custom font without having to use the preloader Hex War does; instead of moving the beginning of BASIC space, it moves the end, which is completely safe so long as (a) you haven't thus made BASIC space too small to hold your program and (b) you immediately use the CLR statement, which erases all variables. (Strictly speaking, what it does is write a blank variable reference table to the end of BASIC memory - and since you've just moved that, this erases potentially garbage info.) I don't believe this would work with Hex War - it greatly reduces the space available for program and variables - but I'll test that.

What's bad: Aside from a spraying sound effect, there's no sound. Control is janky, a common problem with joystick games on a C64 (because of the delay between it reading the stick and you seeing the effect). Aside from simply having more flowers and faster weed growth, levels don't get more difficult or interesting. Sometimes, when you spray a weed, it doesn't actually die, so it reappears when it hits its next growth stage and is redrawn.

What's odd: The timer's weird. See, Commodore BASIC provides two timekeeping methods. The internal variable TI counts the number of jiffies since the computer was turned on or reset. (A jiffy is 1/60th of a second on NTSC C64s and 1/50th of a second on PAL C64s, because it's synced to screen refreshes.) You can also assign a value to TI to cause the count to go from there. It wraps around at 24 hours.

The other timekeeping variable is TI$, which is a six-digit string holding the current timer value in hours, minutes, and seconds. You can assign it a six-digit string (if you try to assign it something else, an error will occur), and the computer will start counting from there. TI and TI$ are kept synchronized, and a change to one affects the other.

So what's weird about the timer? The program simply prints TI$, which means two things. One, it counts up, and you don't know how much time you have until it's game over. Two, it counts from (say) 159 to 200, which is not behavior you'd expect without some colons in there somewhere. It'd probably be better to take the number of jiffies that mean game over, subtract TI, divide by 10 or something, and show that as a timer.

Weird ads: This issue has several contenders, and indeed the one I chose isn't the freakiest. It is, however, the one the most amused me:



Saved game:

I'm trying something different with this post. See the header image? Save it, rename it to a .zip, extract it, and you'll get the .prg and the C64List-format .txt that created it! (Note: when I tried this hosting on Imgur, it didn't work, so the file is probably reprocessed there.)

Tiggum
Oct 24, 2007

Your life and your quest end here.


FredMSloniker posted:

What's odd: The timer's weird. See, Commodore BASIC provides two timekeeping methods. The internal variable TI counts the number of jiffies since the computer was turned on or reset. (A jiffy is 1/60th of a second on NTSC C64s and 1/50th of a second on PAL C64s, because it's synced to screen refreshes.) You can also assign a value to TI to cause the count to go from there. It wraps around at 24 hours.

The other timekeeping variable is TI$, which is a six-digit string holding the current timer value in hours, minutes, and seconds. You can assign it a six-digit string (if you try to assign it something else, an error will occur), and the computer will start counting from there. TI and TI$ are kept synchronized, and a change to one affects the other.

So what's weird about the timer? The program simply prints TI$, which means two things. One, it counts up, and you don't know how much time you have until it's game over. Two, it counts from (say) 159 to 200, which is not behavior you'd expect without some colons in there somewhere. It'd probably be better to take the number of jiffies that mean game over, subtract TI, divide by 10 or something, and show that as a timer.

I've never used a C64, but based on what you've said here I'd probably go with something like, take the third and fourth characters of TI$, convert to a number and multiply by sixty, take the last two characters of TI$ and convert to a number, add the two numbers together and subtract it from the total number of seconds allocated. Display that as the time remaining. If you wanted to you could leave it as minutes and seconds but it's a bit more fiddly. Something like:

TT$ = TI$
TM = 60 * VAL(MID$(TT$, 3, 2))
TS = TM + VAL(RIGHT$(TT$, 2))
TR = TL - TS


or:

TT$ = TI$
TM = VAL(MID$(TT$, 3, 2))
TS = VAL(RIGHT$(TT$, 2))
SE = (TM * 60) + TS
TR = TL - SE
TM = INT(TR / 60)
TS = TR - (TM * 60)
TM$ = STR$(TM)
IF TS > 9 THEN TS$ = STR$(TS)
IF TS<10 THEN TS$ = "0" + STR$(TS)
TR$ = TM$ + ":" + TS$


That way your timer appears in a format that a human can easily understand and you don't inadvertently make the game harder on PAL systems.

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.

Tiggum posted:

I've never used a C64, but based on what you've said here I'd probably go with something like
Your first bit of code is unnecessarily complicated. If you want a time in seconds since the timer's started, that's just TI / 60 (for NTSC) or TI / 50 (for PAL). But how do you know which you're running in? Well, this is an easy way to find out how many jiffies per second your machine uses that you can stick at the beginning of your program:
code:
JS=50:TI$="000100":IFTI>3599THENJS=60
On a PAL machine, setting TI$ to "000100" (one minute) sets TI to 3000 (1 * 60 * 50). On an NTSC machine, it sets TI to 3600 (1 * 60 * 60). The delay between TI being set and tested would have to be 600 / 50 = 12 seconds for a PAL machine to be mistakenly identified as NTSC... and BASIC isn't that slow. :v:

ManxomeBromide
Jan 29, 2009

old school

FredMSloniker posted:

Let's Play Pests!
I'm trying something different with this post. See the header image? Save it, rename it to a .zip, extract it, and you'll get the .prg and the C64List-format .txt that created it! (Note: when I tried this hosting on Imgur, it didn't work, so the file is probably reprocessed there.)

You are a hero and madman, sir: I think I owe you a copy of Jiujitsu now unless you've beaten me to the punch.

(The trick worked for me here, but I had to use 7-Zip to open it instead of the Windows default.)

vvvvv I think the issue is that Windows Explorer is being too clever about its detection of what kind of file it is, and is prematurely concluding that it's a JPEG, filename be damned.

ManxomeBromide fucked around with this message at 05:46 on Mar 23, 2016

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.

ManxomeBromide posted:

You are a hero and madman, sir: I think I owe you a copy of Jiujitsu now unless you've beaten me to the punch.

Actually, you know what I'd rather see you do, if you can rope a second player into doing it with you? Eagles and Gators, from issue 39 of the Gazette (September '86). (E: the same issue as Jujitsu, as it happens.) I thought it looked interesting back in the day, but I didn't have anyone to play it with, and now that I'm grown up... well, I still don't have anyone to play it with. :sweatdrop:

(And I just zipped it up the default way on my Xubuntu box. Next time, I'll be sure it's a Windows-style .zip.)

FredMSloniker fucked around with this message at 05:43 on Mar 23, 2016

ToxicFrog
Apr 26, 2008


ManxomeBromide posted:

vvvvv I think the issue is that Windows Explorer is being too clever about its detection of what kind of file it is, and is prematurely concluding that it's a JPEG, filename be damned.

IIRC, all the important parts of a ZIP (i.e. the bits you need to read to figure out where the rest of the data is) are stored at the end of the file, which is why appending a ZIP to something else works so often. But this means that if you just look at the magic number, it looks like something else (a JPEG, in this case).

That said, windows has historically cared a lot more about the file extension than the file contents when it comes to deciding how to open a given file. I'm curious what's going on here.

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.
Hex War: An Autopsy: Part 4

Last time, all we did is get ready to play a tone. It just took a while to explain how. Can we do better this time? Let's find out.
code:
30 DIM J, K, HT, HB, CT, CB, J1, J2, A, B, C, D, E
40 DIM ARMY(31, 6, 1), BTL(64, 1, 3), MAP(9, 9, 2), FQ(20, 1), NX(1), C(2)
50 CN = 12:DIM CIT(CN, 1)
Lines 30-50 make extensive use of the DIM command. DIM is used to create an array, which is a set of variables referenced by a common name and one or more values. Arrays are zero-indexed, which means that any integer from 0 to the maximum size of a dimension is a legal value for an element of the array. Arrays can be integer arrays, string arrays, or floating point arrays, depending on the extension (if any) before the list of dimensions; in this case, all of our arrays are floating point arrays (the default). Floating point arrays and integer arrays are initialized to have all of their elements be 0; string arrays are initialized to have all of their elements be "" (an empty string). Only one array of a given type and name can exist; if you try to create another, even if it has different dimensions, your program will crash.

Line 30 is a bit odd, in that it DIMs non-array variables. This is technically legal (even if some references say otherwise), but pointless, as ordinary variables are created and initialized when you first use them. (About the only reason I can think of to do this is if memory's tight and you want to make sure your program won't crash when it tries to use the variables later.) Incidentally, you don't have to DIM arrays either, as long as you want a single-dimensioned array with 11 elements (0-10). As you can see, though, all of the arrays defined here have a different size.

So what are all these variables? Well, in order of definition:
  • J and K are temporary variables, used for multiple purposes.

  • HT and HB are used to identify a particular hexagonal cell on the map. The subroutine that moves the cursor to a cell uses these. (The game uses T and B, not DIMmed here, to identify cells; these values are mapped to X and Y coordinates as needed. HT and HB are named in reference to this.)

  • CT and CB are also used as cell references in a few different places in the program.

  • J1, J2, A, B, C, D, and E are temporary variables.

  • ARMY is an array used to keep track of information about each army in the game. (Note that, internally, the name of the array is AR; variable names are a single letter, optionally followed by a single letter or digit. ARTICHOKE(x, y, z) would refer to the same array. Calling it ARMY is therefore an aid to the programmer's memory.) ARMY(x, y, z) contains the following information about the xth army of player z (remember, internally player 2 is player 0):

    • y = 0: The number of robots in the army that are ready to fight. (This is what's displayed as the army's strength.)

    • y = 1: The number of robots in the army that are injured. When the army is no longer in combat, its injured robots are transferred to the reinforcement queue and will become available again in five turns. If an army is wiped out, its injured robots are captured by the enemy and placed into their reinforcement queue, where they will take seven turns to be repaired and reprogrammed.

    • y = 2: The number of robots in the army that are lightly dazed. These robots will be available to fight again next turn. If the army is defeated before then, these robots are captured by the enemy and put in the reinforcement queue; reprogramming them takes three turns.

    • y = 3: The number of robots in the army that are heavily dazed. All robots dazed in battle are first heavily dazed; after one turn, they become lightly dazed. Reprogramming heavily dazed robots also takes three turns.

    • y = 4: The T coordinate of the army.

    • y = 5: The B coordinate of the army.

    • y = 6: Whether or not the army cannot move (1 means the army is immobilized). Armies can't move if (a) they've used all of their movement points for the turn or (b) they're adjacent to an enemy army.

  • BTL is an array used to keep track of information about ongoing battles. (Again, the internal name of the array is BT.) BTL(x, y, z) contains the following information about the xth battle going on:

    • z = 0: The number of the army of player y that's in this battle.

    • z = 1: The number of robots in that army that could potentially be vaporized this turn. Vaporized robots are permanently removed from play.

    • z = 2: The number of robots in that army that could potentially be injured this turn.

    • z = 3: The number of robots in that army that could potentially be dazed this turn.

    I'll get into the gritty details of how many robots actually suffer those fates when I get to the actual battle code, but a dice roll is involved for each category; based on the dice roll, player 1's army loses x% of its possible losses, while player 2's army loses (100-x)% of its possible losses.

  • MAP (internally, MA) is an array used to keep track of information about the map. MAP(t, b, x) contains the following information about the map cell (t, b):

    • x = 0: The number of the army present in the cell, if any.

    • x = 1: The number of the owner of the cell, if any. Cells start neutral - a value of 0 - and gain a value of 1 (for player 0) or 2 (for player 1) when visited by an army. If there is an army in this cell, it therefore belongs to this player.

    • x = 2: Whether or not this cell contains a city. Oddly enough, this value is only used once in the code, to make the cursor red when it's over a cell with a city in it. For all other purposes, the CIT array, defined below, is used.

    Here's a reference for the map, by the way. Cells are numbered as T.B.



  • FQ is an array used to keep track of reinforcements. FQ(x, y) is the number of reinforcements for player y that will arrive in x + 1 turns.

    A few notes on this:

    • Only the first nine turns' worth of reinforcements are shown at any time.

    • The only time reinforcements are put in the queue beyond seven turns (injured robots captured from the enemy) is at the beginning of the game, when this array is loaded with random reinforcements. Once those reinforcements run out, there are no more random ones.

    • In addition to capturing and/or repairing robots, each turn you also gain a number of robots equal to the number of map cells you control. These robots take two turns to enter play.

  • NX is an array used to keep track of how many armies each player controls. NX(x) is the number of armies player x controls plus one.

  • C is an array used to count things. Specifically, it's used when checking victory conditions to tally up the number of cities or hexes controlled or occupied by each player, depending on the game mode. C(0) counts neutral cells, C(1) counts cells owned by player 0, and C(2) counts cells owned by player 1. This corresponds to the possible values of MAP(t, b, 1).

  • CIT (internally, CI) is an array used to keep track of the coordinates of each city in the game. CIT(x, 0) is the T coordinate of the xth city, while CIT(x, 1) is the B coordinate. (Oddly enough, CIT(0, x) is not used.)
That's a fair whack of information, and it represents a fair whack of research, figuring out what all those variables were used for. With that in mind, and with me wanting to type in another game, I'll leave off here. Next time, we'll stick values in a bunch of stuff!

FredMSloniker fucked around with this message at 19:17 on Mar 23, 2016

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.
My intention was to dissect a game, not kill the thread. :sweatdrop: Somebody post some stuff! I have another game to mini-LP, but I prefer this thread be at most 50% me by volume, so I'm hanging onto the game until some other folks do stuff.

Chokes McGee
Aug 7, 2008

This is Urotsuki.

FredMSloniker posted:

My intention was to dissect a game, not kill the thread. :sweatdrop: Somebody post some stuff! I have another game to mini-LP, but I prefer this thread be at most 50% me by volume, so I'm hanging onto the game until some other folks do stuff.

Nah, it's all good. I'm going to be posting (lol) Beekeeper shortly, which is terrible! After that, and when I finish typing in Bassem, I'll be unveiling Project Atrocity. :getin:

ManxomeBromide
Jan 29, 2009

old school

FredMSloniker posted:

My intention was to dissect a game, not kill the thread. :sweatdrop: Somebody post some stuff! I have another game to mini-LP, but I prefer this thread be at most 50% me by volume, so I'm hanging onto the game until some other folks do stuff.

I have at least four posts simmering right now; one of them however depended on me lining up a player for Eagles & Gators and confirming that the game would be possible to play.

This has been done, so here's that first post: VICE netplay constraints have been confirmed, so I'll get going on E&G pretty soon. :getin:

As for the other stuff, well, I expect to have time for that this weekend. We'll see how it goes.

ManxomeBromide
Jan 29, 2009

old school

FredMSloniker posted:

Visually atrocious, you say?
code:
10 DATA238,32,208,238,33,208,76,0,192
20 FORZZ=0TO8:READZX:POKE49152+ZZ,ZX:NEXT
30 PRINTCHR$(147):SYS49152
(Not gonna spoil what it does. Type it in if you're curious.)

My contribution to visual atrocity:
code:
10 REM OMG GOON RUSH
20 FOR I=0 TO 19:READ A:POKE 49152+I,A:NEXT I:SYS 49152
30 DATA 169,6,160,8,32,30,171,238,134,2,32,228,255,240,241,169,154,76,210,255
The remark may not be omitted. :) Also, you can press a key to exit it.

Chokes McGee
Aug 7, 2008

This is Urotsuki.
I think after Beekeeper and the custom stuff we'll shut 'er down. Last call to anyone who wants to contribute! I.E. where the gently caress is Crossroads 2 :mad:

If interest picks up after some more games are posted then we'll keep going, though!

ToxicFrog
Apr 26, 2008


Chokes McGee posted:

I think after Beekeeper and the custom stuff we'll shut 'er down. Last call to anyone who wants to contribute! I.E. where the gently caress is Crossroads 2 :mad:

One page ago, dawg.

ManxomeBromide
Jan 29, 2009

old school

Chokes McGee posted:

I think after Beekeeper and the custom stuff we'll shut 'er down. Last call to anyone who wants to contribute! I.E. where the gently caress is Crossroads 2 :mad:

If interest picks up after some more games are posted then we'll keep going, though!

I've got Eagles and Gators (interesting but two-player) and The Tomb (terrible) on-tap, but after that and maybe one bonus post I'll be tapped out.

Prenton
Feb 17, 2011

Ner nerr-nerrr ner
MATCH BLOX
Issue 41, November 1986


Game Summary
Click (well, press fire as it's joystick controlled) on squares to toggle them and any surrounding ones. Match the pattern to - wait, this is just Lights Out isn't it? It's Lights Out, on a tiny board.
But wait, a twist: you can only click on orange squares, allowing you to get yourself into unsolvable positions.

It caught my eye because I actually saw my first Lights Out-esque game on the C64 back in the day: the much later Reaxion.


(click for video)

What's Good
A new twist on an old classic. Taxes the little gray cells quite nicely for a bit.

What's Bad

Very spartan, with a grand total of two sound effects and standard system font throughout. Also, staring a long line of cryptic reverse video symbols (C64 BASIC really needed a "PRINT AT" command) for ages until I realised the checksum mismatch was because I'd used the British spelling of "colour"

Disk image here

Weird/hilarious ads you came across
The most unlikely licensed game:

FredMSloniker
Jan 2, 2008

Why, yes, I do like Kirby games.

Chokes McGee posted:

I think after Beekeeper and the custom stuff we'll shut 'er down. Last call to anyone who wants to contribute! I.E. where the gently caress is Crossroads 2 :mad:

If interest picks up after some more games are posted then we'll keep going, though!

Awww! I've got lots more material. Including this!



Let's Play The Farm Game
Compute!'s Gazette, October 1985, Issue 28, Volume 3, Number 10

Before I get into talking about the game, can I just take a moment to mention this?



This wasn't uncommon in the earlier issues of the Gazette, though fewer and fewer people did it over time. Right now, I could get a cassette tape for about $3. Envelopes are about $5 for a box of 50, so ten cents each, need two. A postage stamp cost 22 cents in late 1985, and I'll need two of those. Add that to the $3 in 1985 money I'll need, and that's about $7.58 in modern money. Add in the $3.20 for cassette tape and envelopes, and I'm looking at $10.78.

Now, I don't know what time machine rental costs these days, but I think I would have paid someone $11 to type this in for me.

Anyway. The Farm Game is a game in a genre that existed before microcomputers did. To my knowledge, the first one to have survived history is Hamurabi (sic), which was written in 1968 as The Sumer Game and expanded on in the 1973 book BASIC Computer Games (archived online), where it got the name it has today. (Note: I was born in 1973. This book is as old as I am.)

Both The Sumer Game and Hamurabi would originally have been played on a teleprinter (Teletype was the most common brand name for them), which was essentially a typewriter hooked up to a remote computer. You'd type in your choices, the time-shared minicomputer or mainframe you were connected to would process them, and it'd send back your results as text that the teleprinter would print. Teleprinters are still in use today, to my surprise, in the aviation industry. Linux users may also be aware of its legacy in the form of /dev/tty.

The Farm Game is, of course, more sophisticated than Hamurabi, but strangely lacks at least one of its features. More on that later.



At the beginning of the game, you choose how many years you want to spend playing. There's no upper limit, or at least none you'll hit. (Though if you put in a number over a billion, floating point math imprecision means you'll be farming forever. Or until you go bankrupt. More on that later.)



Each year, you're taken to this menu, which gives you four options. (The reason only the odd function keys are used is that the Commodore 64 only has four physical function keys; F2, F4, F6, and F8 are shifted versions of F1, F3, F5, and F7.)



F1 gives you this news release, which is full of useful numbers. It might be a good idea to write them down if you're playing seriously. I wasn't playing seriously.[/foreshadowing]



F3 gives you your financial status, as well as your bushels of currently stored grain. (Note: I changed the capitalization of 'Crops Presently in Storage' after I took this screenshot to be more consistent with the rest of the program. It's one of a number of minor presentation changes I made. I kind of want to make some other changes too, but I don't want to get sucked down that rabbit hole.)



F7 is the futures market. For those unfamiliar with the concept, the futures market is your way of betting on what the price of crops is going to do. When someone wants grain next year, but thinks the price of grain is going to go up, they offer to lock in a price that's more than the going market rate, but less than they expect it to rise to. When you sell grain on the futures market, you're taking that bet, getting more for the grain than you could sell it for right now; the risk, of course, is that you might have gotten much more for it if you'd just held onto the grain until the end of the year.



Finally, F5 is the planting menu. (Note that you can't go back to the main menu after entering the planting menu, so get whatever information you need first!) As you can see from the screenshot, you choose which of three crops to plant in each of your five 40-acre plots...



...and you're given a chance to see what that will cost and confirm your decision. (It takes 60 bushels of wheat or soybean seeds to plant 40 acres; corn only takes about 13 1/3 bushels per 40 acres.) You're then asked how many units per acre of insecticide and herbicide you want to apply. The article accompanying the game says the best amount is somewhere between 15 and 35 units per acre. For this turn, I applied 25 units of each.



Provided you still have a positive bank balance (I'll get to what happens if when you don't later), you get to see this lovely screen for a moment...



...and move onto this significantly less lovely screen that tallies up the damages. Note that it assumes you will sell all of your crops immediately. As you can see from the last two numbers, I'm in a spot of trouble.



Trouble which I compound by choosing not to sell my soybeans, hoping for a better price later.



You wind up at this not-so-lovely screen if you're out of money either after planting or after harvesting. (Thankfully, you can sell your harvest first. In real life, I'm pretty sure you have to pay for the harvest before you can sell it.) As the game says, you can borrow any amount from the minimum required to get out of debt up to your maximum line of credit. I have no idea why you'd borrow more than absolutely necessary, though, given that you can take out a loan at any time you need to.



As you can see, my finances are significantly less rosy at this point. I wind up selling my soybeans on the futures market, hoping $6.33 a bushel is a good rate. I also plant the same mix of crops I planted last year (taking out a bigger loan to pay for the seed) and decide to skip insecticide and herbicide. I mean, how bad can it be?



Ah. That bad. (As insult to injury, the price of soybeans went up.)



I have to make a payment on the loan, with money I don't have...



...which means I have to take out a bigger loan.

Uh, there's one problem, though. I can't take out a loan big enough. Which means that, after staring at this screen for a moment...



...I get sent to this one. No, The Farm Game, I would not like to try again.

But maybe you would! Download the title image above, rename it to a ZIP file, and extract it to get the .prg and .txt files. If you're actually able to make a farm function for even five years, let us know in the thread; if we get even a few people who manage it, and if there's interest, I'd be happy to host a farm-off.

Or not. There's no shame in being beaten by The Farm Game.

The good: The program is very professionally presented and resistant to players' efforts to screw with it by entering -q.2 as a quantity or getting a negative loan to make that fat interest rate work for them. The code is pretty clean, and while the formulae for the harvest results are an arcane mess, they're not an obfuscated arcane mess, so if you really wanted to you could take the program apart and figure out exactly how it works.

The bad: Dear god the difficulty. There's no option to leave a field fallow until you build up a bit of bank by selling crops, and the information you'd need to decide on your planting regime isn't available from the screen where you have to select it. The bills you incur are huge, and the 12% interest rate the bank charges is nearly usurious. (Google tells me farm loan interest rates these days are closer to 4% at worst.) Even surviving a few years is hard, and to truly win the game, you have to have more money at the end than you started with! All in all, if you want Harvest Moon, look elsewhere. (Hm. Harvest Moon C64. Now there's an idea.)

Also, there are no graphics (the solid horizontal line you see in some of the screenshots is the only time even PETSCII graphics are used) and no sound. No animated scenes of corn stalks swaying in the breeze (or being stripped bare by locusts). No random events to help (or, more likely, hinder), which is the missing feature from Hamurabi I mentioned. And, despite some cute doodles at the start of the article -



- there are no animals to raise.

Ads and articles:



The 1541 disk drive had a design flaw. If it couldn't find the track it wanted to read from on the disk (for instance, the disk hadn't been formatted yet), it would attempt to find the track by moving the drive head a half-step at a time in one direction. Of course, if the disk didn't have any tracks, it'd wind up smacking against a stopper - making a godawful racket in the process - before, eventually, giving up. For bonus fun, every time you formatted a disk, it'd whack the drive head against the stopper to make sure it was in the right place to start making tracks.

Ironically, all this whacking would often put the head out of alignment. This ad touts a software solution for fixing it, which, if I had to guess, would involve alternating digging into the 1541's low-level processes (it had its own computer in there, and you could program it to do some very silly things) and, well, whacking the drive head against its stopper until it was back in alignment.

Mind you, I'm only sharing this ad for the weird art.



Gee, I wonder.



$69.95/year is about $5.83/month. $5.83 in 1985 dollars is about $12.85 in 2016 dollars. This may or may not be relevant later.

ToxicFrog
Apr 26, 2008



As someone who married into a farming family, I can confirm that this (and the conceptually similar board game The Farming Game) is an accurate simulation of what it's like to be an independent farmer.

Grimwit
Nov 3, 2012

Those eyes! That hair! You're like a movie star! I must take your picture!

More Nostalgia.
To me, if that drive wasn't vibrating off the table, I assumed something was wrong.
That and the load times.

Ah, good times.
How will I play a game that take 25 minutes to load while the devil knocks about on my table now?

ManxomeBromide
Jan 29, 2009

old school
Special Easter Post

In a number of religious traditions, today is known as "Resurrection Sunday."

Let's celebrate it by bringing some old hardware back to life:



I've been maintaining a disk image for the thread. In this post, I'm going to try to get it onto one of these:



Most of the hardware you'll see in this post is scavenged, donated, or borrowed. Those of you who have helped me; I know you're out there reading this. Thanks. :)

You'll notice that's a fairly modern-looking monitor I have it hooked up to there. That's because that "monitor" is actually a television set, and the Commodores had TV output. Unfortunately, the TV output is incredibly terrible so text is often barely readable. If you're retrocomputing at home, don't do this. It ends only in tears and headaches.

Which I guess leads into my

:siren: Important Disclaimer :siren:

I don't really know what I'm talking about here. I've tried to do my homework and provide what information I've found, but in a very real sense I'm still just some moron on the Internet toying with forces I only dimly comprehend. It is not only possible but likely that I seriously overestimate the utility, professionalism, or safety of the devices and retailers I discuss. The best I can say is that every device where I mention a manufacturer or model by name I know at least person who's done business with them and been happy with the results.

Getting stuff onto floppies: The Hardware Side

Preserving magnetic media is actually a serious deal; a lot of data lives only on magnetic disks and those don't survive very long. The 5.25" floppies that are used here actually do better than they later 3.5", hard plastic cousins, though. I've heard a couple of theories about this. Both are based on the observation that as magnetic media rely on, well, remagnetizing bits of magnetic material, the substance of the disks are actually prone to oxidation, which destroys or corrupts the data.

Which is to say, your data will literally rust off your floppy disks after a decade or so.

One theory is that the physical size of bits on the 5.25" floppies were larger—not only are they larger objects, they hold less information—and so rust damage is less likely to corrupt the disk. The other one is that you kept these disks in paper sleeves and stacked closely together, which means unlike the hard plastic cousins, fresh air can't get to the 5.25" disks' media, limiting damage over time. The hard shells let the newer disks breathe and so they take more and more damage over time.

That's not a risk for us here, though; I cracked open a fresh packet of floppy disks for this experiment, because it turns out Amazon just straight-up sells the things and adding them to my order got me free shipping.

But that's the target. What about the source? There are a bunch of things designed to do this. The gold standard seems to be KryoFlux's devices; these are intended for forensic and archival use and the serious digital antiquarians I know swear by them. There are cheaper but similar devices such as the ZoomFloppy.

But the Commodore systems were always designed to talk to "smart" devices. The old floppy drives had their own CPUs that were equally as powerful as the main system. File operations involved sending what were essentially DOS commands down the serial port to the disk drive, and then getting a pile of data back. Even at the time there were hard drives that "looked like" floppy drives to BASIC, where changing directories was vaguely equivalent to swapping disks. There are a variety of devices in the "uIEC" and "SD2IEC" families that are SD card readers that present themselves to the Commodore system as a hard drive of sorts and use the same connectors. They even daisy-chain properly with disk drives.

The finest device for hobbyists seems to be the 1541 Ultimate II—Commodore speedrunner videos seem to invariably use these, and they actually simulate the internal processor on a 1541 and can thus actually run stuff that relies on it. (A surprising number of commercial games used custom loading logic to speed things up; as a result, those games won't work on anything that doesn't simulate that. If you care about that, that takes hard drives and the SD Card-based systems out of consideration right away.)

Of these, the one I have access to for this post is an SD2IEC device, manufactured by The Future Was 8-Bit. That's the weakest of the solutions I've listed, which is kind of a bummer if you wanted to oh never mind look at this thing oh my god that is the cutest thing ever:



Anyway, we don't need anything fancy for this anyway, because all our programs are simple BASIC or single-file machine language programs designed to interact with nothing more complex than LOAD and SAVE.

Getting Stuff Onto Floppies: The Software Side

The SD2IEC is drive 8 here, which means the real floppy is drive 9. I'll be using CBM-Command to handle imaging and formatting and stuff. It's inspired by Norton Commander and it looks an awful lot like the DOSSHELL.EXE program that came with my old PC.

It's also open-source, and written in C. I guess C was the language of the future after all.

This was loaded onto the SD card, and when we start it up, we see a nice little loading screen that is marred slightly by my failure to disable my camera flash:



And soon we're looking at the main screen.



We select the sa_gazette.d64 image and give it the Write Image To Disk command. Note that the underscore is a left-arrow because early ASCIIs, of which Commodore's PETSCII was a variant, did not have the ^ or _ characters, and used up and left arrow there instead:



Meanwhile, in meatspace, both disks are chugging along, at a couple of hundred bytes per second.



And after 10 minutes or so...



... nothing at all. :argh: Okay, fine, let's just copy a few files over manually, by LOADing from drive 8 and SAVEing to drive 9.

Actually Playing Some Games

:siren: CLICK THIS IMAGE FOR VIDEO :siren:


After recording this I then tried the reimaging again, but told it to reformat the disk first, and that half worked!



For some reason, though, it renamed the disk TEMP instead of LP GAZETTE like it should have. Maybe I'm just bad at CBM-Command.

But this does mean I can fire up Crossroads and do not-completely-embarassingly!



With the awful display setup I have here, you actually can't tell which direction Purple Rubberheads are facing. That ends about as well as you'd expect. Still, so close to 50k. I'll take it.

Chokes McGee
Aug 7, 2008

This is Urotsuki.
Well hell, if people are going to fire things back up again, let's keep this party rolling! :mmmhmm: When I have a chance away from work tomorrow I'll do some more thread curation.

AlphaKretin
Dec 25, 2014

A vase to face encounter.

...Vase to meet you?

...

GARVASE DAY!

Well that's just awesome. :allears: My personal curiousity is sated.

Decoy Badger
May 16, 2009
I'm really enjoying this thread! How did commercial games differ from these type-in ones? Were they generally better, more complex, etc. or was it still a big crapshoot?

Adbot
ADBOT LOVES YOU

ManxomeBromide
Jan 29, 2009

old school

Decoy Badger posted:

I'm really enjoying this thread! How did commercial games differ from these type-in ones? Were they generally better, more complex, etc. or was it still a big crapshoot?

There's a simultaneous thread going on where Prenton is playing through commercial demo coverdisks. The technical wizardry is a lot more wizardly, but game design is kind of similarly all over the place.

  • Locked thread