EasyManua.ls Logo

Atari ST series - Page 257

Atari ST series
420 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Cconrs
Read String from Keyboard
Cconrs() Opcode = 10 ($0A)
T his fu n ctio n rea d s a n en tire s trin g o f c h ara cte rs from th e co n so le k e y
b o ard , e ch o in g ea ch ch a ra cte r to th e s cre en a s it is re ad . It pro v id es so m e
lin e-ed iting fu nc tio n s a s w ell. T h e fu nctio n w ill n o t re tu rn un til th e u se r
sign als th at th e en tire strin g h a s b ee n en te re d , by p re ssin g th e R etu rn k e y ,
o r b y en te rin g a strin g o f th e m a x im u m le n gth . N o te th at th e en tire p ro
g ra m (n o t ju st th is fu nctio n ) te rm in ate s if C on tro l-C is stru ck d u rin g ch a r
a cte r e n try .
C macro format
ch ar b u ffer[M A X L E N ];
in t le n gth ;
le n gth = C con rs(b u ffer);
Machine language format
m o ve .l b u ffe r, - (sp )
m o v e.w # $ 0 A , - (sp )
trap # 1
ad d q .l # 6 ,s p
Inputs
b uffer lo n g T h e a d d re ss of a bu ffer in to w h ich th e
c h a ra cters w ill be re ad . T h e first tw o
b y tes o f th is b u ffer a re res erv ed . Y o u
sh ou ld p lace th e m axim u m n u m b er of
ch a ra cte rs th a t ca n be rea d (b u ffer len g th
- 2 ) in th e first b y te . T h e fu n c tio n w ill
te rm in ate as so on as th a t m an y ch a rac te rs
h a v e b een re a d . T he le n gth of th e strin g
th at is rea d w ill be re tu rn e d in th e se co n d
b y te o f th e bu ffer.
Results
DO len g th w o rd T h e len gth o f th e strin g rea d by th e fu nction .
249