A86: Re: Greeting Messages


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

A86: Re: Greeting Messages




You copy the code that you want to run to _alt_on_exec, similiar to
_alt_interrupt_exec.  Then you set the correct checksum and enable the flag.
After that, it will run everytime the calc is turned on.  I just wrote this
from memory, so I guessed on a couple of things.  I would guess that ROM
page D cannot be assumed to be loaded, so the handler swaps it in before
making ROM calls.  Second, I am assuming that it is good to restore the old
ROM page after changing it, so that is done as well.


#include "ti86asm.inc"

.org _asm_exec_ram

 bit alt_on,(iy+exceptionflg)       ; check if already installed
 jr z,Install
 res alt_on,(iy+exceptionflg)       ; uninstall by resetting flag
 ld hl,Uninstalled
 jp _puts
Install:
 ld hl,AltOnRoutine                 ; copy the routine
 ld de,_alt_on_exec                 ; to _alt_on_exec
 push de
 ld bc,AltOnSize
 ldir
 ld de,40                           ; bytes to checksum are
 pop hl                             ; 1, 40, 80, 120, 160 and 200
 ld a,(hl)
 dec hl
 push hl
 ld b,5
CalcChecksum:
 add hl,de
 add a,(hl)
 djnz CalcChecksum
 pop hl
 ld (hl),a                          ; write checksum to alt_on_chksum
 set alt_on,(iy+exceptionflg)       ; install by setting flag
 ld hl,Installed
 jp _puts
Installed:
 .db "Installed",0
Uninstalled:
 .db "Uninstalled",0
AltOnRoutine:
 ld hl,Message-AltOnRoutine+_alt_on_exec    ; code is at _alt_on_exec,
 in a,(5)                                   ; not asm_exec_ram
 push af                            ; make sure to save current ROM page
 ld a,$d
 out (5),a                          ; switch to ROM page D
 call _puts
 call _newline
 pop af
 out (5),a                          ; restore old ROM page
 ret
Message:
 .db "Turn me off!",0
AltOnSize = $ - AltOnRoutine


> How do you put greeting messages on the calc so that when you turn it
> on, it displays a mesage, that can be easily cleared?





References: