inform@uklirb.UUCP (03/09/87)
# This is a shell archive. # Remove everything above and including the cut line. # Then run the rest of the file through sh. #----cut here-----cut here-----cut here-----cut here----# #!/bin/sh # shar: Shell Archiver # Run the following text with /bin/sh to create: # STARTGEM.S # STARTGEM.UUE # # This archive created: Mar 8, 1987 -- 23:31:48 # By: a friendly ATARI ST hacker (using that wonderful machine :-) # echo shar: extracting STARTGEM.S sed 's/^XX//' << \SHAR_EOF > STARTGEM.S XX/ XX/ STARTGEM.S 6-MAR-1987 by GHOST-Soft XX/ XX/ This program is used to start GEM programs from within the AUTO folder. XX/ XX/ The code is probably highly nonportable, as it heavily depends on the XX/ internal organisation of code in TOS/GEM. XX/ As this program works with ROM- as well as all disk-based versions XX/ of German TOS, I'm pretty sure that this program works with foreign XX/ versions of TOS, too. XX/ All addresses given in square brackets apply to the German ROM-TOS. XX/ XX/ Assemble with Mark Williams assembler: XX/ as -o startgem.o startgem.s XX/ gemfix startgem.o startgem.prg XX/ strip startgem.prg XX/ XX XX XXlinef= 0x2c XXvbllist1= 0x4d2 XX XXgemdos= 1 XXxbios= 14 XX XX XX .shri XX XXstart: XX lea basepage(pc),a0 XX move.l 4(a7),(a0) / get basepage address XX XX pea msg(pc) XX move.w $0x9,-(a7) / print line XX trap $gemdos XX addq.w $6,a7 XX XX moveq $70,d2 / wait 1 second = 71 vblanks XX1: move.w $0x25,-(a7) / wait for vertical blank XX trap $xbios XX addq.w $2,a7 XX dbra d2,1b XX XX clr.l -(a7) XX move.w $0x20,-(a7) / enter super mode XX trap $gemdos XX addq.w $6,a7 / keep old super sp in d0 XX XX moveq $-1,d2 XX move.l d2,linef / set line-f emulator trap XX lea vblank(pc),a2 XX move.l a2,vbllist1 / set vblank vector #1 {0..7} XX XX move.l d0,-(a7) XX move.w $0x20,-(a7) / exit super mode XX trap $gemdos XX addq.w $6,a7 XX XX lea basepage(pc),a0 / compute number of bytes to keep XX suba.l basepage(pc),a0 XX clr.w -(a7) / 0 = no error XX move.l a0,-(a7) XX move.w $0x31,-(a7) / terminate and stay resident XX trap $gemdos / this call never returns XX XXvblank: XX moveq $-1,d0 XX cmp.l linef,d0 XX beq.s 1f XX clr.l vbllist1 / clear vblank vector #1 XX movea.l linef,a0 XX lea old_lf(pc),a1 XX move.l a0,(a1) / save old line-f vector (usually in low RAM) XX lea new_lf(pc),a1 XX move.l a1,linef / install new one XX XX / find the address of the buffer that GEM uses for the XX / name of the program that it is going to execute XX movea.l 0x16(a0),a0 / get start of line-f table from instruction XX / [a0 = fee8bc] move.l $0xfee8bc,a0 XX movea.l 0x7c8(a0),a0 / get address of routine 'f7c8' from table XX / [a0 = fd8fc4] XX movea.l 0xa(a0),a2 / get address from instruction XX / [a2 = 73e4] move.l $0x73e4,a5 XX adda.w 0x10(a0),a2 / add offset 0x1f56 from instruction XX / [a2 = 933a] lea 0x1f56,a0 XX lea pointer(pc),a1 XX move.l a2,(a1) / save buffer address XX1: rts XX XXnew_lf: XX movea.l 2(a7),a0 / get addr. of instr. that caused exception XX cmpi.w $0xf08c,(a0) / 'f08c' is the line-f instr. we're looking for XX bne.w exit XX move.l old_lf(pc),linef / restore old line-f vector XX XX movea.l pointer(pc),a0 XX lea filename(pc),a1 XX1: move.b (a1)+,(a0)+ / copy filename into GEM buffer space XX bne.s 1b XX XX pea dta XX move.w $0x1a,-(a7) / set DTA XX trap $gemdos XX addq.l $6,a7 XX move.w $0x27,-(a7) / don't look at volumes and directories XX pea filename(pc) XX move.w $0x4e,-(a7) / search first XX trap $gemdos XX addq.l $8,a7 XX tst d0 / status != 0 indicates error XX bne.s exit XX XX movea.l 2(a7),a0 / get addr. of instr. that caused exception XX / [a0 = fed188] XX2: cmpi.w $0xf4b8,(a0) / look for line-f instruction 'f4b8' XX beq.s doload XX addq.l $2,a0 XX cmpa.l $0xfefffe,a0 / test for ROM end XX beq.s exit XX cmpa.l $0x078000,a0 / test for RAM end (on 512K machine) XX bne.s 2b / {RAM-TOS usually loads much lower} XX XXexit: XX movea.l old_lf(pc),a0 / resume execution of regular line-f handler XX jmp (a0) XX XXdoload: XX / [a0 = fe1de2] XX move.w (a7)+,d2 / pop status word XX addq.w $4,a7 / destroy addr. of instr. 'f08c' XX move.w d2,sr / restore status register XX adda.w $56,a7 / destroy parameters of instr. 'f08c' XX jmp (a0) / jump to instruction 'f4b8' XX XX XX .prvd XX XXdta: XX .blkb 44 XXold_lf: XX .blkl 1 XXpointer: XX .blkl 1 XX XXmsg: XX .ascii "\033\105Autostart of " XXfilename: XX .ascii "MSH.PRG" XXnulls: XX .blkb 20 / these nulls allow easy patching of code file XX XX .even XXbasepage: XX .ascii "EOPA" / magic number indicates End Of Patch Area XX SHAR_EOF if test 3758 -ne "`wc -c STARTGEM.S`" then echo shar: error transmitting STARTGEM.S '(should have been 3758 characters)' fi echo shar: extracting STARTGEM.UUE sed 's/^XX//' << \SHAR_EOF > STARTGEM.UUE XXbegin 777 startgem.prg XXM8!H $( 8@ $'Z 60@KP $2'H!,C\\ E.x XXM05Q/=$8_/ E3DY43U'*__9"IS\\ "!.05Q/=/\CP@ "Q%^@ D(\H 32x XXM+P _/ @3D%<3T'Z 1R1^@$80F<O"#\\ #%.07#_L+D L9S)"N0 !-(@x XXM>0 "Q#^@#"(HA#^@ @(\D L(&@ %B!H!\@D: *U.@ $$/Z *8BBDYUx XXM(&\ @Q0\(QF !4(_H C@ "P@>@"*0_H F1#99OQ(>0 0@_/ :3D%<x XXMCS\\ "=(>@!_/SP 3DY!4(]*0&8<(&\ @Q0]+AG&%2(L?P _O_^9PBQ_ 'x XXM@ !FZ"!Z #Q.T#0?6$]&PM[\ #A.T x XXM ;14%U=&]S=&%R="!O9B!-x XXM4T@N4%)' !%3U!! N@ ' 10!"@ P x XXF" $ &( !x XX x XXend SHAR_EOF if test 652 -ne "`wc -c STARTGEM.UUE`" then echo shar: error transmitting STARTGEM.UUE '(should have been 652 characters)' fi # End of shell archive exit 0