Re: A83: Re: Newbies :)


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

Re: A83: Re: Newbies :)




I didn't know what I was doing when I wrote PW hehe.. anyway, I think the
best way to turn off the calc is:

 ld a,1
 out (3),a
 ei
 halt
res 4,(iy+9)

Joe Wingbermuehle
http://www.usmo.com/~joewing/

----- Original Message -----
From: Evil Sam <evil_sam@hotmail.com>
To: <assembly-83@lists.ticalc.org>
Sent: Saturday, December 05, 1998 9:42 PM
Subject: Re: A83: Re: Newbies :)


>
>>Here's the bit of code from Joe's PW program that turns the calc off...
>Do
>>with it what you will, and direct questions to him... =P
>> --Jason K.
>> di ; turn off interrupts
>> ld a, $01 ;\
>> out (3), a ;  \ Tell the calculator to shut down
>> xor a ;  / at getkey
>> out (4), a ;/
>> ei ; turn the interrupts back on
>> res 4, (iy+9) ; get rid of the "on" flag to prevent errors
>> call getkey ; shut down the calculator and wait for [ON]
>>
>> ; Note By Me:  His "getkey" is the equivalent of "_getkey".
>
> "xor a / out (4),a" will screw up the calc's interrupt speed. The
>correct shutdown code is this(taken from Penguins 82/83, Bill Nagel
>can't be wrong :). The getkey part is unnecessary. If the ON flag is
>cleared, then it will wait for the ON flag to occur :)
>
>OFF:
>  RES 4, (IY $09)     ; Turn off 'ON' flag
>  DI                  ; disable interrupts
>  LD  A, 01           ; bit 3 = lcd status
>  OUT ($03), A        ; bit 0 = ON-interrupt status
>  XOR A               ; make interrupts go fast
>  OUT ($04), A
>  EI                  ; enable interrupts
>  HALT                ; wait for ON (that's the only interrupt)
>  DI
>  LD  A, $16          ; Default setting for interrupt speed
>  OUT ($04), A
>  ret
>
>
>
>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com
>