diff --git a/libsrc/atari/getdefdev.s b/libsrc/atari/getdefdev.s
--- a/libsrc/atari/getdefdev.s
+++ b/libsrc/atari/getdefdev.s
@@ -17,8 +17,8 @@
 	.include	"atari.inc"
 	.import		__dos_type
 	.export		__getdefdev		; get default device (e.g. "D1:")
+	.export		__defdev
 .ifdef	DYNAMIC_DD
-	.export		__defdev
 	.constructor	__getdefdev,24
 .endif
 
@@ -27,9 +27,13 @@
 __getdefdev:
 
 .ifdef	DEFAULT_DEVICE
+	lda	#'D'
+	sta	__defdev
 	lda	#'0'+DEFAULT_DEVICE
 	sta	__defdev+1
 .endif
+	lda	#':'
+	sta	__defdev+2
 	lda	__dos_type	; which DOS?
 	cmp	#ATARIDOS
 	beq	finish
@@ -85,6 +89,9 @@
 
 ; Default device
 
+	.bss
 __defdev:
-	.byte	"D1:", 0
-
+	.res	4
+.ifdef	UCASE_FILENAME
+	.res	128
+.endif
diff --git a/libsrc/atari/open.s b/libsrc/atari/open.s
--- a/libsrc/atari/open.s
+++ b/libsrc/atari/open.s
@@ -21,7 +21,6 @@
 	.import	__oserror
 	.importzp tmp4,tmp2
 .ifdef	UCASE_FILENAME
-	.importzp tmp3
 	.import	ucase_fn
 .endif
 
@@ -128,11 +127,6 @@
 	tya
 	pha
 
-.ifdef	UCASE_FILENAME
-	ldy	tmp3		; get size
-	jsr	addysp		; free used space on the stack
-.endif	; defined UCASE_FILENAME
-
 	jsr	incsp4		; clean up stack
 
 	pla
diff --git a/libsrc/atari/sysmkdir.s b/libsrc/atari/sysmkdir.s
--- a/libsrc/atari/sysmkdir.s
+++ b/libsrc/atari/sysmkdir.s
@@ -13,7 +13,6 @@
 	.import	findfreeiocb
 	.importzp tmp4
 .ifdef	UCASE_FILENAME
-	.importzp tmp3
 	.import	ucase_fn
 .endif
 	.export	__sysmkdir
@@ -71,15 +70,6 @@
 	sta	ICBLH,x
 	jsr	CIOV
 
-.ifdef	UCASE_FILENAME
-	tya
-	pha
-	ldy	tmp3		; get size
-	jsr	addysp		; free used space on the stack
-	pla
-	tay
-.endif	; defined UCASE_FILENAME
-
 	bmi	cioerr
 	lda	#0
 	rts
diff --git a/libsrc/atari/sysremove.s b/libsrc/atari/sysremove.s
--- a/libsrc/atari/sysremove.s
+++ b/libsrc/atari/sysremove.s
@@ -9,8 +9,6 @@
 	.import	findfreeiocb
 	.importzp tmp4
 .ifdef	UCASE_FILENAME
-	.importzp tmp3
-	.import	addysp
 	.import	ucase_fn
 .endif
 	.export	__sysremove
@@ -61,15 +59,6 @@
 	sta	ICBLH,x
 	jsr	CIOV
 
-.ifdef	UCASE_FILENAME
-	tya
-	pha
-	ldy	tmp3		; get size
-	jsr	addysp		; free used space on the stack
-	pla
-	tay
-.endif	; defined UCASE_FILENAME
-
 	bmi	cioerr
 	lda	#0
 	rts
diff --git a/libsrc/atari/ucase_fn.s b/libsrc/atari/ucase_fn.s
--- a/libsrc/atari/ucase_fn.s
+++ b/libsrc/atari/ucase_fn.s
@@ -9,8 +9,7 @@
 ;	AX   - points to filename
 ; Return parameters:
 ;	C    - 0/1 for OK/Error (filename too long)
-;	AX   - points to uppercased version of the filename on the stack
-;	tmp3 - amount of bytes used on the stack (needed for cleanup)
+;	AX   - points to uppercased version of the filename
 ; Uses:
 ;       ptr4 - scratch pointer used to remember original AX pointer
 ;
@@ -20,10 +19,9 @@
 
 .ifdef	DEFAULT_DEVICE
 	.importzp tmp2
+.endif
+	.importzp ptr4
 	.import	__defdev
-.endif
-	.importzp tmp3,ptr4,sp
-	.import	_strupr,subysp
 	.export	ucase_fn
 
 .proc   ucase_fn
@@ -31,7 +29,7 @@
 	; we make sure that the filename doesn't contain lowercase letters
 	; we copy the filename we got onto the stack, uppercase it and use this
 	; one to open the iocb
-	; we're using tmp3, ptr4
+	; we're using tmp2, ptr4
 
 	; save the original pointer
 	sta	ptr4
@@ -50,60 +48,39 @@
 hasdev:
 .endif
 
-	; now we need the length of the name
+	; copy the filename to the buffer at __defdev+3.
 	ldy	#0
 loop:	lda	(ptr4),y
+	sta	__defdev+3,y	; store in __defdev+3
 	beq	str_end
-;	cmp	#ATEOL		; we also accept Atari EOF char as end of string (not!)
-;	beq	str_end
-	iny
-	bne	loop		; not longer than 255 chars (127 real limit)
+	bmi	L1		; Not lowercase (also, invalid, should reject)
+	cmp	#'a'
+	bcc	L1		; Not lowercase
+	and	#$DF		; make upper case char, assume ASCII chars
+	sta	__defdev+3,y	; store in __defdev+3
+L1:	iny			; next char
+	bpl	loop		; we only can handle lenght < 128
 toolong:sec			; indicate error
 	rts
 
 str_end:iny			; room for terminating zero
 	bmi	toolong		; we only can handle lenght < 128
-	sty	tmp3		; save size
-	jsr	subysp		; make room on the stack
-
-	; copy filename to the temp. place on the stack
-	lda	#0		; end-of-string
-	sta	(sp),y		; Y still contains length + 1
-	dey
-loop2:	lda	(ptr4),y
-	sta	(sp),y
-	dey
-	bpl	loop2		; bpl: this way we only support a max. length of 127
 
 .ifdef	DEFAULT_DEVICE
 	lda	tmp2
 	cmp	#1		; was device present in passed string?
 	beq	hasdev2		; yes, don't prepend something
+	; leave A and X pointing to the modified filename with default drive letter
+	lda	#<__defdev
+	ldx	#>__defdev
+	clc			; indicate success
+	rts
 
-	inc	tmp3		; no, prepend "D:" (or other device)
-	inc	tmp3		; adjust stack size used
-	inc	tmp3
-	ldy	#3
-	jsr	subysp		; adjust stack pointer
-	ldy	#2
-	lda	#':'
-	sta	(sp),y		; insert ':'
-	dey
-	lda	__defdev+1
-	sta	(sp),y		; insert device number
-	dey
-	lda	__defdev
-	sta	(sp),y		; insert device name (normally 'D' or 'H')
 hasdev2:
 .endif
-	; uppercase the temp. filename
-	ldx	sp+1
-	lda	sp
-	jsr	_strupr
-
-	; leave A and X pointing to the modified filename
-	lda	sp
-	ldx	sp+1
+	; leave A and X pointing to the modified filename without default drive letter
+	lda	#<__defdev+3
+	ldx	#>__defdev+3
 	clc			; indicate success
 	rts
 
