Jump to content

Michael Parson

Members
  • Content Count

    13
  • Joined

  • Last visited

Community Reputation

15 Good

About Michael Parson

Recent Profile Visitors

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

  1. I'm glad it solved your problem. I'm a sysadmin, by trade, but now manage a team and don't have as much time for script as I used to, so this was fun. I'm not much of a programmer, outside shell stuff needed to do my job and stupid BASIC tricks and just recently started playing around in C again, so, it's fun to be able to contribute however I can to this project. I went ahead and stuck it up in my github repo under a CC-SA license. Feel free to do whatever with it now.
  2. Yeah, I was bumping against the fstype problem with mformat for a bit too. Was getting ready to post the original version of the script to use losetup & mkfs.vfat, but I decided to take one more read of the mformat man page and found that magic '-F' flag.
  3. Posted an updated & downloadable version of the above script to the dev tools section.
  4. Michael Parson

    mkcard

    Version 1.0.2

    1 download

    Someone asked for help creating new sdcard images to be used with the emulator, so I banged around in vim for a while and dug around in DDG until I found enough hints around using sfdisk and mtools to create a suitable file w/o needing any root permissions. Due to limits of the FAT32 filesystem, the smallest image you can format with FAT32 is 32 MB. $ mkcard -f scratch.img -s 32 Checking that no-one is using this disk right now ... OK Disk scratch.img: 34 MiB, 35651584 bytes, 69632 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes >>> Created a new DOS disklabel with disk identifier 0x9983f409. scratch.img1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 33 MiB. scratch.img2: Done. New situation: Disklabel type: dos Disk identifier: 0x9983f409 Device Boot Start End Sectors Size Id Type scratch.img1 2048 69631 67584 33M c W95 FAT32 (LBA) The partition table has been altered. Syncing disks. You'll need the mtools and util-linux packages installed to use the script. Unfortunately, this limits this to be only be usable by Linux users (maybe Windows 10 users with WSL as well, don't know, don't have a Win10 setup to try with), I don't see sfdisk in the macOS ported versions of util-linux packages. To make things even easier to use these files with mtools, create a ~/.mtoolsrc file with something like: mtools_skip_check=1 drive s: file="~/scratch.img" exclusive partition=1 drive x: file="~/basic-progs.img" exclusive partition=1 drive y: file="~/demos.img" exclusive partition=1 And now you can use mcopy to copy files to your s:, x: or y: drives. Just make sure you UPPERCASE the filenames so x16emu will display the filenames as you expect them to look.
  5. mkcard View File Someone asked for help creating new sdcard images to be used with the emulator, so I banged around in vim for a while and dug around in DDG until I found enough hints around using sfdisk and mtools to create a suitable file w/o needing any root permissions. Due to limits of the FAT32 filesystem, the smallest image you can format with FAT32 is 32 MB. $ mkcard -f scratch.img -s 32 Checking that no-one is using this disk right now ... OK Disk scratch.img: 34 MiB, 35651584 bytes, 69632 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes >>> Created a new DOS disklabel with disk identifier 0x9983f409. scratch.img1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 33 MiB. scratch.img2: Done. New situation: Disklabel type: dos Disk identifier: 0x9983f409 Device Boot Start End Sectors Size Id Type scratch.img1 2048 69631 67584 33M c W95 FAT32 (LBA) The partition table has been altered. Syncing disks. You'll need the mtools and util-linux packages installed to use the script. Unfortunately, this limits this to be only be usable by Linux users (maybe Windows 10 users with WSL as well, don't know, don't have a Win10 setup to try with), I don't see sfdisk in the macOS ported versions of util-linux packages. To make things even easier to use these files with mtools, create a ~/.mtoolsrc file with something like: mtools_skip_check=1 drive s: file="~/scratch.img" exclusive partition=1 drive x: file="~/basic-progs.img" exclusive partition=1 drive y: file="~/demos.img" exclusive partition=1 And now you can use mcopy to copy files to your s:, x: or y: drives. Just make sure you UPPERCASE the filenames so x16emu will display the filenames as you expect them to look. Submitter Michael Parson Submitted 01/07/21 Category Dev Tools  
  6. OK, worked up a script for creating a 32MB image that can be used with the emulator, no root needed. $ cat bin/mkcard #!/bin/bash printusage() { cat - <<EOF $0 [-f filename] [-s size-in-megabytes] To create a 64 MB file: $0 -f card.img -s 64 EOF } # print usage if we don't have the right number of arguments if (($# != 2 )); then printusage exit 0 fi while getopts "f:s:" opts; do case $opts in f ) diskimg="$OPTARG" ;; s ) size="$OPTARG" ;; * ) printusage exit 0 ;; esac done alignment=1048576 size=$((size *(1<<20))) size=$(( (size + alignment - 1)/alignment * alignment)) # create the file truncate -s $((size + 2*alignment)) "${diskimg}" # partition the file echo ',,c;' | sfdisk ${diskimg} # create the filesystem mformat -F -i ${diskimg}@@$alignment For extra fun, have multiple images available to mtools: $ cat ~/.mtoolsrc mtools_skip_check=1 drive s: file="~/scratch.img" exclusive partition=1 drive x: file="~/basic-progs.img" exclusive partition=1 drive y: file="~/demos.img" exclusive partition=1 And now you can use the mtools to move files back and forth from the different virtual cards, just make sure your UPPERCASE your filenames when you copy files into the images. ************ Post accepted solution edit: I've uploaded a "polished" version of the script to github.
  7. Yeah, I was playing around with that too. Seems that the emulator wants there to be a partition on the (virtual) card, so, to use a partitioned image file, you'll need to set up a ~/.mtoolsrc like this: $ cat .mtoolsrc mtools_skip_check=1 drive x: file="~/card.img" exclusive partition=1 Now you can copy files to/from your virtual "X:" drive: $ mcopy myfile.prg x: And to see the files on the new 'X' drive: $ mdir x: Volume in drive X has no label Volume Serial Number is 1F4D-A765 Directory for X:/ MAD-CX16 9977 2021-01-07 2:29 00001820 ~1~ 32 1980-00-00 0:00 HELLO 2 files 10 009 bytes 1 070 559 232 bytes free "HELLO" is a short BASIC program I did as a test save in the emulator.
  8. First, you need a file of appropriate size, for a 1G file: $ dd if=/dev/zero of=card.img bs=10240 count=102400 102400+0 records in 102400+0 records out 1048576000 bytes (1.0 GB, 1000 MiB) copied, 9.53099 s, 110 MB/s $ ls -lh card.img -rw-rw-r-- 1 mparson mparson 1000M Jan 6 08:17 card.img Now, it needs partitions and a filesystem, but first, it needs to be setup as a loopback device: $ sudo losetup /dev/loop0 card.img [sudo] password for mparson: Now we can create the partition: $ sudo fdisk /dev/loop0 Welcome to fdisk (util-linux 2.35.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0xc071d876. Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-2047999, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-2047999, default 2047999): Created a new partition 1 of type 'Linux' and of size 999 MiB. Command (m for help): t Selected partition 1 Hex code (type L to list all codes): b Changed type of partition 'Linux' to 'W95 FAT32'. Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. For good measure, remove and re-create the loopback device (might not be necessary, but it does force the kernel to re-read the partition table): $ sudo losetup -D $ sudo losetup /dev/loop0 card.img Now, put a FAT32 filesystem on the new partition: $ sudo mkfs.fat -F32 /dev/loop0p1 mkfs.fat 4.1 (2017-01-24) $ sudo mount /dev/loop0p1 /mnt $ df -h /mnt Filesystem Size Used Avail Use% Mounted on /dev/loop0p1 998M 4.0K 998M 1% /mnt This method requires that you copy the files to the /mnt mount point as root, best practice would be to use 'sudo cp MYFILE.PRG /mnt' As others have noted, you'll want to unmount it before using it with the emulator: $ sudo umount /mnt
  9. I first saw this on Adrian's Digital Basement when someone sent him a copy of the magazine. The original C-64 BASIC version takes about 20 minutes to draw the image, the compiled C version takes about 4 seconds on a C-64 and about 1 second on the x16emu. Glad I could contribute to the nostalgia.
  10. I found that cc65 does have tgi, just the version in the Fedora 32 repos didn't have it. I grabbed the latest from github and was able to compile my C version of the mad-computer demo. It, along with the source code, has been uploaded to the same spot as the BASIC version.
  11. Hello all! I was a big C-64 user back in the 80s, got a 128 in the 90s, moved on to Amiga and later succumbed to the x86 world, though mostly was able to stick with Linux, only using Windows when I had to. I recently started playing with cc65 to practice my C skills, found that it also had targets for the CX16, so I thought I'd check out this community. Unfortunately, no tgi library for CX16 yet, so, can't port any of the crappy graphics programs I've written. I just posted a CX-16 version of the MAD Program that Adrian's Digital Basement covered in a recent Mini Mail Call. The BASIC version on the CX-16 (emulator) runs almost as fast as the compiled C version does on a C64 (though I've not run it on real metal yet, just in VICE and the C64 MiSTER core).
  12. MAD Program View File CX16 port of the "MAD-COMPUTER" program published in the October 1985 issues of Mad Magazine https://archive.org/details/mad-258 Submitter Michael Parson Submitted 01/03/21 Category Demos  
  13. Version 1.0.0

    30 downloads

    CX16 port of the "MAD-COMPUTER" program published in the October 1985 issues of Mad Magazine https://archive.org/details/mad-258
×
×
  • Create New...

Important Information

Please review our Terms of Use