Re: 16 bit compare

From: didier_at_aida.org
Date: Wed, 23 Oct 2019 08:19:01 +0200
Message-ID: <29409e31-2677-8e5e-9783-0ea8b7a5373f_at_aida.org>
Thanks Andre, apparently it works
I have to check the similar problems
(when I save in intel hex the last byte is missing if I'm ending at  
XXFF address)

the code is quite simple
;- get the arguments on the command line
then...
in the following code, DST is untouched
SRC is incremented by 8 after each line
CMDDUMP1           JSR    SRCEND
                                  BCS    CMDDUMPEND
CMDDUMP2:         LDA    #':'
                                  JSR    PRTPROMPT            ;- display  .:
                                  JSR    CMDDUMPHEX       ;- display 8 
bytes in hexa
                                  JSR    PRTSPACE ;- display a space
                                  JSR    CMDDUMPASC        ;- display 
the 8 bytes in ascii
                                  JSR CRLF                           ;- 
send crlf
                                  LDA #$08                          ;- 
add A to SRC
                                  JSR    SRCINC
                                  JMP    CMDDUMP1            ;- loop
CMDDUMPEND:    CLC                                        ;- normal end
CMDDUMPERR:    RTS                                         ;- end with 
an error  (called from command line parsing

I'm writing this monitor to have one independent of the machine
I only need 2 functions one to input a character and one to output a 
character
I also need a timer for the trace
the syntax is close to the syntax of the monitor for the commodore 8000
I started to develop it on a replica 1(*), then moved to a W65C816SXB 
board (used in emulation mode + custom firmware)
then I'll move it to commodore machines  (8000,700,C64)

(*) I abandoned the replica 1 ten due to numerous bugs
- board very sensible to electrical parasites  (I had to patch it)
- bugs in the wozmon  (stack never initialized, interrupt badly initialized)

thanks to all


On 22/10/2019 22:58, David Roberts wrote:
> My thought is that your problem may not be in this bit of code itself, 
> but the bit of code that converts from ASCII text on your monitor 
> command line to the two 16-bit parameters SRC and DST.
>
> Dave
>
> On Tue, 22 Oct 2019 at 21:52, André Fachat <afachat_at_gmx.de 
> <mailto:afachat_at_gmx.de>> wrote:
>
>     Try
>     BNE SRCNEXT
>     instead of the BCC.
>     Cannot explain, but if high byte is not equal and in particular
>     larger,the
>     comparison of the low byte overwrites this info.
>
>     André
>
>     Am 22. Oktober 2019 22:35:01 schrieb didier_at_aida.org
>     <mailto:didier_at_aida.org>:
>
>     > for years I programmed the 6502 mostly on the commodore 8000
>     >
>     >
>     > I've restarted with the 6502 (programming a monitor)
>     > it mostly works (with you help for relative branch)
>     > it's usable but I still have several glitches
>     >
>     >
>     > in the memory dump it display the memory
>     > for example if I use the range
>     > M 0400 0500   the display is correct
>     > M 0400 04F8   the display is also correct
>     > but if I try
>     > M 0400 04FX  with X in 9..F  in never end and goes in an
>     infinite loop
>     >
>     >
>     > the compare function I'm using:
>     > SRCEND:    LDA    SRC+1
>     >                    CMP    DST+1
>     >                    BCC    SRCNEXT
>     >                    LDA    SRC
>     >                    CMP    DST
>     > SRCNEXT:  RTS
>     >
>     >
>     > SRC = current addres  (first argument of command M)
>     > DST =  limit  (second argument of command M)
>     >
>     >
>     > I use the function this way:
>     > CMDDUMP1    JSR    SRCEND
>     >                           BCS    CMDDUMPEND
>     >
>     >
>     > any idea ?
>     > spent several days on this problem...
>     >
>     >
>     > thanks
>
>
>
>
Received on 2020-05-29 23:21:10

Archive generated by hypermail 2.3.0.