Here's a walkthrough example. I'll notate every
time I press tab with "\t":
<dbg>ps dos_\t Display all 105 possibilities? (y or n) n <dbg>ps dos_file_\t\t dos_file_advance_to_next_cluster dos_file_loadaddress dos_file_advance_to_next_sector dos_file_read_current_sector dos_file_descriptors <dbg>ps dos_req\tuested_filename dos_requested_filename: BOOTLOGO.M65
No worries, I'll break an instruction deeper into it, at "break 8F9A" and that does the trick...
Hello,Great work on the tab completions etc.Adding a reset command to the serial monitor interface would not be that hard. This might be a job that Tim can do (who will soon introduce himself here).For the breaks, just manage them in software, because of the known problems with the hardware break. Note that Tim will also be working on reducing the output (and thus improving the speed) of the serial monitor trace output by a factor of about 20x. While it still won't be as fast as we might like, it will hopefully be enough to make things usable. We can then look at increasing the serial port speed to get further gains there, e.g., to use 960Kbps instead of 240Kbps. If we can get a cumulative ~100x or better, then 10 minutes becomes 6 seconds, which will be workable, I think.Paul.
--
You received this message because you are subscribed to the Google Groups "C65GS Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to c65gs-development+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
./m65dbg --device /dev/cu.usbserial-210292742986B
(replacing /dev/* with whatever you need).
At some stage, I probably should save out a settings-file to persist settings like this between runs. I'll save that idea for a later growth spurt.
Gurce
--
- We have wb (watch-byte), ww (watch-word), wd (watch-dword), ws (watch-string), which can take a parameter of an address or symbol-name:
<dbg>ws dos_requested_filename watch added! <dbg>wd dos_file_loadaddress watch added!
You can then list your watches as follows:
<dbg>watches #1: STRING dos_requested_filename: CHARROM.M65 #2: DWORD dos_file_loadaddress: 0FF7E000
You can type things like "wdel 1" or "wdel 2" to delete either item from the watchlist. You can delete both with "wdel all".
I've also added a "autowatch" command that will automatically list all your watches each time a disassembly is shown (eg, upon each step/n/dis). This can be used alongside "autocls" to get a reasonably clean view of your watches_disassembly upon each step:
<dbg>ws dos_requested_filename watch added! <dbg>wd dos_file_loadaddress watch added! <dbg>autocls - autocls is turned on. <dbg>autowatch - autowatch is turned on. <dbg>step
The screen then clears and you'll see something like this:
PC A X Y Z B SP MAPL MAPH LAST-OP P P-FLAGS RGP uS IO 88F9 20 2D 0B 3F BF BEF9 CFC0 3F00 9D 67 BC A4 00 N.E..I... ..P 11 -00 H- --------------------------------------- #1: STRING dos_requested_filename: CHARROM.M65 #2: DWORD dos_file_loadaddress: 0FF7E000 --------------------------------------- > /home/vets/mega65/kickstart_dos.a65:1154 > 1144: > 1145: dos_requested_filename_to_uppercase: > 1146: ; Convert filename to upper case for comparison > 1147: ldx dos_requested_filename_len > 1148: cpx #$3f > 1149: lda #dos_errorcode_name_too_long > 1150: bcs dos_return_error > 1151: drftu1: lda dos_requested_filename,x > 1152: jsr toupper > 1153: sta dos_requested_filename,x > 1154: inx > 1155: cpx dos_requested_filename_len > 1156: bne drftu1 > 1157: sec > 1158: rts > 1159: > 1160: dos_get_free_descriptor: > 1161: > 1162: ldx #$00 > 1163: dgfd1: txa > 1164: asl $88F9 M_nnnn:2 E8 EC 66 INX <dbg>
I've refined the "dis" command to do more:
For example:
<dbg>dis c000 10 $C000 M_immnn:1 A9 47 LDA #$47 $C002 M_nnnn:2 8D 2F D0 STA $D02F $C005 M_immnn:1 A9 53 LDA #$53 $C007 M_nnnn:2 8D 2F D0 STA $D02F $C00A M_immnn:1 A9 0E LDA #$0E $C00C M_nnnn:2 8D 20 D0 STA $D020 $C00F M_immnn:1 A9 06 LDA #$06 $C011 M_nnnn:2 8D 21 D0 STA $D021 $C014 M_immnn:1 A9 0E LDA #$0E $C016 M_nnnn:2 20 D2 FF JSR $FFD2 $C019 M_immnn:1 A2 00 LDX #$00 $C01B M_immnn:1 A9 20 LDA #$20 $C01D M_nnnnX:2 9D 00 04 STA $0400,X $C020 M_nnnnX:2 9D 00 05 STA $0500,X $C023 M_nnnnX:2 9D 00 06 STA $0600,X $C026 M_nnnnX:2 9D 00 07 STA $0700,X
<dbg>DC000
:777C000 A9 47 8D 2F D0 A9 53 8D 2F D0 A9 0E 8D 20 D0 A9
:777C010 06 8D 21 D0 A9 0E 20 D2 FF A2 00 A9 20 9D 00 04
:777C020 9D 00 05 9D 00 06 9D 00 07 A9 0E 9D 00 D8 9D 00
:777C030 D9 9D 00 DA 9D 00 DB E8 D0 E1 A0 27 B9 EA C5 20
:777C040 7D C5 09 80 99 00 04 B9 12 C6 20 7D C5 09 80 99
:777C050 C0 07 88 10 E7 A9 00 8D E3 C5 8D E4 C5 8D D4 C5
:777C060 8D D5 C5 8D E1 C5 8D E2 C5 78 A9 00 8D 40 D6 EA
:777C070 A3 00 58 C9 00 D0 39 A2 27 BD 88 C0 20 7D C5 9D
:777C080 E0 05 CA 10 F4 4C 85 C0 4E 6F 20 72 65 70 6C 79
:777C090 20 66 72 6F 6D 20 48 79 70 65 72 76 69 73 6F 72
:777C0A0 20 2D 20 6E 6F 74 20 61 20 4D 45 47 41 36 35 3F
:777C0B0 A9 00 4B A9 41 85 00 A9 12 8D 40 D6 EA B0 39 A2
:777C0C0 27 BD D0 C0 20 7D C5 9D E0 05 CA 10 F4 4C 85 C0
:777C0D0 20 20 43 6F 75 6C 64 6E 27 74 20 6F 70 65 6E 20
:777C0E0 64 69 72 65 63 74 6F 72 79 20 66 6F 72 20 72 65
:777C0F0 61 64 69 6E 67 20 20 20 8D E9 C5 A9 00 85 FE A9
:777C100 10 85 FF A9 14 AE E9 C5 A0 0F 8D 40 D6 EA 93 8C
:777C110 00 AD 00 0F C9 2E F0 EB AD 40 0F C9 05 90 E4 A8
:777C120 88 B9 00 0F C9 31 D0 DB 88 B9 00 0F C9 38 D0 D3
:777C130 88 B9 00 0F C9 44 F0 04 C9 64 D0 C7 AD 40 0F 38
:777C140 E9 04 8D 40 0F A0 00 B9 00 0F 91 FE C8 CC 40 0F
:777C150 F0 04 C0 10 D0 F1 C0 10 B0 0C A9 00 C0 10 B0 06
:777C160 91 FE C8 4C 5C C1 AD D4 C5 18 69 01 8D D4 C5 AD
:777C170 D5 C5 69 00 8D D5 C5 C9 90 B0 21 A5 FE 18 69 10
:777C180 85 FE A5 FF 69 00 85 FF AD D5 C5 D3 76 FF AD D4
:777C190 C5 C9 01 93 6E FF 20 EF C3 4C 03 C1 A3 00 20 6C
:777C1A0 C4 20 E4 FF D0 03 20 A6 C5 C9 11 D0 0D A2 01 A0
:777C1B0 00 20 B3 C3 20 5B C3 4C 9E C1 C9 91 D0 0D A2 FF
:777C1C0 A0 FF 20 B3 C3 20 5B C3 4C 9E C1 C9 1D D0 0D A2
:777C1D0 15 A0 00 20 B3 C3 20 5B C3 4C 9E C1 C9 9D D0 0D
:777C1E0 A2 EB A0 FF 20 B3 C3 20 5B C3 4C 9E C1 C9 30 D0
:777C1F0 09 20 D4 C3 20 5B C3 4C 9E C1 C9 39 D0 09 20 DD
--
Hi guys,
Ralph gave m65dbg a try recently on his mac.
He encountered an occasional seg-fault and frequent stalls/freezes.
I repaired one of the seg faults. We tried debugging the cause of the stall for him.
It was a stall in serialRead(), awaiting the results of the requested command.
I had a sneaky suspicion it might've been related to my usage of serialFlush() (perhaps the flush got delayed and it lost some of the input for the result too) so we tried commenting the tcflush call out and then things worked much better for him.
As for the backstory of why I was flushing the serial port prior to every command I sent: it was to assure there wasn't any remnant/leftover data in the buffer that could screw up the parsing of the received results.
For example, if you reset the nexys board during your debugging, the board outputs a greeting msg onto the serial port as it starts up, and that would screw up the parsing of the results of the next command you typed.
So anyway, just wanted to put it on your radars, if you experience similar stalls on your mac, try commenting tcflush out.
I'll be curious to learn who else is affected by this as I have a mac book and I'm *not* experiencing this problem with tcflush. It worked fine in winxp+cygwin too.
Oh, also Ralph mentioned he wanted to commit/push this comment-out change in, but didn't have access to do so yet.
Although part of me feels that simply commenting it out isn't a complete solution, as it means you will encounter other probs with parsing the results from your commands on some occasions.
Ah well, perhaps we can iron such things out over time, especially now that a few of you are considering to revise the serial comms packets to be more succinct.
Gurce
Glad that command is out of the way! :)
Gurce
Also, I was pondering the 'load' command, and achieving it via the s, S, or even f raw commands, but all of them report a syntax error at present. Are they commands that used to work but broke over time?
Oh, also, I noticed today that there's a "g<addr> - Set PC" raw command, that sounds really handy. It made me wonder whether I could use that to perform a reset? Just as a short-term measure until Paul's monitor-based reset is available.
--
Hello,You basically just have to have all the characters arrive with ~0.3ms spacing between them, which is complicated by USB clumping them together.There is an untested bulk memory set operation in the uart monitor, which doesn't echo back, and thus can accept characters at full rate.It would be: l<start_addr> <end addr (must be in the same 64KB range, i.e., only the bottom 16 bits matter!)>After sending the CR to submit the command, you then send the upto 64KB of bytes directly.eg:l0000400 00007e7<1000 bytes to write over the C64 screen RAM>As I say, I haven't actually tested this, and there might be problems with it.There is also an "s" command that [might] work similarly, to retrieve bytes in bulk from the machine.Both of these should get you transfers at ~20KB/sec.Paul.
On Thu, Aug 11, 2016 at 7:08 AM, Gurce Isikyildiz <gurce.is...@gmail.com> wrote:
Oops, apologies for the typo, the line should read:
"due* to* a lack of a buffer, ..."
--
PC A X Y Z B SP MAPL MAPH LAST-OP P P-FLAGS RGP uS IO
8E37 02 00 0A 00 BF BEFB 4000 3F00 69 02 24 00 ..E..I... ..P 11 R00 H-
Ah great, the breakpoint triggered!
<dbg>dis
> /home/vets/mega65/kickstart_dos.a65:1937
> 1927: jmp sd_readsector
> 1928:
> 1929: dos_file_advance_to_next_sector:
> 1930:
> 1931: ; Increment file position offset by 2 pages
> 1932: ldx dos_current_file_descriptor_offset
> 1933:
> 1934: lda dos_file_descriptors+dos_filedescriptor_offset_fileoffset+0,x
> 1935: clc
> 1936: adc #$02
> 1937: sta dos_file_descriptors+dos_filedescriptor_offset_fileoffset+0,x
> 1938: bcc dfatns1
> 1939: inc dos_file_descriptors+dos_filedescriptor_offset_fileoffset+1,x
> 1940: bne dfatns1
> 1941: inc dos_file_descriptors+dos_filedescriptor_offset_fileoffset+2,x
> 1942: dfatns1:
> 1943:
> 1944: ; increase sector
> 1945: inc dos_file_descriptors+dos_filedescriptor_offset_sectorincluster,x
> 1946: lda dos_file_descriptors+dos_filedescriptor_offset_sectorincluster,x
> 1947: ldy dos_disk_table_offset
---------------------------------------
$8E37 M_nnnnX:2 9D C1 BC STA $BCC1,X
Now, type "back" to get the backtrace of past jsr calls that got us to this present pc:
#0: $8E37 M_nnnnX:2 9D C1 BC STA $BCC1,X
#1: $8FD4 M_nnnn:2 20 2E 8E JSR $8E2E
#2: $93B0 M_nnnn:2 20 98 8F JSR $8F98
#3: $FFFE M_rrrr:2 53 53 9D BVC $9D53
#4: $00DD M_nnrr:2 0F 02 00 BBR $02,$00E0
#5: $CAFE M_impl:0 00 BRK
#6: $0014 M_impl:0 00 BRK
#7: $FFFE M_rrrr:2 53 53 9D BVC $9D53
#8: $007E M_impl:0 00 BRK
Currently, I just show the raw disassembly to the right of each frame#, but in future, I can try swap this to the corresponding source-code line instead.
The current-frame will be inverse-highlighted (i.e., frame#0 at present).
You can then use the "down" command to move down a frame.
- This will automatically call "dis" for you afterwards and show this output:
<<< FRAME#: 1 >>>
> /home/vets/mega65/kickstart_dos.a65:2223
> 2213: bne drfim_rr1
> 2214: inw <dos_file_loadaddress+1
> 2215: drfim_rr1b:
> 2216: lda $df00,x
> 2217: nop ; 32-bit pointer access follows
> 2218: sta (<dos_file_loadaddress),z
> 2219: inz
> 2220: inx
> 2221: bne drfim_rr1b
> 2222:
> 2223: jsr dos_file_advance_to_next_sector
> 2224: bcc drfim_eof
> 2225:
> 2226: ; We only allow loading into a 16MB space
> 2227: ; Provided that we check the load address before starting,
> 2228: ; this ensures that a user-land request cannot load a huge file
> 2229: ; that eventually overwrites the hypervisor and results in privilege
> 2230: ; escalation.
> 2231: inw <dos_file_loadaddress+1
> 2232:
> 2233: ; Increment number of sectors read (16 bit valie)
---------------------------------------
$8FD4 M_nnnn:2 20 2E 8E JSR $8E2E
If you type "back" (for backtrace), you'll see it again, but with frame#1 now highlighted:
<dbg>back #0: $8E37 M_nnnnX:2 9D C1 BC STA $BCC1,X #1: $8FD4 M_nnnn:2 20 2E 8E JSR $8E2E #2: $93B0 M_nnnn:2 20 98 8F JSR $8F98 #3: $FFFE M_rrrr:2 53 53 9D BVC $9D53 #4: $00DD M_impl:0 00 BRK #5: $CAFE M_impl:0 00 BRK #6: $0014 M_impl:0 00 BRK #7: $FFFE M_rrrr:2 53 53 9D BVC $9D53 #8: $007E M_impl:0 00 BRK
Currently, the backtrace is limited to 8 frames. Hope this is sufficient for now. If not, we can increase it later.
Hope that helps some.
Gurce
That's fair enough, I was hoping that my laid-back, meandering pace was 'tolerable' for savvy linux users and appreciated by not-so-savvy-linuxy users. I suppose it reflects my own personal nature too, and my affection towards the c64. I feel the machine has a strong connection to our youth/childhood for many of us, which was (hopefully!) an era of our lives when things were fun, warm, fuzzy and happy, so I tried to imbue some of that flavour into the video via my style, like a child figuring out this universe and enjoying the journey as they go :)
> It was a little slow for my liking but great for those needing the explanations.
> change the version numberSure, it's a worthwhile thing to do, agreed. I'm taking a bit of a breather from the tooling side of things though, and might just do incremental bug hunting as my time permits, but please feel free to improve on the m65dbg code as the community sees fit.
so that I could get a reasonably nice debugger up and running in a reasonably short timeframe so that I could then quickly switch my focus to bug-hunting.
I consider the 'raw' commands to be the ones provided by the serial monitor residing in the vhdl code.I consider the 'new' commands to be the newer ones provided by the m65dbg tool.
> - can you make the "<dbg>" prompt bold to help show where the last command was opposed to text output.....
That being said, if you think it will help you, sure, add it in.
Gurce
I consider the 'raw' commands to be the ones provided by the serial monitor residing in the vhdl code.I consider the 'new' commands to be the newer ones provided by the m65dbg tool.