[zxspectrum] Re: R: Re: usare le variabili intere

  • From: "BODRATO Stefano" <Stefano.Bodrato@xxxxxxxxxxxxxxxx>
  • To: <zxspectrum@xxxxxxxxxxxxx>
  • Date: Fri, 12 Mar 2004 17:28:51 +0100

>Ah, ho capito. Stavamo parlando di due livelli di astrazione diversi.
>Però aspetta: come fai ad occupare due bytes se stai passando un float?

Puntatore.


A proposito della discussione su INT e recasting.. mi sbagliavo: lo Spectrum 
trasforma il tipo !

ZX81:
-----------------------------------------------------------------------------------
int       RST   28H             ;; FP-CALC              x.    (= 3.4 or -3.4).
          DEFB  $2D             ;;duplicate             x, x.
          DEFB  $32             ;;less-0                x, (1/0)
          DEFB  $00             ;;jump-true             x, (1/0)
          DEFB  $04             ;;to L1C46, X-NEG

          DEFB  $36             ;;truncate              trunc 3.4 = 3.
          DEFB  $34             ;;end-calc              3.

          RET                   ; return with + int x on stack.



Spectrum (http://www.wearmouth.demon.co.uk/zx82.htm, poi cercate ";; truncate"):
------------------------------------------------------------------------------------

;; truncate
L3214:  LD      A,(HL)          ;
        AND     A               ;
        RET     Z               ;

        CP      $81             ;
        JR      NC,L3221        ; to T-GR-ZERO

        LD      (HL),$00        ;
        LD      A,$20           ;
        JR      L3272           ; to NIL-BYTESdirettamente!!!

; ---

;; T-GR-ZERO
L3221:  CP      $91             ;
        JR      NZ,L323F        ; to T-SMALL  >>> INTERO di 2 byte
                        ----
          >>> INTERO > 2 byte

        ...
        ...     
        .

Other related posts: