Dr. Jim's BASIC dumping ground

Show us what you're working on, (preferably with screenshots).
User avatar
TMD2003
Rick Dangerous
Posts: 2045
Joined: Fri Apr 10, 2020 9:23 am
Location: Airstrip One
Contact:

Re: Dr. Jim's BASIC dumping ground

Post by TMD2003 »

I've been away in QL-land for the last week to keep me amused, in the absence of CSSCGC entries that aren't completely broken and have me tearing my hair out (because nature hasn't done that for me and I'd perfer to keep it that way for as long as possible). Over on the QL Forum, what I post there gets attention from those who like to examine it, pull it apart, and see what improvements can be made - such is the way with a more technical forum. Meanwhile, my latest attempt to show what can be done on Sir Clive's four-coloured business machine is this:

Image

Get it here: ALL YOUR BASE ARE BELONG TO US

This was all sparked by my recent efforts trying to get a ZX80 to do something - anything, even - with machine code, that culminated in the program a few posts above this one. With that completed and running successfully, why not turn my hand to the QL again? 68000 machine code is still beyond me, so we're back to strictly (Super)BASIC for this one.

The advantage that the QL brings to the table, and once which I've used before, is is wide MODE 4 screen which can hold 85 characters. Could I make a QL version of Hex Bin Converter that would extend the range of values as far as 18,446,744,073,709,551,615? Who is ever going to need to count to 18 quintillion anyway? Why not just use WolframAlpha? As with all my QL programs, it's more of an exercise to see if I can do it. And, as you can see, I can. Numbers as huge as those this program can handle are best contained either in strings, or in arrays where each element houses one digit each. As this program was put together bit by bit - I'd get the decimal conversion working first, and then adapt it to the other bases later - I've used a bit of both each time. It's easier to use arrays to handle the conversion between bases, and strings to handle the display format.

And talking of the display format, there are more windows in this program than in a concrete tower block in the grimmest parts of any city in the former Soviet Union. #0, #1 and #2 are all redefined to TV-mode size (but retained in MODE 4), #3 displays the decimal output, #8 handles octal, #4-#7 are used for the "D/H/B/O" menu, and the hex and binary outputs get eight windows each - #11-18 and #21-28 - for a total of 25 windows defined, although window #2 is never used, it's just there to maintain compatibility if the program needs to be stopped and LISTed. So 24 windows will see action along the course of this program.

I make no guarantees that the code is perfect - it may look like a bit of a mess, but I've tried to keep all the procedures in one place, so the 1000s are the printing procedures, the 2000s-5000s are the conversions (2000 = decimal, 3000 = hex, 4000 = binary, 5000 = octal), the 6000s are any shared conversion sub-procedures, the 7000s ask which base is required, the 8000s ask for the value, and the 9000s are setting up the arrays and screen. With any error-trapping procedures, I've tried to make sure they're watertight, but the decimal input was so tricky (seeing as it's checking for a value that's higher than the QL can store accurately and isn't just a string of repeating digits) that this is the one most likely to be less than perfect.

Anyway, have fun with this - what's the longest word you can make using only hex digits, and what's its value in decimal?
Spectribution: Dr. Jim's Sinclair computing pages.
Features my own programs, modified type-ins, RZXs, character sets & UDGs, and QL type-ins... so far!
User avatar
TMD2003
Rick Dangerous
Posts: 2045
Joined: Fri Apr 10, 2020 9:23 am
Location: Airstrip One
Contact:

Re: Dr. Jim's BASIC dumping ground

Post by TMD2003 »

Crikey o'blimey. Is it a year and a half since I've been mucking about with bits and pieces of BASIC?

Anyway... seeing as I had cause to make a character set out of what Final Fantasy provided for the FF Jukebox, and also needed a few hiragana characters for the loading screen, I thought I'd go all the way and make a short demo of Japanese character sets swiped from FF1 (the American release) and FF2 (which only ever emerged in Japan at the time).

Image

Image Image

I'm quite impressed at how even the more complicated hiragana characters can still just about be crammed into an 8×8 pixel square and still be legible (to those who can read it, anyway). Maybe one day, this will be of use to someone with an interest in all things Japanese. Preferably someone who doesn't wear pink cat ears on top of an impossibly spiky blue hairdo. So, if you wish to have much honour:

GET IT HERE
Spectribution: Dr. Jim's Sinclair computing pages.
Features my own programs, modified type-ins, RZXs, character sets & UDGs, and QL type-ins... so far!
Post Reply