# Johan Kårlin

Members

123

7

1. ## Keyboard Layout Survey

0000041D Swedish
2. ## math atan2()

If the blue car is to the right, of the yellow car, above it or something in between those two positions it is in the first quadrant. 1. Let dx = horizontal distance = x coordinate of blue car - x coordinate of yellow car dy = vertical distance = y coordinate of blue car - y coordinate of yellow car 2. a = angle = look up value in table by using |dx| and |dy|. 3. if dx < 0 then take 128 - a (blue car is in second or third quadrant). 4. if dy < 0 then take 256 (=0) - a (blue car is in fourth quadrant) This works as long the distance between the objects (in my case cars) are no more than 31 units horzontally and vertically in your "world" coordinate system. In other words, usable for bouncing effects.
3. ## math atan2()

I struggled with this while making Rally Speedway 2020. I wanted the two cars to "bounce" away from each other when colliding. In order to do that I used the yellow car as reference point (origo in a coordinate system) and calculated what angle the blue car had in reference to the yellow using the horizontal and vertical distance. Because the cars are close to each other when colliding I simply used this precalculated atan2 table: ;Table for atan2 - which angle a vector (x,y) have in relation to origo. 256 = 360 degrees. Just for the first quadrant. _atantable: ;rows x = 0 to 31, columns y = 0 to 31 !byte -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 !byte 64,32,19,13,10, 8, 7, 6, 5, 5, 4, 4, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1 !byte 64,45,32,24,19,16,13,11,10, 9, 8, 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3 !byte 64,51,40,32,26,22,19,16,15,13,12,11,10, 9, 9, 8, 8, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 4, 4, 4, 4 !byte 64,54,45,38,32,27,24,21,19,17,16,14,13,12,11,11,10, 9, 9, 8, 8, 8, 7, 7, 7, 6, 6, 6, 6, 6, 5, 5 !byte 64,56,48,42,37,32,28,25,23,21,19,17,16,15,14,13,12,12,11,10,10,10, 9, 9, 8, 8, 8, 7, 7, 7, 7, 7 !byte 64,57,51,45,40,36,32,29,26,24,22,20,19,18,16,16,15,14,13,12,12,11,11,10,10,10, 9, 9, 9, 8, 8, 8 !byte 64,58,53,48,43,39,35,32,29,27,25,23,22,20,19,18,17,16,15,14,14,13,13,12,12,11,11,10,10,10, 9, 9 !byte 64,59,54,49,45,41,38,35,32,30,27,26,24,22,21,20,19,18,17,16,16,15,14,14,13,13,12,12,11,11,11,10 !byte 64,59,55,51,47,43,40,37,34,32,30,28,26,25,23,22,21,20,19,18,17,16,16,15,15,14,14,13,13,12,12,12 !byte 64,60,56,52,48,45,42,39,37,34,32,30,28,27,25,24,23,22,21,20,19,18,17,17,16,16,15,14,14,14,13,13 !byte 64,60,57,53,50,47,44,41,38,36,34,32,30,29,27,26,25,23,22,21,20,20,19,18,18,17,16,16,15,15,14,14 !byte 64,61,57,54,51,48,45,42,40,38,36,34,32,30,29,27,26,25,24,23,22,21,20,20,19,18,18,17,16,16,16,15 !byte 64,61,58,55,52,49,46,44,42,39,37,35,34,32,30,29,28,27,25,24,23,23,22,21,20,20,19,18,18,17,17,16 !byte 64,61,58,55,53,50,48,45,43,41,39,37,35,34,32,31,29,28,27,26,25,24,23,22,22,21,20,19,19,18,18,17 !byte 64,61,59,56,53,51,48,46,44,42,40,38,37,35,33,32,31,29,28,27,26,25,24,24,23,22,21,21,20,19,19,18 !byte 64,61,59,56,54,52,49,47,45,43,41,39,38,36,35,33,32,31,30,29,27,27,26,25,24,23,22,22,21,21,20,19 !byte 64,62,59,57,55,52,50,48,46,44,42,41,39,37,36,35,33,32,31,30,29,28,27,26,25,24,24,23,22,22,21,20 !byte 64,62,59,57,55,53,51,49,47,45,43,42,40,39,37,36,34,33,32,31,30,29,28,27,26,25,25,24,23,23,22,21 !byte 64,62,60,58,56,54,52,50,48,46,44,43,41,40,38,37,35,34,33,32,31,30,29,28,27,26,26,25,24,24,23,22 !byte 64,62,60,58,56,54,52,50,48,47,45,44,42,41,39,38,37,35,34,33,32,31,30,29,28,27,27,26,25,25,24,23 !byte 64,62,60,58,56,54,53,51,49,48,46,44,43,41,40,39,37,36,35,34,33,32,31,30,29,28,28,27,26,26,25,24 !byte 64,62,60,58,57,55,53,51,50,48,47,45,44,42,41,40,38,37,36,35,34,33,32,31,30,29,29,28,27,26,26,25 !byte 64,62,60,59,57,55,54,52,50,49,47,46,44,43,42,40,39,38,37,36,35,34,33,32,31,30,30,29,28,27,27,26 !byte 64,62,61,59,57,56,54,52,51,49,48,46,45,44,42,41,40,39,38,37,36,35,34,33,32,31,30,30,29,28,27,27 !byte 64,62,61,59,58,56,54,53,51,50,48,47,46,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,30,29,28,28 !byte 64,62,61,59,58,56,55,53,52,50,49,48,46,45,44,43,42,40,39,38,37,36,35,34,34,33,32,31,30,30,29,28 !byte 64,62,61,59,58,57,55,54,52,51,50,48,47,46,45,43,42,41,40,39,38,37,36,35,34,34,33,32,31,31,30,29 !byte 64,63,61,60,58,57,55,54,53,51,50,49,48,46,45,44,43,42,41,40,39,38,37,36,35,34,34,33,32,31,31,30 !byte 64,63,61,60,58,57,56,54,53,52,50,49,48,47,46,45,43,42,41,40,39,38,38,37,36,35,34,33,33,32,31,31 !byte 64,63,61,60,59,57,56,55,53,52,51,50,48,47,46,45,44,43,42,41,40,39,38,37,37,36,35,34,33,33,32,31 !byte 64,63,61,60,59,57,56,55,54,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,36,35,34,33,33,32
4. ## F-Secure is blocking emulator r39

It all works perfectly fine now! I compiled the latest source code with VS2022, copied the latest rom.bin from the official emulator and used the -vsync none option. Thanks all for your help, it is much appreciated! And Stephen, Box16 seems absolutely great. There are debugging possibilites and other improvements that I have been dreaming about. Fantastic job. I will report if I find anything broken.
5. ## F-Secure is blocking emulator r39

Hm, things suddenly got both easier and more complicated. I wasn't aware about box16 but it seems lika a good or actually better alternative. So I downloaded and compiled it, no problem. I copied the r39 rom.bin to the ouput folder. It starts without F-Secure complaining about it, there is some information in a first window but then a completely white and blank window opens and nothing more happens. Some more questions if you have the paticence: 1. I have VS2022 so I upgraded the project. Maybe I have to install VS2019? 2. Should I compile the latest version of the source files or go for the latest release from last year? 3. Does rom.bin from the official release 39 of the emulator work? (It seems to work.) 4. If I get this working, is it compaitble with the official r39? After all, the reason for doing this is to upgrade my programs to work with this release.
6. ## F-Secure is blocking emulator r39

I tried to make a full scan, it didn't help. I think the next step will be to try to make my own build. Last resort, talk to the IT department. In that case I will hope for mercy because I have to be very creative to explain how this relates to my work ...
7. ## F-Secure is blocking emulator r39

For better or worse I am using my work computer to develop for the X16. It is the only computer I have. So far there have been no problems but now my antivirus program, F-Secure, blocks the new release of the emulator. It says it is an "unusual program". I have no problem with earlier versions or any other tool that I use which include VS Code and ACME. Unfortunately (I understand this is a good thing for security reasons) I cannot control F-Secure in any way. Is there something I can do to make the antivirus program accept it?
8. ## The difference between Feature Creep and Craftsmanship

My understanding of feature creep has always been very simple. It is the common experience of discovering that what you originally planned for is almost sufficient, there is just one thing missing. You add that and two days later you suddenly realize that there is just one more thing missing and so on. You want to draw the line the line but this one last thing is so valuable that you just must have it. And most of the time it is, I think we all are grateful for being able to use hexadecimal values in BASIC. Still you have to draw the line somewhere …
9. ## Let's help push this over the finish line

After all, I can see your point. I am already a patreon but I think I will make an extra donation even if money isn’t the main issue right now. It is an encouragement and a way to let the project group know that we are many who support the project.
10. ## Let's help push this over the finish line

The quote is from August last year. The latest update makes it clear that the project group have had a communication problem. And there is no project manager what it seems. If the group becomes stable and functional I wouldn’t hesitate to donate money. Stephen Horn is offering some help. It seems like a good idea to ask if he could assist Michael Steil. For now I am sort of waiting to see what happens.
11. ## Change of Command

I am very happy for your commitment and will be glad to contribute! It is incredible that the community survives the long wait so well.
12. ## New community dev tool uploaded: Basic Label Compiler for Windows

Yes there are some developer tools that are more or less essential. You end upp making them yourselves or finding what someone else has already made. This is one example. I have made another tool - XPngConverter - for converting graphics, that's another. Good thing there's alternatives. A problem for all spare-time-developers is to really finish something. Perhaps can my contribution be making a (nearly) finished product which is quite polished. In this case I tried to succeed by keeping the list of features short.
13. ## New community dev tool uploaded: Basic Label Compiler for Windows

QBasic is still beyond the horizon but I have made some improvements in v 2.0.
14. ## Happy holidays

I wish you the same. And may 2022 be a year when the X16 project makes real progress.
15. ## X16PngConverter - convert png images to sprites, tiles or bitmap images

Version 1.0.0

This is a console application for Windows that will convert png images to a format that the video controller (VERA) of the Commander X16 can read. Both indexed images (which contain a palette) and full-color images are supported. The original file can contain an image or a number of tiles or sprites with max 256 colors. For conversion of images, the width of the image must be 320 or 640 pixels. Height has no restrictrions. For conversion to tiles or sprites, the width and height of each tile/sprite must be specified. COLORS Bits per pixel (BPP) in the generated file will depend on how many colors the conversion results in. The number of colors might be reduced because the color depth of VERA is limited to 12 bits. In other words several 32-bit colors in the original image might be converted to the same 12-bit color. Semitransparent colors (0 < alpha < 255) will be treated as solid colors. For conversions of images with 16 colors or less, up to 13 colors will be displayed in the console window. Due to limitations of the console itself this is the maximum number that can be displayed correctly. TRANSPARENCY The first color of the palette might be transparent when rendered by VERA. This is for example the case when a sprite is rendered in front of a layer. Therefore it can be absolutely crucial which color in the original image that will receive index 0 in the generated palette. The selection is made in the following way: 1. If the original image is indexed (has a palette), the color with index 0 in the original will also receive index 0 in the converted image. 2. If the user has explicitly stated which color should be the first, this color will receive index 0. 3. If nothing above applies, the color of the top left pixel will receive index 0. OUTPUT At least two files will be generated: a binary file with image data and the palette in binary format or in the format of assembly source code or BASIC. As an extra bonus a BASIC program that displays the image/tiles/sprites can be generated. INSTALLATION The application is for Windows and depends on .NET 6.0. No installation is needed, there is just one executable file. SYNTAX X16PngConverter [-help] [FILENAME] {-image|-tiles|-sprites} [-height] [-width] [-palette] [-transparent] [-demo]. OPTIONS (No arguments) : Displays this text. -help/-h : Same as above if it is the first argument. FILENAME : If the name of the file is the only argument, the original image will be analyzed to see if conversion is possible and in that case which options that are possible. -image|-tiles|-sprites : Set conversion mode (mandatory). When image mode is used the original image must be either 320 or 640 pixels wide. -height/-h : Set height of tiles or sprites (not used when converting to a bitmap image). Valid values for tile mode are 8 and 16, for sprites 8, 16, 32 and 64. -width/-w : Set width of tiles or sprites, (not used when converting to a bitmap image). Valid values are the same as for height. -palette/-p : Set file format for the destination file that contains the palette. Valid values are: bin - a binary file asm - text file containing assembly source code) bas - text file containing BASIC DATA statements). If this option is omitted, all three files will be created. -transparent/-t : Set which color that will have index 0 in the generated palette. The value must be a 32-bit hexadecimal value in the following format: \$aarrggbb where a = alpha, r = red, g = green and b = blue. -demo/-d : Generate a demo program in BASIC. This can be loaded to the emulator by using the -bas option. For example: x16emu -bas mysprites_demo.txt. To run it immediately add the option -run. Using this option will cause a binary palette file to be created. EXAMPLES X16PngConverter : Display help text. X16PngConverter image.png : Analyse image and see if it is possible to convert. X16PngConverter image.png -image : Convert to a bitmap image (width must be 320 or 640 pixels). X16PngConverter image.png -tiles -h 16 -w 16 : Convert to tiles with a widht and height of 16 pixels. X16PngConverter image.png -image -p asm : Convert to sprites and output palette only as a file with assembly source code. X16PngConverter image.png -image -t \$ff88aacc : Convert image with the specified (potentially transparent) color as the first in the generated palette. X16PngConverter image.png -image -demo : Convert image and generate a BASIC demo program named image_demo.txt.
16. ## New community dev tool uploaded: X16PngConverter - convert png images to sprites, tiles or bitmap images

X16PngConverter - convert png images to sprites, tiles or bitmap images View File This is a console application for Windows that will convert png images to a format that the video controller (VERA) of the Commander X16 can read. Both indexed images (which contain a palette) and full-color images are supported. The original file can contain an image or a number of tiles or sprites. For conversion of images, the width of the image must be 320 or 640 pixels. Height has no restrictrions. For conversion to tiles or sprites, the width and height of each tile/sprite must be specified. COLORS Bits per pixel (BPP) in the generated file will depend on how many colors the conversion results in. The number of colors might be reduced because the color depth of VERA is limited to 12 bits. In other words several 32-bit colors in the original image might converted to the same 12-bit color. Semitransparent colors (0 < alpha < 255) will be treated as solid colors. For conversions of images with 16 colors or less, up to 13 colors will be displayed in the console window. Due to limitations of the console itself this is the maximum number that can be displayed correctly. TRANSPARENCY The first color of the palette might be transparent when rendered by VERA. This is for example the case when a sprite is rendered in front of a layer. Therefore it can be absolutely crucial which color in the original image that will receive index 0 in the generated palette. The selection is made in the following way: 1. If the original image is indexed (has a palette), the color with index 0 in the original will also receive index 0 in the converted image. 2. If the user has explicitly stated which color should be the first, this color will receive index 0. 3. If nothing above applies, the color of the top left pixel will receive index 0. OUTPUT At least two files will be generated: a binary file with image data and the palette in binary format or in the format of assembly source code or BASIC. As an extra bonus a BASIC program that displays the image/tiles/sprites can be generated. INSTALLATION The application is for Windows and depends on .NET 6.0. No installation is needed, there is just one executable file. SYNTAX X16PngConverter [-help] [FILENAME] {-image|-tiles|-sprites} [-height] [-width] [-palette] [-transparent] [-demo]. OPTIONS (No arguments) : Displays this text. -help/-h : Same as above if it is the first argument. FILENAME : If the name of the file is the only argument, the original image will be analyzed to see if conversion is possible and in that case which options that are possible. -image|-tiles|-sprites : Set conversion mode (mandatory). When image mode is used the original image must be either 320 or 640 pixels wide. -height/-h : Set height of tiles or sprites (not used when converting to a bitmap image). Valid values for tile mode are 8 and 16, for sprites 8, 16, 32 and 64. -width/-w : Set width of tiles or sprites, (not used when converting to a bitmap image). Valid values are the same as for height. -palette/-p : Set file format for the destination file that contains the palette. Valid values are: bin - a binary file asm - text file containing assembly source code) bas - text file containing BASIC DATA statements). If this option is omitted, all three files will be created. -transparent/-t : Set which color that will have index 0 in the generated palette. The value must be a 32-bit hexadecimal value in the following format: \$aarrggbb where a = alpha, r = red, g = green and b = blue. -demo/-d : Generate a demo program in BASIC. This can be loaded to the emulator by using the -bas option. For example: x16emu -bas mysprites_demo.txt. To run it immediately add the option -run. Using this option will cause a binary palette file to be created. EXAMPLES X16PngConverter : Display help text. X16PngConverter image.png : Analyse image and see if it is possible to convert. X16PngConverter image.png -image : Convert to a bitmap image (width must be 320 or 640 pixels). X16PngConverter image.png -tiles -h 16 -w 16 : Convert to tiles with a widht and height of 16 pixels. X16PngConverter image.png -image -p asm : Convert to sprites and output palette only as a file with assembly source code. X16PngConverter image.png -image -t \$ff88aacc : Convert image with the specified (potentially transparent) color as the first in the generated palette. X16PngConverter image.png -image -demo : Convert image and generate a BASIC demo program named image_demo.txt. Submitter Johan Kårlin Submitted 12/01/21 Category Dev Tools
17. ## Basic Label Compiler for Windows

Version 2.0.1

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
18. ## New community dev tool uploaded: Basic Label Compiler for Windows

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
19. ## Current state of the audio options?

I just found this thread when thinking about the exact question that started it almost a year ago. The FAQ still says that the YM2151 may not make it to the final product, but it is still there on he latest revision of the motherboard. I understand this as it is very unlikely that it will be removed. Or am I jumping to conclusions?
20. ## Hide sprites in vera

Nice job! I am looking forward to see what will become of this!
21. ## Hide sprites in vera

Easily done to miss things : ). Of course the other way is to just place the sprite outside screen boundaries, for example by setting the vertical position to 512. If you constantly calculate sprite positions it might feel more natural to only work with the position registers and never change the Z-depth, at least that is what I have found.
22. ## Hide sprites in vera

You can actually disable sprites individually by setting the Z- depth to 0.
23. ## Simple development software recommendations

I have found PyxelEdit very useful. You can draw you tiles and simultaneously arrange them in tilemaps to see how they work together. It have some bugs though. Tiled is the best program I know for drawing tilemaps. I have made an extension that exports the maps in the binary format that the X16 uses. I have made a small tool for converting tilemaps made with PyxelEdit as well but that is a separate program because PyxelEdit does not support extensions. You can find them under “Development Tools” in the download section.
24. ## Scrolling Land on the X16

I have implemented this, but updating single columns and rows got unnecessary complicated. I ended up with a double buffered 32x32 tilemap (tiles 16x16). I scrolled 15 pixels and then updated the complete visible part of the tilemap. That made be spend about half of the available CPU cycles including all other code that was running each frame. A processor speed of 8 MHz makes a great difference compared to 1 MHz : ).
25. ## Petscii Robots port in the works

I am happy to see an X16 version after all. It’s encouraging for all of us who are trying to develop programs for this platform as well. [emoji4]
×
×
• Create New...