;==================================================== ; ; Api92/Api89 Example Source Code ; ; (c) NeXO Software, Ibrahim - Benoit SCHERRER ; e-mail : p.c.scherrer@wanadoo.fr ; web : http://perso.wanadoo.fr/scherrer/ben/ ; ; File> slctfil3.asm ; > This example wait that the user choose ; a TEXT file and then prints its complete ; name (it supports nested folders) ;==================================================== ;--------------------- Includes --------------------- include "tios.h" include "api92.h" include "api92cst.h" xdef _ti92plus OX equ 0 OY equ 0 ;------------ Start of assembly program ------------- xdef _main xdef _comment _main lea ieInterface(PC),a0 jsr api92::InterfaceEngine lea SelectFileHeader(PC),a0 jsr api92::SelectFileComponent cmp.w #1,d0 ;ENTER on a file ? bne.s \exit ; jsr api92::vat_FindHdlEverywhere ;look for it in the VAT tst.w d2 ;if d2=0 beq.s \exit ;handle not found => exit subq.w #1,d2 ;d2=0-based index suba.w #30,a7 ;Create a stack frame move.l a7,a0 ;addr in a0 moveq.w #25,d1 ;max chars jsr api92::nf_GetVatName tst.w d1 ;if error bne.s \skip ;skip move.l a0,sFileAddr lea ieInterface2(PC),a0 jsr api92::InterfaceEngine jsr api92::WaitKey \skip adda.w #30,a7 ;Delete stack frame \exit rts api92CB_Filter: moveq.w #1,d0 ;d0=1 : Add btst.b #7,VAT_ENTRYFLAG(a0) ;if a folder bne.s \exit ;add it move.w VAT_ENTRYHDL(a0),d0 jsr api92::DEREFd0a0 jsr api92::vat_GetFileExt cmp.w #EXT_TEXT,d2 beq.s \exit clr.w d0 ;d0=0 : Don't Add \exit rts ;------------------- Program Data ------------------- SelectFileHeader: dc.w 70+OX,50+OY ;X,Y dc.w 4 ;Nb Item per page dc.w 100 ;Width of the component dc.w 0 ;Current Folder dc.b %00011000,0 ;Flags dc.l api92CB_Filter ;api92CB_Filter dc.l 0 ;api92CB_lvKeyDown dc.l 0 ;api92CB_lvKey dc.l 0 ;api92CB_lvOnSelect dc.l 0 ;api92CB_lvDrawItem ieInterface: dc.b IE_WIN2,40+OX,30+OY,199+OX,95+OY,"Open Dialog",0 dc.b IE_SETFONT,0 dc.b IE_STRING,50+OX,43+OY,"Select a text file :",0 dc.b IE_SETFONT,1 dc.b IE_END ieInterface2: dc.b IE_WIN2,40+OX,40+OY,199+OX,80+OY,"Result:",0 dc.b IE_STRING,45+OX,55+OY,"The selected file was :",0 dc.b IE_NOP,IE_STRINGADDR,45+OX,64+OY sFileAddr dc.l 0 _comment dc.b "Select File - Ex3",0 ;-------------------- End of program ------------------ end