Re: A86: batt checker
[Prev][Next][Index][Thread]
Re: A86: batt checker
In a message dated 11/26/98 14:37:02 Eastern Standard Time,
croop@oregontrail.net writes:
> Does anyone have a copy? Or is it somewhere on TiCalc hiding from me
> under some name I wouldn't expect? I didn't find it the last time I
> looked.
it's sysmon.asm. it should be on ticalc.org, but it's attached anyway
#include "asm86.h"
#include "ti86asm.inc"
_alt_interrupt_exec equ 0D2FEh
.org _asm_exec_ram
ld a,$76
out (0),a
call _runindicoff
call $49DC
call _clrscrn
ld hl,$3954
ld (_penCol),hl
ld hl,category_strs
call _vputs
ld a,$6C
ld (_penCol),a
call _vputs
ld hl,$0000
ld (_curRow),hl
ld hl,title_strs
set 3,(iy+5)
call _puts
call _newline
call _puts
res 3,(iy+5)
ld hl,$0103
ld (_curRow),hl
ld hl,other_strs
call _puts
ld de,$0106
ld (_curRow),de
call _puts
call $46BB ;get free mem -> AHL
call $404C ;AHL /= 10
push hl ;save that
ld a,87
call $4048 ;AHL /= 87
srl h ;AHL /= 2
rr l
ld c,l ;B = L
ld hl,$FF8E
call show_progress_bar
ld hl,$0207
ld (_curRow),hl
pop hl
ld a,98
call $4048
xor a
call D_HL_DECI
ld a,'%'
call _putc
; ld hl,($4065) ; ROM patch, sort of.
; ld (intgetkey+1),hl ; call $4064 doesn't work in an interrupt handler (?)
ld hl,$F300
ld (hl),$F4
ld de,$F301
ld bc,256
ldir
ld hl,IntCounter ; Make HL point to the interrupt handler
ld de,$F4F4 ; And DE where to store the handler
ld bc,IntEnd-IntCounter
ldir
ld a,$F3
ld i,a
im 2
the_loop:
call get_power_level
push hl
ld a,57
call $4048
ld c,l
ld hl,$FF8B
call show_progress_bar
ld hl,$0204
ld (_curRow),hl
pop hl
ld a,33
call $4048
xor a
call D_HL_DECI
ld a,'%'
call _putc
halt
ld hl,$FC00
ld de,$F600
ld bc,$0400
ldir
wait_for_key:
ld a,%10111111
out (1),a
nop \ nop
nop \ nop
in a,(1)
bit 6,a
jr nz,the_loop
im 1
ld a,$7C
out (0),a
call _clrscrn
call _homeup
res 5,(iy)
ret
get_power_level:
halt
xor a
ld (interrupt_indicator),a
ld bc,$0000
get_level:
inc bc
ld a,(interrupt_indicator)
cp 19
jr c,get_level
ld hl,-11400
add hl,bc
ret c
ld hl,0
ret
show_progress_bar:
ld de,-16
ld b,57
ld a,%11111111
show_progress_loop:
rrca
ld (hl),a
add hl,de
dec c
jr nz,show_progress_okay
ld a,%10101010
show_progress_okay:
djnz show_progress_loop
ret
IntCounter: ; Interrupt handler which increases a timer
ex af,af'
exx
ld hl,interrupt_indicator
inc (hl)
in a,(3)
rra
ld a,9
adc a,0
out (3),a
ld a,$0B
out (3),a
exx
ex af,af'
ei
reti
IntEnd:
category_strs:
.db "BATT",0
.db "MEM",0
other_strs:
.db "Power Level",0
.db "Memory Left",0
title_strs:
.db "SystemMonitor",0
.db "by Kirk Meyer",0
interrupt_indicator:
.end