Line  

1  DEFINE PAGE00, SPACE=ROM


2  SEGMENT PAGE00


3 


4  include "includes\os2.inc"


5 


6  PUBLIC CheckLowBatteriesTurnOff,_ZERO_PORT_3,_OUT_PORT_3,PowerOff,UpdateAPD,resetAPDTimer


7  EXTERN SaveOScreen


8 


9  PowerOff:


10  ld a,8


11  call _OUT_PORT_3


12  res 4,(iy+1)


13  res 3,(iy+12h)


14  res 3,(iy+9)


15  ld a,2


16  out (10h),a


17  ld a,6


18  out (4),a


19  ld a,11h


20  out (3),a


21  ex af,af'


22  exx


23  ei


24  $$: halt


25  jr $B


26 


27  UpdateAPD:


28  ld a,(flags+apdFlags)


29  bit apdAble,a


30  ret z


31  bit apdRunning,a


32  ret z


33  ld hl,apdSubTimer


34  dec (hl)


35  ret nz


36  inc hl


37  dec (hl)


38  ret nz


39  ld a,lcdTurnOff


40  out (LCDinstPort),a


41  call SaveOScreen


42  res apdRunning,(iy+apdFlags)


43  set apdWarmStart,(iy+apdFlags)


44  jr PowerOff


45  resetAPDTimer:


46  ld hl,apdTimer


47  ld (hl),74h


48  ret


49 


50  _ZERO_PORT_3:


51  sub a


52  _OUT_PORT_3:


53  push af


54  ld a,INTERRUPT_MASK_POWER


55  out (interruptEnPort),a


56  pop af


57  out (interruptEnPort),a


58  sub a


59  out (31h),a


60  out (34h),a


61  out (37h),a


62  ret


63 


64  CheckLowBatteriesTurnOff:


65  ld a,STATE_MODE0_DEFAULT


66  out (interruptStatusPort),a


67  bit batteriesGood,(iy+interruptFlags)


68  ret nz


69  xor a


70  out (57h),a


71  out (5Bh),a


72  in a,(54h)


73  bit 1,a


74  jr nz,$F


75  ;ViewScreen attached? Maybe? Not sure.


76  ld a,2


77  out (54h),a


78  xor a


79  out (4Ch),a


80  $$: pop hl


81  pop hl


82  ld a,lcdTurnOff ;turn off the LCD


83  out (LCDinstPort),a


84  res enableHW2Timer,(iy+interruptFlags)


85  ld hl,0A55Ah ;set special checksum for power on from forced turnoff


86  ld (RAMChecksum),hl


87  ld a,INTERRUPT_MASK_ON ;this is putting the calculator in low power mode


88  out (interruptEnPort),a


89  res shift2nd,(iy+shiftFlags)


90  res onRunning,(iy+onFlags)


91  res turnOffIfLowBatteriesFound,(iy+batteryCheckFlags)


92  ld a,STATE_MODE0_DEFAULT


93  out (interruptStatusPort),a


94  xor a


95  out (memPageBPort),a


96  ei


97  $$: halt


98  jr $B


Note: See
TracBrowser
for help on using the repository browser.