Acorn Communicator 65816 COP system calls ========================================= COP &00-&6F: One-byte COP number COP &7x,&nn: Two-byte COP number General register usage: BHA: three-byte address X: reason code Y: handle Cy: CC on exit for ok, CS on exit for failure Call Name Action Description -------------------------------------- COP &00 OPWRC OSWRCH Print character, A=char COP &01 OPWRS OSSTRING Prints inline string COP &02 OPWRA Prints string at BHA (X=0 terminate with &00, X=1 terminate with any byte<&20 ?) COP &03 OPNLI OSNEWL Print LF/CR COP &04 OPRDC OSRDCH Read input character, returns A=char COP &05 OPCLI OSCLI BXY=>command string or D,X=>command string COP &06 OPOSB OSBYTE A=action, X=param1, Y=param2 COP &07 OPOSW OSWORD A=action, BXY=>control block or D,X=>control block COP &08 superceeded, gives 'Bad COP', prossibly OSFILE COP &09 superceeded, gives 'Bad COP', prossibly OSARGS COP &0A OPBGT OSBGET Y=channel, returns A=byte, Cy=EOF COP &0B OPBPT OSBPUT Y=channel, A=byte COP &0C superceeded, gives 'Bad COP', prossibly OSGBPB COP &0D OPFND OSFIND superceeded, gives 'OPFND - fatal error' COP &0E OPCOM OSCLI Execute a command, DHA=>command string COP &0F OPERR OSFATAL Generates fatal error with inline string COP &10 OPADP Allocate Direct Page, followed by 2-byte inline size COP &11 OPADF Allocate Direct Page Fast, followed by 2-byte inline size COP &12 OPFD Free Direct Page. (Copies DP to A) COP &13 OPAST Allocate Stack, followed by 2-byte inline size COP &14 OPFST Free Stack COP &15 OPASC OSASCI Output A, translate CR to LFCR COP &16 OPAEV Acknowledge Event COP &17 OPBYX BYXD to BHA conversion, returns BHA=BYX or BD,X COP &18 OPRLH Parse Y nybbles from hex string from BHA to memory at DX COP &19 OPRLS Pares string from string as BHA (GSREAD?) COP &1A OPFZB Free Zero Bank pool COP &1B OPARM Call Arithmetic module COP &1C OPSCX Save VDU+MOS Context COP &1D OPRCX Restore VDU+MOS Context COP &1E OPSSC Save Screen COP &1F OPRSC Restore Screen COP &20 OPSEV Signal events COP &21 OPPRE Allow pre-emption COP &22 OPRLN OSRDLINE Read line from input COP &23 OPCVS Convert Stack index, return BHA=S+HA COP &24 OPCVD Convert Direct Page index, returns BHA=HA+DP COP &25 OPCRC Calculate CRC COP &26 OPBHA Gets absolute address of inline string to BHA COP &27 OPREF Refer to module COP &28 OPCMD Call a module, inline name COP &29 OPRFR Reference module, name at BHA, returns block for indirect call to module COP &2A OPURF Unreference module COP &2B OPDIS Write to status line COP &2C OPFMA Find Module Address, BHA=>address to test COP &2D OPWRM Write Module Name, sends to OSWRCH name of module at BHA COP &2E OPFPO Find Pool Owner, BHA=>address to test COP &2F OPIIQ Intercept interupt COP &30 OPRIQ Release interupt intercept COP &31 OPMIQ Modify interrupt intercept COP &32 OPSUM Calculate checksum from BHA, length Y COP &33 OPSLM Scan List of Modules, returns BHA=>next module in list COP &34 OPRMI Read Module Information, name at BHA COP &35 OPAM Add Module COP &36 OPNLU Name LookUp, scans an OSCLI-style command table COP &37 OPEOF Test for End of File COP &38 OPAH Allocate 16-bit handle, BHA=>device name COP &39 OPFH Free Handle COP &3A OPCUH Call device driver using handle COP &3B COP &3C OPDTD Device driver command table decode COP &3D OPGSR General System Read routine COP &3E OPADY Add Y to BHA, returns BHA=BHA+Y COP &3F OPATR Allocate transient COP &40 OPFTR Free transient COP &41 OPECO OSWORD &10-&12 Econet actions COP &42 OPRHL Read Hardware Links COP &43 OPXKC KBSTAT Examine keyboard buffer (nb, buffer only, not input stream) COP &44 OPOPN OSOPEN Open file or device driver, BHA=>filename, Y=action COP &45 OPCLS OSSHUT Close file or device driver, Y=handle COP &46 OPEND Read EOF COP &47 OPMM Memory management, X=reason COP &48 OPVER OSVERSION Return OS version number COP &49 OPFSC Free Screen COP &4A OPNET OSWORD &13-&14 NETFS actions COP &4B OPVH Validate Handle COP &4C OPBGB OSGBPB Read block from file COP &4D OPBPB OSGBPB Write block to file COP &4E OPLOD OSLOAD Load file COP &4F OPSAV OSSAVE Save file COP &50 OPRLE OSFILE 5 Read LOAD and EXEC addresses of object (and length?) COP &51 OPWLE OSFILE 1 Write LOAD and EXEC addresses of object COP &52 OPRAT OSFILE 5 Read attributes of object COP &53 OPWAT OSFILE 4 Write attributes of object COP &54 OPRSP OSARGS 0 Read Sequential Pointer (PTR) on channel Y to address at BHA COP &55 OPWSP OSARGS 1 Write Sequential Pointer (PTR) on channel Y from address at BHA COP &56 OPRPL OSARGS 4 Read Physical Length on channel Y to address at BHA COP &57 OPRLL OSARGS 2 Read Logical Length (EXT) on channel Y to address at BHA COP &58 OPWLL OSARGS 3 Write Logical Length (EXT) on channel Y from address at BHA COP &59 OPRCH Read catalog header COP &5A OPRFN Read object names from directory COP &5B OPDEL OSFILE 6 Delete an object COP &5C OPREN Rename an object COP &5D OPSTAR Command line interpret string at given address COP &5E OPFCX Free MOS+VDU context COP &5F OPOSX COP &60 OPDFR Defer call COP &61 OPERC Convert error number, reads a string to HA COP &70-&7F have two parameter bytes MOS 1.00 implementes &00-&61. Is bit 7 used for anything? COPs used by BASIC ------------------ &00 OSWRCH &02 OSSTRING &03 OSNEWL &04 OSRDCH &06 OSBYTE &07 OSWORD &08 &0A OSBGET &0B OSBPUT &0E OSCLI &0F Abort &11 OPADF - Allocate Direct Page &16 OPAEV - Acknowledge Event - called if OSRDCH returns an error that isn't Escape &18 OPRLH - Parse hex string &1A OPFZB - Free Zero Bank pool &21 OPPRE - Allow pre-emption &22 OPRLN - OSRDLINE, read line from input &24 OPCVD - Convert Direct Page index, returns BHA=HA+DP, prepare for filing system call &26 OPBHA - Get absolute address of inline string to BHA &28 OPCMD - Call a module, inline name &29 OPRFR - Reference a module, name at BHA &2C OPFMA - Find Module Address, BHA=>address to test &2E OPFPO - Find Pool Owner, BHA=>address to test &38 OPAH - Allocate 16-bit handle, BHA=>device name &44 OPOPN - OSOPEN, open file, BHA=>filename, Y=action &45 OPCLS - OSSHUT, close file, Y=handle &46 OPEND - Read EOF &4E OPLOD - OSLOAD, load file &4F OPSAV - OSSAVE, save file &54 OPRSP - Read PTR, Y=channel, BHA=>data &55 OPWSP - Write PTR, Y=channel, BHA=>data &57 OPRLL - Read EXT, Y=channel, BHA=>data &58 OPWLL - Write EXT, Y=channel, BHA=>data &5D OPSTAR - Command line interpret string at given address &61 OPERC - Convert error number, reads a string to HA BASIC direct page workspace --------------------------- &16/7/8 - STACK &19/A/B - HIMEM &A7/8/9 -> String buffer DP: 01 02 03 04 05 06 07 08 09 0A 0B 0C Yl Yh Xl Xi Al Ah DBR DPl DPh flags ret.lo ret.hi DP: 01 02 03 04 05 06 07 08 09 Yl Yh Xl Xi Al Ah DBR DPl DPh In BASIC: &16/7/8 - STACK &19/A/B - HIMEM &A7/8/9 -> String buffer Low memory: &00A5xx - equiv. of BBC &0002xx, vectors and OSBYTE variables &00A52A/B - INSV &00A52C/D - REMV &00A536 - OSBYTE 166 &00A58F - OSBYTE 255 etc. &00ACxx - MOS workspace &00FFxx - Entry points to MOS High memory: &45xxxx - Electron memory map &450000 - screen memory &458000 - keyboard &45FE00 - ULA Direct MOS calls ================ JSRL &00FF80-&00FFBF: Direct MOS call ------------------------------------- JSRL @FC% ; &00FF80 - FC - unsupported JSRL @LN% ; &00FF84 JSRL @ST% ; &00FF88 - STuff, X=call JSRL @MM% ; &00FF8C - Memory Management JSRL @CO% ; &00FF90 - Coroutine management JSRL @CCO% ; &00FF94 - Call a coroutine JSRL @CWT% ; &00FF98 - Suspend coroutine (WaiT) JSRL @CRS% ; &00FF9C - Resume a sibling coroutine JSRL @OSB% ; &00FFA0 - OSBYTE JSRL @OSW% ; &00FFA4 - OSWORD JSRL @VDU% ; &00FFA8 - (null) JSRL @KB% ; &00FFAC - Make direct call to Keyboard module JSRL @EV% ; &00FFB0 - Test Escape flag JSRL @LN% ; &00FF84 -------------------- JSRL @ST% ; &00FF88 - STuff, X=call ----------------------------------- &02, @STRTI% &04, @STWTI% &06, @STRSI% &08, @STWSI% &0A, @STGIT%: GSINIT, space terminated &0C, @STGLN%: GSINIT, line terminated &0E, @STGRD%: GSREAD &10, @STSEN% &12, @STREN% &14, @STSBK%: Read BRK signiture &16, @STTBK%: Read BRK message text &18, @STCSI% &1A, @STRBK% &1C, @STGAD% &1E, @STBMP% &20, @STBMB% JSRL @MM% ; &00FF8C - Memory Management ---------------------------------------- JSRL @CO% ; &00FF90 - Coroutine management ------------------------------------------- @COCRE%: Create a coroutine @COENV%: Set coroutine's environment @COREN%: Restore current coroutine's environment @CODEL%: Delete a coroutine @CODES%: Destroy a coroutine @COBRK%: Set coroutine BRK handler @COCBH%: Cancel coruotine BRK handler @COIAM%: Return handle of coroutine @COINTI%: Initialise language @COKILL%: Kill language @COHELP%: Language help JSRL @CCO% ; &00FF94 - Call a coroutine JSRL @CWT% ; &00FF98 - Suspend coroutine (WaiT) JSRL @CRS% ; &00FF9C - Resume a sibling coroutine JSRL @OSB% ; &00FFA0 - OSBYTE JSRL @OSW% ; &00FFA4 - OSWORD JSRL @VDU% ; &00FFA8 JSRL @KB% ; &00FFAC - Make direct call to Keyboard module JSRL @EV% ; &00FFB0 - Escape/Vxxxx test ---------------------------------------- On entry, A=%000000xy - x and y are set for bits of Escape Flag to test On exit, CC if the tested bit is clear CS if the tested bit is set Indirections ------------ @IVB% : IRQ/BRK @IVCOP%: COP @IVBRK%: BRK @IVABT%: ABORT @IVNMI%: NMI @IVRST%: RESET @IVIRQ%: IRQ @HDMMW% Entire machine memory map pool @HDMMM% Entire memory pool @HDMMT% Task memory @HDMMC% CMOS RAM pool @HDMMV% Video memory pool Events @EVESC% Escape event @EVPRE% Pre-emption event Drivers DVRST%: Reset device driver DVOPN%: Open device driver DVCLS%: Close device driver DVBGT%: Get a byte DVBPT%: Put a byte DVCGT%: Get a control byte DVCPT%: Put a control byte DVEOF%: Read EOF on device or file DVBGB%: get block of bytes DVBPB%: put block of bytes DVLOD%: load a file DVSAV%: save a file DVRLE%: read LOAD and EXEC addreses DVWLE%: write LOAD and EXEC addresses DVRAT%: read attributes DVWAT%: write attributes DVRSP%: Read sequential pointer DVWSP%: Write sequential pointer DVRPL%: Read physical length DVRLL%: Read logical length DVWLL%: Write logical length DVRCH%: Read catalog header DVRFN%: Read object name from directory DVDEL%: Delete an object DVREN%: Rename an object DVUNK%: Execute/transient-load an unknown command Clock: CKCMD%: Enter clock command handler CKINIT%: Initialise clock handler CKDAY%: Get day of week CKREAD%: Read date and time CKSET%: Set date and time CKPAGE%: Get clock handler's Direct Page address CKMNTH%: Get number of days in a month Econet: COP @OPECO%, X= @ECOTX%: Transmit @ECORO%: Open receive block @ECOPR%: Open remote procedure call receive block @ECOOP%: Open OS procedure call receive block @ECORP%: Poll reception @ECORR%: Read receive block @ECORD%: Delete receive block @ECOXB%: Allocate RAM for extra control blocks @ECONB%: Read number of free receive blocks COP @OPNET%, X= @NETOP%: Do a file server operation @NETXH%: Convert internal to external handle @NETRF%: Read file station number @NETWF%: Write file station number @NETRR%: Read retry settings @NETWR%: Write retry settings @NETRC%: Read context @NETWC%: Write context Printer driver @TXHLT%: select highlight mode @TXHMI%: perform microspacing @TXDMP%: perform text screen dump \ Calls a module via a vector returned by CPRFR .callmodule PEI &04 PEI &02 ; &03/4/5 pushed return address of return handler PEI &00 ; &00/1/2 pushed entry-1 of destination module RTL Five pre-empting keys: PHONE, COMP, CALC, STOP, HELP. When its keypress gets to head of keyboard buffer, pre-emption event occurs. (So, only occurs when reading from keyboard buffer? IE during INKEY or OSRDCH?) So.... is STOP key RESET or not? Notes NVMXDIZC CPU flags |||||||+-Carry ||||||+-Zero |||||+-IRQ disable ||||+-Decimal |||+-Index 0=16bit, 1=8bit ||+-Accumulator 0=16bit, 1=8bit |+-Overflow +-Negative @ERC% Error code @ERMSG% Error message MOS workspace: &9F-&A6: vector to call Econet module &A7-&AE: &AF-&B6: vector to call NET module &B7-&BE: &BF-&C6: vector to call VDU module &C7-&CE: vector to call Keyboard module