#864 port = b = c

closed-fixed
z80 port (188)
5
2013-05-25
2005-01-17
Anonymous
No

PSIOSetSDA(bool) in assembly:

_PSIOSetSDA_start::
_PSIOSetSDA:
push ix
ld ix,#0
add ix,sp
ld iy,#_PSIOlast
ld c,0(iy)
ld a,c
and a,#0xFE
ld c,a
or a,4(ix)
ld c,a
;clock.c:10: PSIO = PSIOlast = y;
ld 0(iy),c
; genAssign
;Z80 AOP_SFR for _PSIO banked:1 bc:1 de:0
push bc
ld bc,#_PSIO
out (c),c ;<-----------
pop bc
pop ix
ret
_PSIOSetSDA_end::

"out (C), r" is outputing wrong byte! Register c is now
part of PSIO address. It would be better without
register c...

In other words, correct assembly output should be:

...
or a,4(ix)
;clock.c:10: PSIO = PSIOlast = y;
ld 0(iy),a ;<--
; genAssign
;Z80 AOP_SFR for _PSIO banked:1 bc:1 de:0
push bc
ld bc,#_PSIO
out (c),c ;<--
...

Discussion

  • Nobody/Anonymous

    C source

     
  • Maarten Brock

    Maarten Brock - 2005-01-18
    • labels: 638148 --> z80 port
     
  • Erik Petrich

    Erik Petrich - 2005-01-26

    Logged In: YES
    user_id=635249

    Fixed in src/z80/gen.c 1.139 (sdcc version 2.4.8 #942)

    Updating the register allocation to use register A for a
    single value across multiple operations is very difficult at
    the moment. We need to get this technique working with HL
    first (the current implementation is buggy and has been
    disabled).

     
  • Erik Petrich

    Erik Petrich - 2005-01-26
    • milestone: 100454 --> fixed
    • assigned_to: nobody --> epetrich
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks