Parameter (W), passed to a subroutine by USR(W), will be converted to floating-point accumulator located at $A9. The floating-point accumulator has the following format:

ADDRESS

CONTENT

$A9

Exponent + $81 ($80 if mantissa = 00)

$AA-$AD

Mantissa, normalized so that Bit 7 of MSB is set.

 

$AA is MSB, $AD is LSB.

$AE

Sign of mantissa

A parameter passed to an assembly language subroutine from BASIC can be truncated by the sub- routine to a 2-byte integer and deposited in $AC (MSB) and $AD (LSB). If the parameter is greater than 32767 or less than -32768, an FC error will result. The address of the subroutine that converts a floating-point number to an integer is located in $B006, $B007.

A parameter passed to BASIC from an assembly language subroutine will be converted to floating- point. The address of the subroutine that performs this conversion is in $B008, $B009. The integer MSB ($AC) must be in the accumulator; the integer LSB ($AD) must be in the Y register.

Prior to executing USR, the starting address of the assembly language subroutine must be stored in locations $04 (LSB) and $05 (MSB). This is generally performed using the POKE command.

Note that more than one assembly language subroutine may be called from a BASIC program, by changing the starting address in $04 and $05.

Figure F-1 is the listing for a BASIC program that calls an assembly language subroutine located at $A00. Here's what the BASIC program does:

*Line 10 - Stores the starting address of the assembly language subroutine ($A00) into locations $04 and $05, using POKE.

*Line 20 - Asks for a number "N".

*Line 30 - Calls the subroutine, with N as the parameter.

*Line 40 - Upon return from the subroutine, the BASIC program prints X, the parameter passed from the subroutine to the BASIC program.

*Line 50 - Loops back to get a new N

ROCKWELL AIM 65

<5>

MEMORY SIZE? 2048

WIDTH?

1518 BYTES FREE

AIM 65 BASIC V1.1 OK

10 POKE 04,0: POKE 05 ,10

20INPUT"NUMBER";N

30X=USR(N)

40PRINTX

50GOTO 20

Figure F-1. BASIC Program That Calls Assembly Language Subroutine

The assembly language subroutine (Figure F-2) performs these operations:

*Prints the floating-point accumulator ($A9-$AE), using Monitor subroutines NUMA ($EA46), BLANK ($E83E) and CRLF ($E9F0),

*Converts the floating-point accumulator to an integer, using the subroutine at $BF00. The address $BF00 was found in locations $B006, $B007. (Address $BF00 may vary with different versions of BASIC. Be sure to check locations $B006 and $B007 for the correct address.)

*After conversion, the program again prints the floating point accumulator,

Page 253
Image 253
Apple II manual Address Content, $Ae, Inputnumbern, Printx

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.