A86: Re: Power off routine


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

A86: Re: Power off routine




>Has anyone ever dissassembled the $4101 routine, the one that turns off the
>calc?  I tried to, but in the emu it looked like $4101 was right in the
>middle of an call opcode.  Does anyone know how to turn it off by hand?
>The following code should lock the calc, but doesn't:
>
>di ; F3
>call $4101 ; CD0141
>
>This would mean that the off handler enables interrupt before it turns off.
> But could you turn it off manually and disable them first?


If you want to lock the calc, do this

di
halt

This should shut off the calculator pretty quickly:

 ld      a,$00
 out     ($03),a
 ld      a,$01
 out     ($03),a

 res     shift2nd,(iy+shiftflags)
 res     onRunning,(iy+onflags)
 ei

loop:
 halt   ;minumum power loop
 jr      loop

I haven't tested it though
An ON key interrupt will get you out of that possible? loop with the halt
and jr statements. The ON key would
be sensed in the IM 1 interrupt handler that would get you out of that code
and jump to some sort of other routine,
depends on whether it was triggered by APD, [2nd][Off], or just [On]

Hmm.. there is a lot of stuff going on..

I posted the calc_off routine earlier, I guess no one was paying attention.
Well, here it is *again* ;-)

calc_off:
0c29  fdcb237e  bit     7,(iy+$23) ;call user off routine
0c2d  c4c53d    call    nz,user_off
0c30  b7        or      a
0c31  f5        push    af
0c32  21eec3    ld      hl,$c3ee ;res 2,(iy+onflags)
0c35  cb56      bit     2,(hl)  ;if it was set, call _clrScrn
0c37  cb96      res     2,(hl)
0c39  c4cb3d    call    nz,_clrScrn ;$3dcb
0c3c  f1        pop     af
0c3d  3805      jr      c,$0c44
0c3f  cdfb0d    call getRAMcksum ;getRAMcksum
0c42  1803      jr      $0c47
0c44  215aa5    ld      hl,$a55a
0c47  22d8c1    ld      (_onCheckSum),hl ;save RAM checksum
0c4a  3e01      ld      a,$01
0c4c  d303      out     ($03),a
0c4e  fdcb129e  res     shift2nd,(iy+shiftflags)
0c52  fdcb099e  res     onRunning,(iy+onflags)
0c56  08        ex      af,af'
0c57  d9        exx
0c58  fb        ei
0c59  76        halt   ;minumum power loop
0c5a  18fd      jr      $0c59

There is so much going on in the ROM it is hard to follow what is going on.
I am going to do experiments to figure out what
is going on in.. Joshua Grams knows alot, since he gave me his commented rom
listing (how nice of him), and I did
some additional disassembling from that. This ROM listing will be on Rom
Central following my next update and it will be
attached to the "security" CGI to determine if you own ROM 1.2.

Later,
    Matt






Follow-Ups: