Calling BASIC Commands from Machine Language Routines

Calling BASIC Commands from Machine Language Routines

111188 COMPUTE! OcOctober.l ober. 1981. IIssuessu e 17 Calling BASIC Commands From Machine Language Routines WiWilliamllia m TTayloray lar Leavi1tsburgLeavittsburg,, OH WhileWhile working oonn a tapetape ooperatingpe rating syssystemtem (TOS)(TC)S) LetLet's's looklook aatt BASIC'SBASI C's LOAD andand SAVE flagsflags for mmyy OSI CCUP I P aandnd a Stringy Floppy ttapea pe drive, and see howhow ththeyey aarere usedused loto ddetermineete rmine ifif BASIBASIC:C mmanyany unknown,unknown, but ddesired,esired , features were neededneeded programs araree tolo be listedlisted lOto ththee CRT or loto the tolO interfaceinte rface ROM BASIBASICC and thethe TOS. First, I CasseCassettette port and iiff the keyboardkeyboard or tthehe CassetteCassette wanted the TOS ttoo aalwayslways hhaveave cocommandmmand of ininpuputt port willwi ll hebe the ininputp ut devidevice.ce. BASIBASIC'SC's LOAD aandnd SAVESAVF routinesroutines.. Second, I wantedwa nted aalwayslways lOto returnrellirn lOto thethe TOS wwheneverhenever a BASIC'sBASIC'S Immediate Mode Commands BASIC program had been lloadedoaded into ththee BASIC BASIC cocommandsmmands are usuallyusuall y executed wwhenhen workspace.wo rkspace. ThirdThird,, I wanted lOto go dirdirectlyectl y from ththee input from tthehe kekeyboardyboard iiss eentered.ntered. For eexample,xample, TOS and RUNRUN a BASIBASICC programprogram that was in the whwhene n yyouou ttypeype RRUNUN followedfo ll owed byby a cacarriagerriage return BASICBASIC workspace. In additaddition,ion, I wishedwished to exitex it ththee ananyy BASIBASICC programprogram in the workspaworkspacece wwillill bebe exe­exe TOS lOto the ML Monitor; write a file dirdirectory;eclOry; ccuteduted or sstarttart loto run,run, sstartingtarting at the firstfirst line of ththee SlOstorere the diredirectoryclOry on tapetape;; retrieveretrieve the dirdirectory;ectory; program. NoticeNotice tthathat I sasaidid ttypeype RUN!RUN! This type and write or loadload llanguageanguage tapes into ththee CC1P I P ooff cOcommandlnmancl iiss knownknown aass aann imimmediatemediate Illmodeode COIllcom ­ using file markmarks.s. mmand.and. IfIf youyou hhadad typed a numbnumbere r beforebefore the RUNRUN SSincein ce ththee StrStringyin gy FloppFloppyy taptapee drivdriveses requirerequire cocommandmmand ththee CCMP I P wouldwould hhaveave rrespondedesponded wwithith that aallll programsprograms sstoredtored on tapetape hhaveave filefil e mmarksarks or OK. The program wouwouldld nnotot run butbut ththee llineine of numbnumbers,e rs, I neededneeded to free the C1PC I P from ROM ttextext wouwouldld havhavee been savesavedd oorr eenteredntered iintonto tthehe BASBASICIC in oorderrder loto ccreatereate filfileses oonn the ttapeape for aallll program mmemory.emory. To undunderstande rstand wwhathat happensha ppens inin programsprogra ms sstoredtored oonn the taptape.e. ThThee TOS cocoulduld be eiteitherher thethe programmingprogramming mode oorr thethe immimmediateed iate wrwrittenitte n in machinemachine langualanguage.ge. ThThee TOS wouldwou ld mmodeod e we mustmU St know howhow BASIBASK:C intinterpretse rprets ththee generate ththee file numbnumbersers underunder thethe controcontroll of the cocoded e input byby ththee operaoperator.tor. To do this lelet'st's llookook uuser,ser, but intinterfacingerfacing the TOS toto ROM BASIBASICC was ininsideside BASIBASIC:C and examine sosomeme of wwhathat hhappensappens ththee problem that I faced and pondered fforor seveseveralral during tthehe cocourseurse of ananyy typetype ooff codecode execexecution.ution. weeweeks.ks . HowHow the OSOSII ROM BASIC:BASI C aandnd thethe TOS At tthehe beginningbeginning ofs),of systemstem memorymemory iiss whatwhat werewere interfacedint e rf ~l c ed brought.brought severaseverall interestinginteresting pointpointss hahass bbecomeecome knknownown as zezeroro papage.ge. ThiThiss mmemorycmory to lilightght that cocoulduld bebe uusefulseful in otheotherr programming area coconsistsnsists of theth e first 256 llocationsocations ooff llowow me­me tatasks.sks. mory.mor),. OSI BASIBASICC uses this area of mmemoryemory as a LetLet mmee summarsummarize.ize. First,First, ccallingall ing BASIBASICC cocomm­ sscratchcratch pad. OSIOSI BASIC uusesses pagepage locationslocati ons SOO$0013l 3 mandmandss and eexecutingxecuting BASBASICIC programs ccanan be through $0$(){)■)A051\ as what iiss knknownow n as theth e BASIC:BAS IC handled frfromom machinemachine llanguageanguage routines. Also, we InInputput Also, Line Buffer.Buffer. What is ththee Input LinLinee Buffer?Buffer' mamayy LIST,LIST, SASAVE. VE, LOADLOAD,, and exexitit BASICBASIC loto our TThishi s area ooff llowow mmemoryemory is uusedseel by BABASICSIC ttoo mamachinechine lanlanguageguage routinesroutines without aanyny USRLISR flll1c­ functtemporarilye mporarily sstoretore aanyny input cocodede fromfwm the user.user. liontion cacall.ll. How ththeseese cocommandsmmands cacanll be executed TThehe code input by the user in tthehe InputInput Line BufferBufler from a mamachinechine language routineroutine willwi ll bbecomeecome clear will be examexaminedin ed byby BASIC:BASIC to ddetermineetermine what ththee with ssomeome newnew knknowledgeowledge of hhowow BASIC'SBAS IC's interinter­ code's ddestinyes tin y will be.be. WhenWhe n theth e useruser terminates a prpretereter works. Let'sLet's sstarttart with\\'ith sosomeme fafactscts about theth e lineline of code withwith a cacarriagerriagc rreturn,el.urn , ththee ddestinationes tination BASIBASICSC interprinterpretereter aandnd hhowow BASIC cocommandsmma nds aarere ooff the code inpuinputt byby theth e ooperatorpe ralO r depdependsends oonn two executed. fafactors.clo rs. First,First, ifif the code began withwith a lin linee nunumbermber OSIOSI AARDVARKAARDVARK OSIOSI NOWMEANSNOW MEANS BUSINESS! WORDWOAD PROCESSINGPROCESS ING THETHE EASYEASY WAY-WAY­ ACCOUNTS RECEIVABLE - This program ACCOUNTS RECEIVABLE - This program BOOKKEEPINGBOOKKEEPING THETHE EASYEASY WAYWAY WITHMAXI-PROSWITH MAX I·PROS willwill handlehandle upup toto 420420 openopen accounts.accounts. ItIt willwill ageage -WITH- WITH BUSINESSBUSINESS I I ThisThis isis a<I line-orientedline-oriented wordword processorprocessor dede­ accounts,accounts, printprint invoicesinvoices {including(including paymentpayment Our business package 1 is a set of programs signedsigned forfor thethe officeo ffice thatthat doesn'tdoesn't wantwant toto sendsend reminders)reminders) andand givegive accountaccount totals.tala Is. ItIt cancan addadd Our business package 1 is a set of programs designed for the small businessman who does not everyevery newnew girlgirl outout forfor trainingtraining inin howhow toto typetype aa automaticautomatic interestinterest chargescharges andand warningswarnings onon fatefate designed for the small businessman who does not have and does not need a full time accountant letter.letter. accounts,accounts, andand cancan automaticallyautomatically provideprovide andand calcal· have and does not need a full time accountant on his payroll. ItIt hashas automaticautomatic rightright andand leftleft marginmargin justijusti­ culateculate volumevolume discounts.discounts. on his payroll. This package is built around a GENERAL ficationfication andand letslets youyou varyvary thethe widthwidth andand marginsmargins 24K24K andand 0S65D05650 required,required, dualdual disksdisks recomrecom· T his package is built around a GENERAL LEDGER program which records all transactions duringduring printing.printing. ItIt hashas automaticautomatic paginationpagination andand mended. SpecifySpecify system.system. LEDGER program which records all transactions and which provides monthly, quarterly, annual, automaticautomatic pagepage numbering.numbering. ItIt willwill printprint anyany texttext AccountsAccounts Receivable.Receivable. S99.95S99.95 and which provides monthly, quarterly, annual, and year-to-date PROFIT AND LOSS statements. single,single, doubledouble or tripletriple spacedspaced andand hashas texttext cencen­ and year·to-date PROF IT AND LOSS statements. GENERAL LEDGER also provides for cash teringtering commands. ItIt willwill make anyany numbernumber ofof ••••* ■ SPECIALSPEC IAL DEAL -- NO LESS!LESS I ••••* * GENERA L LEDGER also provides for cash account balancing, provides a BALANCE SHEET multiplemultiple copiescopies oror chainchain filesfiles togethertogethe r toto print anan account balancing, provides a BALANCE SHEET AA completecomplete businessbusiness packagepackage forfor OSI051 smallsmall and has modules for DEPRECIATION and entireentire disk ofof datadata atat oneone time.time. and has modules for DEPRECIATION and systemssystems -- (C1,(C1, C2, C4 or C8).C81. Includes MAXI-MAX I­ LOAN ACCOUNT computation. MAXI-PROSMAXI·PROS hashas bothboth global andand lineline editedit LOAN ACCOUNT computation. PROS, GENERALGENERA L LEDGER,L EDGER, INVENTORY,INVENTORY, GENERAL LEDGER (and MODULES) Si29.95. capabilitycapability andand thethe polledpolled keyboardkeyboard versionsversions G ENERAL LEDGER (and MODULES) $129.95. PAYROLL ANDAND ACCOUNTSACCOUNTS RECEIVABLERECEIVABLE­- containcontain aa corrected keyboard routineroutine thatthat makemake ALLA LL THETH E PROGRAMS THETHE SMALLSMALL BUSIBUSI· PAYROLL is designed to interface with the thethe OSI keyboardkeyboard decode asas a standardstandard typetype­ PAYROLL is designed to interface with the NESS MAN NEEDS. $299.95$299.95 GENERAL LEDGER. It will handle annual writer keyboard. GENERAL LEDGER. It will handle annual records on 30 employees with as many as 6 MAXI-PROSMAX I·PROS also has sophisticatedsophisticated

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us