Classic Computer Magazine Archive PROGRAM LISTING: 85-04/PBI.M65


	
%X; Parallel Device Handler ExampleX; By Earl RiceX; ANTIC Magazine(X;25X;(ASM,,#D:MYFILE.OBJ) because the obj code is put<%X;where there is no RAM available.FFPX;  EQUATESZ9PDVMSKG;;Parallel device mask (indicates which ared9PDIMSKI;;Parallel interrupt mask (not used in thisn-GPDVV;;Generic Parallel Device VectorxX;$HATABS;;Device handler table)CRITICB;;Critical code section flagX;3DEVNAM
T;;Device name, E.G. T for "Telephone".$HWGET;;Hardware GET register%HWPUT;;Hardware PUT register.5HWRSET;;Hardware reset (clears get register).)HWSTAT;;Hardware STATUS register.X;X; Rom vector table	;;Optional ROM checksum ;;Optional Revision number;;Mandatory ID number;;Optional Name or Type4!NONEED;;Lo-level IO vector, which we don't need"5!NONEED;;IRQ handler vector, which we don't need.,;;Mandatory ID number6DEVNAM;;Device name@1	NONEED;;Open vector, which we don't need.J2	NONEED;;CLOSE vector, which we don't need.T 	GETBYT;;GET BYTE vector.^ 	PUTBYT;;PUT BYTE vector.h"	GETSTA;;GET STATUS vector.r4	NONEED;;SPECIAL vector, which we don't need.|,!INIT;;INIT vector at power up or reset.;;NOT USED.X;X;CODE STARTS HEREX;)X;Initialize device and device handlerINIT%QPDVMSK;;Get enabled device flagsL>;;Set bit 0.PPDVMSK;;& replace.:X;Note: if device used interrupts we would set bit 0 ofX;,X;Put device name in Handler table HATABS$>X;        Top of loop
SEARCH#QHATABS9;;Get a byte from table&#FFNDIT;;0? Then we found space.02:2D2N(>$;;Length of HATABSXDSEARCH;;Still lookingb/:;;No room in HATABS; device not initializedlX;vX;         We found a spot.	FNDITQ>DEVNAM;;Get device name.#PHATABS9;;Put it in blank spot.2&Q>GPDVV;;Get lo byte of vector.'Q>GPDVV;;Get hi byte of vector.PHATABS9:X;X; GET BYTE routine.
GETBYTQ>-PCRITIC;;Enable deferred  vertical blank.%QHWGET;;Get a byte from hardware.PHWRSET;;Reset hardware.;;;Indicate we handled it. :*X;4X; PUT BYTE routine.>
PUTBYTH$>R-&CRITIC;;Enable deferred  vertical blank.\!PHWPUT;;Put byte to hardware.f;;;Indicate we handled it.p:zX;X; GET STATUS routine.
GETSTAQ>-PCRITIC;;Enable deferred  vertical blank.QHWSTAT;;Get HW status.;;;Indicate we handled it.:X;X; Do nothing routine.
NONEED;;;Indicate we handled it.:X;X;

Back to previous page