Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.acorn.programmer > #5999
| Path | csiph.com!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!border2.nntp.ams1.giganews.com!nntp.giganews.com!buffer2.nntp.ams1.giganews.com!buffer1.nntp.ams1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Mon, 24 Feb 2020 07:18:46 -0600 |
| From | Martin <News03@avisoft.f9.co.uk> |
| Subject | Re: Subtracting times |
| Newsgroups | comp.sys.acorn.programmer |
| Date | Mon, 24 Feb 2020 13:05:57 +0000 (GMT) |
| Message-ID | <58475466f3News03@avisoft.f9.co.uk> (permalink) |
| References | <37f8364458.Alan.Adams@ArmX6.adamshome.org.uk> <0a59594458.jmb@jmc.bruck.orange.fr> <80ec8ad6-58f7-4862-8ccd-34d8d5627c3c@googlegroups.com> <12ecd44558.Alan.Adams@ArmX6.adamshome.org.uk> <20c98ac0-98f6-4d7a-be0a-8ccaf93e1276@googlegroups.com> <r308ag$h4j$1@gioia.aioe.org> <21f8494758.Alan.Adams@ArmX6.adamshome.org.uk> |
| User-Agent | Pluto/3.17j (RISC OS/5.27) NewsHound/v1.52-32 |
| Organization | None |
| Lines | 44 |
| X-Usenet-Provider | http://www.giganews.com |
| X-Trace | sv3-FaORbVxnXVDdgNCqQ806AEim5G/cQ6xpLJFp9oLYrBKI96qT55IGVZW4fjtRG1RkWiw+UPBmApDpEG9!xFMVip5wARZvq2D0rU+stmDm+NqH9kvMQtROjoco3wgu2HdbNjM5OG8RVgop6VndMO+lYR1rQaSR!bXc= |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 2955 |
| Xref | csiph.com comp.sys.acorn.programmer:5999 |
Show key headers only | View raw
On 24 Feb in article <21f8494758.Alan.Adams@ArmX6.adamshome.org.uk>, Alan Adams <alan@adamshome.org.uk> wrote: > My preference is Martin's, because although all the options return > the time difference in an integer for valid ranges, Martin's > returns a defined -1 to indicate negative or overflow, which helps > with the calling code. In in case anyone is interested, I have posted it below. I had to send it direct to Alan because I was away with no csap access. DEF FNsub(A%,B%) = USR tsub% :REM = B% - A% (=> 5 byte times) REM Returns -1 (error) if result negative, REM or over &7fffffff (~35 weeks) .tsub% ; Entry r0 = A% => 5 byte start time (word aligned) lsb..msb ; r1 = B% => 5 byte stop time (word aligned) lsb..msb ; Exit r0 = B%-A% 4 byte time difference or -1 if start after stop ; r0 = r3 - r2 (low word) ; r4 = r6 - r5 (high byte) LDR r2,[r0] ; get low 4 bytes start LDR r3,[r1] ; get low 4 bytes stop LDRB r5,[r0,#4] ; get high byte start LDRB r6,[r1,#4] ; get high byte stop SUBS r0,r3,r2 ; get low bytes difference SBCS r4,r6,r5 ; get high bytes difference - set Z if zero ; r4 = 0 if positive, -1 if negative, else over ~70 weeks Bne error ; TST r0,#1<<31 ; r0 'negative' if over 35 weeks MOVeq pc,r14 ; ok to return positive result .error ; Return error indicator if negative or > ~35 weeks positive MVN r0,#0 ; set return to -1 to indicate error MOV pc,r14 It could be extended, and prbably improved! Martin -- Martin Avison Note that unfortunately this email address will become invalid without notice if (when) any spam is received.
Back to comp.sys.acorn.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-18 11:55 +0000
Re: Subtracting times Jean-Michel <jmc.bruck@orange.fr> - 2020-02-18 19:11 +0100
Re: Subtracting times Steve Drain <steve@kappa.me.uk> - 2020-02-21 03:28 -0800
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-21 12:45 +0000
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-21 15:17 +0000
Re: Subtracting times Steve Drain <steve@kappa.me.uk> - 2020-02-22 10:37 +0000
Re: Subtracting times Steve Drain <steve@kappa.me.uk> - 2020-02-25 16:05 +0000
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-25 16:35 +0000
Re: Subtracting times Steve Drain <steve@kappa.me.uk> - 2020-02-27 17:10 +0000
Re: Subtracting times Steve Drain <steve@kappa.me.uk> - 2020-02-27 10:06 -0800
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-28 11:21 +0000
Re: Subtracting times jeffrey.a.doggett@gmail.com - 2020-04-22 12:00 -0700
Re: Subtracting times Martin <News03@avisoft.f9.co.uk> - 2020-04-23 00:07 +0100
Re: Subtracting times jeffrey.a.doggett@gmail.com - 2020-04-23 03:13 -0700
Re: Subtracting times Martin <News03@avisoft.f9.co.uk> - 2020-04-23 18:01 +0100
Re: Subtracting times "John Williams (News)" <UCEbin@tiscali.co.uk> - 2020-04-23 18:06 +0100
Re: Subtracting times jeffrey.a.doggett@gmail.com - 2020-04-23 11:18 -0700
Re: Subtracting times Martin <News03@avisoft.f9.co.uk> - 2020-04-23 21:23 +0100
Re: Subtracting times David Higton <dave@davehigton.me.uk> - 2020-04-24 15:24 +0100
Re: Subtracting times David Higton <dave@davehigton.me.uk> - 2020-04-23 20:57 +0100
Re: Subtracting times jgh@mdfs.net - 2020-02-23 17:39 -0800
Re: Subtracting times Steve Drain <steve@kappa.me.uk> - 2020-02-24 10:23 +0000
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-24 11:12 +0000
Re: Subtracting times Martin <News03@avisoft.f9.co.uk> - 2020-02-24 13:05 +0000
Re: Subtracting times Matthew Phillips <spam2011m@yahoo.co.uk> - 2020-02-19 08:35 +0000
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-19 10:03 +0000
Re: Subtracting times Sebastian Barthel <naitsabes@freenet.de> - 2020-02-19 13:04 +0000
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-19 16:41 +0000
Re: Subtracting times jgh@mdfs.net - 2020-02-19 12:01 -0800
Re: Subtracting times Matthew Phillips <spam2011m@yahoo.co.uk> - 2020-02-23 20:46 +0000
Re: Subtracting times Martin <News03@avisoft.f9.co.uk> - 2020-02-19 23:54 +0000
Re: Subtracting times Alan Adams <alan@adamshome.org.uk> - 2020-02-20 11:18 +0000
csiph-web