Retrocomputing Asked on August 25, 2021
Some small utilities, tools etc for Atari were distributed as BASIC programs that would consist of just one line, that looked something like this:
10 A=USR(ADR("p$PHHLéúÿÿÇEéúÿÿ@éüÿÿ2A$éòùÿÿE°U´è§øÿÿøÿÆûÿÿé`"))
Sometimes they would be split into two lines, but rarely more.
Essentially, the machine language program was encoded as a string (Atari could display all 256 characters of ATASCII even if typing some of them required some hoop-jumping), the string was wrapped into ADR (returning the address of the string) and USR (jumping to the address given).
I can’t quite imagine anyone converting the binary generated by the assembler into ATASCII by hand, especially if the program was longer. There had to be some utility to do this – emit a fragment of memory as string, wrap it into the commands, save as BASIC program. Is it obtainable somehow?
One solution is to use the program published at COMPUTE! ISSUE 76 / SEPTEMBER 1986 / PAGE 100 :
http://www.atarimagazines.com/compute/issue76/AtariML.php
The program heavily utilizes the BASIC "self-programming trick".
First, let's explain the trick. An example - dynamically allocating a string of variable length - is located starting with line 31570:
PH 31570 GRAPHICS 0:POSITION 2,4:PRINT "31750 DIM TEMP$(";FILSIZ;"):RETURN"
FK 31580 PRINT "CONT":POSITION 2,0:POKE 842,13:STOP
FK 31590 POKE 842,12:GOSUB 31750
31570:
GRAPHICS 0
).POSITION 2,4
)31580:
CONT
- this command makes sense only in immediate context - used in a program it would trigger 'already running' error.POKE 842,13
- I'm not sure what's 'behind the scenes' - 842 is the ICAX1 register, but I only managed to find the meaning of its 2 and 3 (device open for read and write); not bit 0 which is toggled here.The moment the "Magical Poke" is executed Atari begins outputting the Return key repeatedly. The program is aborted before the cursor reaches the text on screen, so when it does, the computer is in immediate mode, but with "jammed Return". Whatever lines the cursor rides through, are executed as if they were typed in. In that case, that's the line preceded by the number - which gets written into the program - and then, the line CONT, which resumes execution from the next command after STOP. Which happens to be...
31590:
POKE 842,12
to cancel the cursor madnessGOSUB 31750
- execute the newly entered line.Now, what the program actually does:
It's up to the user to save the remaining program containing the gibberish strings of machine code.
Correct answer by devwebcl on August 25, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP