83Plus:BCALLs:50EC

From WikiTI
Revision as of 09:08, 9 March 2007 by Brandonw (Talk | contribs)

Jump to: navigation, search

Synopsis

Unofficial Name: RunAppLib

BCALL Address: 50EC

Minimum OS Version: 2.30

Calls a function directly, by offset, or by name within a compatible Flash application.

Inputs

  • A = 0: call routine directly
    • B: Flash page of routine
    • DE: address of routine
  • A = 1: call routine by offset
    • B: Flash page of table pointer
    • HL: address of table pointer (this is the output from FindSpecialAppHeader)
    • DE: zero-based function to call (0000h, 0001h, 0002h, etc.)
  • A = 2: call routine by name
    • B: Flash page of table pointer
    • HL: address of table pointer (this is the output from (FindSpecialAppHeader)
    • OP1: zero-terminated name of function to call. This can be the same as the application or all uppercase.

Outputs

  • None

Destroys

  • All

Comments

You must search for a Flash application using FindSpecialAppHeader with DE = 1 before BCALLing this. When an application is found, HL will be the input to this routine. B must be the base page of the application.

The format of the table data for the Flash application is below.

 DW wNumberOfEntryPoints
 DB "Call1",0,0,0 ;make sure this fills 8 bytes
 DW wCall1Address
 DB "Call2",0,0,0 ;make sure this fills 8 bytes
 DW wCall2Address
 ...
 DB "LastCall" ;make sure this fills 8 bytes
 DW wLastCallAddress

OS 2.41, at least, has inactive code which uses this and searches for "IsDevice".

Example

Call routine "IsDevice" from Flash application "MyApp":

     ld hl,sMyApp
     rst 20h
     ld de,1
     B_CALL FindSpecialAppHeader
     ret nz
     push hl
     push bc
     ld hl,sIsDevice
     rst 20h
     pop bc
     pop hl
     ld a,2
     B_CALL RunAppLib
     ret
sMyApp:
     DB AppObj,"MyApp",0
sIsDevice:
     DB "IsDevice",0