Reader Comment


Dollars and Cents in Atari BASIC

Like most versions of BASIC, Atari BASIC does not print zero values. If you work with dollar values and the cent value is zero, BASIC does not print the decimal point and the zero cent value. For example, $25.00 will be printed $25, and this would look rather strange.

The following one-line routine will overcome this problem for dollar amounts with up to three zero decimals. The result always shows two zero decimals. For example, if the program has computed the following values for the numeric variable X, the converted result in a string, V$, always shows two zero decimals.

Example:

X=25.000
X=25.00
X=25.0
X=25

Result always V$ = $25.000 [Archiver's Note: This should probably read "$25.00".] Here is the one-line routine which solves this above problem:

V$=STR$(X+.006):V=LEN(V$):V$=V$(1,V-1)

This routine also takes care of rounding in case of three decimals, i.e.:

X=25.001 --> V$="25.00"
X=25.005 --> V$="25.01"
X=25.008 --> V$="25.01"

Sincerely,
Fred Jansen
Winnipeg, Canada


Dear ANALOG,

I've been wondering for a long time if there is any way to "kill" the SYSTEM RESET key. I know that POKE 590,1 will disable the key, but it will also get rid of the program when pressed. I hope that you will tell me the answer to this as it is very important to me. Also, if you don't have a printer to make a copy of the program, can you still submit articles and programs to ANALOG?

Thanks for your attention.
Greg Taunt
Springfield, MO

1. There is no way to disable the SYSTEM RESET key, unless you physically disconnect the keyswitch.

2. We prefer that submitted articles include printed program listings, but if this is not possible, we will accept submissions with programs on cassette or disk only.
-- TH


I recently wrote to the attention of Bert Williams and Tom Hamel about some trouble I was having with their disk cataloging utility in issue 11. I am using a 48K 800 with a Percom double density drive and OS/A+ or ATARI DOS 2.0. The program as I typed it CHECKed perfectly, but when RUN would apparently hit an ERROR when it tried to read a disk directory. Now remember, I just purchased the disk drive and am trying to learn how to use the DOS'S.

Well, to make a long story fairly short, after I sent off that letter, I read up as much as I could on drives and operating systems. Then, after another attempt at debugging, I realized that the problem was two-fold:

1) The routine to read the directory, being booted in double density, would see garbled material when it tried to read it from an ATARI DOS single density disk.

2) The part that formatted the DATA lines from the directory was set up for the display of an ATARI DOS disk directory and printed meaningless information to the DATA lines when reading the different display format of the OS/A+ directory.

The remedy was simple, now that the discrepancy was obvious. All I had to do to use the catalog utility on an ATARI DOS formatted disk was to boot the program in that format. Then all I had to do for the OS/A+ was to rewrite the lines printing the DATA lines for FILENAME.LST.

These changes are outlined here:

The DIM statements in Line 70 must be changed to handle the wider directory display of OS/A+:

70 DIM FILE$(Q3+Q34),C$(Q3+Q34),FA$(Q3+Q34)

Change the "end of directory" search in Line 420 to:

420 INPUT #Q1,FA$:IF FA$(Q7,Q10)="FREE" 
THEN ? C;",";FA$(Q3,Q34);",0":GOTO Q43*Q10+Q30

The FOR-NEXT loop in Line 425 must be changed to:

425 ? C;",";:FOR I=Q3 TO Q34:IF FA$(I,I)
=" " THEN ? FA$(I,I);:NEXT I

Then delete Lines 430 and 435, and change 440 to read:

440 ? ",";FA$(Q1+Q34,37);

And that's all there is to it! It's amazing what you can learn if you try! So now I have two catalog disks-one for those formatted in double density and one single density.

See you later,
Patrick Stewart
Reno, NV


Dear Sirs,

This is the first time that I had seen your magazine locally and bought it (#17). I am wondering why, in your "DISK MISER" article, did you use two types of BASIC? Listing 1 is in regular Atari BASIC, and Listing 2 is in Microsoft BASIC. For people who only have Atari BASIC, like myself, it makes it a little hard to use your programs. Thanks.

Sincerely,
V. L. Burton
Great Falls, MT

"Disk Miser" runs fine in Atari BASIC. Listing 2 of the article is not Microsoft BASIC, but the assembly language source code for the DATA in lines 600-610 of Listing 1. You don't need to type Listing 2 to use the program; it's provided so that advanced programmers can see how the program operates.
-- TH


Dear ANALOG,

I have become reasonably fluent in Atari BASIC, jazzing it up with machine language as I am able to, and compiling it with ABC (compiler). I'm pleased with this approach, but I can see that machine language programmers are able to do things that can never be done directly through BASIC. So I took on the formidable task of learning 6502 machine language. Then, as your magazine has hinted at in past issues and I have heard from other sources, Atari comes out with a new advanced computer with, let's say, a 32-bit processor. My question to you is: how useful would knowledge of the 6502 be in those circumstances?

Sincerely,
Wait Huber
Atwater, CA

An important thing to remember about programming is that effort spent leaming another language is NEVER wasted. Most ANALOG programmers knew 8080 assembly language, and when the Atari computers showed up, we picked up 6502 assembly relatively quickly.

In the event that Atari moves up to a 16-bit processor, knowledge of the 6502 will only help you learn the new chip faster. Sure, there'll be differences, but there will also be a lot of similarities.
-- TH


Previous | Contents | Next

Original text copyright 1984 by ANALOG Computing. Reprinted with permission by the Digital ANALOG Archive.