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 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.
  2. 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.
  3. Version 0.1.0

    44 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.
  4. Version 2.0.1

    31 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
  5. Version 1.0.0

    59 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
  6. 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.
  7. 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  
  8. 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?
  9. 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.
  10. 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  
  11. Version 1.0.0

    33 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
  12. Version 1.0.0

    30 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
  13. 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  
  14. 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)
  15. 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
  16. Version 1.0.0

    13 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.
  17. 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  
  18. 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.
  19. 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  
  20. Version 1.0.0

    25 downloads

    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
  21. Version 1.0.0

    24 downloads

    A simple demo creating a random road and the player moves the car sprite around.
  22. Grand Prix View File A simple demo creating a random road and the player moves the car sprite around. Submitter Justin Baldock Submitted 10/29/21 Category Demos  
  23. Labyrinth View File 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 Submitter Justin Baldock Submitted 10/28/21 Category Demos  
  24. Version 1.1.0

    77 downloads

    This reads the disk directory in BASIC. This is a super simple example and doesn't actually parse the files... it's just smart enough to read "$" and print it to the screen.
  25. Version 2.1; 1.0; 0.2

    28 downloads

    This is a single program listing that contains three different versions of the Proteus Demo from my thread in HOWTOs on converting and optimizing BASIC programs. Version .02 was from very early in the conversion/optimization process from that thread and, consequently, is quite slow. Its also got the original author's bad scaling coefficients, which make the output look a little gnarly. Version 1.0 was originally what I thought would be the 'fully optimized' version, with all sorts of things (documented in the thread) done to squeeze out better performance. And of course the scaling is fixed so the output looks better. This was supposed to be the end of the thread, except that... Version 2.0 takes advantage of something I noticed about the calculations, which led to the idea to have the program start off by precomputing a table that allows us to avoid having BASIC redundantly performing a bunch of the most expensive operations in the program. Even considering (and counting) the over minute-and-a-half it takes to initially compute the lookup table, the trick resulted in nearly halving the time to complete plotting the output compared to what was the previous fastest version. (Of course, I now wonder if some of the better math and coding gurus have been rolling their eyes all along, just wondering when, if ever, I might figure this part out...). Just RUN it and pick A, B or C from the menu. When its done plotting and puts up the elapsed time (its in HHMMSS format) you can press any key, and it will 'LIST' the program lines that correspond to the version that just completed plotting. I hope folks find it helpful having the three versions (and the howto thread) in terms of seeing how the thing evolved. You will notice that the more tweaking you do for speed, the more opaque and confusing the program becomes in terms of ever expecting someone with fresh eyes to try and see what the heck is going on. That 'early' version is included, in part, because its much easier to follow than the others. More info at the thread here:
×
×
  • Create New...

Important Information

Please review our Terms of Use