Posted By
Csabo on 2024-04-22 14:17:19
| Re: Input Filename
This is a lot easier to do from BASIC Which is why most of the old-school packers, etc. that asked for a filename also did it with simple INPUT commands.
Anyway, if you don't want to write your own custom input routine, you can use $FFCF. There are two things to take care of: 1) count the length of the input and 2) convert the screen codes. Those are still relatively simple. Here's an example:
jsr $FF4F ; clear screen and print message db $93,"ENTER FILENAME: ",0 ; this ensures fixed screen position jsr $FFCF ; input ldx #$10 ; count the length with a backwards loop loop1 dex lda $0C10,x ; fixed screen position cmp #$20 ; space? beq loop1 ; yes, keep looping back txa ; at this point, X = length-1 tay loop2 lda $0C10,y cmp #$1B ; "z" or smaller? bcs *+4 ora #$40 ; yes, convert to uppercase sta $0C10,y dey bpl loop2
After this, you will have the length-1 in X, and the filename on $0C10. In the second loop, you may copy the filename to your variable if you like. This code doesn't deal with invalid input though.
Hope it helps
|