Difference between revisions of "83Plus:OS:Dialog context"

From WikiTI
Jump to: navigation, search
 
Line 5: Line 5:
 
To start this context, load a menu structure* to ramCode/[[83Plus:RAM:8000|appData]], BCALL [[83Plus:BCALLs:4C06|DialogInit]] and then BCALL [[83Plus:BCALLs:4C03|StartDialog]].
 
To start this context, load a menu structure* to ramCode/[[83Plus:RAM:8000|appData]], BCALL [[83Plus:BCALLs:4C06|DialogInit]] and then BCALL [[83Plus:BCALLs:4C03|StartDialog]].
 
You choose whether the run indicator is displayed and whether contexts are allowed (appAllowContext,(iy+appFlags)).
 
You choose whether the run indicator is displayed and whether contexts are allowed (appAllowContext,(iy+appFlags)).
It is imperative that (cxCurApp) be one of the allowed value s (use 58h=kExtApps).
+
It is imperative that (cxCurApp) be one of the allowed values (use 58h=kExtApps).
  
 
If kSolveRoot (SOLVE EDITOR), kStatEd (list editor), or kInfStat (inferential statistic editor) are pressed, the entire screen is redrawn and then the parser callback is called with A=1.
 
If kSolveRoot (SOLVE EDITOR), kStatEd (list editor), or kInfStat (inferential statistic editor) are pressed, the entire screen is redrawn and then the parser callback is called with A=1.

Latest revision as of 20:27, 30 January 2009

This Documentation is for use with the Dialog BCALLS.

General Info

To start this context, load a menu structure* to ramCode/appData, BCALL DialogInit and then BCALL StartDialog. You choose whether the run indicator is displayed and whether contexts are allowed (appAllowContext,(iy+appFlags)). It is imperative that (cxCurApp) be one of the allowed values (use 58h=kExtApps).

If kSolveRoot (SOLVE EDITOR), kStatEd (list editor), or kInfStat (inferential statistic editor) are pressed, the entire screen is redrawn and then the parser callback is called with A=1.

If [UP], [DOWN], or [ENTER] are pressed, any entered number is parsed*.

If [2nd]+[QUIT] is pressed, whatever has been entered will be parsed* (no errors thrown nor anything displayed) to OP1, the previous context vectors are restored, SP is restored from (spSave), and the run indicator is turned off.


Parsing the number

ParseInp is called on the data entered, and OP1 is checked to make sure it is REAL (error thrown if not (and this may return to the edit)). A=0 is passed to the parser callback. B (8006h) is the index into a prompt structure (probably bID = 3). It is expected to return a value in A. Return zero to display the current line (string and number). It also copies the number in OP1 to the spot bNumIndex points to. If 0,(iy+2Eh) is set, the rest of the line is not erased (then NewLine).


Menu structure

Load as many of these structures, one after the other (zero-terminated), to ramCode/appData in the order you want it displayed. Store the length-indexed strings in RAM as well (right after this structure, in ramCode/appData).

bID can be from 1-6: bID = 1: display string (cannot select). bID = 2: display highlightable choices (as in the MODE context). A byte table at 8009h has to do with what is selected here. bID = 3: display prompt string and number. bID = 4: display highlightable string. bID = 5: display menu number (ex. "1:") and prompt string. bID = 6: hidden, skip displaying this entry.

Prompt structure when bID = 1

       DB bID             ;
       DB bNumChoices     ;probably always 1
       DB bUnknown        ;
       DW wStringOffset   ;offset from start of ramCode

Prompt structure when bID = 2

       DB bID             ;
       DB bNumChoices     ;
       DB bUnknown        ;I think this is the number of rows to skip for next item, or something
       DW wStringOffset   ;offset from start of ramCode                        /
       DB bColumn         ;column to display string (this is probably ignored) \ There are bNumChoices of these.

Prompt structure when bID = 3

       DB bID             ;
       DB bNumChoices     ;probably always 1
       DB bNumIndex       ;
       DW wStringOffset   ;offset from start of ramCode

Prompt structure when bID = 4

       DB bID             ;
       DB bNumChoices     ;probably always 1
       DB bUnknown        ;
       DW wStringOffset   ;offset from start of ramCode

Prompt structure when bID = 5

       DB bID             ;
       DB bNumEntries     ;probably always 1
       DB bMenuItemNum    ;1 for "1:", 2 for "2:", etc.
       DW wStringOffset   ;offset from start of ramCode

Prompt structure when bID = 6

       DB bID             ;
       DB bNumChoices     ;
       DB bUnknown        ;
       DW wStringOffset   ;offset from start of ramCode < There are bNumChoices of these.

8038h: bNumIndex above is an offset into a list of floating-point numbers:

       DB 00h,80h,00h,00h,00h,00h,00h,00h,00h

Examples

Example Code

hookBackup              equ     appBackUpScreen
.db 0BBh,6Dh
       ld hl,rawKeyHookPtr
       ld de,hookBackup
       ld bc,4
       ldir
       ld a,(flags+34h)
       ld (de),a
       ld a,(cxCurApp)
       push af
       ld a,58h
       ld (cxCurApp),a
       ld hl,structStart
       ld de,ramCode
       ld bc,structEnd-structStart
       ldir
       ld hl,dialogCallback
       in a,(6)
       bcall(_DialogInit)
       bcall(_runIndicOff)
       bcall(_StartDialog)
       bcall(_cursorOff)
       bcall(_clrLCDFull)
       res appCurWord,(iy+appFlags)
       bcall(_ClrTxtShd)
       ld hl,cmdShadow
       ld de,cmdShadow+1
       ld (hl),' '
       ld bc,127
       ldir
       pop af
       ld (cxCurApp),a
       ld hl,hookBackup
       ld de,rawKeyHookPtr
       ld bc,4
       ldir
       ld a,(hl)
       ld (flags+34h),a
       xor a
       bcall(_GetDialogNumOP1)
       ld hl,0
       ld (penCol),hl
       ld a,9
       bcall(_DispOP1a)
dialogCallback:
       xor a
       ret
structStart:
       ;put your dialog data here
structEnd:

Example Table

structStart:
       .db 1
       .db 1
       .db 1
       .dw sOptions-structStart
       .db 5
       .db 1
       .db 1
       .dw sItem1-structStart
       .db 5
       .db 1
       .db 2
       .dw sItem2-structStart
       .db 2
       .db 3
       .db 1
       .dw sSelect-structStart
       .dw sOpt1-structStart
       .dw sOpt2-structStart
       .db 3
       .db 1
       .db 0
       .dw sNum-structStart
       .db 4
       .db 1
       .db 1
       .dw sDone-structStart
       .db 0
sOptions:
       .db 7,"OPTIONS"
sItem1: .db 5,"Item1"
sItem2: .db 5,"Item2"
sSelect:
       .db 6,"Opts: "
sOpt1:  .db 4,"Opt1"
sOpt2:  .db 4,"Opt2"
sNum:   .db 4,"Num="
sDone:  .db 4,"Done"
structEnd:

Credits

  • Thanks to BrandonW for finding out all this info on the dialog BCALLs and for the example code, though apparently Detached Solutions knew it all along.