Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by rje

  1. I lack the hardware as well; otherwise, I'd be trolling the yard sales. I gave my Commodore system to a friend 17 years ago -- and it was a good choice to make. But I understand the draw of rescuing those old floppies. A generous hacker digitized the contents of three of my C64 diskettes a decade ago, and I am grateful for his kindness and consideration.
  2. It's not (noticeably) slower or faster, and technically it's a demonstration of the autoincrement, so I'm keeping it.
  3. I've made a couple of small updates and brought the version up to "1.1". First, I re-enabled Dusan's small PSG library. By adding proper timers, the PSG works ok. I'm also only using sound when interesting events happen -- i.e. finding things or monster hits. That makes the pauses permissable. I tested this version out by running several games in a row. I did poorly on a few, but then I got some momentum and cleared the field, got the amulet, and escaped with a score in the 600s. If only I had captured a screen shot of that!
  4. You're right. For now, though, I'm seeing what it can do when I stay in BASIC, to serve as a demo of what you can do with BASIC. Ah, but I am currently using that tiny interrupt-driven sound library by Dusan. Even as simple as it is, it's adding a great bit of "color" to the game!
  5. Thanks for that. Managing the bitfields (and understanding what they do) is the full problem. It looks to me like I was POKEing above $10000, so the OR is probably needed.
  6. Thanks. It's not exactly correct, so I have to hunt around for the right way. In particular, the initial VPOKE has something wrong with it.
  7. Today I opened up the old "Rogue Forest" game I wrote a year ago, and I thought that this snippet could be sped up: if y>8 and y<40 then ff=int(rnd(1)*3) vpoke 1,P,fo(ff) :rem character index vpoke 1,P+1,cl :rem bg/fg color nybbles if y>8 and y<40 then ff=int(rnd(1)*3) vpoke 1,P+2,fo(ff) vpoke 1,P+3,cl if y>8 and y<40 then ff=int(rnd(1)*3) vpoke 1,P+4,fo(ff) vpoke 1,P+5,cl if y>8 and y<40 then ff=int(rnd(1)*3) vpoke 1,P+6,fo(ff) vpoke 1,P+7,cl P, P+1, P+2, P+3... P+7. I mean, that sounds like a shoo-in for using the auto-increment with Port 0, for example. Anyone think that sounds reasonable? I THINK I should be able to do something like this: vpoke %10000, P, 0 :rem set up autoincrement if y>8 and y<40 then ff=int(rnd(1)*3) poke $9f23, fo(ff) :rem character index poke $9f23,cl :rem bg/fg color nybbles if y>8 and y<40 then ff=int(rnd(1)*3) poke $9f23, fo(ff) poke $9f23, cl if y>8 and y<40 then ff=int(rnd(1)*3) poke $9f23, fo(ff) poke $9f23, cl if y>8 and y<40 then ff=int(rnd(1)*3) poke $9f23, fo(ff) poke $9f23, cl
  8. I don't know. If you've watched his videos, you know how he works, and this seems to be the way he does it. Seems like a hill-climbing algorithm to me. Certainly is not a top-down style. If you know what I mean. Has 8BG ever given you the impression that he works in the manner you suggest?
  9. I'm doing something wrong. I've got a PET font, and a VIC-20 font, both 2K and apparently representing similar PETSCII sets. I can load either one into the X16, like this: cbm_k_setnam("chargen-font.bin"); cbm_k_setlfs(0,8,0); cbm_k_load(2, 0x0f800); So far, so good. Now when I load them, lowercase is uppercase, and uppercase are those graphic chars. I solve that by printing the control code to switch cases: cbm_k_bsout(14); // to upper+lower case HOWEVER, what that does is switch the X16 back to its built-in Commodore 64 PETSCII font. It does not get me the PET PETSCII (or the VIC-20 PETSCII if I use that binary instead). I'm obviously doing something wrong in a simple way. Can someone tell me what that is? Thanks!
  10. So reading his webpage a bit, it seems that CPLDs are most useful for all the glue hardware -- logic gates, for instance, that do some address decoding. He uses a 65816 of course for the CPU. Meanwhile, Frank shows us how FPGAs are suited for the raw capability of processor design, be it graphics, sound, or CPU. That leaves RAM, ROM, and I/O.
  11. No, that's reasonable. I worry about the heap requirements, as well as the size of the codebase -- AWK is not small. V7 AWK is here: https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/awk And now it's here: https://github.com/bobbyjim/AWK-7 My question is: what would you use it for, if it were running on the X16? Catting files is useful, but is filtering them also useful? Splitting records, and displaying columns? Counting strings? Selecting records?
  12. My current hack isn't a parser: it only uses sscanf() and strcmp() to detect some basic cases. As a result, I can catenate a file with the command 'MYFILE And 1 'MYFILE Note there's no trailing quote. I wanted to use the PETSCII left-arrow, but I can't do that until I use a half decent tokenizer.
  13. Let's continue the AWK discussion in an AWK topic.
  14. Now that I'm thinking about it, I'm also thinking about the reasonable scope for the X16. These sorts of UNIX-like operations aren't very common on Commodore 8 bit machines. I've already found the plain-old catenate pattern useful. I suspect one that matches a substring and prints the matching line and line number would be useful, so a condition to match a string, and an action for printing NR and the line itself would be nice. I wonder if vprintf() is as easy as it sounds?
  15. Thank you for the link. I'm reading it now. I'm also writing a throw-away thing to do some very careless things in a vaguely AWKlike manner.
  16. That makes sense to me. No worries, I have a work-around for my current project... I'll load a file into banked RAM and then operate on that data. Maybe create a fake stream function, or not.
  17. There's two things for the X16. First, there's a built-in machine language monitor. Second, the emulator has a debugger. Third, there's a rather nicely featured assembly development environment that's .. well I thought it was in Downloads, but perhaps not.
  18. BASIC has three uses: 1. Small programs that don't require speed. Classic "business simulation" games from the 1970s. Some PETSCII games like Lunar Lander. --> Ambitious programs like Temple of Apshai can be written, but we're better off doing them in something other than BASIC. 2. Prototyping, as you mentioned. 3. Batch scripting. In other words, as the pseudo shell command interpreter for Commodore machines.
  19. I'd like to fopen() files in the native filesystem, i.e. not the mounted SD image, while I'm just writing code and testing things out. I'm not sure that can be done, though. Except by using the KERNAL functions I suppose. Anyone?
  20. As for AWK, I search for "practical examples" instead of tutorials that show me how to do uninteresting things. <CONDITION> [<ACTION>] <SETTINGS> <SOURCE FILE NAME> ^ This looks like the generic template for AWK statements. Note I'm using [brackets] because PETSCII doesn't have {braces}. No worries. First, let's posit that this particular AWK is only for one-liners. No reason to think so, except for simplicity maybe. All the settings/field separators etc are fine. 1 MY_FILE Cats the file to the "terminal" (does it pause at the bottom of the screen?) 'NR>1 && NR < 5' MY_FILE Cats lines 2 through 4. Note that the initial condition, if complex, is in single quotes. NF MY_FILE Prints lines that have non-space characters on them. I.E. ignores lines which only have whitespace. 1 RS='' file Ignores lines that only have the newline character. Note that the Record Separator assignment is outside of the action, so isn't in brackets. '{ print $1, $3}' FS=, OFS=, file Prints columns 1 and 3 of every line. Note the input and output field separators are both the comma. 'NF { print $1, $3 }' FS=, OFS=, file If the line has fields, then print the columns, otherwise ignore the line. * * * Now. Can we have multi-line scripts, complete with BEGIN and END options? I think variables would be no problem, so we could have variable assignment in the action blurbs. Associative arrays are, I think, just out of reach, without some shoehorning. I'd defer that until the rest of it works beautifully. The most interesting parts of regular expressions will probably never work here. Too big.
  21. My online friend Alex had written a very very very low C heap manager, for the purpose of implementing a CSH variant on the C64. I've got his code, but I didn't use it. I'm having enough trouble writing a compiler down to interpretable bytecode. I attach them here for your amusement. heap.c heap.h testcsh.c testcsh.notes
  22. Hey, that doesn't write bytes to the output channel, it creates a text file containing the Python expression "[12, 13, 14, 0, 80, 0, 90, 0, 10, 0, 12, 13, 14]". The binary file should have 12 bytes in it, since there are 12 byte values in the concatted array. Maybe I'm doing something wrong? And, by the way, the Perl version looks very similar, and also creates a text file, although just the digits and not the Python expression. @struct_1 = ( 12, 13, 14 ); @struct_2 = ( 0, 80, 0, 90, 0, 100 ); @data = (@struct_1, @struct_2, @struct_1); open my $fh, ">:raw", "DATA.BIN"; print $fh @data; close $fh; To write actual bytes, I still need pack(): @struct_1 = ( 12, 13, 14 ); @struct_2 = ( 0, 80, 0, 90, 0, 100 ); @data = (@struct_1, @struct_2, @struct_1); open my $fh, ">:raw", "DATA.BIN"; print $fh pack "C*", @data; close $fh;
  • Create New...

Important Information

Please review our Terms of Use