home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fujiology Archive
/
fujiology_archive_v1_0.iso
/
!FALCON
/
NOCREW
/
MP2_0997.ZIP
/
mp2_0997
/
src
/
dsp.s
< prev
next >
Wrap
Text File
|
1998-11-07
|
10KB
|
336 lines
;; dsp.s
;;
;; COPYRIGHT (c) 1998 by NoCrew Laboratories.
;;
;; Implements:
;;
;; extern Int dsp_load_program(Byte *program, Int length);
;;
;; Where length is the number of DSP words (e.i. 3 byte tuples).
;; A return value of 1 means that the loading was sucessful. 0
;; means something went wrong.
;;
;; This module will always load the DSP program. It is compatible
;; with the Dsp_ExecProg loader. However, as it reloads the DSP
;; bootstrap code every time -- which the TOS version does not --
;; this one does not freeze up.
export dsp_load_program
export dsp_send_timeout
export dsp_receive_timeout
text
dsp_load_program:
move.l a0,dsp_program
move.l d0,dsp_length
;; Test for supervisor mode.
move sr,d0
btst #13,d0
bne.s dsp_load
move.l #dsp_load,-(sp)
move.w #$26,-(sp)
trap #14
addq.w #6,sp
move.l dsp_status,d0
rts
dsp_load: bsr dsp_reset
bsr dsp_go
move.l d0,dsp_status
rts
dsp_reset: ; Power down.
move.b #$e,$ffff8800.w
move.b $ffff8800.w,d0
and.b #$ef,d0
move.b d0,$ffff8802.w
or.b #$10,d0
move.b d0,$ffff8802.w
; Wait for DSP to power down.
move.w #10000-1,d0
wait: nop
dbra d0,wait
; Power up.
move.b #$e,$ffff8800.w
move.b $ffff8800.w,d0
and.b #$ef,d0
move.b d0,$ffff8802.w
rts
dsp_go:
; Load system startup code.
lea dsp_bootstrap_code,a0
move.w #512-1,d0
next: btst.b #1,$ffffa202.w
beq.s next
move.b (a0)+,$ffffa205.w
move.b (a0)+,$ffffa206.w
move.b (a0)+,$ffffa207.w
dbra d0,next
; Load DSP binary
move.l dsp_program,a0
move.l dsp_length,d0
subq.w #1,d0
bmi.s no_way
copy: btst.b #1,$ffffa202.w
beq.s copy
move.b (a0)+,$ffffa205.w
move.b (a0)+,$ffffa206.w
move.b (a0)+,$ffffa207.w
dbra d0,copy
; Launch DSP binary
go: btst.b #1,$ffffa202.w
beq.s go
move.l #3,$ffffa204.w
moveq #1,d0
rts
no_way: moveq #0,d0
rts
;; Send a value with timeout
dsp_send_timeout:
move.l d0,dsp_value
;; Test for supervisor mode.
move sr,d0
btst #13,d0
bne.s send_timeout
move.l #send_timeout,-(sp)
move.w #$26,-(sp)
trap #14
addq.w #6,sp
move.l dsp_status,d0
rts
send_timeout:
move.l #333333-1,d0
wait_send:
btst.b #1,$ffffa202.w
bne.s ok_to_send
subq.l #1,d0
bne.s wait_send
move.l #$80000000,d0
move.l d0,dsp_status
rts
ok_to_send:
move.l dsp_value,$ffffa204.w
move.l #$1,d0
move.l d0,dsp_status
rts
;; Send a value with timeout
dsp_receive_timeout:
;; Test for supervisor mode.
move sr,d0
btst #13,d0
bne.s receive_timeout
move.l #receive_timeout,-(sp)
move.w #$26,-(sp)
trap #14
addq.w #6,sp
move.l dsp_status,d0
rts
receive_timeout:
move.l #333333-1,d0
wait_receive:
btst.b #0,$ffffa202.w
bne.s ok_to_receive
subq.l #1,d0
bne.s wait_receive
move.l #$80000000,d0
move.l d0,dsp_status
rts
ok_to_receive:
move.l $ffffa204.w,d0
btst.l #23,d0
beq.s no_ext
or.l #$ff000000,d0
no_ext:
move.l d0,dsp_status
rts
data
dsp_bootstrap_code:
dc.b $0c,$00,$40,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$60,$f4,$00,$00,$00,$4f,$61,$f4
dc.b $00,$00,$7e,$a9,$06,$2e,$80,$00,$00,$47
dc.b $07,$d8,$84,$07,$59,$84,$08,$f4,$a8,$00
dc.b $00,$04,$08,$f4,$bf,$00,$0c,$00,$00,$fe
dc.b $b8,$0a,$f0,$80,$00,$7e,$a9,$08,$f4,$a0
dc.b $00,$00,$01,$08,$f4,$be,$00,$00,$00,$0a
dc.b $a9,$80,$00,$7e,$ad,$08,$4e,$2b,$44,$f4
dc.b $00,$00,$00,$03,$44,$f4,$45,$00,$00,$01
dc.b $0e,$a0,$00,$0a,$a9,$80,$00,$7e,$b5,$08
dc.b $50,$2b,$0a,$a9,$80,$00,$7e,$b8,$08,$46
dc.b $2b,$44,$f4,$45,$00,$00,$02,$0a,$f0,$aa
dc.b $00,$7e,$c9,$20,$00,$45,$0a,$f0,$aa,$00
dc.b $7e,$d0,$06,$c6,$00,$00,$7e,$c6,$0a,$a9
dc.b $80,$00,$7e,$c4,$08,$58,$6b,$0a,$f0,$80
dc.b $00,$7e,$ad,$06,$c6,$00,$00,$7e,$cd,$0a
dc.b $a9,$80,$00,$7e,$cb,$08,$58,$ab,$0a,$f0
dc.b $80,$00,$7e,$ad,$06,$c6,$00,$00,$7e,$d4
dc.b $0a,$a9,$80,$00,$7e,$d2,$08,$58,$eb,$0a
dc.b $f0,$80,$00,$7e,$ad,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00,$00,$00,$00,$00
dc.b $00,$00,$00,$00,$00,$00
bss
dsp_program: ds.l 1
dsp_length: ds.l 1
dsp_status: ds.l 1
dsp_value: ds.l 1
end