Custom text input
From Retrosoftware
(Difference between revisions)
(→Custom Text Input - Created page) |
m (→Custom Text Input - Changed the label 'display' to 'chkLimit' as it was nonsense in this version) |
||
| Line 4: | Line 4: | ||
== The Code == | == The Code == | ||
| - | |||
| - | |||
| - | <code> | ||
10 REM Custom text input example | 10 REM Custom text input example | ||
| Line 42: | Line 39: | ||
330.chkDelete | 330.chkDelete | ||
340 CMP #127 | 340 CMP #127 | ||
| - | 350 BNE | + | 350 BNE chkLimit |
360 CPY #0 | 360 CPY #0 | ||
370 BEQ loop | 370 BEQ loop | ||
| Line 48: | Line 45: | ||
390 JSR osasci | 390 JSR osasci | ||
400 JMP loop | 400 JMP loop | ||
| - | 410. | + | 410.chkLimit |
420 CPY #255 | 420 CPY #255 | ||
430 BEQ loop | 430 BEQ loop | ||
| Line 67: | Line 64: | ||
580 CALL getText | 580 CALL getText | ||
590 =$buffer% | 590 =$buffer% | ||
| - | |||
| - | </code> | ||
Revision as of 11:17, 28 May 2008
Custom Text Input
This is a custom text input routine that I wrote since the BBC's standard INPUT command handles commas differently from what I needed.
The Code
10 REM Custom text input example 20 REM by Francis G. Loch 30 40 DIM mc% 100 50 DIM buffer% 255 60 osasci=&FFE3 70 osbyte=&FFF4 80 osrdch=&FFE0 90 FOR opt%=0 TO 2 STEP 2 100 P%=mc% 110[ OPT opt% 120.getText 130 LDA #2 140 LDX #0 150 JSR osbyte 160 LDY #0 170.loop 180 JSR osrdch 190 CMP #27 200 BNE chkReturn 210 LDA #13 220 JSR osasci 230 STA buffer% 240 LDA #126 250 JSR osbyte 260 RTS 270.chkReturn 280 CMP #13 290 BNE chkDelete 300 JSR osasci 310 STA buffer%,Y 320 RTS 330.chkDelete 340 CMP #127 350 BNE chkLimit 360 CPY #0 370 BEQ loop 380 DEY 390 JSR osasci 400 JMP loop 410.chkLimit 420 CPY #255 430 BEQ loop 440 JSR osasci 450.store 460 STA buffer%,Y 470 INY 480 JMP loop 490] 500 NEXT 510 520 PRINT "Enter text: "; 530 A$=FNgetText 540 PRINT A$ 550 END 560 570 DEF FNgetText 580 CALL getText 590 =$buffer%