Apple II manual Variables Assigning Variables with AN Input Statement, Input R, Variable Names

Page 222

+1

1

-1

-1

6523

6523

-23.460

-23.46

1E20

1E+20

-12.3456E-7

-1.23456E-06

1.234567E-10

1.23457E-10

1000000000

1E+09

999999999

999999999

.1

.1

.01

.01

.000123

1.23 E-04

A number input from the keyboard or a numeric constant used in a BASIC program may have as many digits as desired, up to the maximum length of a line (72 characters) or maximum numeric value. However, only the first 10 digits are significant, and tenth digit is rounded up.

PRINT 1.23456789876543210 1.2345679

206 VARIABLES

ASSIGNING VARIABLES WITH AN INPUT STATEMENT

Following is an example of a program that reads a value from the keyboard and uses that value to calculate and print a result:

10 INPUT R

20 PRINT 3.14159*R*R

RUN ?10 314.159

Here's what's happening: When BASIC encounters the input statement, it outputs a question mark

(?)on the display and then waits for you to type in a number. When you do (in the above example, 10 was typed), execution continues with the next statement in the program after the variable (R) has been set (in this case to 10). In the above example, line 20 would now be executed. When the formula after the PRINT statement is evaluated, the value 10 is substituted for the variable R each time R appears in the formula. Therefore, the formula becomes 3.14159*10*10, or 314.159.

If we wanted so calculate the area of various circles, we could rerun the program for each successive circle. But, there's an easier way to do it simply by adding another line to the program, as follows:

30 GOTO 10 RUN

?10

314.159

?3

28.27431

?4.7

69.3977231

?

By putting a "GOTO" statement on the end of our program, we have caused it to go back to line 10 after it prints each answer for the successive circles. This could have gone on indefinitely, but we decided to stop after calculating the area for three circles. This was accomplished by typing a carriage return to the input statement (thus a blank line).

VARIABLE NAMES

The letter "R" in the program above is a "variable." A variable name can be any alphabetic character and may be followed by any alphanumeric character (letters A to Z, numbers 0 to 9).

Any alphanumeric characters after the first two are ignored.

Here are some examples of legal and illegal variable names:

Legal Illegal

A % (first character must be alphabetic)

Image 222
Contents Apple II Original ROM Information Data Qjjj0005A0 FDA9A920 EDFDA98D 4CEDFDA9 8D4CEDFD Page Page Page JI@ Page 001AA0 F3FFE8E1 E8E8EFEB FFFFE0FF Ffefeeef 001AC0 FFFFE1E1 EFEEE7E8 EEE7F3FB FBEEE1EF001AE0 E8EEE7E8 Efefeeef Eeefeeee Efeeeeee 001DB0 9CDD9CDE DD9EC3DD Cfcacdcb 00479AAD 001FB0 Ffffffff FFFF2071 E14CBFEF 2003EEA9 Page 02E61FBD JJJ DDBAF9F0 0DBDBAF9FA60FFFF 60FFFFFF .JJAEAEA8AD Page Page Return Page LOC1 System Monitor CopyrightLOC0 BaslMask INY NO, INC Index X-COORD LDY PCH PRMN1 LDA FMT1 DFB Format Above EOR STA A3H FAE2 A2 FB Tabv STA Vtabs to ROW in A-REG STA Bash BCC Clreol Clear to END of Line NXTA4 INC A4L Incr 2-BYTE A4 STA BASL,Y Replace Flashing Screen Fdad A5 3C LT2 LDA A2L,X Copy A2 2 Bytes to Ioprt LDA A2L SET RAM IN/OUT Vectors BCC RD3 Loop Until Done STA A3H,X DFB LIST-1 FFF3 CC Save BRTBL,XLSR Prepare Carry for BC, BNC Stat LDA R0L JSR STAT2 Push LOW PC Byte VIA R12 BNE Nomove LDA IN,YCMP JSRBNZ Mloop MloopDCR RTNBNZ INRBNC BM1Store Indirect ExampleLoad Indirect Load DOUBLE-BYTE IndirectStore DOUBLE-BYTE Indirect POP IndirectStore POP Indirect ACC SubtractPOP DOUBLE-BYTE Indirect LOOP1 SUB CompareBF A0 SET $A0BF BNC LOOP1LOOP2 Return to 6502 ModeDecrement BNZ LOOP2Branch if Plus Branch if no CarryBranch if Carry SET LOOP3 SUBBreak Branch if Minus ONEBranch if not Minus ONE Return from Sweet 16 SubroutineLDA #ADRH STA IND+1 LDA OPTBL,XSTA IND JMP Page Page Sweet 16 Introduction Page Source Input Enter String a $ , a $ DSPPrint Dbload Sweet REM Ctrl D NVACall -605 Return REM XAM8 in Monitor Poke 776 , a REM Poke DestinationPrint Print Goto SweetMneml MINI-ASSEMBLERBaum MnemrSBC PCL Form ADDR-PC-2 JSR Cout Position FORM7 STX A1H Save Index STA ORGCLC BNENorm LDA EXP1 ZERO? Shift Dividend Left Floating Point Package Floating Point Representation LOWFloating Point Representation Examples StoredHigh LOW EXP Mantissa Number Exponent MantissaFloating Point Subroutine Descriptions Page Page Page Page Calling Sequence STY Init MANT1 LDYSTY HIGH-ORDERPage Page Page Page Page Page Seeeeeee MmmmmmmmFsub ORG SET Base page Adresses STA X2,X Common LOG of MANT/EXP1 Result in MANT/EXP1 Ovflw BRK Overflow 1EBB STA X2,X Load EXP/MANT2 with Z 1EBD DEX 1EBE BPL LF3 CMP YES,RETURN with MANT1 NormalizedRight Shift MANT1 or Swap with MANT2 on Carry AddendNormx BCC Norm If EXEN, Normalize PRODUCT, Else Complement Errata for Rankins Floating Point Routines LDX Load X for High Byte of ExponentLDA STA Fsub LOGFadd FmulPage Mantissa MOD 9/76 Load X for Later M2MHL Contin 1EAD LFA LDA Z,X L2E DCM RTLOG1 MdendNormx Object Code Dump Page Toutfl TapdelHsbdry Lstcom=UBRKVC OutvecUrcvec =UIRQVCTAX ADCORA Stocom STABPL HASHUS+2 Restore Except A,F CPX BEQSTX JMPOutxah PHA Exwrap RTSChksad PHP TXANibasc and #$0F Nibble in a to Ascii in a BCS INST1 RTI Ldbyte JSR Inbyte Verify MEM E1PARM JMP STD2 MORED2 LDY JSR Brtt INC Ercnt UP to FF MEM3EX CLC SBC P3L BNE Exitgk Ksconf LDA Txtmov LDA BNE INRT2 Outone Dftxfr LDX Newdev LDALDA Toutfl 8BFF 0D Msfirst Bufadh DdrdigLOADT2 STA Mode BNE Lcerr Last Char not Kgettr LDA H8DFF BCC PACKT3 DMPT1A LDA DumptDUMPT1 TXA DUMPT4 LDYOutbth LDX Register Name Patch Outcht STXHS Tape Boundary Uddra Rockwell InternationalUdrah NowlnMovad OldlenLength TMASK1 =MOVADTabuff CurposChecksum TABUF2Write Edge Detect Control not Used Because KB CRB EQSDB TO,EQS CFD2A0A0A0A0SEI Disable Interrupt RS6 JSR Crlow Clear Display E1AC Have Valid Command Nxtadd TYA Space CommFor LOAD1A LDALOADK5 LDX JMP LOADK5 Next E46A EE INC Bkflg SET FLG Outcks LDA OUTCK1 PHADumpta LDX DUMPT1 LDAE5EA TOGTA1 LDA TOGTA2 LDA BCC JD3 MSG Whereo LDY ANY Other CPYSTA Outflg Output PHA Outall PHAROL Priflg Restore FLG Wrax JSR Numa EAA3 CA DEX Memerr JSR STA STIY+2 Dehalf LDA EC5E 4A LSR Only ROW Onekey LDA Debkey LDXED3B GET a Char from Tape Subroutine Edba LSR Cpiy Make Room for MSB Outtty PHA OUTD1A CPX OUTD2A TXAOUTDD1 PHA LDA First Chip Select Prndot LDA LDA #PRTIME/256 Start T2 for 1.7 Msec BIT Imask See if DOT is SET NEW Print ROW Newcol LDACkbuff LDA Bkcksm LDAOUTTA1 PHA OUTTA2 LDXF2E1 3E7E7F3E7F7FCOL0 Zero Leftmost ColumnDB BGYU76HN MNNDX1 LSR RtmodeGetfmt TAX MNNDX2 LSRPRADR2 LDA PLAPRADR4 DEX BPL PCADJ4 AIM Text Editor LDA END+1 CMP with END AF E7 JMP KEP RUB COMMAND-FIND String JMP CHN1 See if WE RAN Past END of Buffer Limit BEQ REP2 SBC Oldlen GOGO1 RTS ROM Table FB46 8A9AAABACADAStartm JSR Rdaddr LDY Tryjmp LDA IMMED1 LDXOPCMP1 LDA Brnchc JMPConvrt LDA FORMD2 LDX Brcomp LDACompbr LDX Backwd LDA Forwrd LDAMATCH1 JMP Curead TXAPATCH4 LDX CURPO2 Dont do Anything if 8D PATC15 JSR Crlf Decode Command Bkcksm AddblkADDS1A BrcompCRA Goerr Namo E8CF NAMO1 RD2 EA5D RD1 AIM 65 Microcomputer Monitor Program Listing E6ACTable of Contents AIM 65 Microcomputer Basic Language Reference ManualIntroduction Memory SIZE? Installing Basic in the AIM ROM Installation ProcedureEntering Basic WIDTH?Basic Cursor Exiting BasicReentering Basic Printer ControlGetting Started with Basic Basic Command SET ASCCHR$ Operating on Programs and Lines Direct and Indirect Commands Direct CommandsIndirect Commands Listing a ProgramDeleting a Program Deleting a LineReplacing a Line List Printing DataPrint ONE Half Equals 1/2 Number FormatNumber Output Format Variables Assigning Variables with AN Input Statement Input RVariable Names PSTG$ Print A, A*2 LET Z=7 Print Z, Z-AReserved Words Relational Tests Program Using RelationsRemarks Input BAN Improved Square Root Program LoopingSquare Root Program Print NsqrnCOUNT-BACKWARD Program Another Square Root ProgramPrint Nsqrn Next N Some Other Looping OperationsMatrix Operations Print What is the NumberPrint I,J Next Next J Sort ProgramPrint Must be Integer Print BAD GUESS, TRY Again RestoreInput N Stopping a ProgramLEN Function Strings$=ROCKWELL R6500 Print A$ Rockwell R6500 Print LENA$,LENMICROCOMPUTERRIGHT$ Function MID$ FunctionCHR$ Function Print B$ Basic for Rockwell R6500Print C$ Basic FOR-ROCKWELL-R6500 VAL and Strs Functions Data AIM 65,DOGInput Input X$ Additional String ConsiderationsName Example PURPOSE/USE DIM Print Print X$Cntl Print Operators Symbol Sample StatementESC Print X/1.3Symbol Sample Statement PURPOSE/USE NegationRelational Operators Not If not Q3 then Operator Argument Result NotAlert CommandsPrint Intruder Alert Statement SYNTAX/FUNCTION Example ClearStatement SYNTAX/FUNCTION Load Statement SYNTAX/FUNCTION FREStatement SYNTAX/FUNCTION List Statement SYNTAX/FUNCTION NEWProgram Statements Statement SYNTAX/FUNCTION Example RUNStatement SYNTAX/FUNCTION Example Save Statement SYNTAX/FUNCTION Example DEFStatement SYNTAX/FUNCTION DIM Statement SYNTAX/FUNCTION ENDStatement SYNTAX/FUNCTION For Statement SYNTAX/FUNCTION IF...GOTO Statement SYNTAX/FUNCTION GosubStatement SYNTAX/FUNCTION Goto Statement SYNTAX/FUNCTION IF...THENStatement SYNTAX/FUNCTION Next If X0 then Print ERROR, X Negative Goto ExampleStatement SYNTAX/FUNCTION LET Statement SYNTAX/FUNCTION ON...GOSUBExample Restore Return Statement SYNTAX/FUNCTION RestoreSymbol SYNTAX/FUNCTION Wait Statement SYNTAX/FUNCTION ReturnStatement SYNTAX/FUNCTION Print Statement SYNTAX/FUNCTION InputStatement SYNTAX/FUNCTION POS Print Value ISAStatement SYNTAX/FUNCTION TAB Statement SYNTAX/FUNCTION ReadStatement SYNTAX/FUNCTION SPC String Functions Statement SYNTAX/FUNCTION ASCStatement SYNTAX/FUNCTION MID$ Statement SYNTAX/FUNCTION LEFT$Statement SYNTAX/FUNCTION LEN Statement SYNTAX/FUNCTION RIGHT$Statement SYNTAX/FUNCTION COS Arithmetic Functions Statement SYNTAX/FUNCTION ABSStatement SYNTAX/FUNCTION ATN Statement SYNTAX/FUNCTION EXPStatement SYNTAX/FUNCTION Example SIN Statement SYNTAX/FUNCTION Example SGNPrint Sgnx Print SinxError Messages ?XX ErrorInverse Hyperbolic Secant TAB, SPC Space HintsPRINTX,Y,Z Storage Allocation Information Speed HintsOLD AIM This is Probably the Most Important Speed HintConverting Basic Programs not Written for AIM 65 Basic OLDNUL Assembly Language SubroutinesAscii Character Codes Decimal SOHInputnumbern Address Content$AE PrintxRecording on Cassette Using the Basic Save Command RUN NUMBER?Storing AIM 65 Basic Programs on Cassette OUT=T F=FNAME T= Cassette Operations Using the AIM 65 EditorOUT=T F= IN=OF9C ATN ImplementationEntered by Alter Memory M 0FACWIDTH? Bytes Free AIM 65 Basic Saving ATN Object Code on Cassette
Related manuals
Manual 19 pages 1.54 Kb

II specifications

The Apple II, launched in April 1977, was one of the first highly successful mass-produced microcomputer products. It marked a significant leap in personal computing, setting standards for future developments in the industry. Created by Steve Wozniak and Steve Jobs, the Apple II differentiated itself with its user-friendly design, appealing aesthetics, and robust capabilities.

One of the standout features of the Apple II was its open architecture, which allowed users to expand and enhance the computer's functionality. This design enabled hundreds of third-party hardware and software developers to contribute to its ecosystem, resulting in an array of peripherals, including printers, modems, and storage devices. The Apple II utilized a MOS Technology 6502 microprocessor running at a clock speed of 1 MHz. Initially equipped with 4 KB of RAM, the machine could be expanded to 48 KB, accommodating more complex applications and programs.

The Apple II was also notable for its colorful graphics. It was one of the first computers to support color display, offering a 6-color palette with a resolution of 280x192 pixels in 16 colors when using its Color Graphics Card. This feature significantly enhanced the visual appeal of games and educational software developed for the platform, making computing more accessible and entertaining for various audiences.

Apple's commitment to user experience was evident in the design of the machine. It featured an integrated keyboard and a plastic case, which was both durable and visually appealing. The self-contained design included drive bays for floppy disk drives, allowing for quicker data access than traditional tape drives. It also supported audio output, enabling sound effects and music, a novelty at the time.

The introduction of the Apple DOS operating system further underscored the machine's capabilities. DOS streamlined file management and made it easier for users to navigate and manage their data. The combination of hardware and software positioned the Apple II as an educational tool and a gaming platform, fostering a vibrant software ecosystem.

The Apple II family continued to evolve, with variations like the Apple II+, IIe, and IIgs being introduced over the years. These iterations brought enhancements in memory, processing power, and graphics capabilities. The legacy of the Apple II endures, not only as a foundational product in personal computing but also as a symbol of innovation that paved the way for future advancements in technology. Its impact is still felt today, as it inspired countless developers and shaped the trajectory of the computer industry.