home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
programs
/
misc
/
watchtv
/
!WatchTV
/
s
/
tvuk
< prev
next >
Wrap
Text File
|
1997-06-15
|
2KB
|
96 lines
; TVUK module v1.00 by Vincent Lefèvre - 15/06/1997
GET h:RegNames
GET h:SWINames
NCHAN EQU 100 ;Number of channels (even number).
AREA TVUK, CODE, PIC, READONLY
ENTRY
BaseAddr DCD 0
DCD RM_Init -BaseAddr
DCD 0
DCD 0
DCD RM_Title -BaseAddr
DCD RM_Help -BaseAddr
DCD 0
DCD &04E840
DCD RM_Handler-BaseAddr
DCD RM_SWIdec -BaseAddr
DCD 0
unknown DCD &1E6
DCB "Unknown TVUK SWI",0
RM_Title DCB "TVUK",0
RM_Help DCB "TVUK",9,9,"1.00 (15 Jun 1997)",0
RM_SWIdec DCB "TV",0
DCB "Channel",0
DCB "TuneChannel",0
DCB 0
too_high DCD 0
DCB "Channel too high",0
bad_freq DCD 0
DCB "Bad channel frequency",0
RM_Init STMFD SP!, {LR}
LDR R0, [R12]
TEQ R0, #0
LDMNEFD SP!, {PC} ;Return if reinit.
MOV R0, #6
MOV R3, #2*NCHAN
SWI XOS_Module ;Claim.
LDMVSFD SP!, {PC} ;Error if not enough memory.
STR R2, [R12] ;R2: pointer to workspace.
MOV R0, #0
init_loop STR R0, [R2], #4 ;Clear the tune data.
SUBS R3, R3, #4
BNE init_loop
LDMFD SP!, {PC}
RM_Handler CMP R11, #2
ADDCC PC, PC, R11, LSL #2
B unknown_swi
B Channel
B TuneChannel
unknown_swi ADR R0, unknown
ORRS PC, LR, #VFlag
Channel CMP R0, #NCHAN
ADRCS R0, too_high
ORRCSS PC, LR, #VFlag ;Error if channel too high.
LDR R1, [R12] ;R1: pointer to workspace.
MOV R10, LR
LDRB R6, [R1, R0, LSL #1]
MOV R2, #2
ADD R1, R1, R0, LSL #1
MOV R0, #&C2
TEQ R6, #0
SWINE XIIC_Control
MOV PC, R10
TuneChannel CMP R0, #NCHAN
ADRCS R0, too_high
ORRCSS PC, LR, #VFlag ;Error if channel too high.
LDR R12, [R12] ;R12: pointer to workspace.
CMP R2, #64
MOVGT R2, #64 ;Fine tune <= 64.
CMP R2, #-64
MOVLT R2, #-64 ;Fine tune >= -64.
CMP R1, #21
RSBCS R6, R1, #69
ADRCC R0, bad_freq ;Error if freq < 21
ORRCCS PC, LR, #VFlag ;or freq > 69.
ADD R4, R12, R0, LSL #1
MOV R3, #&1500
ADD R3, R3, #&62
ADD R3, R3, R1, LSL #7
ADD R3, R3, R2
STRB R3, [R4, #1]
MOV R3, R3, LSR #8
STRB R3, [R4]
MOV PC, LR
END