Re: A83: Ld


[Prev][Next][Index][Thread]

Re: A83: Ld




Someone correct me if I'm wrong...

If hl = 1 (%00000000 00000001) then
    h = 0  (%00000000) and l = 1 (00000001) 
    so you should try this code

    ......      ; all of the other stuff
    call cpHLone

cpHLone:        ; resets the carry flag if hl to 1
    scf         ; set carry flag
    ld a,h      ; check h to be zero
    cp 0
    ret z       ; if its not the hl can't be 1... return
    ld a,l      ; check l to be 1
    cp 1
    ret nz      ; if its not equal... return
    ccf         ; its equal!... set the carry flag
    ret         ; return

Adam
    "In an infinite universe, anything is possible" -Ford, "Hitchhiker's 
Guide"

<< I use the following code. It seems like it's working,
 but there's one thing that I'm not sure about:
 
   call _rclX
   call _convop1
   ex de,hl
   ld a,hl
 
   ...
 
   cp 1
 
 
 
 You can see that I want to compare 1 to hl.
 
 How can I do this?
 
 ld a,hl     ;does not work
 ld a,h      ;does not work
 ld a,l      ;this seems to work, but I don't think it's the right way to do
 it.
  >>