Open Source Logic Analyzer Experiments

for bbc micro/electron hardware, peripherals & programming issues (NOT emulators!)
User avatar
Elminster
Posts: 3282
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: Open Source Logic Analyzer Experiments

Post by Elminster » Fri May 17, 2019 1:02 pm

I dont use windows, but usually when you install cygwin it installs various redhat linux libraries so you can compile c stuff.

Not sure you would get that using a built in bash prompt.

User avatar
danielj
Posts: 7160
Joined: Thu Oct 02, 2008 4:51 pm
Location: Manchester
Contact:

Re: Open Source Logic Analyzer Experiments

Post by danielj » Fri May 17, 2019 1:21 pm

You do. Windows Linux subsystem. Ubuntu or debian. Bit finnecky with some x-stuff but absolutely fine for building at the command line.

User avatar
Elminster
Posts: 3282
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: Open Source Logic Analyzer Experiments

Post by Elminster » Fri May 17, 2019 1:33 pm

danielj wrote:
Fri May 17, 2019 1:21 pm
You do. Windows Linux subsystem. Ubuntu or debian. Bit finnecky with some x-stuff but absolutely fine for building at the command line.
Witchcraft.

I am near tempted to start a windows VM and try that myself .....

User avatar
hoglet
Posts: 8097
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Open Source Logic Analyzer Experiments

Post by hoglet » Fri May 17, 2019 1:59 pm

vanekp wrote:
Fri May 17, 2019 12:58 pm
What am I doing Wrong ?
There is a script called build.sh that contains the commands that I use to build it.

Try running that script, i.e.:

Code: Select all

bash build.sh
This is what the script currently contains:

Code: Select all

#!/bin/bash

LIBS="-lm"

if [[ $OS = *"Windows"* ]]; then
  LIBS="$LIBS -largp"
fi

gcc -Wall -O3 -D_GNU_SOURCE -o decode6502 src/main.c src/em_6502.c src/profiler.c src/profiler_instr.c src/profiler_block.c src/profiler_call.c src/tube_decode.c $LIBS
(In Windows 10, I'm not sure if you will need the additional -largp library or not.)
Last edited by hoglet on Fri May 17, 2019 2:29 pm, edited 2 times in total.

User avatar
vanekp
Posts: 585
Joined: Thu Nov 30, 2000 7:09 am
Location: The Netherlands
Contact:

Re: Open Source Logic Analyzer Experiments

Post by vanekp » Fri May 17, 2019 5:19 pm

okay so that creates a file but cant even run it in ubuntu :-
# decode6502 --help
sh: 6: decode6502: not found
and certainly does not create a windows exe which I would prefer as I am no fan of Linux I always seem to fight with it...its frustrating :x
Peter.

User avatar
hoglet
Posts: 8097
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Open Source Logic Analyzer Experiments

Post by hoglet » Fri May 17, 2019 5:30 pm

vanekp wrote:
Fri May 17, 2019 5:19 pm
okay so that creates a file but cant even run it in ubuntu :-
# decode6502 --help
In the bash shell, try:

Code: Select all

./decode6502 --help

User avatar
vanekp
Posts: 585
Joined: Thu Nov 30, 2000 7:09 am
Location: The Netherlands
Contact:

Re: Open Source Logic Analyzer Experiments

Post by vanekp » Fri May 17, 2019 6:18 pm

okay have eventually got a windows exe that looks like its working as i get the following with a help switch :-

Code: Select all

C:\cygwin64\home\peter\6502Decoder>decode6502.exe --help
Usage: decode6502 [OPTION...] [FILENAME]

Decoder for 6502/65C02 logic analyzer capture files.

FILENAME must be a binary capture file with 16 bit samples.

If FILENAME is omitted, stdin is read instead.

The default bit assignments for the input signals are:
 - data: bit  0 (assumes 8 consecutive bits)
 -  rnw: bit  8
 - sync: bit  9
 -  rdy: bit 10
 - phi2: bit 11
 -  rst: bit 14

To specify that an input is unconnected, include the option with an empty
BITNUM. e.g. --sync=

If phi2 is not connected the capture file should contain one sample per
falling edge of phi2.

If rdy is not connected a value of '1' is assumed.

If sync is not connected a heuristic based decoder is used. This works well,
but can take several instructions to lock onto the instruction stream.
Use of sync, is preferred.

If RST is not connected, an alternative is to specify the reset vector:
 - D9CD (D9 is the high byte, CD is the low byte)
 - A9D9CD (optionally, also specify the first opcode, LDA # in this case)


  -a, --address              Show address of instruction.
  -b, --byte                 Byte samples
      --bbctube              Decode BBC tube protocol
  -c, --c02                  Enable 65C02 mode.
      --data=BITNUM          The start bit number for data
  -d, --debug=LEVEL          Sets debug level (0 1 or 2)
  -e, --emulate              Enable emulation, for error checking.
  -f, --bbcfwa               Show BBC floating poing work areas.
  -h, --hex                  Show hex bytes of instruction.
  -i, --instruction          Show instruction.
  -m, --machine=MACHINE      Enable machine specific behaviour
      --phi2[=BITNUM]        The bit number for phi2, blank if unconnected
  -p, --profile[=PARAMS]     Profile code execution.
  -q, --quiet                Set all the show options to off.
      --rdy[=BITNUM]         The bit number for rdy, blank if unconnected
      --rnw[=BITNUM]         The bit number for rnw
      --rst[=BITNUM]         The bit number for rst, blank if unconnected
  -r, --rockwell             Enable additional rockwell instructions.
      --sync[=BITNUM]        The bit number for sync, blank if unconnected
  -s, --state                Show register/flag state.
  -t, --trigger=ADDRESS      Trigger on address.
  -u, --undocumented         Enable undocumented 6502 opcodes (currently
                             incomplete)
      --vecrst[=HEX]         The reset vector, black if not known
  -y, --cycles               Show number of bus cycles.
  -?, --help                 give this help list
      --usage                give a short usage message
  -V, --version              print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

Report bugs to <dave@hoglet.com>.
but get no output if I try using it on one of the included reset.bin out of the test folder with the following :-
decode6502.exe -h -s --sync= <reset.bin >data.txt
I end up with a zero byte txt file, guess more playing around is required.
Peter.

User avatar
hoglet
Posts: 8097
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Open Source Logic Analyzer Experiments

Post by hoglet » Fri May 17, 2019 7:10 pm

vanekp wrote:
Fri May 17, 2019 6:18 pm
I end up with a zero byte txt file, guess more playing around is required.
No output typically means an issue with clocking.

How exactly did you create the capture file? i.e. what signals are connected, and how was it clocked?

There are two options for clocking:
1. You capture syncronously (one sample per clock period), and pass in --phi2=
2. You capture asyncronously (several cycles per clock period), and pass in --phi2=<N> where N is the data bit that the clock signal is connected to

If you zip up the capture file, and post it I'll take a quick look.

Dave
Last edited by hoglet on Fri May 17, 2019 7:18 pm, edited 3 times in total.

User avatar
vanekp
Posts: 585
Joined: Thu Nov 30, 2000 7:09 am
Location: The Netherlands
Contact:

Re: Open Source Logic Analyzer Experiments

Post by vanekp » Fri May 17, 2019 9:40 pm

hoglet wrote:
Fri May 17, 2019 7:10 pm
vanekp wrote:
Fri May 17, 2019 6:18 pm
I end up with a zero byte txt file, guess more playing around is required.
No output typically means an issue with clocking.

How exactly did you create the capture file? i.e. what signals are connected, and how was it clocked?

There are two options for clocking:
1. You capture syncronously (one sample per clock period), and pass in --phi2=
2. You capture asyncronously (several cycles per clock period), and pass in --phi2=<N> where N is the data bit that the clock signal is connected to

If you zip up the capture file, and post it I'll take a quick look.

Dave
Hi Dave,

No as I said "one of the included reset.bin out of the test folder" (6502Decoder-master\test\beeb\reset.bin) so I used one of those just to test it but of cause I don't know how those bin files where made but figured it should work with it.

I assume this will also work with my LA5016 logic analyzer?

Sorry about the confusion, and thanks for you help.
Peter.

User avatar
Elminster
Posts: 3282
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK
Contact:

Re: Open Source Logic Analyzer Experiments

Post by Elminster » Fri May 17, 2019 9:49 pm

vanekp wrote:
Fri May 17, 2019 6:18 pm

but get no output if I try using it on one of the included reset.bin out of the test folder with the following :-
decode6502.exe -h -s --sync= <reset.bin >data.txt
I end up with a zero byte txt file, guess more playing around is required.
Should that not be:

Code: Select all

decode6502.exe -h -s --sync= reset.bin >data.txt
instead of :

Code: Select all

decode6502.exe -h -s --sync= <reset.bin >data.txt
i.e. no stdin redirect '<' in front of reset.bin ?

Edit: Okay I see help says it will read stdin if nothing specified, but still makes the '<' unrequired at best, and confusing it at worst. Been a while since I used it.
Last edited by Elminster on Fri May 17, 2019 9:51 pm, edited 2 times in total.

User avatar
hoglet
Posts: 8097
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Open Source Logic Analyzer Experiments

Post by hoglet » Sat May 18, 2019 6:40 am

All of the data in the test folder was synchronously sampled.

So you definitely need the following option:

Code: Select all

--phi2=
Try the following:

Code: Select all

decode6502.exe --phi2= -s -h -y  reset.bin >reset.txt
(the order of the option flags doesn't matter)

Dave
Last edited by hoglet on Sat May 18, 2019 6:40 am, edited 1 time in total.

User avatar
vanekp
Posts: 585
Joined: Thu Nov 30, 2000 7:09 am
Location: The Netherlands
Contact:

Re: Open Source Logic Analyzer Experiments

Post by vanekp » Sat May 18, 2019 6:26 pm

Okay that worked now that I know it works and have an idea how to use it, I can see if I can get it to work with some output from my Analyzer now.

Analyzer Output
Analyzer Output.png
and decoded6502 Output

Code: Select all

???? :          : RESET !!       : 7 : A=?? X=?? Y=?? SP=?? N=? V=? D=? I=1 Z=? C=?
D9CD : A9 40    : LDA #40        : 2 : A=40 X=?? Y=?? SP=?? N=0 V=? D=? I=1 Z=0 C=?
D9CF : 8D 00 0D : STA 0D00       : 4 : A=40 X=?? Y=?? SP=?? N=0 V=? D=? I=1 Z=0 C=?
D9D2 : 78       : SEI            : 2 : A=40 X=?? Y=?? SP=?? N=0 V=? D=? I=1 Z=0 C=?
D9D3 : D8       : CLD            : 2 : A=40 X=?? Y=?? SP=?? N=0 V=? D=0 I=1 Z=0 C=?
D9D4 : A2 FF    : LDX #FF        : 2 : A=40 X=FF Y=?? SP=?? N=1 V=? D=0 I=1 Z=0 C=?
D9D6 : 9A       : TXS            : 2 : A=40 X=FF Y=?? SP=FF N=1 V=? D=0 I=1 Z=0 C=?
D9D7 : AD 4E FE : LDA FE4E       : 4 : A=80 X=FF Y=?? SP=FF N=1 V=? D=0 I=1 Z=0 C=?
D9DA : 0A       : ASL A          : 2 : A=00 X=FF Y=?? SP=FF N=0 V=? D=0 I=1 Z=1 C=1
D9DB : 48       : PHA            : 3 : A=00 X=FF Y=?? SP=FE N=0 V=? D=0 I=1 Z=1 C=1
D9DC : F0 09    : BEQ D9E7       : 3 : A=00 X=FF Y=?? SP=FE N=0 V=? D=0 I=1 Z=1 C=1
D9E7 : A2 04    : LDX #04        : 2 : A=00 X=04 Y=?? SP=FE N=0 V=? D=0 I=1 Z=0 C=1
D9E9 : 86 01    : STX 01         : 3 : A=00 X=04 Y=?? SP=FE N=0 V=? D=0 I=1 Z=0 C=1
D9EB : 85 00    : STA 00         : 3 : A=00 X=04 Y=?? SP=FE N=0 V=? D=0 I=1 Z=0 C=1
D9ED : A8       : TAY            : 2 : A=00 X=04 Y=00 SP=FE N=0 V=? D=0 I=1 Z=1 C=1
D9EE : 91 00    : STA (00),Y     : 6 : A=00 X=04 Y=00 SP=FE N=0 V=? D=0 I=1 Z=1 C=1
D9F0 : C5 01    : CMP 01         : 3 : A=00 X=04 Y=00 SP=FE N=1 V=? D=0 I=1 Z=0 C=0
D9F2 : F0 09    : BEQ D9FD       : 2 : A=00 X=04 Y=00 SP=FE N=1 V=? D=0 I=1 Z=0 C=0
D9F4 : C8       : INY            : 2 : A=00 X=04 Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=0
D9F5 : D0 F7    : BNE D9EE       : 3 : A=00 X=04 Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=0
D9EE : 91 00    : STA (00),Y     : 6 : A=00 X=04 Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=0
D9F0 : C5 01    : CMP 01         : 3 : A=00 X=04 Y=01 SP=FE N=1 V=? D=0 I=1 Z=0 C=0
D9F2 : F0 09    : BEQ D9FD       : 2 : A=00 X=04 Y=01 SP=FE N=1 V=? D=0 I=1 Z=0 C=0
D9F4 : C8       : INY            : 2 : A=00 X=04 Y=02 SP=FE N=0 V=? D=0 I=1 Z=0 C=0
D9F5 : D0 F7    : BNE D9EE       : 3 : A=00 X=04 Y=02 SP=FE N=0 V=? D=0 I=1 Z=0 C=0
.
.
.
.
D9EE : 91 00    : STA (00),Y     : 6 : A=00 X=7F Y=FF SP=FE N=1 V=? D=0 I=1 Z=0 C=0
D9F0 : C5 01    : CMP 01         : 3 : A=00 X=7F Y=FF SP=FE N=1 V=? D=0 I=1 Z=0 C=0
D9F2 : F0 09    : BEQ D9FD       : 2 : A=00 X=7F Y=FF SP=FE N=1 V=? D=0 I=1 Z=0 C=0
D9F4 : C8       : INY            : 2 : A=00 X=7F Y=00 SP=FE N=0 V=? D=0 I=1 Z=1 C=0
D9F5 : D0 F7    : BNE D9EE       : 2 : A=00 X=7F Y=00 SP=FE N=0 V=? D=0 I=1 Z=1 C=0
D9F7 : C8       : INY            : 2 : A=00 X=7F Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=0
D9F8 : E8       : INX            : 2 : A=00 X=80 Y=01 SP=FE N=1 V=? D=0 I=1 Z=0 C=0
D9F9 : E6 01    : INC 01         : 5 : A=00 X=80 Y=01 SP=FE N=1 V=? D=0 I=1 Z=0 C=0
D9FB : 10 F1    : BPL D9EE       : 2 : A=00 X=80 Y=01 SP=FE N=1 V=? D=0 I=1 Z=0 C=0
D9FD : 8E 8E 02 : STX 028E       : 4 : A=00 X=80 Y=01 SP=FE N=1 V=? D=0 I=1 Z=0 C=0
DA00 : 8E 84 02 : STX 0284       : 4 : A=00 X=80 Y=01 SP=FE N=1 V=? D=0 I=1 Z=0 C=0
DA03 : A2 0F    : LDX #0F        : 2 : A=00 X=0F Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=0
DA05 : 8E 42 FE : STX FE42       : 4 : A=00 X=0F Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=0
DA08 : CA       : DEX            : 2 : A=00 X=0E Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=0
DA09 : 8E 40 FE : STX FE40       : 4 : A=00 X=0E Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=0
DA0C : E0 09    : CPX #09        : 2 : A=00 X=0E Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA0E : B0 F8    : BCS DA08       : 3 : A=00 X=0E Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA08 : CA       : DEX            : 2 : A=00 X=0D Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA09 : 8E 40 FE : STX FE40       : 4 : A=00 X=0D Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA0C : E0 09    : CPX #09        : 2 : A=00 X=0D Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA0E : B0 F8    : BCS DA08       : 3 : A=00 X=0D Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA08 : CA       : DEX            : 2 : A=00 X=0C Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA09 : 8E 40 FE : STX FE40       : 4 : A=00 X=0C Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA0C : E0 09    : CPX #09        : 2 : A=00 X=0C Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA0E : B0 F8    : BCS DA08       : 3 : A=00 X=0C Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA08 : CA       : DEX            : 2 : A=00 X=0B Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA09 : 8E 40 FE : STX FE40       : 4 : A=00 X=0B Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA0C : E0 09    : CPX #09        : 2 : A=00 X=0B Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA0E : B0 F8    : BCS DA08       : 3 : A=00 X=0B Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA08 : CA       : DEX            : 2 : A=00 X=0A Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA09 : 8E 40 FE : STX FE40       : 4 : A=00 X=0A Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA0C : E0 09    : CPX #09        : 2 : A=00 X=0A Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA0E : B0 F8    : BCS DA08       : 3 : A=00 X=0A Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA08 : CA       : DEX            : 2 : A=00 X=09 Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA09 : 8E 40 FE : STX FE40       : 4 : A=00 X=09 Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA0C : E0 09    : CPX #09        : 2 : A=00 X=09 Y=01 SP=FE N=0 V=? D=0 I=1 Z=1 C=1
DA0E : B0 F8    : BCS DA08       : 3 : A=00 X=09 Y=01 SP=FE N=0 V=? D=0 I=1 Z=1 C=1
DA08 : CA       : DEX            : 2 : A=00 X=08 Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA09 : 8E 40 FE : STX FE40       : 4 : A=00 X=08 Y=01 SP=FE N=0 V=? D=0 I=1 Z=0 C=1
DA0C : E0 09    : CPX #09        : 2 : A=00 X=08 Y=01 SP=FE N=1 V=? D=0 I=1 Z=0 C=0
DA0E : B0 F8    : BCS DA08       : 2 : A=00 X=08 Y=01 SP=FE N=1 V=? D=0 I=1 Z=0 C=0
Now I have a base line so if I ever have a faulty BBC I have something to compare it with :)
Thanks for you help Dave and for the useful Utility and Article :D
Last edited by vanekp on Sat May 18, 2019 11:59 pm, edited 1 time in total.
Peter.

Post Reply