2 ; Christian Groessler, Dec-2001
5 ; helper routine to convert a string (file name) to uppercase
6 ; used by open.s and remove.s
9 ; AX - points to filename
11 ; C - 0/1 for OK/Error (filename too long)
12 ; AX - points to uppercased version of the filename on the stack
13 ; tmp3 - amount of bytes used on the stack (needed for cleanup)
15 ; ptr4 - scratch pointer used to remember original AX pointer
25 .importzp tmp3,ptr4,sp
31 ; we make sure that the filename doesn't contain lowercase letters
32 ; we copy the filename we got onto the stack, uppercase it and use this
33 ; one to open the iocb
34 ; we're using tmp3, ptr4
36 ; save the original pointer
42 sty tmp2 ; initialize flag: device present in passed string
49 sta tmp2 ; set flag: no device in passed string
55 jsr subysp ; make room on the stack
57 ; copy filename to the temp. place on the stack, also uppercasing it
63 bmi L1 ; Not lowercase (also, invalid, should reject)
65 bcc L1 ; Not lowercase
66 and #$DF ; make upper case char, assume ASCII chars
67 sta (sp),y ; store back
70 bpl loop2 ; bpl: this way we only support a max. length of 127
73 jsr addysp ; restore the stack
81 cmp #1 ; was device present in passed string?
82 beq hasdev2 ; yes, don't prepend something
84 ldy #128+3 ; no, prepend "D:" (or other device)
85 sty tmp3 ; adjust stack size used
87 jsr subysp ; adjust stack pointer
90 sta (sp),y ; insert device name, number and ':'
96 ; leave A and X pointing to the modified filename
99 clc ; indicate success