Jump to content

Search the Community

Showing results for tags 'basic'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Commander X16 Forums
    • Introductions
    • X16 Discussion Lounge
    • X16 Help & Support Lounge
    • The Lounge
    • Hobbies and Interests

Categories

  • Official Software
  • Official Docs
  • Community Downloads
    • Games
    • Productivity Apps
    • Graphics Apps
    • Audio Apps
    • Demos
    • Networking Apps
    • Dev Tools
    • Tutorial Apps
    • Misc Apps

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me

  1. I've been messing around with the emulator a bit, playing with programs that I used to type in for fun all the time back in the day. The first computer I ever used on a regular basis was the TRS-80 Model III down at the Radio Shack in a nearby shopping center. And it had some pseudographics commands. SET, and RESET. They're very similar to the PSET command. The program that I am thinking about at the moment was the one for filling the screen with random pixels until the whole screen was full. It took a while, but eventually, every pixel would be filled in, and at that point I'd hit BREAK and move on to the next activity. But while the TRS-80 BASIC would eventually fill the screen, X16 BASIC won't. Using exactly the same 128×48 grid that the old Z80 system used, trying to use the RND() function to fill the screen results in a few pixels always being left over. I know that the available routines have a fairly short periodicity, so I tried to enhance the randomness by recursive randomizing. But still, even using RND(RND(1)*32768)*[number of pixels] for both X and Y, this is the best it will do for a 128×48 grid: I ran that at top speed for an hour, and that's as far as it got. Those white pixels never get filled in. If I try to fill the entire SCREEN $80 grid of 320×240, it's much worse. I would use RND(0) as the inner seed, but it's my understanding that it's even more repetitive, at least, going by the C64 Wiki's article on the function. While I don't know much about the TRS-80 version of the function, and I know it's still a pseudo-random number generator, it seems to be a little better at covering a wider range of values more comprehensively. Is this just something we're stuck with, and will just have to code our own, or is there a way to shoehorn in a better PRNG algorithm into the stock interpreter? Or is there a workaround to get better results out of the existing RND() code?
  2. Version 1.0.0

    7 downloads

    This is a simple Python utility to add line numbers to BASIC programs. GOTO and GOSUB use labels instead of line numbers, like this: GOTO @HELLO END @HELLO PRINT "HELLO WORLD" In addition, the special @@ label resolves to "current line", like this: GET A$:IF A$="" THEN @@ This will resolve to something like 100 GET A$:IF A$="" THEN 100 I have included a little Morse Code translator as a proof of concept and simple test program. This program and the Morse demo are open source, distributed under CC-BY license.
  3. BASIC Line Number tool in Python View File This is a simple Python utility to add line numbers to BASIC programs. GOTO and GOSUB use labels instead of line numbers, like this: GOTO @HELLO END @HELLO PRINT "HELLO WORLD" In addition, the special @@ label resolves to "current line", like this: GET A$:IF A$="" THEN @@ This will resolve to something like 100 GET A$:IF A$="" THEN 100 I have included a little Morse Code translator as a proof of concept and simple test program. This program and the Morse demo are open source, distributed under CC-BY license. Submitter TomXP411 Submitted 06/10/22 Category Dev Tools  
  4. Version 1.1.0

    5 downloads

    This game quizzes the player about the abbreviations for the Commander X16 BASIC v2 keywords including VIC20 and C64. If you know these abbreviations you can code BASIC for X16 and VIC20/C64 faster and write more code per line. First the program figures out the keywords and abbreviations for the exact release of the ROM. Then you are offered the quiz. The quiz is timed and the errors are counted. If you give the wrong answer you get that question again directly. C64 mode: You can stop the program by pressing the Esc key before the quiz, then type SCREEN 255:RUN 64 and press Enter to only be quizzed for C64 keywords. (VIC20 keywords are identical to C64.) The game X16&C64 Keywords&Abbreviations is tested with R38 (Try it now) and R41, but may work with later releases. The program is FOSS (license GPLv3) and the source is included in the zip-file, but is also on GitHub: https://github.com/mobluse/chargen-maker Command line: x16emu -bas KEYWORDSABBR.BAS -run -echo By using -echo you can copy the generated program and load it in x16emu and check that the abbreviations really expand correctly.
  5. X16&C64 Keywords & Abbreviations Quiz View File This game quizzes the player about the abbreviations for the Commander X16 BASIC v2 keywords. If you know these abbreviations you can code BASIC for X16 and C64 faster and write more code per line. First the program figures out the keywords and abbreviations for the exact release of the ROM. Then you are offered the quiz. The quiz is timed and the errors are counted. If you give the wrong answer you get that question again directly. C64 mode: You can stop the program by pressing the Esc key before the quiz, then type SCREEN 255:RUN 64 and press Enter to only be quizzed for C64 keywords. The game X16&C64 Keywords&Abbreviations is tested with R38 (Try it now) and R41, but may work with later releases. The program is FOSS (license GPLv3) and the source is included in the zip-file, but is also on GitHub: https://github.com/mobluse/chargen-maker Command line: x16emu -bas KEYWORDSABBR.BAS -run -echo By using -echo you can copy the generated program and load it in x16emu and check that the abbreviations really expand correctly. Submitter mobluse Submitted 06/07/22 Category Games  
  6. mobluse

    Aritm

    Version 0.3.5

    64 downloads

    Aritm is a game that trains you in mental calculation. It only teaches what is necessary to know in order to calculate manually using pen and paper. It adapts and asks more about what you answered wrong before. Aritm is written in pure Commander X16 BASIC v2 and uses X16 control codes for text and screen colors, and has sound effects. Future versions will probably support larger text in game. Aritm is available for many platforms including graphing calculators, Java phones, spread sheets, and common retro computers. You can run using the "Try it now" button or from command line: x16emu -prg ARITM-X16.PRG -run -echo If you exit the program you can LIST it and copy the listing to an editor. Aritm is open source (GPLv3) and is tested using an automatic testing system: https://github.com/mobluse/aritmjs
  7. I found a way to test my mental calculation training program Aritm for X16, C64, VIC20, ZX81, Apple I, PicoMite and other BASIC computers using Pexpect which is a system for automating logins etc. Pexpects is a Python module, but similar systems exist for other programming languages e.g. Expect for Perl. For X16, C64, and VIC20 I didn't use actual computers or emulators, but a C64 BASIC for console: cbmbasic: https://github.com/mist64/cbmbasic. I only tested one actual computer using USB serial: PicoMite. I tested the ZX81 and Apple I versions using emulators. I converted the X16 BASIC version to cbmbasic using: sed 's/#1,/ /' aritm-x16.bas > aritm-cbm.bas and commented one line that had incompatible commands that only affected colors, screen size, and input prompt. cbmbasic doesn't support removing BASIC prompt using a file handle, but does using a poke, but I tried not to use pokes to make the program less dependent on a particular machine. The test program is currently configured for cbmbasic and Aritm versions for X16, C64, and VIC20 are tested with the same configuration: https://github.com/mobluse/aritmjs/blob/master/expect-aritm.py The test configures Aritm to generate all problems and then answers them, but let you answer the last. In order to speed up testing one can change the delay subroutine in the BASIC program. BASIC dialects are rather incompatible with regards to e.g. precedence rules and floating point precision; so it's important to test. You wouldn't want a program that is supposed to teach you mental calculation to teach you the wrong facts. One could use the official X16 emulator, but that was more difficult to input to since one would have to send key presses to the emulator window, but that is also doable using another Python module, but I have not tested it with x16emu. For future testing it would be good if the real X16 had a serial port, but if it doesn't one could send key presses using the PS/2 port and get output to Expect using e.g. morse or DTMF tones from the sound system or QR codes on the screen.
  8. So, I came across this recently: https://www.youtube.com/watch?v=ROR1NQE-2DY "VisionBASIC", a compiled BASIC for the C64. Note that to write and compile programs in VisionBASIC you need extra RAM - but it's compatible with many forms of RAM expansion, not only vintage solutions like old REUs or the SuperCPU, but also modern ('retro') gear like the Turbo Chameleon or either of Gideon's "Ultimate" producrs (the cart, or the Ultimate C64 itself). Or even just in an emulator. ....but, crucially, you don't need the extra RAM to run programs compiled with VisionBASIC. So you can use it as a developer, but still distribute your work and expect it to run on stock C64s.
  9. Version 0.1.0

    53 downloads

    For the last two years, as I relearn BASIC, I've been writing a book. It has been difficult to keep going, as I'm also studying for a Master's in Cybersecurity. This is a teaser of how it looks. The contents section shows the topics being covered. At the moment, it is around 260 pages. I'm curious about any feedback on how it looks and reads.
  10. Version 2.0.1

    35 downloads

    Writing BASIC programs longer than 10 rows on the X16 is a tedious experience. The text editor is very limited, much is about struggling with row numbers. This is an extremely simple compiler (sort of at least) for Windows that lets you write your BASIC programs in your favourite text editor with labels. The compiler outputs a new text file with the extension ".bas". It adds row numbers and fills in the right row number after the commands "GOTO", "GOSUB" and "THEN". No installation is needed, just copy the only file to the directory of your choice. Usage: x16LabelCompiler <filename> [first row number] [step between row numbers] Labels must end with a colon (":"). Labels must not be reserved keywords in BASIC. Labels are preserved in the generated code by inserting "REM" before them. Empty rows are removed. All letters are converted to uppercase. A sample program called "guess_the_number.txt" is included. To compile the program: x16LabelCompiler guess_the_number.txt To start the emulator, load the generated file and run it immediately: x16emu -bas guess_the_number.bas -run
  11. Version 1.0.0

    71 downloads

    This is a character editor written in BASIC. Both layers are being used so all 256 characters in a font can be modified without affecting the program. The start-up of the program is slow due to character rom being written into layer 0 so it can be edited. Also had to clear layer 0 ram. Unable to use Try-In as program requires the the CHAR-EDIT-IF file. Once the program is loaded you can press L to load the EXAMPLE1 file so see an alternative character tile set. Download the SD image to use. I've made an assumption about where the required interface data file is located and where the user data files will be. Unzip the sdcard-pal-edit.zip file and start the X16 emulator x16emu -sdcard sdcard-pal-edit , once it starts load"*",8 and run it. CHAR-EDIT-IF EXAMPLE1.CHAR CHAR-EDIT.PRG char-edit.bas sdcard-pal-edit.zip
  12. I have been experimenting with assembly for a little bit. I've created a simple function to replace some BASIC I have which works, but is slow (the BASIC is slow, not the assembly - whoosh its super fast!) . I'm using the cc65 toolchain. Its definitely a challenge I am enjoying. When I compile with .ORG $080D I can load the PRG and run it ok. If I change the memory address to .ORG $0400 that just breaks the program since the SYS2016 no longer works. If I adjust the PRG header so it is loaded to address $0400 instead of $0801 and then try to SYS to the actual first assembly instruction it is broken as well. If I adjust the .ORG $040C which is the first assembly instruction after the 3 BASIC NULLs, adjust the PRG header and call with SYS then my program works. My question is, how do I compile some assembly which I can call using the SYS command easily. eg Create some machine code that my BASIC program can just poke in to memory and then call with SYS. Or create a PRG which has the correct load address and no single line basic included. Or once compiled will I need to manually edit the PRG? I'm sure I've missed some simple switch or I've not understand something. Any pointers would be great.
  13. Character Editor View File This is a character editor written in BASIC. Both layers are being used so all 256 characters in a font can be modified without affecting the program. The start-up of the program is slow due to character rom being written into layer 0 so it can be edited. Also had to clear layer 0 ram. Unable to use Try-In as program requires the the CHAR-EDIT-IF file. Once the program is loaded you can press L to load the EXAMPLE1 file so see an alternative character tile set. Download the SD image to use. I've made an assumption about where the required interface data file is located and where the user data files will be. CHAR-EDIT-IF EXAMPLE1.CHAR CHAR-EDIT.PRG char-edit.bas sdcard-pal-edit.zip Submitter Justin Baldock Submitted 01/14/22 Category Dev Tools  
  14. I have created a PETSCII UI for a program using PETDRAWX16. I then poke it into VERA RAM. A simple rounded box. I then am using the kernal PLOT command to place the cursor in the rounded box and then use INPUT statement. The problem I am having is the string which INPUT gets is not the keyboard input but the entire line from the ? prompt. e.g. User enters "TEST" and I receive TEST and all the spaces then petscii, so the string is "TEST |" Any advise on working around this?
  15. Hi, I think I may have discovered a bug. Just hoping to see if other people can replicate? I'm using a Virtual Windows 10 machine. Create any BASIC program. 10 PRINT"TEST" 20 GOTO 10 Then use the RESET command, use the OLD command then try PRINT FRE(0) The emulator locked up with what appears to be an endless loop. Errors are going to the CMD console are WARN: Invalid register 9fbc WARN: Invalid register 9fb6 WARN: Invalid register 9fbc WARN: Invalid register 9fbc If other people can replicate I will create a bug report. Updated: Bug report added to GitHub.
  16. Basic Label Compiler for Windows View File Writing BASIC programs longer than 10 rows on the X16 is a tedious experience. The text editor is very limited, much is about struggling with row numbers. This is an extremely simple compiler (sort of at least) for Windows that lets you write your BASIC programs in your favourite text editor with labels. The compiler outputs a new text file with the extension ".bas". It adds row numbers and fills in the right row number after the commands "GOTO", "GOSUB" and "THEN". No installation is needed, just copy the only file to the directory of your choice. Usage: x16LabelCompiler <filename> [first row number] [step between row numbers] Labels must end with a colon (":"). Labels must not be reserved keywords in BASIC. Labels are preserved in the generated code by inserting "REM" before them. Empty rows are removed. All letters are converted to uppercase. A sample program called "guess_the_number.txt" is included. To compile the program: x16LabelCompiler guess_the_number.txt To start the emulator, load the generated file and run it immediately: x16emu -bas guess_the_number.bas -run Submitter Johan Kårlin Submitted 11/08/21 Category Dev Tools  
  17. Version 1.0.0

    37 downloads

    The Commodore Labyrinth demo written entirely in BASIC from the early 80s. I've updated it a little bit and I'm trying to understand and untangle some of the spaghetti code. LABYRINTH.PRG labyrinth.bas
  18. Version 1.0.0

    35 downloads

    Akalabeth: World of Doom (1979) by Richard Garriott, AppleSoft basic ported to the Commander X16 by Justin Baldock. When starting I recommend you buy some food. This game is very unforgiving. This game was a little tricky to port, it leaves about 124 bytes free of Basic memory. I've added some colour to a few of the enemies. https://github.com/JustinBaldock/X16-Akalabeth Keyboard commands in play. N = Move North / Foward W = Move West / Turn Left E = Move East / Turn Right S = Move South / Turn Around X = Statistics A = NA / Attack - = Pass / Pass P = Toggle Pause D = Climb Ladder / Enter Town/ Enter Castle / Climb Down Q = Quit AKALABETH.PRG akalabeth.bas
  19. Akalabeth View File Akalabeth: World of Doom (1979) by Richard Garriott, AppleSoft basic ported to the Commander X16 by Justin Baldock. When starting I recommend you buy some food. This game is very unforgiving. This game was a little tricky to port, it leaves about 124 bytes free of Basic memory. I've added some colour to a few of the enemies. Keyboard commands in play. N = Move North / Foward W = Move West / Turn Left E = Move East / Turn Right S = Move South / Turn Around X = Statistics A = NA / Attack - = Pass / Pass P = Toggle Pause D = Climb Ladder / Enter Town/ Enter Castle / Climb Down Q = Quit AKALABETH.PRG akalabeth.bas Submitter Justin Baldock Submitted 11/24/21 Category Games  
  20. Hi, When using basic v2 on R38 ROM. I want to check what is the current cursor line number. On the C64 I can peek at $D6 and it returns the current line the cursor is on. When I try this on the X16 I get the value 8 back... no matter where the cursor is. I've had a look at the repo and found, x16-rom/kernal/cbm/editor.s, which appears to have, "tblx .res 1 ;$D6" Checking to find where tblx is explained I found kernal/open-roms/screen/e566.cursor_home.s, which appears to explain it as the cursor_home, current row. So $00D6 should be returning what I am looking for, my question is, am I misunderstanding or have I found a bug? (I'm leaning towards not understanding)
  21. I wrote a series of blog posts/articles on Commander X16 architecture and coding. I have started with focus on beginners and then slowly moved to more advanced topics and techniques. First I tackle smaller chunks and use simple examples to show the topic in practice. After enough new knowledge is covered I write a complete game to utilize several of the techniques to illustrate how it all comes together so each new complete project is more complex than the one before. I do cover only Commander X16 specific so I recommend reading Commodore C64 BASIC tutorials and guides. Please note that the games and most examples are written with a goal to be as clearly readable and understandable so there is very little source code optimizations. Snake Game This game is written in very clean BASIC with very little trickery so not much special Commander X16 knowledge is required. We do VPOKE directly into video memory so only understanding of fundamentals is required. Recommended reading VERA Overview Topics Covered in Game Analyzing the game itself is a great way to learn basics like: How to structure source code (outer loops, game loop) What is Game loop Use of Data structure like multiple Arrays How to read Joystick, Keyboard How to use VPOKE to “talk to” VERA Video RAM organization and using colors Writing to certain location on the screen Using PETSCII control characters to display messages and title screen GOTO Crazy Snake Tutorial GOTO Download Tetris Clone This game introduces some more advanced features of Commander X16 and we have to take a bit more care of how to use data structures and optimize some parts of the game to make it playable. Recommended reading VERA Overview Tiles in Basic I - Video Modes 0 and 1 Colors and Palettes Topics Covered in Game Tetris clone requires us to improve on pretty much all parts of the snake game structure: We have additional loops outside and inside game loop Advanced game collisions based on screen state Pre-calculate relative positions of four segments of each tetromino Customize color palette Customize tiles (characters) Speed increase per level Adding sound to the game GOTO Crazy Tetrominoes Tutorial GOTO Download Boulder Dash style game With this game we are using most of the Commander X16 hardware capabilities and we are getting close to squeezing most out of it for BASIC games. We have to pay close attention to timings, synchronizing scrolling and animation, take care of different types of collisions, etc. Recommended reading VERA Overview Tiles in Basic I - Video Modes 0 and 1 Sprites in Basic I - Setup Sprites in Basic II - Animation Scrolling and Layers in BASIC Colors and Palettes Simplest Sound Effects Library for BASIC Font Library for Commander X16 Topics Covered in Game This game is taking advantage of hardware features of Commander X16 to the level it almost looks like 16bit game or something written in Assembly for 8 bit computer like: Two phase approach to development Full color mode Full screen scrolling Two layer graphics Scrollable playfield Static HUD Animated full color sprites 256 color title screen in graphics mode Advanced physics and game mechanics Loading assets to memory from binary files for: Tileset Sprite Sheet Fonts Sound effects library Title screen GOTO Crazy Boulders Tutorial GOTO Download Lunar Lander style game With this game we are using most of the Commander X16 hardware capabilities and we are getting close to squeezing most out of it for BASIC games. Due to pixel perfect collision detection requirement we had to use small machine code routine. Recommended reading VERA Overview Tiles in Basic I - Video Modes 0 and 1 Sprites in Basic I - Setup Sprites in Basic II - Animation Scrolling and Layers in BASIC Colors and Palettes Music Player Library for BASIC Programs Font Library for Commander X16 Topics Covered in Game This game is taking advantage of hardware features of Commander X16 to the level it almost looks like 16bit game or something written in Assembly for 8 bit computer like: Integration of machine code, Assembly source code is available Full color mode 256 Color Title screen Two layer graphics Bitmap background Tile based HUD Full color sprites Advanced physics and game mechanics Loading assets to memory from binary files for: Tileset - fonts Sprite Sheet Background music Title screen GOTO Crazy Lander Tutorial GOTO Download
  22. Version 1.0.0

    15 downloads

    This is my first "proper" program written for the Commander X16, and it is written entirely in BASIC. I wrote it mostly so that I could get a feel for how logic and moving between sections of code works, as well as to help with understanding how to draw pixels to the screen using the PSET command. At the moment, I know there are ways I could optimize my code, but at the same time I'm not sure quite how much faster I could get the program to really run. If I make any real, tangible changes to the code, I'll update the file on here with what I changed. Currently, the program offers four possible modes of drawing color to the screen: MODE 1 - 2-COLOR (draws a random black-and-white static pattern to the screen) MODE 2 - 4-COLOR (draws a random 4-color "3d goggles" static pattern to the screen) MODE 3 - 16-COLOR (draws a random 16-color static pattern to the screen) MODE 4 - 256-COLOR (draws the default 256-color pallete to the screen) I know this really isn't much and there are far better demos for the Commander X16 out there at the moment, but I still feel proud of what I wrote, considering how inexperienced I am at writing for the system.
  23. COLORGEN: A simple color generator written in BASIC. View File This is my first "proper" program written for the Commander X16, and it is written entirely in BASIC. I wrote it mostly so that I could get a feel for how logic and moving between sections of code works, as well as to help with understanding how to draw pixels to the screen using the PSET command. At the moment, I know there are ways I could optimize my code, but at the same time I'm not sure quite how much faster I could get the program to really run. If I make any real, tangible changes to the code, I'll update the file on here with what I changed. Currently, the program offers four possible modes of drawing color to the screen: MODE 1 - 2-COLOR (draws a random black-and-white static pattern to the screen) MODE 2 - 4-COLOR (draws a random 4-color "3d goggles" static pattern to the screen) MODE 3 - 16-COLOR (draws a random 16-color static pattern to the screen) MODE 4 - 256-COLOR (draws the default 256-color pallete to the screen) I know this really isn't much and there are far better demos for the Commander X16 out there at the moment, but I still feel proud of what I wrote, considering how inexperienced I am at writing for the system. Submitter path2whatevrr Submitted 11/14/21 Category Demos  
  24. On the C64 we could clear line X on the screen using a poke and sys to a kernal function. POKE 781,X: SYS 59903 Is there something like this for the X16? If I try it, it simply clears the entire screen. What I am doing is printing a game "shopping list" using CHR$(!13) CHR$($11) CHR$($11) so in the middle of the screen is a table of items. Then I'm using CHR$($13) to send the cursor back to home and prompt what the player would like to buy. The 2nd line would say if they purchased it, didn't have enough money, etc. Then I was hoping to clear just the 2nd line on the screen and re-prompt them until they leave the store. Any pointers would be cool.
  25. Palette Editor View File This is a little tool written in BASIC to display the VERA palette and let you edit the colours. A palette file can be saved or loaded. A palette file is simply all 256 colours saved out of memory. The interface was drawn using PetDraw16. The program and files are on a SD card image. Simply attach and load pal-edit then run. Code available from https://github.com/JustinBaldock/X16-SpriteEdit Submitter Justin Baldock Submitted 11/04/21 Category Dev Tools  
×
×
  • Create New...

Important Information

Please review our Terms of Use