BAS:
mode 3:PRINT"EXAMPLE OF DOS INTERRUPT PROGRAMMING VIA BASIC"
PRINT "DISPLAY ALL GIF IMAGES FROM DIRECTORY EX\IMG"
dim REG%(11):TronOn=0
flags%=0:rAX%=1:rBX%=2:rCX%=3:rDX%=4:rSI%=5:rDI%=6:rBP%=7:rES%=8:rDS%=9:'registres
iDosInt=10:iflags%=9:iAX%=8:iBX%=7:iCX%=6:iDX%=5:iSI%=4:iDI%=3:iBP%=2:iES%=1:iDS%=0:'index of registers in array REG%
?"*ASK RAM SEGMENT*"
DosInt=&67:IntFunc%=&4100:gosub DosIntCall
EmsSeg%=rBX%:'EMS SEGMENT = CPC RAM
?"*SAVE DTA OFFSET*"
DosInt=&21:IntFunc%=&2F00:gosub DosIntCall
DTASeg%=rES%:DtaBakOfs%=rBX%
?"*SET DTA OFFSET*":DtaOfs%=&4000
DosInt=&21:IntFunc%=&1A00:rDS%=EmsSeg%:rDX%=DtaOfs%:gosub DosIntCall
rDX$="EX\IMG"+chr$(0)
?"*GO REP*"rDX$
DosInt=&21:IntFunc%=&3B00:rAX%=IntFunc%:rDS%=EmsSeg%
§int,DosInt,@flags%,@rAX%,@rBX%,@rCX%,@rDX$,@rSI%,@rDI%,@rBP%,@rES%,@rDS%
gosub DosIntTRON
?"search 1st entry directory"
IntFunc%=&4E00:rCX%=0:rDX$="*.GIF"+CHR$(0)
REG%(iDosInt)=&21:REG%(iAX%)=@IntFunc%:REG%(iCX%)=@rCX%:REG%(iDX%)=@rDX$:|INT,@REG%(0)
gosub DtaIName:?FileName$;
'search next entry directory
while (flags% and 1)=0:IntFunc%=&4F00:REG%(iAX%)=@IntFunc%:|INT,@REG%(0)
if (flags% and 1)=0 then gosub DtaIName:?"-"FileName$;
wend
?

//----------------- RESTORE DTA and DIR --------------
?"*RESTORE DTA OFFSET*"
DosInt=&21:IntFunc%=&1A00:rDS%=DTASeg%:rDX%=DtaBakOfs%:gosub DosIntCall
rDX$="..\.."+chr$(0)
?"*RESTORE REP*"rDX$
IntFunc%=&3B00:REG%(iDosInt)=&21:REG%(iAX%)=@IntFunc%:REG%(iDX%)=@rDX$:REG%(iDS%)=@EmsSeg%:|INT,@REG%(0)
//--------------------------------------------

END
DtaIName:
FileName$=""
for i=0 to 12:a$=chr$(peek(DtaOfs%+&1E+i)):FileName$=FileName$+a$
if a$=chr$(0) then §input,FileName$:for tempo=0 to 2000:next:return
 next:?"error":stop
DosIntCall:
rAX%=IntFunc%
//§int,DosInt,@flags%,@rAX%,@rBX%,@rCX%,@rDX%,@rSI%,@rDI%,@rBP%,@rES%,@rDS%
REG%(10)=DosInt:REG%(9)=@flags%:REG%(8)=@rAX%:REG%(7)=@rBX%:REG%(6)=@rCX%
REG%(5)=@rDX%:REG%(4)=@rSI%:REG%(3)=@rDI%:REG%(2)=@rBP%:REG%(1)=@rES%:REG%(0)=@rDS%
|INT,@REG%(0)
DosIntTRON:
if TronOn=0 then return
?"INT="hex$(DosInt)"-"hex$(IntFunc%,4)"-FLAGS="bin$(flags%,8)
?"AX="hex$(rAX%,4)"-BX="hex$(rBX%,4)"-CX="hex$(rCX%,4)"-DX="hex$(rDX%,4)"-SI="hex$(rSI%,4)"-DI="hex$(rDI%,4)"-BP="hex$(rBP%,4)"-ES="hex$(rES%,4)"-DS="hex$(rDS%,4)
return

/*-------- OTHERS DOS INTERRUPT PROGRAMMING EXAMPLES -----
rDX$="EXAMPLE.TXT"+chr$(0)
?"*FILE OPEN*"rDX$
DosInt=&21:IntFunc%=&3D40:rAX%=IntFunc%:rDS%=EmsSeg%
§int,DosInt,@flags%,@rAX%,@rBX%,@rCX%,@rDX$,@rSI%,@rDI%,@rBP%,@rES%,@rDS%
gosub DosIntTRON
?"*FILE CLOSE*"
rBX%=rAX%:IntFunc%=&3E00:gosub DosIntCall
---------------------------------------------------------*/

