home *** CD-ROM | disk | FTP | other *** search
RISC OS BBC BASIC V Source | 1996-04-20 | 2.4 KB | 61 lines |
- > SourceAsm
- Assemble and save ARM code routines for SwiftJPEG.
- (C) Hipposoft 1996
- $+" at line "+
- The codesize% variable holds the amount of space the raw
- ARM code should take. The variable% variable holds the
- number of new variables you wish to 'link' between this
- generator and the loading application - this allows the
- relative addresses of each routine to be tagged onto the
- end of the file, and read in (in the same order as written,
- obviously, so this isn't a totally automatic process by
- any means) when the loader application initialises.
- Clearly, codesize% must be a multiple of 4; variable% can
- be any integer greater than zero.
- If codesize% isn't big enough you'll be warned about it,
- but the value of variable% is not checked in any way.
- The resultant filesize will be codesize%+variable%*4+4 bytes,
- with the first word holding the value codesize%+4.
- So it is intended that the loader should read the first word,
- allocate this word-4 bytes, load the next (word-4) bytes into
- that block, then use the variable% remaining words as
- pointers to read or write, as offsets within the block it
- allocated.
- codesize%=52
- variable%=4
- This section shouldn't need altering.
- gam% 256,mc% codesize%+variable%*4+4
- !mc%=codesize%+4
- assemble(mc%+4,codesize%)
- List the variables here...
- !(mc%+!mc%+0)=gammtred
- !(mc%+!mc%+4)=gammtgre
- !(mc%+!mc%+8)=gammtblu
- !(mc%+!mc%+12)=gammawrite
- The rest shouldn't need to be altered either.
- a%=0
- variable%-1
- 5)mc%!(!mc%+a%*4)=mc%!(!mc%+a%*4)-mc%-4
- "Save <SwiftJPEG$Dir>.ARMcode "+
- ~mc%+" + "+
- ~(!mc%+variable%*4)
- "SetType <SwiftJPEG$Dir>.ARMcode FFD"
- assemble(c%,d%)
- a%=8
- A P%=c%
- L%=c%+d%
- [OPT a%
- .gammtred EQUD 0
- .gammtgre EQUD 0
- .gammtblu EQUD 0
- J3.gammawrite STMFD R13!,{R0-R2,R4,R9,R14}
- L# MOV R0,#19
- M& SWI "OS_Byte"
- O( LDR R0,gammtred
- P( LDR R1,gammtgre
- Q( LDR R2,gammtblu
- R$ MOV R4,#&09
- S$ MOV R9,#&23
- T- SWI "OS_CallAVector"
- V2 LDMFD R13!,{R0-R2,R4,R9,PC}
-