Path: news.uiowa.edu!chi-news.cic.net!news.math.psu.edu!news.cse.psu.edu!uwm.edu!lll-winken.llnl.gov!nntp.coast.net!zombie.ncsc.mil!news.mathworks.com!newsfeed.internetmci.com!xmission!news.uoregon.edu!cie-2.uoregon.edu!nparker From: nparker@cie-2.uoregon.edu (Neil Parker) Newsgroups: comp.sys.apple2.programmer Subject: Re: Input Anything routine Date: 18 May 1996 07:36:34 GMT Organization: University of Oregon Campus Information Exchange Lines: 52 Message-ID: <4njum2$kme@pith.uoregon.edu> References: <4nglek$qu@newsbf02.news.aol.com> NNTP-Posting-Host: cie-2.uoregon.edu In article <4nglek$qu@newsbf02.news.aol.com> cbrmaster@aol.com (CbrMaster) writes: >Could someone provide me with an input anything routine? The one I >currently have alwasy dumps me too the monitor on a IIgs. I need to use >that for a Applesoft Basic program I'm doing. Sure. Try this: 0300:C9 84 CMP #$84 (skip if not INPUT token) 0302:D0 1E BNE $0322 0304:20 06 E3 JSR $E306 (?ILLEGAL DIRECT ERROR if prog not running) 0307:20 B1 00 JSR $00B1 (advance to next token) 030A:20 E3 DF JSR $DFE3 (parse var name and find it in memory) 030D:20 6C DD JSR $DD6C (?TYPE MISMATCH ERROR if not string) 0310:85 85 STA $85 (save pointer to var for $DA9A) 0312:84 86 STY $86 0314:20 2C D5 JSR $D52C (read line from kbd) 0317:A0 02 LDY #$02 (point to kbd buffer) 0319:A9 00 LDA #$00 031B:AA TAX 031C:20 E9 E3 JSR $E3E9 (build string descriptor for input text) 031F:20 9A DA JSR $DA9A (save text in string area & point string var to it) 0322:60 RTS After entering it, save it like this: BSAVE INPUT.ANY,A768,L35 Here's how to use it: 10 PRINT CHR$ (4)"BLOAD INPUT.ANY" 20 POKE 1013,76: POKE 1014,0: POKE 1015,3: REM Set up & vector 30 PRINT "Type anything: ";: REM Issue a prompt 40 & INPUT A$: REM Call our input-anything routine 50 PRINT "You typed "A$".": REM Prove that it worked! If you don't have room at $300 for this routine, go ahead and BLOAD it wherever you *do* have room. It will run at any memory location without modification (but you will, of course, have to modify line 20 of the BASIC program to poke the correct BLOAD address into locations 1014 and 1015). The syntax of the input-anything command is "& INPUT A$", where A$ can be any string variable. It can't issue a prompt like the regular INPUT statement, so if you want a prompt you'll have to PRINT one separately (as in line 30 of the example). - Neil Parker -- Neil Parker | No cute quote, no cute ASCII art, no cute nparker@cie-2.uoregon.edu | disclaimer, no deposit, no return.... nparker@cie.uoregon.edu | (This space intentionally left blank: http://cie-2.uoregon.edu/~nparker | )