REM Battery and AC Adaptor REM *WARNING* This has not been tested on an S3; I write it down manually here REM and now. If smoke is coming out of the machine while testing this program -- REM don't panic, just put the machine in the kitchen sink or anything similar proc osdemo: global ax%, bx%, cx%, dx%, si%, di% global regs% global mbatt%, lbatt%, mains% global supply% regs%=addr(ax%) supply%=addr(mbatt%) supply: get swoff:(-1) :REM Setting swoff time to -1 means no auto swoff print "Auto switch-off disabled" get swoff:(300) :REM Restore to default value print "Auto switch-off ensabled" get endp proc supply: ax%=$1100 :REM os$get_supply is os-call $8e sub $11 bx%=supply% :REM supply struct os($8e, regs%) print "Main battery:",mbatt%;"mV" print "Lithium battery:",lbatt%;"mV" print "Mains supply:", if mains%<0 print "Unknown. SSD door open?" elseif mains%=0 print "No mains adapter present." elseif mains%=1 print "Mains adapter present." else print "Ouch! How did you get here?!?" endif endp proc swoff:(t%) ax%=$1800 :REM os$set_swoff is os-call $8b sub $18 bx%=t% :REM new swoff time os($8b, regs%) ax%=$1700 :REM os$get_swoff is os-call $8b sub $17 os($8b, regs%) print "Switch off time now is:",ax%;"s" endp