From 6339f1a5b94e291db493363d1b988e4ea3e7a4bb Mon Sep 17 00:00:00 2001 From: Jose Rodriguez Date: Fri, 27 Oct 2017 11:59:31 +0200 Subject: [PATCH] bugfix: fix read / write errors Using POKE before an ASM region in a fastcall function might overwrite the registers used as parameters. Fixed. Thanks to @emook (D. Saphier) for the report. ;) --- library/esxdos.bas | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/esxdos.bas b/library/esxdos.bas index ac792a751..609d0c393 100644 --- a/library/esxdos.bas +++ b/library/esxdos.bas @@ -135,6 +135,8 @@ Function FASTCALL ESXDosWrite(ByVal handle as Byte, _ Asm ;FASTCALL implies handle is already in A register + ld hl, EDOS_ERR_NR + ld (hl), 255 ; sets 255 = OK pop de ; ret address pop hl ; buffer address pop bc ; bc <- nbytes @@ -169,10 +171,10 @@ End Function Function FASTCALL ESXDosRead(ByVal handle as Byte, _ ByVal buffer as UInteger, _ ByVal nbytes as UInteger) as Uinteger - poke EDOS_ERR_NR,255 - Asm ;FASTCALL implies handle is already in A register + ld hl, EDOS_ERR_NR + ld (hl), 255 ; sets 255 = OK pop de ; ret address pop hl ; buffer address pop bc ; bc <- nbytes