XBASIC manual. - Nascom homepage

Sequengial The Flte-H:nd11r{ DRIVE, ATPENDI File-|hndl1.a Flle Flle lhninE ..... po$ible c.ealed or of the Lhe rhe by to bufler dea @ve reas abcve PTF lenath ...
3MB taille 12 téléchargements 363 vues
@NTEIq'S

0. IfrnoDocrloal I. CETTIJGSIiiTED 'rrIH )GTSIC 1. airet step6 - Dlrect & Prcer@ @de 2. lilLmb.rssd Strl.As 5. Expressi@s II. TtE SYSTS|EDrloR& SlS'lEi (,ttlANtri 1. &reen cohircl Lbde3 ?. the Scrcn Edito. 3. llle Line Edito. 4. SystenO(rl,@&: M)N, I{B{, DEI-, AL'l!, I'AD, SAVEI VERIIY CLErlN,RUN, CMIN, LI,YI, 8OT,D,FfE, REJI'{ 5. ftal!1n€ ed 'sefl1-uE1.1ng' P'.oai4 III.

3 5 6 6

9 9 l0 10

t5

(,ftlalt6, STTTF]IENTS AlD FuliL'TIO'{S 1. QlrtBde/SiatdHi3 2. Dl* tlandlLha Cd@idsl DIR, ERr, REN, LOC(! !lll@(

3.

Stardafd St.l.A ADcilons nDcttds

5- &er-Deflned

IV. INPUT/OUI?UTFACILITIES 1. Devlcd dd I/O assieft.t. PnIMII, INPIN' 2. Di.eC I/O Port @4s aftetlna l/Ol 3. Speiar Cdffi& sEP, M, Ic[ r SPE D, r{lJLL, llIUfH, ZO E

6

2A

n p

. V. X&{SIC FILE HAIAGD,ENT SYSTS4 2, 3. 4. 5.

l9

1. Llst of D-ls l€$aaes 2. Errcr hedlina rtthin BAsIcl

\'t

OFFEAR,OFFEoF, ERN,ENN$,ERL 3. Frrd lhssaae Construcrlon/A(tensld

48

oN Ett colo/cosuB,oN mF colD/00s05,

VlI.

3rl l4

Flle lhninE Conve.tions The Flle lbsc.ipLo. Sequengial ed n4dm a.cese lbthods Flte-H:nd11r{ CocrErds: DRIVE,OPEIi,CBEATE, CLC$E, ATPENDI PNINT', INPLrl{' IN(XT 6. File-|hndl1.a Frmples

TCSINE-('DE I-INfuCE l. lo{ode retared corl@ds / tlncrlons: CcLL, POKE,PE€(, DOKE,DSK, PIN, Hd$ 2. Ladlra &d savlna Uc{ode Flles

T

x 1l

5o 52

vIIl.

cottrxD/FuNcftotl o(TENSIoN 1. Pea.m stor.ge 2, 3. 4. 5.

lteseNed UorC Ornstrutlo lhe Auiliary Tab]es C@nds ad nmcllons HoHto ente. exrra Resd.d

lbrn!

a. Index of ieeru€d to.& dd E.tu. l€s.aaes includitg: B. the Har.drae co.fia!.atlon, MDfnY u\P, S0!{T(]H-PID addr6ss Graphlcs, I/0 Devlce a$ignenls, rith oth ln.doarlbllitles Usetul Srbrcutines in XBlSlC Exdples of Adra 00.r@d3 ad fircti@s E . Ile3lalor for Nasc@ nc$1ed rape Aask

53 54 55 55 55

58

65 81

O. IIIIFOD{JCTIOI{ cod. rlita ln z8o hchire rhs! Adcnd.d B.!tc (llbrsrc) ls & lnie.preter Il based d €rpe.rence 1s develop€d by C.yshl ne$&ch. {htch hd lrs Nas.d lioll BISIC. Eb.tdded Xtal BASIC ad earlie. ve.slo.s of ,irh Aalned Rcsl latse. lhd borh the ea.li€. xtal BAsIc 4d llass BASIo 1s strificmtly features have bes ad exbil.a My ne{ fealues, BASIC, t{t irclud$ the ablLliv lo ao. thos Hlth s@ erpe.tence oa mchine{ode pr.a!m1nA, 6e of Ehe rcsl @tsl&d1.a rusL b. Ne.-defined create apprcpriate sub_routines ed bv l.eftr.a fearures of this BAstc. By fitinA jn 6rns e auilidy rese.ved !o.d Labte, you wlll be able Volr om derined lyp€ of BAsIc rcsL suiLed to your om to e{Dsd Lhls inLe.prete. to aive lhe needs. !e beLieve that, for the tloe bei.a a! least (ed @ have.ot hearYlof &y e,tulvale.i 1n over tm yeas)' lhis leatue is ulque to AASIC'S flu (}ysia], 4d ir Ek* iL potenlialLy o.e or |he rost pove.tul B,cslc's eve. of disc hedllna c*o{rended &cslc 13 deslaned to alro, lhe inco.podlton iap€, dd lhe flle hadung syst4 has as reIl as hedllra castie @ds, re e tfte t rc been deisned dth a vl4 io deallna rlth bolh. althola! 'casstte tape' ihrc€hout the MuaI, lt rls as ,eII Lo r@rbe. 'd1&t ad Lhar 3m forc ol tape, such a the t3trtn&| floppyr or 'fLoppy raper N theoretlcally caDable of rsdoE- acce$, dd Ey hoLd sepeate 'f1lc r.e, io all inten!3 &d purroses rhey behaveas dlsc d.1v€. }le dlrectorl$'. ir.Iude all sch devices 6der the bMd tem rdt$ d.iwst, to lhe.efoe distL.arrish fM lhe serjuentiaL{nly rcassetle Lape' drlves. NAS-E ljblld E lended SASICft availabl€ in three fo@ - tap€ cassette, prcvlsloh redia sd the of differe.ces involve only the &d CtlM, !e apprcp.late d1$ ac.$s cmds. (rA?! lLlSIoN) LOADIICD(IENDEDBASICotl NASrfl fOCSOLO4PLiIIRS XAASICdrl ru oh dy of the lb$m conpute.s, as lo.g a3 ote of the NIS-SYS to load al ls beina used, It ls suppllel on rape 1n cms fomt, @nlrors To l€d XSASIC,lype R ed then press the . If a cMd/tu.crion thls nolatlon {111 shov rhe Lype of expression :hal !s alLcce!: ro a dwber jn Lne ranse 0 to 255. d.ciml paft ol the nsb€r ,ill be

& exp.essio., p&r o.ry

chopped.ra, rhe uieee.

-65535 tc a. exp.essioni !hi.h nust elaluate ro a nuber Ln rh..aee 165535, Agat., only th€ tnLe8er oarl is actually used. In [email protected], the rarae is resrricLed to 0 to bt535, or even 0 ro 3?6? {e.e, array eldenNs), buL renLiof is Dde only {h€r lhos€ case: aFply. thi.

rust b. a bMer

dry!

ed s mY .ot b€ Aiv@ as a vriable. r.y nu@ric expressron. ky exp.ession, ,hethe. [email protected] o. st.l.g. &y s!.!na exp.esslo!, a str:.8 "\p_-..i n, ,n.!h ru31 evalute to 8tv. a (d deained in OEpNer V.2). A nft.i

vrrable,

{ vdiable n@,

,nrc-

ry

loL e

& a...y

L ch may be of n@ric

a sr.rna va.lable n@i

elffint

or s!.lna ttpe, ed

@y

,hich @y not b€ a strina dray e]@nt.

I complereXbl BASICarat@ni.

L $aDier III.{



llnd th. LE!'T! t\Dction d$c.lb.d

th!s: LEFIT(,..,

is stFh:

thls m&s that CNn$r be follored by a naber 1n ihe ra€e O to 255 foUorcd by Lhe rcrd @lp follmd by one or mrc lln. n@beB to . &ch of lhese 1!.e nMbers (if mre tha o.e) rust be *pa.ated by a c(m. e.g. ONX @10 1000,2000,3000,r11 seply d.op t. rhe next tine if X rs 0 o. Eleate. lha l, orhefrise a corc rill be €xecuted to one cf lines 1000, 2000 o. 3oo0 acco.dins !o the value of X beins 1, 2 or 3 &specgtveLy.

3 I. GET1IIE STAFTEO {ITH XBASIC NUNNIIICUP )GASIC lbvins loaded Xar,SICfM '!rar{n ' ressaae, i.e: llalcd

ydr

taDe o. d1$ , ya 3hou1d b€ re@ned dth

the

Flh&ced &1slc Fev x

rhere s.ep.ests thc $E ErcIon fo|ou. Mchlne, and yyyJ.t !h€ iEDry size avallable for slo.age o! BISIC prcare dd vdlables. !}E & pMpt rha! xBAIc pfoa.dj 5hd3 avallable &d Is hot Mnl.a a but 13 raiti.g for be rlTed In ar the keyb.a.d. vi.rually dy or rhe cmd3 or [email protected] l1sted h the tolldina chapre.s nay be ryped ln dd executed, along eiLh a .wbe. of special .oMds Lrom a Alven rn OEprer II, rSYStEt4rc@ds. For effip1e, rc @y use ihe Mchine as a calcularor:

3.rqr59 th13

i3 looh

s

ohpuie. p.1nts the resutb or ra.a€nt or l DIIEC! e&culion

nbde, since cmds

rllematlvely, clfuds ed stai@ts by typlla a ltn€ nwb€r in l.dt frUNcffid

{

tjrs

de exeut.d

the

a&-

DIREL-ny

@y be enLe.ed *lthout betna exeutedr ot 1t. a seoue.ceof oe or mre 11nes

(ee beloq). thts tu kdod pFcllFAr{ @de,

Line nwb€rs Ey.rAe betw€n 1 dd 65535, dd tuy be roltowed by one or rhch line so enre.ed 15 au!@Cicatly placed in orrer, ulth Iine I at rhe frunt. L1.e !@b€rs Dy be ssldred dbir.a.ily by Lhe uer, but iL is .e(ftnded Lha! .easo.abte aaps be leat (say, 1O) berreen I1n€, e that exrra ll.es @y be tnserred if these ar tar€. foud to be.e.ess4. In Lhe develogre.r or a prosra. lie p.oard my beah ,rLh oy Iine nnbe., but Lhe firsL liie to te lnLe.preled xill a&ays b€ rhe to'esL tine n8b.r a ]1ne my seve.al c@ds

b.

delered by entart.s Ey b€ enieed

10 PRINT2113 : lilNt

tLs nurb€r folloHed by . : ..: : EllE : ..:
b€rueenexpresi.ns Ey be as follors:

Ieaves the (tMaha.y) ; qpession will prln! direlly

prlnr,head ,ire.e 11 13, & rhat rhe n€xt ft@ the end ol the p.evious @e.

@res the {lrDginary) prinr-head tc lhe sre! ot Lh€ next Lab-B)l.i. , or lhich thee are several pcr line, .o@tlv lq colws :parr (bu| rhls qi be rDllrred ry re&s of rhe zoNEc@d, as ey ihe ir3b 11o1t,). If lhe pr1.L cotm 1s alre:dy pasr the tab ltnit, a CRLFtu prinLed befo.e the next

pri.Lins or exp.essions at spe.ifie. poinrs on ,he sreen --:;'.1,:', " " : :,i"' !iif- l,l1 :::"i.*.:::',;""l,::",;il..:il .ll; ''€' ,

"r1*"

",:'"-f:"'i;:,,'"-.---e";;":,,:i: ;fiH'"li:"f', ;l :; :i _l'":l-:, ,.,.".';6 ;,iitifl:-""r :' J.:::,.1v;, ;i::;il::i":i"!i::.""::: r:" ":i:"j":,:l"_:f;";;;;:: ;*.;l:l ff;::;"'ff"= : H,..T""';;; ' ;i;;;;

fii*'",':i;j,l'l; .:;::::"";::i"::',1; - iij,,. ei ."'" &cepL in Lhe c:se of a coordinaLe spe.iai.aLion .onia

tsy Lh€ sae ro(e., a pnIIT sratmt

by ii*lf

uitt

Jusr prirt a CiLF.

'.rTo toun.98?_

20 PRtht r2l4 ]1ELL@OODBY!

pffItT

a!

th€ end or a p,,.,r*jrmnc ...,;"4.'.,.;;

?,i'llll:"-- if f * ":,,,-,

m You98?

r2J4

l::l :;i "l:l:r!s .ff]"i,':l'ir,":"ffi"""l: !!iril'":+"q:ru""il"p:'

t,

;"j::ii:::':T:":#i";*:;r:.Ti:r"i',:: .:ffiri:.:;,l"lr;*j:lll ffr"#:i:"i;#",*H:i ::*j:":fi;:*jlili*!::T.ff";:H:"i'#r PFIUTEy bc "Dbrer-,Fd.

o ? "ren r/p-o

"n rs

a _ue

ot. progre

e"riv" * iilfff!*';;'i"i"'li"l"T.;:."ij',iliii"ll;ii,.'*"'''""t nEAD.,..DiTA..,.8ESmnEarc used lbr sr.ring ao uslnA dara ,M orcd.d do .ppose. r. o"r" -ueea uy rre -ier.

tritnl!

a

%i."ii:: ".nry""'t,:i".Jfi r:3 ff".!*i!'a;"iih"*ihii":":'*fl

;;l;i l 3"'l;li.l"X.,:,,,ii:";-',""t*,:j_11;,")"{,i^l;**' l'iL-.",

jlff :vr:iilh:::T'm;: xftlrrit$:t$#;i* :.fii:{ DlTa

spe.1f1es the 1t43

of data to t

21 ft dest.ed tlthtn a prcexe, each containinB as @y o. a3 fd itm as are co.ventenl. [email protected] @y appea. at ey poslrlon !o a prcgre ed ull be read as thoueb rhey re.e all in o.e block. DATAstar*.Ls are iAlored |hen e.cosLeed (Just rike 8EYsLatefrelLs)

durlrA the l.@lng

of a psg.a

s€prator (no@Uy t ,') my be Ddliled by re&s of lhe Qlapte. IV.l). &d it Dst b€ ren nbered Ehat lh13 c(rtlbd

Restores Lhe intemal data poi.tc. Lo stat@en! foll@1nA line . s , { a ra ( I ) , A ( I + 1) r e p r a c e sT : A ( I ): r ( I ) : a ( I + 1) : a ( I + 1) : T Hhere T i3 d extra va.tabre rhich b€ neededro hotd one of th. orhe. Eiables. !1e speed of this cl)lllgd beaores very appren! ,hen strlng sorLlna ls done, since .nly the FoINTEFS de seapped,not th€ acruat

2, DISC COlt&,llDS the follorrng 4e avaltabt. dly

1n rhe dlec reF14

Displays the dlBtory,

3lwlrA

0f )G,!sIc:

thc aUcs speclaled

by
1 0x - 5

al INPUTrType 1n expre351d.,,;a$: y:ev4l(lt) 30 PFINI 'nesuLt b: liY NW lYpe h expressidr t+x-4p(X/3)

naies e (vatue 2.21828..) to thc p.!e. oa ab.ut 3?, a ovl1-Eaftondr] .esulr (sbce Areater tn@ 1 E39r ). E@(
ICnE: If the p.1nt col@

ls past or at colm

, ro TABdU

@ca.

Rel@5 th. taaaent of rsC('rBcDrr) retuhs

the

ol trie ftBt

value 66 (d@lEl

cbl@ta

of ttE

tof 42n. th. @de ro. 'gr).

Retans Lne liiAre characte. strrng {no$ Aslfl v.l* Ii{cl$

!trl.6

I rE6 or < 1E-2, ad tElll-ra zerces 4

Fr4r3,3: PnrNT 56?.9876

PfrtNl .00124 PRTtrt-1.7a2A5 tnINT 7895 Fl'I 15,2: PRINr56?.9876

dlsprays as 56?.988 dlsplays as - 1-?32 displays as 7.895000803 displays as 5.688102

lbt. that Nhe Bi€! 1s not corted *1ih the fiAures, bur apoeds in tha Ieading space at the starL of Nh€enrle n@be. (rtEn @sitive, this s6c. my b€ rmv€d by @ds of IcM, see betd). AII In at1, allhouAh a PRJNTUSINC aacility (a .o@d fo. fomrll.A ourpu!, roud on s@ othe. BAsIcrs) is ho! p.ovided {rth xB,csrcas suppll€d, rhe FfiT comd prcvides a al€xible Fay ol iridyl.g up'ourpurj dd for puirDa such nabers lnto strings (@th1.a thar PllNT1]sl.lcca.ot do), IO' r Seis blL of ihe IciOD rc.d in tlle s€. thte c@3$ts of sixteen one-b1t f]ass, of rtrlch sEn )EASIC, the otheE betr8 reserved for nrtu.e expdslo.. it @tly, bits * se! (1), indicarl.g a mde 6, ad my eeture to r ontr, the @des for a.e d€sc.ibed as toLloBi B1i 0 - Eidlt @de. Or fo. SCREU{EDIT bde,

&rat h-bd ft E.d tt all slrteen either 0 or

off for LI'E EJLITmde.

32

Bi! 1 - Echo @de. ch f atl lnput chdacte.s ee to b€ echoed to tlre outpui l,llth thls bde oft, ll E EDIT mde t3 aut@t1@1ly devic., otheru*e otf. ihe Hhole systd tru1d seleted, lhatever the settlr€ of b1t 0 (othenise Blr 2 - sH1t.htude. Iib@uy, re sap to IINE EDITrcde rhen a proard ts RUN, ad back again io SCnEU{EDIT uhen Lhe progra od3 o. is abandoned, By settl.g lhls blt !o 0, thls ,$l!chi.g' 1s p.eve.ied, 1.e, the ed1! Dode, @ce set, vllr stay 1n that sLaLe until it i3 set to the other rcde. B1t 3 - Brear, be n oved to speclfied usL.a S|AD stat@nts). ]lne by FEYDnE sta!@.!.

ln a nAl{CE ERfron. fte Iny value for 0 ed 0 t Y delhed for X