Prevod pameti do tabulky dat (Memory-to-DATA Converter)
- Type
- Utility
- Category
- Programming utility — memory dump to BASIC DATA lines
- Author
- Zlatko Bleha
- Published in
- Flop (Czech disk magazine for 8-bit Atari), issue 7 — 1986 program by Zlatko Bleha, translated by Drastich, AtariKlub Ostrava, 1989
- Year
- 1986
- Language
- Atari BASIC
- Requirements
- Any 8-bit Atari with Atari BASIC (title says 800 XL); keyboard
About the program
Anyone who wanted to publish a machine-language routine as a BASIC type-in needed a way to turn bytes in memory into DATA statements. This small Czech utility does exactly that. It also shows off one of the neatest tricks in Atari BASIC, a program that types new lines into itself. The title screen credits "ZLATKO BLEHA 1986" and "PREKLAD DRASTICH AK OSTRAVA 89", which means "translated by Drastich, AtariKlub Ostrava, 1989". The program was distributed on the Czech disk magazine Flop 7. (The "ARATI 800 XL" in line 1 is a typo in the original.)
What the screens say
| Czech | English |
|---|---|
| PROGRAM UMOZNUJE PREVOD CASTI PAMETI DO TABULKY | The program converts part of memory into a table |
| PO PREVODU SE MUZE PROGRAM SMAZATI A TABULKA DAT ZUSTANE | After conversion the program can delete itself, leaving the DATA table |
| TABULKU MUZETE NAHRATI NA KAZETU, DISKETU… | You can save the table to cassette or disk like any BASIC program |
| POSLEDNI CISLO V KAZDEM RADKU JE SOUCET TOHOTO RADKU | The last number in each line is that line's sum (a checksum) |
| POCATECNI ADRESA / KONECNA ADRESA | Start address / end address |
| ZADEJ CISLO PRVNIHO RADKU (VETSI NEZ 40) | First line number (must be over 40) |
| ZADEJ KROK MEZI RADKY | Step between line numbers |
| POCKEJ NEZ UKONCIM PREVOD | Wait while I finish the conversion |
| PREJES SI AT SE PROGRAM SMAZE? (A/N) | Delete this program? (A = yes) |
Typing it in
The listing is plain ASCII. Type it exactly, keeping lines 0–29 as they are. The program deletes lines 0–29 at the end, and line numbers 40 and up are reserved for the DATA it creates.
How to use it
Press START. Enter the first and last addresses of the memory block (decimal, 0–65535), the first DATA line number (40 or more) and the line step. The screen then fills with DATA lines, ten bytes plus a checksum per line, and they are entered into the program automatically, ten lines per batch. At the end, answer A to delete the converter, and only your DATA lines remain. LIST them, then SAVE.
How it works
The trick is forced-read mode. Location 842 is the command byte of IOCB 0, the screen editor. Normally it holds 12. Setting it to 13 and then stopping the program makes the editor read back every line on the screen as if you'd pressed RETURN on each one. Lines 18–23 print ten complete DATA lines followed by GOTO 25, move the cursor to the top (POSITION 0,0) and STOP with 842 set to 13. BASIC then "types" each DATA line into the program, runs GOTO 25, and line 25 restores 842 to 12 and carries on with the next batch. Self-deletion in lines 28–29 works the same way. Printing a bare line number and "entering" it deletes that line, so lines 0–29 vanish in two passes.
Listing
0 GRAPHICS 0:SETCOLOR 2,0,0:POKE 752,1:DIM A$(1)
1 ? "********** ARATI 800 XL **********"
2 ?:? " PREVOD PAMETI DO TABULKY DAT"
3 ?:?:? " ZLATKO BLEHA 1986 (013) 851 905"
4 ?:? " PREKLAD DRASTICH AK OSTRAVA 89"
5 ?:? " PROGRAM UMOZNUJE PREVOD CASTI PAMETI DO TABULKY.";
6 ? "PO PREVODU SE MUZE PROGRAM SMAZATI A TABULKA DAT ZUSTANE.";
7 ? "TABULKU MUZETE NAHRATI NA KAZETU,DISKETU JAKO KAZDY JINY BASIC PROGRAM.";
8 ? "POSLEDNI CI- SLO V KAZDEM RADKU JE SOUCET TOHOTO RADKU":POSITION 12,22:? "STLAC START."
9 IF PEEK(53279)<>6 THEN 9
10 GRAPHICS 0:SETCOLOR 2,0,0:TRAP 10
11 ? " POCATECNI ADRESA PRO PREVOD ";:INPUT PA:IF PA<0 OR PA>65535 THEN ?:? " ERROR ADRESA NEZNAMA ":GOTO 11
12 TRAP 12:? " KONECNA ADRESA ";:INPUT KA:IF KA<0 OR KA>65535 THEN ?:? " ERROR ADRESA NEEXISTUJE ":GOTO 12
13 IF KA<PA THEN ?:? "ERROR KONECNA ADRESA MENSI ":GOTO 12
14 TRAP 14:? "ZADEJ CISLO PRVNIHO RADKU(VETSI NEZ 40";:INPUT BL:IF BL<40 THEN ? "ERROR CISLO MENSI NEZ 40":GOTO 14
15 TRAP 15:?:? " ZADEJ KROK MEZI RADKY";:INPUT KR
16 IF KR<1 OR KR>5000 THEN ?:? " ERROR SPATNE URCENY KROK":GOTO 15
17 GRAPHICS 0:SETCOLOR 2,0,0:? "***** POCKEJ NEZ UKONCIM PREVOD *****":POSITION 2,4
18 ? BL;" DATA ";
19 IF PA>KA THEN ? CS:? " GOTO 26":GOTO 24
20 A=PEEK(PA):? A;",";:PA=PA+1:CS=CS+A:S=S+1:IF S/10=INT(S/10) THEN 22
21 GOTO 19
22 ? CS:CS=0:BL=BL+KR:Q=Q+1:IF Q<>10 THEN 18
23 Q=Q:? " GOTO 25"
24 POSITION 0,0:POKE 842,13:STOP
25 POKE 842,12:? CHR$(125):GOTO 17
26 POKE 842,12:? CHR$(125):GRAPHICS 0:SETCOLOR 2,0,0:? " ********** PREVOD UKONCEN **********"
27 ?:? "* PREJES SI AT SE PROGRAM SMAZE?(A/N)*":INPUT A$:IF A$<>"A" THEN END
28 GRAPHICS 0:SETCOLOR 2,0,0:POSITION 2,4:FOR Z=0 TO 29:? Z:IF Z=15 THEN ? "GR.0:SE.2,0,0:POS.2,4:G.29":GOTO 24
29 NEXT Z:? " POKE 842,12:?CHR$(125)":GOTO 24
Credits
- Program listing: Prevod pameti do tabulky dat (Memory-to-DATA Converter) — program listing (Flop (Czech disk magazine for 8-bit Atari), issue 7 — 1986 program by Zlatko Bleha, translated by Drastich, AtariKlub Ostrava, 1989) — Zlatko Bleha
- Gury's Atari 8-bit Forever — Prevod pameti do tabulky dat — Zlatko Bleha
