Jump to content

gavinhaslehurst

Members
  • Content Count

    19
  • Joined

  • Last visited

Community Reputation

15 Good

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Oh man, this is why this forum is so useful! I'm really new to this stuff, and although it's been a great learning experience to literally work out floating point, 2s complement etc from scratch, finding out there is a kernal routine is really useful! I will search out some decent references for this and explore my options. Still, definitely time well spent as I've really enjoyed getting under the hood of how some of this stuff actually works. Thanks again for your help!
  2. Correct RJE. Floats are stored in the usual way and converted using the Compute! code. I'm slowly working my way through the whole floating point maths thing, and this exercise is to help understand more how it all works in machine code. DesertFish has a good point though. I could add a line of basic to store a floating point number somewhere and see if the code works with it!
  3. Version 0.0.2

    2 downloads

    **EDITED TO ADD: for all those who are new like me, exploring this world, please see the forum thread where some of the more experienced coders here have pointed out some really useful Kernal routines which take the pain out of this!! Hi all! As I journey towards 6502 mastery (LOL), this demo explores floating point numbers and how they are stored and managed in binary. It borrows heavily from others' code to achieve what I was struggling to do from first principles, and I am grateful to all the YouTubers, bloggers and hobbyists out there who have kindly shared their work in this area. This particular routine takes a binary floating point number stored in memory and displays it on the screen in a human-readable decimal format. It also dumps some of the memory addresses involved so you can have a look under the hood. Some functions include: jsr FLTTODEC Displays the floating point number stored in MSB, NMSB, NLSB, LSB and BEXP as a decimal number on screen (PETSCII string) jsr print_mem_16 .word (addr) Memory dump. Shows paired bytes at the address, looping for MemDumpLen addresses (default=8) If you click try it now, you can poke around in memory to change the starting parameters of the programme. For example, to change the most significant byte of the mantissa, POKE $080E,XX and to change the binary exponent, POKE $081E,XX then type RUN again to see the results. FLTTODEC was adapted by me for the specific hardware of the Commander X16 from Jeff Tranter's code, who in turn adapted it for CC65 from the original appearing in Compute! issues 9 and 11, 1981 by Marvin L. De Jong. https://github.com/jefftranter/6502/blob/master/asm/wozfp/bcdfloat.s Jeff's Blog: https://jefftranter.blogspot.com/
  4. Floating Point in 6502 View File **EDITED TO ADD: for all those who are new like me, exploring this world, please see the forum thread where some of the more experienced coders here have pointed out some really useful Kernal routines which take the pain out of this!! Hi all! As I journey towards 6502 mastery (LOL), this demo explores floating point numbers and how they are stored and managed in binary. It borrows heavily from others' code to achieve what I was struggling to do from first principles, and I am grateful to all the YouTubers, bloggers and hobbyists out there who have kindly shared their work in this area. This particular routine takes a binary floating point number stored in memory and displays it on the screen in a human-readable decimal format. It also dumps some of the memory addresses involved so you can have a look under the hood. Some functions include: jsr FLTTODEC Displays the floating point number stored in MSB, NMSB, NLSB, LSB and BEXP as a decimal number on screen (PETSCII string) jsr print_mem_16 .word (addr) Memory dump. Shows paired bytes at the address, looping for MemDumpLen addresses (default=8) If you click try it now, you can poke around in memory to change the starting parameters of the programme. For example, to change the most significant byte of the mantissa, POKE $080E,XX and to change the binary exponent, POKE $081E,XX then type RUN again to see the results. FLTTODEC was adapted by me for the specific hardware of the Commander X16 from Jeff Tranter's code, who in turn adapted it for CC65 from the original appearing in Compute! issues 9 and 11, 1981 by Marvin L. De Jong. https://github.com/jefftranter/6502/blob/master/asm/wozfp/bcdfloat.s Jeff's Blog: https://jefftranter.blogspot.com/ Submitter gavinhaslehurst Submitted 01/14/21 Category Demos  
    This was really cool! Nice demo style graphics
    I really enjoyed this! Thanks for uploading!
  5. Version 0.0.4

    4 downloads

    This may be of interest to absolute 6502 assembly beginners like me, although advanced 6502 programmers may cringe at the way I've done things here! This program does very little, but it is a repository of useful assembly routines for things like printing different bytes of memory (useful for debugging) as well as some basic math operations. I will keep adding to this as I progress through my assembly journey (I'm aiming to write my fractal BASIC programs in assembly). Thanks to the following YouTubers for their excellent tutorials on all things 6502: Ben Eater - YouTube Matt Heffernan - YouTube ChibiAkumas - YouTube (and also his excellent website: Assembly Tutorials: Learn 6502 Assembly Programming... With ChibiAkumas!) Function usage: (notation for cc65 assembler) jsr print .byte (list of PETSCII character codes to print, ending in a $0 byte) jsr println .byte (list of PETSCII character codes to print, ending in a $0 byte) jsr print_mem .word (start address of memory dump) Set MEMDUMPLEN to the number of addresses you wish print_mem to display.
  6. Beginner 6502 Assembly Stuff View File This may be of interest to absolute 6502 assembly beginners like me, although advanced 6502 programmers may cringe at the way I've done things here! This program does very little, but it is a repository of useful assembly routines for things like printing different bytes of memory (useful for debugging) as well as some basic math operations. I will keep adding to this as I progress through my assembly journey (I'm aiming to write my fractal BASIC programs in assembly). Thanks to the following YouTubers for their excellent tutorials on all things 6502: Ben Eater - YouTube Matt Heffernan - YouTube ChibiAkumas - YouTube (and also his excellent website: Assembly Tutorials: Learn 6502 Assembly Programming... With ChibiAkumas!) Function usage: (notation for cc65 assembler) jsr print .byte (list of PETSCII character codes to print, ending in a $0 byte) jsr println .byte (list of PETSCII character codes to print, ending in a $0 byte) jsr print_mem .word (start address of memory dump) Set MEMDUMPLEN to the number of addresses you wish print_mem to display. Submitter gavinhaslehurst Submitted 01/12/21 Category Demos  
  7. Version 0.0.4

    3 downloads

    *** THIS FILE IS ALSO NOW IN THE DEMO SECTION TO ENABLE THE "TRY IT NOW" FEATURE *** This may be of interest to absolute 6502 assembly beginners like me, although advanced 6502 programmers may cringe at the way I've done things here! This program does very little, but it is a repository of useful assembly routines for things like printing different bytes of memory (useful for debugging) as well as some basic math operations. I will keep adding to this as I progress through my assembly journey (I'm aiming to write my fractal BASIC programs in assembly). Thanks to the following YouTubers for their excellent tutorials on all things 6502: Ben Eater - YouTube Matt Heffernan - YouTube ChibiAkumas - YouTube (and also his excellent website: Assembly Tutorials: Learn 6502 Assembly Programming... With ChibiAkumas!) Function usage: (notation for cc65 assembler) jsr print .byte (list of PETSCII character codes to print, ending in a $0 byte) jsr println .byte (list of PETSCII character codes to print, ending in a $0 byte) jsr print_mem .word (start address of memory dump) Set MEMDUMPLEN to the number of addresses you wish print_mem to display.
  8. Your YouTube tutorials are great Matt! I've always wanted to learn assembly, and this has been a really fun way to get started. I can't wait to run my creations on the real hardware.
  9. Another tip for people embarking on this journey: if you cd to the /mnt/ directory in Debian, you'll find all your Windows drives available there. With this I was able to use the cc65 assembler inside a Windows directory that I was editing my ASM files.
  10. Hi all - relative noob here, so I thought I'd share my experience of getting cc65 installed on Windows. It wasn't all that straightforward, so the following might make life easier for those starting out. cc65 assembler will enable you to follow the excellent 6502 assembly tutorials by Matt Heffernan here: X16 Assembly Language Tutorial, Lesson 1: The Basics - YouTube Installing Linux in Windows Make sure you have enabled your CPU's "virtualisation" mode in the BIOS (often called SVM). In my case, this was found by trawling deep into the Advanced CPU settings in the BIOS, and was disabled by default. Install Windows Subsystem for Linux. This is gone through in detail here: Install Windows Subsystem for Linux (WSL) on Windows 10 | Microsoft Docs, but I'll summarise below. Make sure that your Windows 10 installation is up to date Search for "Powershell" app and right click to "Run as administator" Type: dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart Now type: dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart Now restart your computer Download and install the following update package: https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi Open Powershell as administrator again and type: wsl --set-default-version 2 Now you can go to the Microsoft Store and install the Linux distro of your choice - I went with Debian Assuming all of the above went to plan (especially checking SVM is enabled in the BIOS!) then Debian should install and run, and launch the BASH terminal. It will prompt you to enter a new username and password first. Once in Debian, you need to do the following to get everything up-to-date and installed: Type: sudo apt update Now type: sudo apt upgrade (this takes a while - it's updating the Debian system) Type the following to get "git": sudo apt install git And type this to get "gcc": sudo apt install gcc Now type the following to get "make": sudo apt install make [edit: I believe there is an even easier way to do this by installing the "build-essential" package] To download cc65 you need to type the following: git clone https://github.com/cc65/cc65.git (this should work fine assuming all the above steps were done correctly) And now type: cd cc65 and then make to compile cc65 on your system - it will take some time Finally type sudo make avail to set up all the paths for the various components of cc65 Now you should be ready to go, and follow the tutorials for the 6502 assembler. One tip, you can access your Debian file system from Windows, so you can use your favourite text editor to edit your .asm files then assemble them from the Debian terminal. I found my Debian directory here: \\wsl$\Debian\home\gavin (replace "gavin" with your Linux username I hope this helps! If I've missed something, or you have any queries about this, please do drop a comment below! [Edited to add: I did all this then found that there is a Win32 version of cc65!! Oh well, this was a useful exercise in getting Linux up and running within Windows, and may have its uses for other projects ]
  11. Version 0.0.1

    7 downloads

    This is a quick and dirty Julia set demo written in Commander X16 BASIC. It generates a random Julia set each time it is run. I strongly suggest using the emulator's -warp option to speed things up a bit! Enjoy the fractal action!
  12. Julia Set Demo View File This is a quick and dirty Julia set demo written in Commander X16 BASIC. It generates a random Julia set each time it is run. I strongly suggest using the emulator's -warp option to speed things up a bit! Enjoy the fractal action! Submitter gavinhaslehurst Submitted 01/07/21 Category Demos  
×
×
  • Create New...

Important Information

Please review our Terms of Use