From 2e13faa3c291a530247f1b426f495f7991d035b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Mon, 3 Jul 2023 19:15:56 +0100 Subject: [PATCH] mescc: Fix hex2:immediate8 to work with mes/m2-compiled mes. * module/mescc/M1.scm (hex2:immediate8): Remove mesc? exception. (mesc?): Remove. --- module/mescc/M1.scm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/module/mescc/M1.scm b/module/mescc/M1.scm index 790ef881..56a79d08 100644 --- a/module/mescc/M1.scm +++ b/module/mescc/M1.scm @@ -88,16 +88,13 @@ (if hex? (string-append "%0x" (dec->hex o)) (string-append "%" (number->string o)))) -(define mesc? (string=? %compiler "mesc")) - (define (hex2:immediate8 o) - ;; FIXME: #x100000000 => 0 divide-by-zero when compiled with 64 bit mesc - (if hex? (string-append "%0x" (dec->hex (if mesc? 0 (modulo o #x100000000))) + (if hex? (string-append "%0x" (dec->hex (modulo o #x100000000)) " %0x" (if (< o 0) "-1" - (dec->hex (if mesc? o (quotient o #x100000000))))) - (string-append "%" (number->string (dec->hex (if mesc? 0 (modulo o #x100000000)))) + (dec->hex (quotient o #x100000000)))) + (string-append "%" (number->string (dec->hex (modulo o #x100000000))) " %" (if (< o 0) "-1" - (number->string (dec->hex (if mesc? o (quotient o #x100000000)))))))) + (number->string (dec->hex (quotient o #x100000000))))))) (define* (display-join o #:optional (sep "")) (let loop ((o o))