opt o+,a+,ow- TEXT ; ; SAMPLE.PRG - sample RAM resident program for DC DESKTOP ; ; This code is given as an example, and is therefore PUBLIC DOMAIN. ; Code used in DC DESKTOP are copyright (c) 1990 Double Click Software ; ; This is sample to code to demonstrate how to make a RAM resident program ; which can be called from DC DESKTOP. ; ; This allows programs to be installed from the AUTO folder, and stay RAM ; resident until the program is called. ; ; NOTE: GEM programs which have a resource included should fix up the ; resource _only once_ when the program is first called from DC DESKTOP ; ; GEM programs which load a resource should note that the default ; path is used, and should have a hard-coded resource path, or ; should have a way for the user to locate the resource. ; ; Self-modifying code should be careful that when the program is ; called again, it executes correctly. ; ; 1024 bytes of supervisor and user stack are given to the program ; when jsr'ed to from DC DESKTOP. If more is needed, you should ; give yourself more. ; * Macro library to call AES & VDI * Copyright (c) HiSoft 1988 * 31.5.88 fixed appl_read,appl_write,graf_slidebox * 2.6.88 fixed evnt_multi ***********AES Macros****************** * macro to call a given AES routine aes macro aes_number XREF CALL_AES,int_in,addr_in,int_out,addr_out,current_handle moveq #\1,d0 bsr CALL_AES endm * may need to change BSR CALL_AES to JSR for large programs form_alert macro button,string move.w \1,int_in move.l \2,addr_in aes 52 endm *********** END OF AES ************* sop: move.l #mystack,a7 ; we need a local stack move.l #test,-(a7) ; see if DC DESKTOP is present - execute move.w #38,-(a7) ; test function in Supervisor mode trap #$e ; Supexec - XBIOS addq.l #6,a7 ; fix stack tst.l d0 ; DC DESKTOP present? bne.s .1 ; nope lea do_it,a0 ; pointer to our routine to be called when move.l #$72000d,d0 ; numeric enter is pressed moveq #3,d1 ; with left-shift and right-shift move.w #$dc03,-(a7) ; DC DESKTOP functin to register a resident ; program and keystrokes to call it trap #9 ; DC DESKTOP trap handler addq.l #6,a7 ; fix stack tst.l d0 ; did it work? (only 26 allowed!) beq.s .0 ; yes .1: pea no_show_name ; nope, not installed text move.w #9,-(a7) ; Cconws trap #1 ; GEMDOS addq.l #6,a7 ; fix stack clr.w -(a7) ; Pterm0 - terminate program trap #1 ; do it - GEMDOS .0: pea show_name ; installed text move.w #9,-(a7) ; Cconws trap #1 ; GEMDOS addq.l #6,a7 ; fix stack clr.w -(a7) ; always zero move.l #eop,d0 ; end-of-program sub.l #sop,d0 ; minus start-of-program = total size add.l #$100,d0 ; plus basepage size move.l d0,-(a7) ; memory size to keep move.w #$31,-(a7) ; Ptermres - terminate and stay resident trap #1 ; GEMDOS test: moveq #-1,d0 ; set to fail move.l $a4.w,a0 ; trap 9 vector number cmp.w #$dc,-(a0) ; is the word before what it points to $dc? bne.s .1 ; nope - DC DESKTOP not present moveq #0,d0 ; yes - DC DESKTOP present .1: rts ; return ; ; DC DESKTOP resident program header: ; This header MUST be present and is used to validate the program ; ; program_name: ; dc.b 14 ; Name of program to run (VALID filename: GEM or TOS) ; must be 14 chars long (can be .PRG, .TTP, .TOS, .APP) ; magic_word: ; dc.w $dcdc ; magic word to verify resident program is valid ; program_name: ; our protocol needs a header dc.b 'SAMPLE.PRG',0,0,0,0 ; before the address to jump to magic_word: dc.w $dcdc do_it: ; jsr to here when lshift+rshift+ form_alert #1,#sample_alert ; numeric enter is pressed rts ; return to DC DESKTOP * AES Library Copyright (C) HiSoft 1988 * this MUST be assembled to either executable or GST linkable, NOT DRI code * sets section order to TEXT,DATA,BSS * the actual calling of the AES MODULE LowLevelAES XDEF CALL_AES,control,global,int_in,int_out XDEF addr_in,addr_out,aes_params TEXT * call an AES routine * in: d0.w=AES function number * out d0.w=int_out value * uses d0-d2/a0-a2 * (assumes control4 needs to be zero) CALL_AES lea control,a1 move.w d0,(a1)+ store the op code lea gemaes52,a0 move.w (a0)+,(a1)+ control1 move.w (a0)+,(a1)+ and control2 move.w (a0)+,(a1)+ and control3 clr.w (a1) assumes control4=0 (all except RSRC_GADDR) move.l #aes_params,d1 move.w #200,d0 function number trap #2 move.w int_out,d0 usually a returned value rts DATA * this is a table of pointers to all the AES arrays aes_params dc.l control,global,int_in,int_out,addr_in,addr_out * this is the list of Control parameters for the AES calls * contains control(1..3), comment is the function number * (an asterisk indicates it is not defined) gemaes52 dc.w 1,1,1 52 EVEN *********** END OF AES ***************** DATA show_name: dc.b 'Sample program installed!',0 no_show_name: dc.b 'Sample program not installed!',0 sample_alert: dc.b '[3][Sample][OK]',0 BSS control ds.w 4 global ds.w 14 int_in ds.w 16 int_out ds.w 7 addr_in ds.l 2 addr_out ds.l 1 ds.l $50 mystack: eop: