Atari 800 Manuel de l'opérateur Page 78

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 92
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 77
A
=
USR(ADR(E$))
But
there is still another
possibl
hitch. Th 6502 machine
language code is not
fully relocatable;
any absolute memory references
to the
program
are certain to
fail. For
example, suppose
yoru
progran
has a
jumpto-subroutine
oSR)
insiruction
that refe$ to a subroutine within
the object code. This instruction
would rell ii rojump
Lo a specinc address. Unforruna-tely. your program
has no
way ofknowing
at
what
specific address that subrouiine is stored
and thus
will
almost ce ainly
jump
to
the
wrong
addre$. The
problm
arises from
the
fact
that BASIC might move your
object
program
almost an}'.whr in memory.
There
are sveral solutions to
this
problem.
The simplest solution is to write
fully
relocatable code; that isJ code with
no
JMP'S,
no
JSR'S
and no data tables
enclosed within it. Put all data tables
and subroutines onto
page
6. Ifyou stil
need
more space,
put
very large data
tables into the
BASIC
string and
point
to
them indirectly.
Replace long
JMP'S
with
a bucket brigade of branch
instruciions. These
techniques shodd allow
you
to
wdte large
machine
languag
programs.
Exarnple 1.
10
20
30
40
60
70
80
90
;
ROUTINE
EXCLOR
;
PERFORMS
EXCLUSIVE OR OPERATION
ON
;
TWO BYTES
PASSED THROUGH THE
STACK
;
PASSES RESUI,TS
DIRECTLY THROUGH USR FUNCTION
t
0000
00cc
00cD
00D4
00D5
0600
68
0601
68
0602
85CD
0604
68
0605
85CC
0607
68
0608 45CD
060A
85D5
o60c
68
060D 45CC
060F 85D4
0611 60
0612
Example 2,
O12O RESLTH
0130 xxcloR PLA
o140
0150
0160
o170
0180
0190
0200
o210
o220
o230
0240
0250
TXMPORARY
HOLDING LOCATION
TXMPORARY
HOI,DING LOCATION
ADDRESS FOR
PASSING RESULTS
ADDRESS FOR PASSING
HIGH RDSULT
SAVE HIGH BYTE
SAVE LOW BYTE
PERFORM HIGH
EXCLUSIVE OR
STORE RESULT
PERFORM lOW XXCLUSIVE
OR
STORE RESULT
WHAT
COULD BE SIMPLER?
TEMP]-
$0600
$cc
$CD
$D4
$D5
O1OO TEMPH
O11O RESLTL
10
20
30
40
50
60
PLA
STA TEMPH
PLA
STA TEMPL
PLA
EOR TEMPH
STA RESI-TH
PLA
EOR
TEMPL
STA RESI,TI,
RTS
.END
I
nourr^" ^otr
;
GENXRATES NOTDS
I,UTH CONTROLLABI,E
ATTACK AND DXCAY
;
TIMIS
;
CALL FROM BASIC
WITH COMMAND:
;A=USR(1536,
F, A, P, D)
Vue de la page 77
1 2 ... 73 74 75 76 77 78 79 80 81 82 83 ... 91 92

Commentaires sur ces manuels

Pas de commentaire