home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / programs / misc / watchtv / !WatchTV / s / tvuk < prev    next >
Text File  |  1997-06-15  |  2KB  |  96 lines

  1. ; TVUK module v1.00 by Vincent Lefèvre - 15/06/1997
  2.  
  3.         GET    h:RegNames
  4.         GET    h:SWINames
  5.  
  6. NCHAN        EQU    100    ;Number of channels (even number).
  7.  
  8.         AREA    TVUK, CODE, PIC, READONLY
  9.         ENTRY
  10.  
  11. BaseAddr    DCD    0
  12.         DCD    RM_Init   -BaseAddr
  13.         DCD    0
  14.         DCD    0
  15.         DCD    RM_Title  -BaseAddr
  16.         DCD    RM_Help   -BaseAddr
  17.         DCD    0
  18.         DCD    &04E840
  19.         DCD    RM_Handler-BaseAddr
  20.         DCD    RM_SWIdec -BaseAddr
  21.         DCD    0
  22.  
  23. unknown        DCD    &1E6
  24.         DCB    "Unknown TVUK SWI",0
  25. RM_Title    DCB    "TVUK",0
  26. RM_Help        DCB    "TVUK",9,9,"1.00 (15 Jun 1997)",0
  27. RM_SWIdec    DCB    "TV",0
  28.         DCB    "Channel",0
  29.         DCB    "TuneChannel",0
  30.         DCB    0
  31. too_high    DCD    0
  32.         DCB    "Channel too high",0
  33. bad_freq    DCD    0
  34.         DCB    "Bad channel frequency",0
  35.  
  36. RM_Init        STMFD    SP!, {LR}
  37.         LDR    R0, [R12]
  38.         TEQ    R0, #0
  39.         LDMNEFD    SP!, {PC}        ;Return if reinit.
  40.         MOV    R0, #6
  41.         MOV    R3, #2*NCHAN
  42.         SWI    XOS_Module        ;Claim.
  43.         LDMVSFD    SP!, {PC}        ;Error if not enough memory.
  44.         STR    R2, [R12]        ;R2: pointer to workspace.
  45.         MOV    R0, #0
  46. init_loop    STR    R0, [R2], #4        ;Clear the tune data.
  47.         SUBS    R3, R3, #4
  48.         BNE    init_loop
  49.         LDMFD    SP!, {PC}
  50.  
  51. RM_Handler    CMP    R11, #2
  52.         ADDCC    PC, PC, R11, LSL #2
  53.         B    unknown_swi
  54.         B    Channel
  55.         B    TuneChannel
  56.  
  57. unknown_swi    ADR    R0, unknown
  58.         ORRS    PC, LR, #VFlag
  59.  
  60. Channel        CMP    R0, #NCHAN
  61.         ADRCS    R0, too_high
  62.         ORRCSS    PC, LR, #VFlag        ;Error if channel too high.
  63.         LDR    R1, [R12]        ;R1: pointer to workspace.
  64.         MOV    R10, LR
  65.         LDRB    R6, [R1, R0, LSL #1]
  66.         MOV    R2, #2
  67.         ADD    R1, R1, R0, LSL #1
  68.         MOV    R0, #&C2
  69.         TEQ    R6, #0
  70.         SWINE    XIIC_Control
  71.         MOV    PC, R10
  72.  
  73. TuneChannel    CMP    R0, #NCHAN
  74.         ADRCS    R0, too_high
  75.         ORRCSS    PC, LR, #VFlag        ;Error if channel too high.
  76.         LDR    R12, [R12]        ;R12: pointer to workspace.
  77.         CMP    R2, #64
  78.         MOVGT    R2, #64            ;Fine tune <= 64.
  79.         CMP    R2, #-64
  80.         MOVLT    R2, #-64        ;Fine tune >= -64.
  81.         CMP    R1, #21
  82.         RSBCS    R6, R1, #69
  83.         ADRCC    R0, bad_freq        ;Error if freq < 21
  84.         ORRCCS    PC, LR, #VFlag        ;or freq > 69.
  85.         ADD    R4, R12, R0, LSL #1
  86.         MOV    R3, #&1500
  87.         ADD    R3, R3, #&62
  88.         ADD    R3, R3, R1, LSL #7
  89.         ADD    R3, R3, R2
  90.         STRB    R3, [R4, #1]
  91.         MOV    R3, R3, LSR #8
  92.         STRB    R3, [R4]
  93.         MOV    PC, LR
  94.  
  95.         END
  96.