Acorn A4 website?

From: Pete Turnbull <pete_at_dunnington.u-net.com>
Date: Mon Apr 17 19:50:14 2000

On Apr 17, 22:09, Peter Pachla wrote:

> >> It's a nice machine, but of little use with nothing but the OS
> >>installed. :-(
>
> > True :-) I've possibly got things that you might have a use for. It
> >depends on what you're interested, obviously. What would you like to
do?
>
> Initially, the main things I'm interested in are learning about the
system
> architecture and getting an assembler for it so I can try out ARM
assembly
> language.

Ah, well I might have an assembler somewhere -- there were two flavours:
one produced executable object code directly (I think) and the other
produced object modules which could be linked with modules produced by
high-level languages such as C, Fortran, and Pascal. I'm sure some of the
remaining Acorn web and/or FTP sites, like Stuttgart or HENSA, still have
instruction set lists.

But you don't even need that to get going -- BBC BASIC V contains a
reasonable 2-pass ARM assembler. It works just like the 6502 assembler in
BBC BASIC II (et al). Here's a sample so you seen what I mean (don't ask
me exactly how it works, it's intimatley bound up with the interactions
between the desktop palette, the OS palette, and the hardware palette, and
anyway I wrote this 12 years ago :-)):

REM part of palette control program for RISC OS 2.0

DIM code% 408
PROCassemble

REM main program loop here
REM followed by several other procedures/functions

DEF PROCsupremacy
CALL getpal : REM read actual colour mapping
D%=colour% : REM R3=colour%
H%=windowhandle% : REM R7=windowhandle%
CALL do_sup
ENDPROC

DEF PROCassemble
LOCAL cnt,sup,bm,sptr,vptr,val,ptr,ccol,sp,link,pass%
ptr=1 : ccol=3 : cnt=6 : sp=13 : link=14 : REM windowhandle passed in
R7
sup=10 : bm=4 : sptr=5 : vptr=8 : val=9 : REM arbitrary register
choice
log=0 : phys=1 : bpp=4 : wptr=5 : tmp=9
FOR pass%=0 TO 2 STEP 2
P%=code%
[ OPT pass%
.do_sup STMFD (sp)!, {link}
        ADR sptr, supremacy% ; set up pointers
        ADR vptr, vpalette%
        LDR sup, [sptr] ; get supremacy word
        MOV bm, #&80 ; supremacy bit mask
        MOV R0, #12 ; for OSWORD 12

        ; In case of moving from 16-colour mode to 256-colour mode,
        ; we need all the clrs separate from all the sets - because
        ; several colours may share one physical palette register

        ADD ptr, vptr, #95 ; ptr to last vpalette entry
        MOV cnt, #19 ; counter
.clr TST sup, bm, LSL cnt ; s-bit for this palette entry
        LDRB val, [ptr, #1]
        AND val, val, #&7F
        STRB val, [ptr, #1]
        SWI "OS_Word"
        SUB ptr, ptr, #5
        SUBS cnt, cnt, #1
        BPL clr

        ; Do sets after clrs to ensure that if any colour in a group
        ; is set, all will be. If we did set/clr together, might
        ; finish a group with a clear.

        ADD ptr, vptr, #95 ; ptr to last vpalette entry
        MOV cnt, #19 ; counter
.set TST bm, sup, LSR cnt ; s-bit for this palette entry
        LDRNEB val, [ptr, #1]
        ORRNE val, val, #&80
        STRNEB val, [ptr, #1]
        SWINE "OS_Word"
.next SUB ptr, ptr, #5
        SUBS cnt, cnt, #1
        BPL set

        ; If there is a current colour, and it should be clear, then
        ; we need to clear it explicitly in case it's been set as part
        ; of a group which is set

        TST ccol, ccol ; see if there IS a current colour
        BMI newsup
        ADD ptr, ccol, ccol, ASL#2 ; if so, point to vpalette%+ccol*5
        ADD ptr, ptr, vptr
        LDRB val, [ptr, #1] ; get logical colour
        ORR val, val, #&80
        TST sup, bm, LSL ccol ; should it be set ?
        ANDEQ val, val, #&7F ; clear supremacy if not
        STRB val, [ptr, #1]
        SWI "OS_Word"

        ; now we re-get supremacy in case of interactions above

.newsup ADD vptr, vptr, #95 ; ptr to final vpalette entry
        MOV cnt, #19 ; counter
        MOV val, #0
.nsloop LDRB R0, [vptr] ; logical colour
        LDRB R1, [vptr, #1] ; supremacy+programming info
        AND R1, R1, #&7F ; just programming info
        SWI "OS_ReadPalette"
        AND R2, R2, #&80 ; return just supremacy
        ADD val, R2, val, LSL#1 ; shift into new supremacy word
        AND R0, bm, sup, LSR cnt ; corresponding bit in old word
        TEQ R0, R2 ; see if same
        BLNE toggle
        SUB vptr, vptr, #5
        SUBS cnt, cnt, #1
        BPL nsloop

        STR val, [sptr]
        LDMFD (sp)!, {PC} ; pop PC to return

.toggle ADR R1, wimp%+1024
        SUB R1, R1, #1024
        STR R7, [R1] ; wimp%!0=windowhandle%
        STR cnt, [R1, #4] ; wimp%!4=icon% or cnt (ie R6)
        CMP cnt, #16
        MOVLT R11, #&00000005 ; depending on which icon,
        MOVGE R11, #&77000000 ; change different things
        STR R11, [R1, #8] ; wimp%!8=icon flags EOR word
        MOV R11, #0
        STR R11, [R1, #12] ; wimp%!12=icon flags clear word
        SWI "Wimp_SetIconState"
        MOVS pc, link

.getpal MVN R0, #0 ; get bits-per-pixel for mode#-1
        MOV R1, #9
        SWI "OS_ReadModeVariable"
        MOV bpp, R2 ; save Log2BPP
        ADR wptr, wpalette%
        MOV R1, wptr
        SWI "Wimp_ReadPalette" ; get wimp palette mappings
        ADR vptr, vpalette%
        ADD vptr, vptr, #95
        MOV cnt, #19
.pal CMP cnt, #16
        LDRMIB log, [wptr, cnt, LSL#2] ; get colour programming info
        ANDPL log, cnt, #7 ; for 16-19, log=cnt MOD 16
        MOVMI phys, #16
        MOVEQ phys, #24
        MOVHI phys, #25
        BPL lc_ok
        CMP bpp, #3 ; if 256 colours, GCOL => LogColNo
        ANDEQ tmp, log, #&40
        ANDEQ log, log, #7
        ADDEQ log, log, tmp, LSR#3
.lc_ok STRB log, [vptr]
        SWI "OS_ReadPalette"
        BIC R2, R2, #&1F ; correct physical colour
        ADD R2, R2, phys
        MOV tmp, #3
.byte STRB R2, [vptr, #1]! ; save RGB, prog info, supremacy
        MOV R2, R2, LSR#8
        SUBS tmp, tmp, #1
        BPL byte
        SUB vptr, vptr, #9
        SUBS cnt, cnt, #1
        BPL pal
        MOV pc, link

        ; claims upcall to permit OS_ChangeDynamicArea
        ; as it does no checking, it must only be enabled immediately prior
        ; to calling OS_ChangeDynamicArea, and disabled immediately
thereafter

.upcall MOV R0, #0
        LDMFD R13!, {PC}
]
NEXT pass%
ENDPROC

-- 
Pete						Peter Turnbull
						Dept. of Computer Science
						University of York
Received on Mon Apr 17 2000 - 19:50:14 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:32:41 BST