I did some progress on the debugger:
– it now scans for potential labels (looking for jump and branch)
– then adds them to the returned disassembled code
– it has a better command line tool (history, autocompletion)
– it doesn’t append the history with small commands (like step/s, continue/c, …) commands you would trigger a lot ending in having multiple of them polluting the history
– it also scans the imported memory blocks to determine the type of each byte (instruction, operand, data)
– the display code has been rewritten in a cleaner way (instructions & memory)and it can now export almost everything as binary and text.

and it can now export almost everything as binary or human readable text.

For instance

To test the result of these enhancements I decided to assemble the following 6502 source code (by Paul Guertin, source: http://6502.org/source/misc/dow.htm):

; This routine works for any date from 1900-03-01 to 2155-12-31.
; No range checking is done, so validate input before calling.
;
; I use the formula
;     Weekday = (day + offset[month] + year + year/4 + fudge) mod 7
; where the value of fudge depends on the century.
;
; Input: Y = year (0=1900, 1=1901, ..., 255=2155)
;        X = month (1=Jan, 2=Feb, ..., 12=Dec)
;        A = day (1 to 31)
;
; Output: Weekday in A (0=Sunday, 1=Monday, ..., 6=Saturday)

         ORG $100

TEST:    LDA #28
         LDX #6
         LDY #78
         JSR WEEKDAY
         BRK

TMP      EQU $6          ; Temporary storage

WEEKDAY:
         CPX #3          ; Year starts in March to bypass
         BCS MARCH       ; leap year problem
         DEY             ; If Jan or Feb, decrement year
MARCH:   EOR #$7F        ; Invert A so carry works right
         CPY #200        ; Carry will be 1 if 22nd century
         ADC MTAB,X      ; A is now day+month offset
         STA TMP
         TYA             ; Get the year
         JSR MOD7        ; Do a modulo to prevent overflow
         SBC TMP         ; Combine with day+month
         STA TMP
         TYA             ; Get the year again
         LSR             ; Divide it by 4
         LSR
         CLC             ; Add it to y+m+d and fall through
         ADC TMP
MOD7:    ADC #7          ; Returns (A+3) modulo 7
         BCC MOD7        ; for A in 0..255
         RTS

MTAB:    DB 0,1,5,6,3,1,5,3,0,4,2,6,4   	; Month offsets

and here is the result once disassembled by the debugger:

> *$0100.i  A9 1C     TEST:       LDA #$1C
   $0102.i  A2 06                 LDX #$06
   $0104.i  A0 4E                 LDY #$4E
   $0106.i  20 0A 01              JSR WEEKDAY
   $0109.i  00                    BRK

   $010A.i  E0 03     WEEKDAY:    CPX $03
   $010C.i  B0 01                 BCS MARCH

   $010E.i  88                    DEY
   $010F.i  49 7F     MARCH:      EOR #$7F
   $0111.i  C0 C8                 CPY #$C8
   $0113.i  7D 26 01              ADC MTAB,X
   $0116.i  85 06                 STA $06
   $0118.i  98                    TYA
   $0119.i  20 22 01              JSR MOD7

   $011C.i  E5 06                 SBC $06
   $011E.i  85 06                 STA $06
   $0120.i  98                    TYA
   $0121.i  4A                    LSR A
   $0122.i  4A                    LSR A
   $0123.i  18                    CLC
   $0124.i  65 06                 ADC $06
   $0126.i  69 07     MOD7:       ADC #$07
   $0128.i  90 FC                 BCC MOD7

   $012A.i  60                    RTS

   $012B.d  00 ...    MTAB:       DB $00, $01, $05, $06, $03, $01, $05, $03
   $0133.d  00 ...                DB $00, $04, $02, $06, $04, $00

That sounds pretty good, right?

There are still a few lambdas to address but I’m almost ready to experiment a loop of assembling, disassembling, … to ensure it doesn’t deviate…And this will be for sure of

And this would be – for sure – a very good unit test!