Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #4825

Re: 32 bit comparison in 16 bit 65816

Newsgroups comp.sys.apple2.programmer
Date 2018-10-14 10:01 -0700
References <43c6650d-3248-4015-8973-05f7fa185a7e@googlegroups.com>
Message-ID <063ca54f-e9cb-4214-9b80-3a95df82dedc@googlegroups.com> (permalink)
Subject Re: 32 bit comparison in 16 bit 65816
From Antoine Vignau <antoine.vignau@laposte.net>

Show all headers | View raw


CMP could do the trick:

* Is high-word SEQ < high-word SEQ_UNA?

	lda	SEQ+2
	ldy	#SEQ_UNA+2
	cmp	[PTR],y
	bcc	Ignore
	
* Is low-word SEQ >= low-word SEQ_UNA?

	lda	SEQ
	ldy	#SEQ_UNA
	cmp	[PTR],y
	bcs	GreaterEqual1

* Test failed

Ignore	rts

* Is high-word SEQ_NXT < high-word SEQ?

GreaterEqual1	ldy	#SEQ_NXT+2
	lda	[PTR],y
	cmp	SEQ+2
	bcc	Ignore
	
* Is low-word SEQ_NXT < low-word SEQ?

	ldy	#SEQ_NEXT
	lda	[PTR],y
	cmp	SEQ
	bcc	Ignore

* If we're here, SEQ_UNA <= SEQ <= SEQ_NXT

	...

* BCS handles greater than or equal
* BCC handles lower than only

John, Peter, and others will come with 1/2 code in size and 2x speed ;-)

av

Back to comp.sys.apple2.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

32 bit comparison in 16 bit 65816 andrew.roughan@writeme.com - 2018-10-13 23:39 -0700
  Re: 32 bit comparison in 16 bit 65816 Antoine Vignau <antoine.vignau@laposte.net> - 2018-10-14 10:01 -0700
    Re: 32 bit comparison in 16 bit 65816 Antoine Vignau <antoine.vignau@laposte.net> - 2018-10-14 10:02 -0700
  Re: 32 bit comparison in 16 bit 65816 Antoine Vignau <antoine.vignau@laposte.net> - 2018-10-14 10:04 -0700
    Re: 32 bit comparison in 16 bit 65816 James Davis <JPD.Enterprises@outlook.com> - 2018-10-14 11:59 -0700
      Re: 32 bit comparison in 16 bit 65816 Antoine Vignau <antoine.vignau@laposte.net> - 2018-10-14 12:15 -0700
        Re: 32 bit comparison in 16 bit 65816 qkumba <peter.ferrie@gmail.com> - 2018-10-14 21:05 -0700
          Re: 32 bit comparison in 16 bit 65816 kegs@provalid.com (Kent Dickey) - 2018-10-15 11:21 -0500
            Re: 32 bit comparison in 16 bit 65816 Stephen Heumann <stephen.heumann@gmail.com> - 2018-10-15 12:42 -0500
    Re: 32 bit comparison in 16 bit 65816 andrew.roughan@writeme.com - 2018-10-15 07:05 -0700
      Re: 32 bit comparison in 16 bit 65816 Antoine Vignau <antoine.vignau@laposte.net> - 2018-10-15 14:37 -0700
  Re: 32 bit comparison in 16 bit 65816 Michael Barry <barrym95838@yahoo.com> - 2018-10-15 08:26 -0700
  Re: 32 bit comparison in 16 bit 65816 James Davis <JPD.Enterprises@outlook.com> - 2018-10-15 19:23 -0700
  Re: 32 bit comparison in 16 bit 65816 James Davis <JPD.Enterprises@outlook.com> - 2018-10-17 00:29 -0700

csiph-web