Difference between revisions of "83Plus:BCALLs:404B"

From WikiTI
Jump to: navigation, search
(Comments)
(Example)
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[Category:83Plus:BCALLs:By Name:Utility|AppInit]] [[Category:83Plus:BCALLs:By Name|AppInit]] [[Category:83Plus:BCALLs:By Address|404B - AppInit]]
+
[[Category:83Plus:BCALLs:By Name:Monitor|AppInit]] [[Category:83Plus:BCALLs:By Name:Utility|AppInit]] [[Category:83Plus:BCALLs:By Name|AppInit]] [[Category:83Plus:BCALLs:By Address|404B - AppInit]]
 
== Synopsis ==
 
== Synopsis ==
 
'''Official Name:''' AppInit
 
'''Official Name:''' AppInit
Line 11: Line 11:
  
 
=== Outputs ===
 
=== Outputs ===
* [[83Plus:RAM:858D|CxMain]] and the 6 vectors that follow
+
* [[83Plus:RAM:858D|cxMain]] and the 6 vectors that follow
* [[83Plus:RAM:8599|CxPage]] is set to the current page of the app
+
* [[83Plus:RAM:8599|cxPage]] is set to the current page of the app
* (iy+appFlags) is set to the 15th byte of the table
+
* [[83Plus:Flags:0D|(iy+appFlags)]] is set to the 15th byte of the table
  
=== Registers Destroyed ===
+
=== Destroys ===
 
* HL, A, DE
 
* HL, A, DE
  
Line 21: Line 21:
 
Typically this routine is called at the start of an application so that the application can receive events and react appropriately.  If this routine is used, it is also important to call [[83Plus:BCALLs:4C36|ReloadAppEntryVecs]] before exiting the app.  Failing to do so will likely result in a crash.
 
Typically this routine is called at the start of an application so that the application can receive events and react appropriately.  If this routine is used, it is also important to call [[83Plus:BCALLs:4C36|ReloadAppEntryVecs]] before exiting the app.  Failing to do so will likely result in a crash.
  
This copies 14 bytes from the address indicated in HL to [[83Plus:RAM:858D|CxMain]], an additional byte to (iy+appFlags), then stores the page number obtained from Port 6 into [[83Plus:RAM:8599|CxPage]].  When starting an app normally, the default is usually a dummy return.  The OS sends key presses to this routine for proper handling.
+
This copies 14 bytes from the address indicated in HL to [[83Plus:RAM:858D|cxMain]], an additional byte to [[83Plus:Flags:0D|(iy+appFlags)]], then stores the page number obtained from Port 6 into [[83Plus:RAM:8599|cxPage]].
  
 
== Example ==
 
== Example ==
Line 36: Line 36:
 
  dw cxPutAwayHandler  ;Put away, this should be used to clean up just before exiting an app.   
 
  dw cxPutAwayHandler  ;Put away, this should be used to clean up just before exiting an app.   
 
                       ;Usually in response to OFF or 2nd+quit.
 
                       ;Usually in response to OFF or 2nd+quit.
  dw cxRedispHandler  ;?
+
  dw cxRedispHandler  ;Redisplay the application's screen.
 
  dw cxErrorEPHandler  ;This can be used to process errors before error handlers set up by AppOnErr
 
  dw cxErrorEPHandler  ;This can be used to process errors before error handlers set up by AppOnErr
  dw cxSizeWindHandler ;?
+
  dw cxSizeWindHandler ;Window size change notification.  For example, rcl has been activated.
  dw 0                ;value to be copied to (iy+appFlags)
+
  db 0                ;value to be copied to (iy+appFlags)

Latest revision as of 22:08, 22 February 2006

Synopsis

Official Name: AppInit

BCALL Address: 404B

Sets the context vector table so an application can receive various notifications from the OS.

Inputs

  • HL=address of custom vector table to copy

Outputs

  • cxMain and the 6 vectors that follow
  • cxPage is set to the current page of the app
  • (iy+appFlags) is set to the 15th byte of the table

Destroys

  • HL, A, DE

Comments

Typically this routine is called at the start of an application so that the application can receive events and react appropriately. If this routine is used, it is also important to call ReloadAppEntryVecs before exiting the app. Failing to do so will likely result in a crash.

This copies 14 bytes from the address indicated in HL to cxMain, an additional byte to (iy+appFlags), then stores the page number obtained from Port 6 into cxPage.

Example

ld hl,vectorTable
B_CALL appInit
;....
vectorTable:
;NOTE: you must define the following routines yourself.  If you have no need for such routines,
;then simply point these vectors to a dummy return.
dw cxMainHandler     ;usually handles keys
dw cxPPutAwayHandler ;Partial put away, this should be used to clean when exiting edit buffers
dw cxPutAwayHandler  ;Put away, this should be used to clean up just before exiting an app.  
                     ;Usually in response to OFF or 2nd+quit.
dw cxRedispHandler   ;Redisplay the application's screen.
dw cxErrorEPHandler  ;This can be used to process errors before error handlers set up by AppOnErr
dw cxSizeWindHandler ;Window size change notification.  For example, rcl has been activated.
db 0                 ;value to be copied to (iy+appFlags)