MediaWiki:Sitenotice:
2025-12-29: I have restored the wiki to a backup from the end of November. Starting in September 2025, accesses went form the 800MB-1.2GB range per month to 26GB in September, 42GB in October, and 70GB in November with most accesses originating from China. As soon as I realized what was causing all the access problems in November, I shut it down (it had reached 36GB by then) behind a password/login screen. The database had gotten corrupted, and I tried a restore from just before the spike in access but that didn't work. Thus, end of November. I still have the other daily backups so if there were any important additions in December, let me know and maybe they can be recovered. - Allen H.

Inkey.asm Level 2: Difference between revisions

From CoCopedia - The Tandy/Radio Shack Color Computer Wiki
Jump to navigation Jump to search
Wayne (talk | contribs)
Created page with " *************** * INKEY - a subroutine for BASIC09 by Robert Doggett * Called by: RUN INKEY(StrVar) * RUN INKEY(Path, StrVar) * Inkey determines if a key has b..."
 
Polluks (talk | contribs)
Categories
 
Line 60: Line 60:
           emod
           emod
  InKeyEnd equ  *
  InKeyEnd equ  *
[[Category:Programming]]
[[Category:OS-9]]

Latest revision as of 11:38, 11 September 2015

***************
* INKEY - a subroutine for BASIC09 by Robert Doggett
* Called by: RUN INKEY(StrVar)
*            RUN INKEY(Path, StrVar)
* Inkey determines if a key has been typed on the given path
* (Standard Input if not specified), and if so, returns the next
* character in the String Variable. If no key has been type, the
* null string is returned. If a path is specified, it must be
* either type BYTE or INTEGER.
NAM INKEY
IFP1
USE      /D0/DEFS/OS9DEFS
ENDC
TYPE     set  SBRTN+OBJCT
REVS     set  REENT+1
         mod InKeyEnd,InKeyNam,TYPE,REVS,InKeyEnt,SIZE
InKeyNam fcs  "Inkey"
         org  0          Parameters
Return   rmb  2          Return addr of caller
PCount   rmb  2          Num of params following
Param1   rmb  2          1st param addr
Length1  rmb  2          size
Param2   rmb  2          2nd param addr
Length2  rmb  2          size
E$Param  equ  $38
SIZE     equ  *
InKeyEnt leax Param1,S
         ldd  PCount,S   Get parameter count
         cmpd #1         just one parameter?
         beq  InKey20    ..Yes; default path A=0
         cmpd #2         Are there two params?
         bne  ParamErr   No, abort
         ldd  [Param1,S] Get path number
         ldx  Length1,S
         leax -1,X       byte available?
         beq  InKey10    ..Yes; (A)=Path number
         leax -1,X       Integer?
         bne  ParamErr   ..No; abort
         tfr  B,A
InKey10  leax Param2,S
InKey20  ldu  2,X        length of string
         ldx  0,X        addr of string
         ldb  #$FF
         stb  0,X        Initialize to null str
         cmpu #2         at least two-byte str?
         blo  InKey30    ..No
         stb  1,X        put str terminator
InKey30  ldb  #SS.Ready
         OS9  I$GetStt   is there an data ready?
         bcs  InKey90    ..No; exit
         ldy  #1
         OS9  I$Read     Read one byte
         rts
InKey90  cmpb #E$NotRdy
         bne  InKeyErr
         rts             (carry clear)
ParamErr ldb  #E$Param   Parameter Error
InKeyErr coma
         rts
         emod
InKeyEnd equ  *