beautypg.com

Assembly language interface, Commands – Remote Processing RPC-150 User Manual

Page 15

background image

CHAPTER 5

DATA MEMORY

RPC-150

Page 13

50 B = PEEK(60000)

You can store and retrieve arrays, strings, and variables
in this way. There ar e many variations of PEE K and
POKE statements. A list of CAMBASIC commands
appears at the end of this chapter.

ASSEMBLY LANGUAGE INTERFACE

Use the CAMBASIC CALL statement to execute an
a s se m b ly o r C l an g ua g e p r o gr a m .

A specific area of RAM should be reserved for the
program . This is to prevent strings and variables from
corrupting that area of RAM . U se the SYS(1) and
SYS(2) statements to do this. SYS(1) returns the low
memory location while SYS(2)-500 returns the upper
location. Run the pr ogram first to ma ke sure v ariable
memory has been allocated before running these SYS
comm ands. F ailure to do so may r esult in address
returned that are not really free for assem bly language
program s.

There are sever al ways to put a program in mem ory,
depending upon your application.

1.

Use D ATA statements a nd PO KE the co de into
segment 0 RAM.

2.

W r i te a pr o g ra m to d ow n lo a d c o de . S om e
applications are connected to a larger system which
"initializes" its systems. Using INKEY $ or COM $,
code is received and then poked into memory using
POKE$.

3.

Read the code from the EPROM (U3) (using INP)
and trans fer it to RA M (using POKE ). Y ou would
have to use an external programm er to place the
code above CAMBASIC code.

I n al l c a se s , it is b es t t o l oa d co d e i nt o R A M f r om a
"secure" source. E ven though RAM is battery backed,
over time there is the possibility it could be corrupted.

Below is an exa mple of loa ding and r unning an asse mbly
l a ng u ag e pr o g ra m .

100 FOR N = &FB00 TO &FB0C
110 READ A
120 POKE N,A
130 NEXT

900 DATA &DB, 2, &47, &E6, &FE, &D3
910 DATA 2, &78, &F6, 1, &D3, 2, &C9

2000 CALL &FB00

Lines 100 to 130 load the program into RAM.

Line 2000 calls the program. It toggles J2 line 13.

COMMANDS

The following is a list of CAM BASIC commands used
w it h R A M .

Comm and

Function

CALL

Calls an assembly language routine

CLEAR

Clears strings and allocates string space

PEEK

Return s a byte

DPEEK

Returns a 16 bit value

PEEK$

Returns a string

FPEEK

Returns a floating point number

POKE

Stores a by te

DPOKE

Stores a 16 bit value

POKE$

Stores a string

FPOKE

Stores a floating point number