PR#3
PREFIX /A2OSX.SRC
NEW
INC 1
AUTO 6
				.LIST OFF
				.OP	65C02
				.OR	$2000
				.TF /A2OSX.DEV/BIN/DEVDUMP
*--------------------------------------
				.INB INC/MACROS.I
				.INB INC/A2OSX.I
*--------------------------------------
ZPPTR1			.EQ ZPBIN
*--------------------------------------
INPUT.BufPtr.SIZE	.EQ 16				
*--------------------------------------
*			File Header (16 Bytes)
*--------------------------------------
CS.START		cld
				jmp (.1,x)
				.DA #$61				6502,Level 1 (65c02)
				.DA #1					BIN Layout Version 1
				.DA 0
				.DA CS.END-CS.START		Code Length To Relocate
				.DA DS.END-DS.START		Data Segment to Allocate
				.DA 0
				.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1				.DA CS.INIT
				.DA CS.RUN
				.DA CS.DOEVENT
				.DA	CS.QUIT
				.DA 0
*--------------------------------------
CS.INIT			>SYSCALL SYS.GetArgC
				cmp #1
				beq .9
				
				lda #1
				>SYSCALL SYS.GetArgA
				
				>SYSCALL SYS.GetDevByNameYA
				bcs .9

				>STYA pDev
				txa
				ldy #S.PS.hINDEV
				sta (pPs),y
*				ldy #S.PS.hOUTDEV
*				sta (pPs),y
*				ldy #S.PS.hERRDEV
*				sta (pPs),y

				ldx #DEVMGR.OPEN
				jsr pDevJmp
				bcs .9
				
				lda (pPs)
				ora #S.PS.F.EVENT		Now accept events
				sta (pPs)
			
				rts
				
.9				lda #$ff
				sec
				rts
*--------------------------------------
CS.RUN			clc
				rts
.9				sec
				rts
*--------------------------------------
CS.DOEVENT		ldy #S.EVT.hDEV
				lda (pEvent),y
				ldy #S.PS.hINDEV
				cmp (pPs),y
				bne .99
				
				lda (pEvent)
				and #S.EVT.F.KEY
				beq .99
				
				ldy #S.EVT.DATAHI
				lda (pEvent),y
				bne .99
				
				ldy #S.EVT.DATALO
				lda (pEvent),y
				pha
				>SYSCALL SYS.HexOutA
				lda #'('
				>SYSCALL SYS.COutA
				pla
				cmp #$20
				bcc .1
				>SYSCALL SYS.COutA
.1				lda #')'
				>SYSCALL SYS.COutA
				clc
				rts
				
.99				sec
				rts		
*--------------------------------------
CS.QUIT			ldx #DEVMGR.CLOSE
				jsr pDevJmp
				clc
				rts
*--------------------------------------
CS.END
				.DUMMY
				.OR 0
DS.START
DS.END
				.ED
*--------------------------------------
MAN
SAVE SBIN/DEVDUMP.S
ASM
