{"id":38102964,"url":"https://github.com/nafmo/bastext","last_synced_at":"2026-01-16T21:21:55.999Z","repository":{"id":145483626,"uuid":"107451290","full_name":"nafmo/bastext","owner":"nafmo","description":"Convert Commodore BASIC files to readable text and back","archived":false,"fork":false,"pushed_at":"2025-12-28T22:25:17.000Z","size":188,"stargazers_count":7,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-31T15:35:19.065Z","etag":null,"topics":["basic","commodore-64"],"latest_commit_sha":null,"homepage":"http://www.softwolves.pp.se/cbm/skapelser/verktyg","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nafmo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-10-18T19:06:29.000Z","updated_at":"2025-12-28T22:25:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"def95505-c883-484c-ae1f-26c74244aec5","html_url":"https://github.com/nafmo/bastext","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/nafmo/bastext","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nafmo%2Fbastext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nafmo%2Fbastext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nafmo%2Fbastext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nafmo%2Fbastext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nafmo","download_url":"https://codeload.github.com/nafmo/bastext/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nafmo%2Fbastext/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28482790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["basic","commodore-64"],"created_at":"2026-01-16T21:21:55.296Z","updated_at":"2026-01-16T21:21:55.984Z","avatar_url":"https://github.com/nafmo.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"BasText - convert Commodore BASIC to text\n==========================================\nCopyright 1997-2026 Peter Krefting.\nA Softwolves Software Release in 2026\n\nhttp://www.softwolves.pp.se/sw/\n\nLICENSE\n--------\n\nThis software is distributed under the GNU General Public License version\n2, as can be found in the accompanying file COPYING.\n\nUSEAGE\n-------\n\nBasText is a program that is used to convert between binary (tokenized)\nBASIC files from the Commodore C64 and C128 to a clean ASCII text format\nthat is human and machine readable, as well as transportable via electronic\nmail. This program is designed to be compatible with tok64, while extending\nthe support for Commodore BASIC extensions and dialects.\n\nThe following Commodore BASIC versions and extensions are supported by\nthis version of BasText:\n\n* Commodore BASIC 2.0 (VIC20/C64)\n* Commodore BASIC 3.5 (C16/+4)\n* Commodore BASIC 4.0 (PET)\n* Commodore BASIC 7.0 (C128)\n* Software Unlimited's Graphics52 for Commodore 64\n* Riska BV's The Final Cartridge III for Commodore 64\n* Rick Simon's BASIC 7.1 for Commodore 128\n* VIC Super Expander for VIC-20\n* Commander X16\n\nBasText tries to autodetect the Commodore BASIC dialect used in the file it\nis processing. At the moment, this is done by checking the starting address\nof the file. These starting addresses are recognized, and interpreted\n(addresses written in hexadecimal):\n\n    $0401\nVIC-20 BASIC 2.0 (3K RAM expansion)\n\n    $0801\nCommodore 64 BASIC 2.0\n\n    $1001\nCommodore 16/Plus 4 BASIC 3.5 (or unexpanded VIC-20 BASIC 2.0)\n\n    $1201\nVIC-20 BASIC 2.0 (8K RAM expansion)\n\n    $132D\nCommodore 128 BASIC 7.1 extension by Rick Simon. This file is a\ncombined file, with both the BASIC 7.1 extension binary, and the\nBASIC source in one file (saved with BASIC 7.1's ESAVE command). The\npreamble will be ignored, and the file will be interpreted as BASIC\n7.1.\n\n    $1C01\nCommodore 128 BASIC 7.0\n\n    $4001\nCommodore 128 BASIC 7.0 saved with graphics mode enabled.\n\nIn version 1.0, some different third-party extensions were included in the\nautodetection. This is now only true for input mode (binary-to-text), for\noutput mode (text-to-binary) you'll need to specify all extensions via\ncommand line parameters.\n\nThe text files created by this program are supposed to be compatible with\nthose of tok64, meaning that the files it creates should be possible to\ninterpret with this one, and the files this program creates should be\npossible to interpret with it. However, an extra header, in front of tok64's\nstart tok64 header is added, start BasText, which contains the starting\naddress of the original binary file, as well as the name of BASIC extension\nused. This is to make the autodetection possible for the text-to-binary\ndirection. For Commodore 128 BASIC programs, the header is changed to start\ntok128, since tok64 only supports C64 programs, this will make it skip those\nprograms. For BASIC 4.0 programs, the header is start tokpet, for the same\nreason.\n\nWhen BasText interprets text representations of files back into binary mode,\nit will use the start BasText header to determine the BASIC extension to\nuse. If the BASIC version is not mentioned there (version 1.0 of BasText\nonly included the start address), BasText tries to autodetect the file\nformat in the same way as in binary-to-text. If no such header exists (e.g\nif the file was created with tok64), BasText will assume that the program's\nstart address is 0801 (standard for Commodore 64), and that it should\ninterpret it as Commodore 128 BASIC 7.0, as this is a super-set of BASIC\n2.0. This should make BasText able to interpret most text files without any\nbig problems. If autodetection in this mode does not work, use one of the\n\"force\" parameters described below.\n\nBasText is command line driven, with the following syntax:\n\n    bastext -i|-o [-f TYPE] [-b MODE] [-a] [-s] [-d filename] filename(s)\n    bastext -h\n\nOne of the three mode selectors must be given:\n\n    -i\nSet input mode (converting from binary Commodore tokenized BASIC to\ntext).\n\n    -o\nSet output mode (converting from text to binary Commodore tokenized\nBASIC).\n\n    -h\nShows a brief help screen, with an overview of the available options.\n\nThe \"-f\" option selects the format of the input and output files:\n\n    -f t64\nEnable T64 (Commodore 64 emulator tape archive) mode. When in input\nmode, this means that instead of the specified file names being binary\nCommodore BASIC files, they are T64 archives. When in output mode, this\nmeans that instead of writing the binary Commodore BASIC files to files\nin the current directory, they will be written to a T64 archive named\nbastext.t64 in the current directory. If the archive already exists, it\nwill be appended to. The default directory size for the bastext.t64\nfile is 30 entries. If you try to add more files to it, the program\nwill abort with an error message. The default directory size is\ncontrolled in the t64.h file.\n\n    -f p00\nEnable P00 (PC64 emulator container file) mode. The Commodore BASIC\nfiles are written to the current directory but get a PC64 container\nheader written to them and a file extension of .p00 added. This\nparameter is ignored in input mode, as it will auto-detect the .p00\ncontainer format.\n\nThe \"-b\" option selects the BASIC dialect to use; if not specified,\nthe format is detected automatically, unless otherwise mentioned:\n\n    -b 2.0\nForce Commodore BASIC 2.0 interpretation of all programs.\n\n    -b 3.5\nForce Commodore C16/+4 BASIC 3.5 interpretation of all programs.\n\n    -b 4.0\nForce Commodore PET BASIC 4.0 interpretation of all programs.\nThis must be specified both in input mode, as these tokens are incompatible\nwith the 3.5 and 7.0 tokens. In output mode, the tokpe theader will enable\nCommodore PET 4.0 mode, but \"-b 4.0\" must be specified if the text file uses\na standard tok64 header.\n\n    -b 7.0\nForce Commodore 128 BASIC 7.0 interpretation of all programs.\n\n    -b 7.1\nForce Commodore 128 BASIC 7.1 extension interpretation of all programs.\n\n    -b TFC3\nForce Commodore 64 The Final Cartridge III BASIC extension\ninterpretation of all programs. (See also BUGS).\n\n    -b 52\nForce Commodore 64 Graphics52 BASIC extension interpretation of all\nprograms.\n\n    -b X16\nEnable Commander X16 BASIC support. This must be specified in input\nmode to properly detokenize Commander X16 BASIC binary. In output mode,\nthe tokx16 header will enable Commander X16 BASIC mode no matter\nwhich BASIC mode has been selected, but \"-b X16\" must be specified if the\ntext file uses a standard tok64 header.\n\n    -b Super\nEnable VIC-20 Super Expander support. This must be specified both in\ninput and output mode, as bastext for compatibility reasons selects\nthe Commodore 64 Graphics52 expansion by default.\n\nThese options modify the behaviour of the conversion:\n\n    -a\nConvert all input files, not only those that have a starting address\n(input mode only).\n\n    -s\nMaintain strict compatibility with tok64. This means that BasText's\n\"extended\" escape codes for charactes 92 (British pound), 95 (left\narrow), 160-192 (shift space to shift asterisk), 219-221 (shift plus,\ncommodore minus and shift minus), and 223 (commodore asterisk), will be\nprinted as three-digit numeric escape codes, not as textual escapes.\nThe \"strict\" mode will not, however, undo the problems with tok64's\n\"uppercase in quoted strings\"-bug (see under BUGS).\n\n    -d filename\nSelects the filename to write the output to. If the filename is not\ngiven, or is given as \"-\", the listings will be output on the standard\noutput device (normally the console).\n\nPlease note that the MS-DOS and OS/2 versions (EMX compiled) uses / (slash)\nas parameter character.\n\nEXAMPLES\n---------\n\n    bastext -i sample.prg\n\nConverts sample.prg to text, and displays it on the standard output.\n\n    bastext -i sample.p00\n\nConverts sample.p00 to text, and displays it on the standard output. The P00\nfile format is detected automatically.\n\n    bastext -i -s -d programs.txt *.prg\n\nConverts all Commodore BASIC binary files with a prg extension to text,\nwriting it to programs.txt in the current directory, while maintaining tok64\ncompatibility.\n\n    bastext -ift64 *.t64 | more\n\nConverts all files in all T64 archives (with filename suffix .t64) in the\ncurrent directory into listings, displaying them one page at a time.\n\n    bastext -ob7.0 programs.txt\n\nConverts all programs in the programs.txt text file into Commodore BASIC 7.0\nprograms.\n\nHISTORY\n--------\n\n* v1.0 - 1998-01-18 -\n  Initial public release.\n* v1.1 - 2023-11-21 -\n  Fix incorrect keyboard mapping.\n  Fix VICE compatibility.\n* v1.2 - unreleased -\n  Simplify parameter parsing.\n  Add support for reading and writing P00 archives.\n  Add Commander X16 tokens.\n  Fix Graphics52 tokenizer.\n\nKNOWN BUGS\n-----------\n\ntok64 seems to parse uppercase characters in quoted strings incorrectly. It\nconverts them into characters in the range of 97-122, whereas a Commodore\ncomputer (and bastext) usually uses the \"shadow\" range of 193-208. This will\nnot look any different when used on a Commodore computer, but it will make\nthe binaries differ, and could make a difference if the program needs the\ncorrect PETSCII values. The problem will appear when you convert the program\nin one direction with bastext and in the other with tok64, not when using\nthe same program in both directions.\n\nBasText does not support the \"bare\" format that tok64 normally outputs\n(without the start tok64 header).\n\nCREDITS\n-----------\n\n* Thanks to Dirk Jagdmann for patches to update sources for compilers\n  20 years newer than what it was originally written for.\n* Thanks to Stig Christensen for suggestions for improvements and bug\n  reports.\n* Thanks to morphinejh for Commander X16 BASIC support.\n\nCONTACT\n--------\n\nThe author, Peter Krefting, can be contacted\nvia Internet e-mail at peter@softwolves.pp.se. Information about this\nprogram is available at\nhttp://www.softwolves.pp.se/sw/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnafmo%2Fbastext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnafmo%2Fbastext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnafmo%2Fbastext/lists"}