Jump to content

rje

Members
  • Posts

    1028
  • Joined

  • Last visited

  • Days Won

    31

Everything posted by rje

  1. 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.
  2. 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.
  3. 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
  4. At least I see the keen interest in the X16 here.
  5. 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?
  6. 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!
  7. 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.
  8. 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?
  9. 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.
  10. Let's continue the AWK discussion in an AWK topic.
  11. 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?
  12. 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.
  13. 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.
  14. 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.
  15. 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.
  16. 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?
  17. Doesn't need to be said!
  18. 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.
  19. 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
  20. 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;
  21. I note that his Python code looks familiar: if I was writing raw bytes, that's what the Perl code would look like. Note that he has to first break down larger numbers, and encode strings into bytes. He might have to do some custom coding if endianness is a problem. ... I want AWK on the X16.
  22. Ah, I get your meaning -- that goes to the original intent of the three versions of the X16. They're all X16s, even though they're built differently. (As far as hitting hardware, well, I suppose the original X16e wouldn't hit any of the hardware, per se since all of it is mushed onto something like a single FPGA...) I know that 8BG has a soft spot for Commodore, one I understand, so I suspect that it's not just about the hardware, and therefore an ABI for X8 compatibility at least seems a fun and useful idea!
  23. I like the "boot from SPI" ability. Seems to be both cheap and useful.
  24. I looked for a VRAM loader in the KERNAL, didn't find one, and then created an "issue" on Github for it. https://github.com/commanderx16/x16-rom/issues/222 One possibility is to extend the memory-copy routine. Or add Yet Another KERNAL Routine (YAKR). I also suggested a call or two for the PSG. Less of an issue but still.
×
×
  • Create New...

Important Information

Please review our Terms of Use