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


Groups > comp.sys.acorn.programmer > #2016

Re: Assembler Help.

From Martin Bazley <martin.bazley@blueyonder.co.uk>
Newsgroups comp.sys.acorn.programmer
Subject Re: Assembler Help.
Message-ID <f8e3bfbb52.martin@blueyonder.co.uk> (permalink)
References (8 earlier) <fcfc5fba52.cferris@cferris.freeuk.com> <Itl*23+bu@news.chiark.greenend.org.uk> <52bb330b1aNews03@avisoft.f9.co.uk> <2ec334e3-5027-417a-9259-d56cf55a4561@m13g2000vbd.googlegroups.com> <33704729-7bec-4fc3-ad69-32a9a757a688@j11g2000vbc.googlegroups.com>
Organization virginmedia.com
Date 2012-08-08 00:52 +0100

Show all headers | View raw


The following bytes were arranged on 7 Aug 2012 by Gazza :

> On Aug 7, 4:50 pm, Gazza <use...@garethlock.com> wrote:
> > Had a go at implementing the changes in Martin Bazley's post. Made a
> > few more feature enchancements/additions too... Will post the updated
> > source on my server when I get in this evening.
>
> Sorry about the delay, but updated listing is now posted... Same URL
> as previously posted.

> ; Initialise the ASH subsystem. This has to be called before anything
> ; else. Except possibly to return LibASH (ASM) version information
> ; using ash_info with R0 = 0. Use ash_init_mm for use from BASIC
> ; programs (where HIMEM is available), otherwise use ash_init. There's
> ; probably a better way of doing this, but I don't know enough yet...

There is no difference between the OS_GetEnv SWI and the HIMEM keyword -
they perform exactly the same function.  Just use OS_GetEnv.

> SUB      R5,R3,#4
> LDR      R0,ash_total
> ADD      R0,R0,R5
> STR      R0,ash_total

As you are not using R5 for anything else in ash_alloc, it's a bit
wasteful to store and load it on the stack just for these two
instructions. Consider:

LDR R0,ash_total
ADD R0,R0,R3
SUB R0,R0,#4
STR R0,ash_total

> CMPVC    R4,#1<<31 ; Clear oVerflow flag.
> CMNVC    R4,#1<<31

I fail to see how this could clear anything, as both instructions are
only executed if the V flag is already clear (the VC condition code).
Fortunately, you immediately follow it with a call to XOS_Heap,
rendering these two instructions entirely pointless.

Oh, and I see you're not actually using R4 anywhere either.  May I
suggest, since you have so many spare registers, repurposing it to do
the job of ash_tmpval2?  Moving values around registers is much faster
than loading and storing them to memory, and you won't have to worry
about other functions overwriting your temporary space either.

> MOV R0,R3

You appear to be completely discarding the base address of the block,
returned in R2 from OS_Heap 2, and instead returning its size.  Have you
actually tested this code?

> MOV R0,R0 ; MOV R1,R4,R3,LSL #8 Bombs on assembly.

Ah, I see I forgot to include the grand old csap disclaimer.  That
should have been "ORR", not "MOV".

By the way, looking more closely at the comment above, I think you were
probably expecting that to multiply the version by 100.  It won't -
you'll get the major version * 256, plus the minor version.  You *could*
change it to multiply by 100 instead, but I'd really advise against it.
So if you want that, you'll have to work out how to do it for yourself.
:-)

> STMFD SP!,{R0-R2} ; Should this only push R0 & R1?

No, but it should be pushing (and pulling) R3, which is corrupted by
this function.

> CMPVC R4,#1<<31 ; Clear oVerflow flag.
> CMNVC R4,#1<<31

The mysterious V-clearing NOPs strike again.

And what's this?

> CMP R3,#1<<31 ; Unknown reason code in R0. Set oVerflow flag.
> CMNVS R3,#1<<31

What does the second instruction do?  It's only executed if the V flag
is set, but the stated purpose of the code is to set the V flag.  Either
it clears the V flag again (thus breaking the code) or it does nothing
(thus a waste of space).

> ANDS R2,R3,#3 ; Is R3 MOD 4 = 0?

My point about TST being the proper instruction for this job still
stands.

-- 
  __<^>__   "Your pet, our passion." - Purina
 / _   _ \  "Your potential, our passion." - Microsoft, a few months later
( ( |_| ) )
 \_>   <_/  ======================= Martin Bazley ==========================

Back to comp.sys.acorn.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Assembler Help. Gazza <usenet@garethlock.com> - 2012-07-10 07:09 -0700
  Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-07-10 08:46 -0700
    Re: Assembler Help. Chris Johnson <chrisjohnson+news@spamcop.net> - 2012-07-10 18:06 +0100
      Re: Assembler Help. jgharston <jgh@arcade.demon.co.uk> - 2012-07-11 11:26 -0700
        Re: Assembler Help. cferris@freeRemoveuk.com.invalid - 2012-07-11 20:05 +0100
          Re: Assembler Help. jgharston <jgh@arcade.demon.co.uk> - 2012-07-11 15:16 -0700
          Re: Assembler Help. Steve Drain <steve@kappa.me.uk> - 2012-07-12 10:25 +0100
            Re: Assembler Help. cferris@freeRemoveuk.com.invalid - 2012-07-13 09:23 +0100
              Re: Assembler Help. Steve Drain <steve@kappa.me.uk> - 2012-07-13 11:16 +0100
                Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-07-24 05:17 -0700
                Re: Assembler Help. Gavin Wraith <gavin@wra1th.plus.com> - 2012-07-24 14:02 +0100
                Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-07-24 06:49 -0700
                Re: Assembler Help. Steve Drain <steve@kappa.me.uk> - 2012-07-24 15:03 +0100
                Re: Assembler Help. usenet@garethlock.com - 2012-07-24 08:21 -0700
                Re: Assembler Help. Steve Drain <steve@kappa.me.uk> - 2012-07-24 17:55 +0100
                Re: Assembler Help. Theo Markettos <theom+news@chiark.greenend.org.uk> - 2012-08-03 20:26 +0100
                Re: Assembler Help. cferris@freeRemoveuk.com.invalid - 2012-08-05 08:51 +0100
                Re: Assembler Help. Martin Bazley <martin.bazley@blueyonder.co.uk> - 2012-07-24 20:04 +0100
                Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-07-24 14:16 -0700
                Re: Assembler Help. Jeremy Nicoll - news posts <jn.nntp.scrap007@wingsandbeaks.org.uk> - 2012-07-24 22:34 +0100
                Re: Assembler Help. Chris Johnson <chrisjohnson+news@spamcop.net> - 2012-07-24 23:56 +0100
                Re: Assembler Help. Martin Bazley <martin.bazley@blueyonder.co.uk> - 2012-07-25 01:42 +0100
                Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-08-03 05:54 -0700
                Re: Assembler Help. Martin Bazley <martin.bazley@blueyonder.co.uk> - 2012-08-03 17:52 +0100
                Re: Assembler Help. "Barry Allen (news)" <evanallen@onetel.net.uk.invalid> - 2012-08-04 10:21 +0100
                Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-08-04 15:57 -0700
                Re: Assembler Help. cferris@freeRemoveuk.com.invalid - 2012-08-05 08:48 +0100
                Re: Assembler Help. Martin <News03@avisoft.f9.co.uk> - 2012-08-06 10:00 +0100
                Re: Assembler Help. Theo Markettos <theom+news@chiark.greenend.org.uk> - 2012-08-06 13:26 +0100
                Re: Assembler Help. Martin <News03@avisoft.f9.co.uk> - 2012-08-06 23:13 +0100
                Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-08-07 08:50 -0700
                Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-08-07 15:43 -0700
                Re: Assembler Help. Martin Bazley <martin.bazley@blueyonder.co.uk> - 2012-08-08 00:52 +0100
                Re: Assembler Help. usenet@garethlock.com - 2012-08-08 02:03 -0700
                Re: Assembler Help. jeffrey.a.doggett@gmail.com - 2012-08-08 02:19 -0700
                Re: Assembler Help. druck <news@druck.org.uk> - 2012-08-12 09:05 +0100
                Re: Assembler Help. Frank de Bruijn <zuiderduin@hotmail.com> - 2012-08-08 11:40 +0200
                Re: Assembler Help. Jeremy Nicoll - news posts <jn.nntp.scrap007@wingsandbeaks.org.uk> - 2012-08-08 11:34 +0100
                Re: Assembler Help. Justin Fletcher <gerph@gerph.org> - 2012-08-09 21:19 +0100
                Re: Assembler Help. druck <news@druck.org.uk> - 2012-08-12 09:08 +0100
                Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-08-14 05:17 -0700
                Re: Assembler Help. Chris Johnson <chrisjohnson+news@spamcop.net> - 2012-08-14 14:50 +0100
                Re: Assembler Help. Martin Bazley <martin.bazley@blueyonder.co.uk> - 2012-08-14 15:03 +0100
                Re: Assembler Help. Martin Bazley <martin.bazley@blueyonder.co.uk> - 2012-08-14 14:59 +0100
                Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-08-15 17:01 -0700
                Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-08-21 03:54 -0700
                Re: Assembler Help. Martin <News03@avisoft.f9.co.uk> - 2012-08-21 12:27 +0100
                Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-08-21 05:08 -0700
                Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-08-21 05:25 -0700
                Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-08-21 08:23 -0700
                Re: Assembler Help. druck <news@druck.org.uk> - 2012-08-21 18:19 +0100
                Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-08-21 14:20 -0700
                Re: Assembler Help. cferris@freeRemoveuk.com.invalid - 2012-08-22 09:07 +0100
                Re: Assembler Help. Gazza <usenet@garethlock.com> - 2012-08-22 05:28 -0700
                Re: Assembler Help. Steve Fryatt <news@stevefryatt.org.uk> - 2012-08-22 14:47 +0100
                Re: Assembler Help. druck <news@druck.org.uk> - 2012-08-22 23:11 +0100
                Re: Assembler Help. Martin Bazley <martin.bazley@blueyonder.co.uk> - 2012-08-29 18:36 +0100
                Re: Assembler Help. Jeremy Nicoll - news posts <jn.nntp.scrap007@wingsandbeaks.org.uk> - 2012-08-22 09:38 +0100
                Re: Assembler Help. jgh@arcade.demon.co.uk (Jonathan Graham Harston) - 2012-08-08 23:15 +0100
                Re: Assembler Help. Martin Bazley <martin.bazley@blueyonder.co.uk> - 2012-08-09 13:59 +0100
                Re: Assembler Help. Steve Drain <steve@kappa.me.uk> - 2012-08-10 15:50 +0100
  Re: Assembler Help. Frank de Bruijn <zuiderduin@hotmail.com> - 2012-07-11 08:30 +0200
    Re: Assembler Help. cferris@freeRemoveuk.com.invalid - 2012-07-11 09:26 +0100

csiph-web