A PIC 16C5x disassembler
It took me some time to find one, but now I have a disassembler for the PIC 16C55 that is used in this project. I first assembled the digscope.src file that Parallax made for this project. I assembled the source into digscope.obj, which I ran through the disassembler, to make digscope.asm. And it worked!
You can download the disassembler sources "16c5xdis.zip" from this site. I did not make this disassembler
myself. Timo Rossi did this fine work. I merely grabbed it off the web and I forgot from which site. But as of
now, you can get if on this site as well. Both compiled and in source format. The name of the disassembler is
'pic12dis'.
I compiled the C-source with the POWER C compiler (from
http://www.mixsoftware.com)
for DOS/Windows, so you can run it together with your older PIC tools.
The disassembled source
Below you find the disassembled source code (that can be downloaded as "digiscope.asm.gz") for the Parallax DSO. I did this, to enable non-DOS/Windows users to program their own PIC 16C55, or possibly even a PIC 16C57 (with added features), with a 'traditional' or non-Parallax assembler.
Toggle = Status.5
Bit = Status.6
Direction = Status.7
Zip = PortB.0
WE = PortB.1
CAS = PortB.2
RAS = PortB.3
Tr = PortB.4
Record = PortB.5
Left = PortB.6
Right = portB.7
RTCC = 1
Status = 3
BankSelect = 4
PortA = 5
PortB = 6
PortC = 7
Buffer = 08..15
AddressLow = 16
AddressHigh = 17
channel = 18
trace = 19
level = 20
temp = 21
ClearToEnd: clrf PortA, f
movlw 0000
tris PortA
movlw 00100110b
bcf Status, Bit
goto WriteEntry
HandleRecord: call ClearAddress
bcf Status, Bit
Debounce: movlw 100
movwf temp
Wait1: btfss PortB, Left
bcf Status, Direction
btfss PortB, Right
bsf Status, Direction
btfsc PortB, Left
btfss PortB, Right
bsf Status, Bit
btfss PortB, Record
goto Debounce
decfsz temp, f
goto Wait1
movlw 0010.1000b
btfsc Status, Direction
movlw 0011.1000b
option
movlw RegularLoop
btfsc PortB, Left
btfss PortB, Right
movlw TriggerLoop
WriteEntry: movwf temp
bcf PortB, WE
btfss Status, Bit
goto RegularLoop
TriggerLoop: clrf RTCC, f
TriggerWait: btfss PortB, Record
goto ClearToEnd
btfss RTCC, 0
goto TriggerWait
RegularLoop: movf AddressLow, w
movwf PortC
bcf PortB, RAS
movf AddressHigh, w
movwf PortC
bcf PortB, CAS
bsf PortB, CAS
bsf PortB, RAS
movf temp, w
incf AddressLow, f
btfsc Status, ZeroFlag
incfsz AddressHigh, f
movwf PC
bsf PortB, WE
goto MakeRAinput
HandlePanning: movlw RTCC
btfsc PortB, Left
goto NotLeft
btfss PortB, Right
goto Both
bcf Status, Direction
goto StepLeft
NotLeft: btfsc PortB, Right
goto Neither
bsf Status, Direction
goto StepRight
Both: movlw 40
btfss Status, Direction
goto StepLeft
goto StepRight
Neither: retlw 00
StepLeft: subwf AddressLow, f
btfsc Status, CarryFlag
goto Done
decf AddressHigh, f
incfsz AddressHigh, w
Done: retlw 00
ClearAddress: clrf AddressLow, f
clrf AddressHigh, f
retlw 00
StepRight: movwf temp
StepRightLoop: incf AddressHigh, w
btfss Status, ZeroFlag
goto StepRightStep
movlw c0
subwf AddressLow, w
btfsc Status, ZeroFlag
goto StepRightDone
StepRightStep: incf AddressLow, f
btfsc Status, ZeroFlag
incf AddressHigh, f
decfsz temp, f
goto StepRightLoop
StepRightDone: retlw 00
Refresh: clrf PortC, f
RefreshLoop: bcf PortB, RAS
bsf PortB, RAS
incfsz PortC, f
goto RefreshLoop
retlw 00
GetBufferPointer: rrf trace, w
movwf BankSelect
rrf BankSelect, f
rrf BankSelect, f
bcf BankSelect, 4
movf trace, w
andlw 0000.0111b
LookupMask: addwf PC, f
retlw 01
retlw 02
retlw 04
retlw 08
retlw 10
retlw 20
retlw 40
retlw 80
TriggerScope: clrf PortA, f
movlw 0e
movwf PortB
movlw ff
movwf PortC
movlw 00
tris PortA
movlw e1
tris PortB
movlw 00
tris PortC
movlw 08
option
clrf RTCC, f
clrf trace, f
retlw 00
BitSyncLevel: addwf level, w
BitSync: btfss RTCC, 7
goto BitSync
movwf PortC
bcf RTCC, 7
retlw 00
BitSyncLevel2: addwf level, w
movwf 1e
movf PortC, w
movwf 1f
BitSyncHere: btfss RTCC, 7
goto BitSyncHere
bcf RTCC, 7
movf 1f, w
subwf 1e, w
btfsc Status, ZeroFlag
goto BitSyncExit
movf 1f, w
subwf 1e, w
btfss Status, CarryFlag
goto BitSyncA
BitSyncB: movlw 0c
movwf 1d
BitSyncBloop: incf PortC, f
decfsz 1d, f
goto BitSyncAloop
goto BitSyncExit
BitSyncA: movlw 0c
movwf 1d
BitSyncAloop: decf PortC, f
decfsz 1d, f
goto BitSyncBloop
goto BitSyncExit
BitSyncExit: retlw 00
ShowLevels: call ShowLevelsLookup
movwf level
clrw
btfsc Status, Toggle
movlw 0c
goto BitSyncLevel
ShowLevelsLookup: movf channel, w
addwf PC, f
retlw b8
retlw 98
retlw 78
retlw 58
TraceDone: clrw
call BitSync
bcf PortB, Zip
movlw f0
tris PortB
MakeRAinput: movlw 0f
tris PortA
retlw 00
PowerUp: call TriggerScope
call ClearAddress
call ClearToEnd
Display: clrf channel, f
DisplayTrace: call Refresh
clrf trace, f
DisplayZ0: movf AddressLow, w
movwf PortC
bcf PortB, RAS
movf AddressHigh, w
movwf PortC
bcf PortB, CAS
movf channel, w
call LookupMask
andwf PortA, w
btfsc Status, ZeroFlag
bcf Status, Bit
btfss Status, ZeroFlag
bsf Status, Bit
bsf PortB, CAS
bsf PortB, RAS
incf AddressLow, f
btfsc Status, ZeroFlag
incf AddressHigh, f
call GetBufferPointer
xorlw ff
andwf 00, f
xorlw ff
btfsc Status, Bit
iorwf 00, f
incf trace, f
btfss trace, 6
goto DisplayZ0
movlw 40
subwf AddressLow, f
btfss Status, CarryFlag
decf AddressHigh, f
call TriggerScope
call ShowLevels
DisplaySample: call GetBufferPointer
andwf 00, w
movlw 00
btfss Status, ZeroFlag
movlw 0c
movf trace, f
btfss Status, ZeroFlag
goto DisplaySlow
call BitSyncLevel
goto DisplayCont
DisplaySlow: call BitSyncLevel2
DisplayCont: incf trace, f
btfss trace, 6
goto DisplaySample
call ShowLevels
call TraceDone
incf channel, f
btfss channel, 2
goto DisplayTrace
GuideTrace: call Refresh
call Refresh
call Refresh
call Refresh
call TriggerScope
movlw 30
movwf level
call BitSync
GuideTraceLoop: rrf AddressHigh, w
movwf temp
rrf temp, w
andlw 3f
xorwf trace, w
movlw 10
btfsc Status, ZeroFlag
goto GuideTraceShow
movf AddressLow, w
addwf trace, w
andlw 3f
movlw 08
btfss Status, ZeroFlag
clrw
GuideTraceShow: call BitSyncLevel
incf trace, f
btfss trace, 6
goto GuideTraceLoop
call BitSyncLevel
call TraceDone
btfss PortB, Record
call HandleRecord
call HandlePanning
movlw 20
xorwf Status, f
goto Display
ORG 01FFh
goto PowerUp
As such, you probably won't be able to feed this into your assembler of choice, but with a little rework it
ought to be do-able.
Page created March 2005,
Page equipped with FroogleBuster technology