home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
hensa
/
drivers
/
autovidc_1
/
Source100
(
.txt
)
< prev
Wrap
RISC OS BBC BASIC V Source
|
1995-02-24
|
10KB
|
260 lines
> <VidcEnh>.Source
VIDC-Enhancer-Umschalter
Schaltet die Leitung AUX1 auf aktiv-1 in bestimmten Bildschirmmodi.
Das Originalprogramm musste unbedingt umgebaut werden, weil es nicht
bei Mode 12 oder aehnlichen zugeschaltet hat und nicht konfigurierbar war.
Version 0.99
- Ruft auch bei Init den Modus ab.
- Untersucht eine interne Tabelle und stellt danach Aux1 ein.
Version 1.00
- Befehle eingebaut um Konfiguration abzufragen und zu aendern.
- Hardware wird geprueft, ob der richtige Rechner vorliegt.
Hardwarepruefung durch OS_ReadSysInfo 2 (PRM 1-722)
Gibt's nicht im RO2 --> alte Hardware automatisch.
Wenn vorhanden, dann muessen R0-R4 = 0 sein, sonst neue Hardware.
code% 2048
"*** Error: "
$" in "
name$ = "RAM:$.AutoVIDC"
version$ = "1.00"
date$ = "24 Feb 1995"
modname$ = "AutoVIDC"
OS_WriteI = &100
XOS_WriteI = &100 + (1<<17)
*Key 1 AutoVIDCmap
*Key 2 AutoVIDCset
*Key 3 RAM:AutoVIDC
"Assembling :"
Pass% = 4
O%=code%:P%=&00000000
[OPT Pass%
.Start%
*( EQUD &00000000 ; Start
+' EQUD Init% ; Init
,' EQUD &00000000 ; Fini
-0 EQUD Service% ; Service-Calls
./ EQUD Title% ; Title-String
/. EQUD Help% ; Help String
08 EQUD Comands% ; Keywords & help table
18 EQUD &00000000 ; SWI chunk base number
22 EQUD &00000000 ; SWI Handlercode
35 EQUD &00000000 ; SWI Decoding Table
44 EQUD &00000000 ; SWI Decoding Code
.Title%
EQUS modname$
EQUB &00
.Help%
EQUS modname$ +
:* EQUS version$ + " (" + date$ + ")"
EQUB &00
ALIGN
.Comands%
?2 EQUS modname$ +
0 ; Command-string
ALIGN
A3 EQUD &00000000 ; command-code
B7 EQUD &00000000 ; Information-word
C= EQUD &00000000 ; invalid-syntax-message
D0 EQUD helpme% ; help-text
EQUS "AutoVIDCmap" +
ALIGN
EQUD map%
EQUD 0
EQUD 0
EQUD helpmap%
EQUS "AutoVIDCset" +
ALIGN
EQUD Set%
PE EQUD 1 + (128<<16) ; min. + max. no. of parameters.
EQUD syntaxSet%
EQUD helpSet%
T> EQUD &00000000 ; Command = 0 = EndofList
.helpme%
EQUS modname$ +
X* EQUS version$ + " (" + date$ + ")"
Y$ EQUS "
Andreas Barth" +
ZH EQUS "Listens to Mode-changes and sets AUX1 accordingly to its "
[I EQUS "internal modelist to 'active 1' to enable a VIDC enhancer."
EQUB &00
.helpmap%
_U EQUS "AutoVIDCmap shows the map of the current settings for each screenmode."
`X EQUS " The Format ist 'Map: <Modenumber>+ <Modenumber>- ...' for all 128 Modes."
aB EQUS " The + and - shows whether Aux1 is switched or not."
EQUB 0
.helpSet%
eQ EQUS "AutoVIDCset <Modenumber><+|-> [...] changes the setting for one or"
f6 EQUS " more screenmodes to '+'=ON or '-'=OFF."
EQUB 0
.syntaxSet%
j7 EQUS "use *AutoVIDCset <Modenumber><+|-> [...]"
EQUB 0
ALIGN
n?.LatBShadow% EQUD &00000105 ; contains Value of LatchB
oA.LatchB% EQUD &03350018 ; Hardware address of LatchB
; Here's the Mode-List
qK; Lowest bit is for Mode 0, going up, every line has 32 bits and modes.
r7; 31-----------------------------0
s7.ModeList% EQUD %11100000000000000000000000000000
t7 EQUD %00000000000000000000000000000001
u7 EQUD %00000000000000000000000000000000
v7 EQUD %00000000000000000000000000000000
x*; I've marked mode 32 as 'enhanced'...
; Initialisation code
|D; Check the Hardware. We can only run on old machines which have
}J; the Aux-Hardware installed. Otherwise we fuddle in unknown hardware.
~0; RO2 would be ok, only old machines got it.
1; Otherwise not features should be displayed.
.Init%
STMFD R13!,{R0-R4,R14}
A MOV R0,#2 ; Read Chip presence and ID.
@ SWI "XOS_ReadSysInfo" ; (doesn't exist under RO2)
5 BVS itsreallyold% ; RO2 is okay...
D
R R0,R0,R1 ; It exists, so test the values.
R R0,R0,R2
R R0,R0,R3
I
RS R0,R0,R4 ; is > 0, if new hardware is present.
BEQ itsreallyold%
LDMFD R13!,{R0-R4,R14}
ADR R0,initerror%
;
RS PC,R14, #1<<28 ; Set V-flag and return
.itsreallyold%
LDMFD R13!,{R0-R4,R14}
.ReInit%
; MOV R1,#&46 ; Let's do our service
; Service Call handler
(; We only check for a Mode-change...
.Service%
STMFD R13!,{R0-R2,R14}
9 TEQ R1,#&46 ; Service_ModeChange
LDMNEFD R13!,{R0-R2,PC}^
6 MOV R0,#&87 ; get Mode-number
0 SWI "XOS_Byte" ; now in R2
,; Now check if this mode has its Bit set
R2,R2,#127
ADR R0,ModeList%
? ADD R0,R0,R2,LSR #3 ; Tablebase + (Mode /32*4)
P BIC R0,R0,#3 ; Clear lowest 2 Bits. (now necessary here)
8 LDR R0,[R0] ; get part of Table
6
R2,R2,#31 ; mask shift amount
: ADD R2,R2,#1 ; always shift one !!
D MOVS R0,R0,LSR R2 ; shift Tablebit into Carryflag
-; Now the carryflag contains the Mode-bit
; and is '1' for VIDC-mode
D LDR R0,LatBShadow% ; Load address of Aux1-contents
D LDR R1,LatchB% ; Load address of Aux1-Hardware
7 LDRB R2,[R0,#0] ; Load Aux1-Shadow
3
RCS R2,R2,#&20 ; set Aux1-Bit.
6 BICCC R2,R2,#&20 ; reset Aux1-Bit.
6 STRB R2,[R0,#0] ; set Aux1-Shadow
8 STRB R2,[R1,#0] ; set Aux1-Hardware
LDMFD R13!,{R0-R2,PC}^
L; AutoVIDCmap shows the map of the current settings for each screenmode.
N; The Format ist 'Map; <Modenumber>+ <Modenumber>- ...' for all 128 Modes.
8; The + and - shows whether Aux1 is switched or not.
.map%
STMFD R13!,{R0-R6,R14}
SWI "XOS_WriteS"
EQUS " Map: "+
ALIGN
1 MOV R4,#0 ; Modenumber
6 ADR R5,ModeList% ; Pointer to Map.
.stloop1%
V LDR R6,[R5],#4 ; Load first Byte from Map and increment pointer.
.stloop2%
; print modenumber
MOV R0,R4
ADR R1,buffer%
MOV R2,#8
& SWI "XOS_ConvertCardinal1"
SWI "XOS_Write0"
; decode map setting
C MOVS R6,R6,LSR #1 ; shift lowest bit into carry.
! SWICC XOS_WriteI +
! SWICS XOS_WriteI +
SWI XOS_WriteI + 32
; finish the loops
; ADD R4,R4,#1 ; increment modenumber
: CMP R4,#128 ; all modes printed ?
SWIEQ "XOS_NewLine"
LDMEQFD R13!,{R0-R6,PC}
? CMP R4,#32 ; check for boundaries and
CMPNE R4,#64
CMPNE R4,#96
BNE stloop2%
9 BEQ stloop1% ; get next mapentry.
I; AutoVIDCset <Modenumber><+|-> [...] changes the setting for one or"
*; more screenmodes to '+'=
or '-'=
.Set%
STMFD R13!,{R0-R6,R14}
; MOV R4,R1 ; number of parameters
8 MOV R1,R0 ; pointer to string
.setloop%
< CMP R4,#0 ; any parameters left ?
LDMEQFD R13!,{R0-R6,R14}
I BEQ ReInit% ; do a new init, maybe we changed...
< SUB R4,R4,#1 ; decrement parameters.
; Scan for modenumber
S MOV R0,#10 ; base; R1 is still pointing to next argument.
4 MOV R2,#127 ; maximum value
" SWI "XOS_ReadUnsigned"
3 LDMVSFD R13!,{R0-R6,R14} ; Any errors ?
ADR R0,seterror%
;
RVSS PC,R14, #1<<28 ; Set V-flag and return
< CMP r2,#128 ; is it a valid value ?
ADDCS R1,R1,#1
6 BCS setloop% ; No, then ignore
; Get the mode-bit ready
5 ADR R0,ModeList% ; Get Tablebase.
? ADD R0,R0,R2,LSR #3 ; Tablebase + (Mode /32*4)
; BIC R0,R0,#3 ; Clear lowest 2 Bits.
= LDR R5,[R0] ; get this part of Table
F MOV R3,#1 ; This is our bit for that entry,
6
R2,R2,#31 ; mask shift amount
I MOV R3,R3,LSL R2 ; shift our bit to correct position.
' ; Check the sign for '+' or '-'
@ ldrb r2,[r1] ; load the signal-character
3 cmp r2,#
"+" ; and decide....
<
Req R5,R5,R3 ; ...Set the bit to one.
' cmp r2,#
"-" ; or
@ BICeq R5,R5,R3 ; ...Reset the bit to zero.
" ; Store the mode-bit again
STR R5,[R0]
S ADD R1,R1,#1 ; Increment string-pointer for next parameter.
B setloop%
.initerror%
EQUD 0
M EQUS "AutoVIDC is only suitable for older Archimedes computers using"
' EQUS " a VIDC-Enhancer !!" +
ALIGN
.seterror%
EQUD 0
0 EQUS "Bad data in command string !" +
ALIGN
.buffer%
EQUD 0
EQUD 0
EQUD 0
.End%
"Pass ";Pass%;" successful..."
Pass%
"SAVE "+name$+" "+
~(code%)+" "+
~(O%)
"SETTYPE "+name$+" &FFA"
"SAVEd "+name$+" "+
~(code%)+" "+
~(O%)
"*Filer_OpenDir RAM::RamDisc0.$