6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Apr 27, 2024 11:55 pm

All times are UTC




Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Sun Feb 27, 2022 11:19 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1927
Location: Sacramento, CA, USA
It looks correct at first glance, but only for unsigned numbers.

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 28, 2022 8:01 am 
Offline
User avatar

Joined: Tue Apr 03, 2018 2:10 pm
Posts: 125
barrym95838 wrote:
It looks correct at first glance, but only for unsigned numbers.


Thanks.

I should have said that this is for unsigned numbers.

_________________
I like it when things smoke.
BlogZolatron 64 project


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 13, 2024 12:23 am 
Offline

Joined: Tue Feb 19, 2013 12:29 am
Posts: 32
Location: Marlborough, Ma
Just as an FYI I have made these macros that work with my assembler, but they should be compatible to others




Code:
;********************************************
;*                                          *
;*  BEQ16                                   *
;*                                          *
;*  16bit beq                               *
;*                                          *
;*  \1  a       16-bit                      *
;*  \2  b       16 bit                      *
;*  \3  Destination a = b                   *
;*                                          *
;*  destroys    a                           *
;*                                          *
;********************************************
        .macro BEQ16
        lda \1 + 1
        cmp \2 + 1
        bne @exit
        lda \1
        cmp \2
        beq \3
  @exit
        .endm

;********************************************
;*                                          *
;*  BNE16                                   *
;*                                          *
;*  16bit beq                               *
;*                                          *
;*  \1  a       16-bit                      *
;*  \2  b       16 bit                      *
;*  \3  Destination a != b                  *
;*                                          *
;*  destroys    a                           *
;*                                          *
;********************************************
        .macro BNE16
        lda \1 + 1
        cmp \2 + 1
        bne \3
        lda \1
        cmp \2
        bne \3
        .endm

;********************************************
;*                                          *
;*  BLT16                                   *
;*                                          *
;*  16bit bcc                               *
;*                                          *
;*  \1  a       16-bit                      *
;*  \2  b       16 bit                      *
;*  \3  Destination a < b                   *
;*                                          *
;*  destroys    a                           *
;*                                          *
;********************************************
        .macro BLT16
        lda \1 + 1
        cmp \2 + 1
        bcc \3
        bne @exit
        lda \1
        cmp \2
        bcc \3
@exit
        .endm

;********************************************
;*                                          *
;*  BLE16                                   *
;*                                          *
;*  16bit branch less than or equal         *
;*                                          *
;*  \1  a       16-bit                      *
;*  \2  b       16 bit                      *
;*  \3  Destination a <= b                  *
;*                                          *
;*  destroys    a                           *
;*                                          *
;********************************************
        .macro BLE16
        lda \1 + 1
        cmp \2 + 1
        bcc \3
        bne @exit
        lda \1
        cmp \2
        bcc \3
        beq \3
@exit
        .endm


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: