(* * * PCPIStuf.inc: Routines for accessing the Apple's memory while running under * the Applicard, a Z-80 coprocessor for the Apple. * * These two routines will allow you to store and retrieve data from the * Apple's memory. They use documented BIOS entry points for communicating * with the Apple. Attempting to use these routines on any system other than * an Apple with an Applicard could cause most anything to happen; I'd rather * not think about it. * * These routines were tested on a Franklin 1000 (Apple compatible) * microcomputer with an Applicard. No problems were detected using these * two routines. * * Routines by John M. Passaniti * 388 Magee Avenue * Rochester, NY 14613 * * Please feel free to improve these routines. Notice that I didn't include * routines for multi-byte transfers between the two computers. The Applicard * does support such transfers, but I hardly ever use them, so I didn't bother * implementing them. * *) procedure PokeApple (address: integer; value: byte); { PokeApple puts 'value' into 'address'. 'address' should either be a 2's complement negative or a hex literal if the address to store is greater than 32767 (decimal). As always, care should be taken to ensure that writes in the range $C000 - $CFFF are carefully executed, as this is the area where the Apple has all its control and I/O ports. } begin inline ($0E/$07/ { LD C,POKECMD } $ED/$5B/address/ { LD DE,(address) } $CD/$FFE3/ { CALL WRBYTE } $CD/$FFE9/ { CALL WRWORD } $3A/value/ { LD A,(value) } $4F/ { LD C,A } $CD/$FFE3) { LD WRBYTE } end; function PeekApple (address: integer): byte; { PeekApple returns a byte length value that is the contents of 'address'. 'address' should either be a 2's complement negative or a hex literal if the address to read is greater than 32767 (decimal). As always, care should be taken to ensure that reads in the range $C000 - $CFFF are carefully executed, as this is the area where the Apple has all its control and I/O ports. } var returned: byte; begin inline ($0E/$06/ { LD C,PEEKCMD } $ED/$5B/address/ { LD DE,(address) } $CD/$FFE3/ { CALL WRBYTE } $CD/$FFE9/ { CALL WRWORD } $CD/$FFE0/ { CALL RDBYTE } $11/returned/ { LD DE,returned } $12); { LD (DE),A } PeekApple := returned end;