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
21 .importzp tmp3,ptr4,sp
22 .import _strupr,subysp
27 ; we make sure that the filename doesn't contain lowercase letters
28 ; we copy the filename we got onto the stack, uppercase it and use this
29 ; one to open the iocb
30 ; we're using tmp3, ptr4
32 ; save the original pointer
36 ; now we need the length of the name
40 cmp #ATEOL ; we also accept Atari EOF char as end of string
43 bne loop ; not longer than 255 chars (127 real limit)
44 toolong:sec ; indicate error
47 str_end:iny ; room for terminating zero
48 cpy #128 ; we only can handle lenght < 128
51 jsr subysp ; make room on the stack
53 ; copy filename to the temp. place on the stack
54 lda #0 ; end-of-string
55 sta (sp),y ; Y still contains length + 1
60 bpl loop2 ; bpl: this way we only support a max. length of 127
62 ; uppercase the temp. filename
67 ; leave X and Y pointing to the modified filename
70 clc ; indicate success