Advertisement
vladikcomper

Sandbox 2 - UI code

Mar 13th, 2012
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     lea VDP_Ctrl,a1
  2.     lea -4(a1),a2   ; VDP_Data
  3.  
  4.     vram    _Nametbl_UI,d7  ; d7 = VRAM offset
  5.     move.b  TabID,d0
  6.     andi.w  #7,d0
  7.     add.w   d0,d0       ; d0 = Active Tab * 2
  8.     moveq   #0,d1       ; d1 = Current Tab * 2
  9.     moveq   #0,d2       ; d2 = Row ID * 2
  10.  
  11. @DoRow:
  12.     move.l  d7,(a1)     ; setup VDP access
  13.     move.w  #_Font1PatBase|_pal2|_pr,(a2)   ; Solid bar
  14.  
  15. @DoTab:
  16.     lea @ActiveTabData,a0
  17.     cmp.w   d0,d1       ; is it active tab?
  18.     beq.s   @Skip
  19.     lea @InactiveTabData,a0
  20. @Skip   adda.w  @TabData_Offsets(pc,d2.w),a0    ; a0 = tab patterns data
  21.     lea @LabelsList,a3
  22.     adda.w  (a3,d1.w),a3    ; a3 = label text
  23.     jsr @RowRoutines(pc,d2.w)
  24.     addq.w  #2,d1       ; next tab
  25.     cmpi.w  #_NumTabs*2,d1  ; is current tab the last?
  26.     bcs.s   @DoTab      ; if not branch
  27.     moveq   #0,d1
  28.  
  29.     addi.l  #$80<<16,d7 ; next row
  30.     addq.w  #2,d2                      
  31.     cmpi.w  #4*2,d2     ; is current row the last?
  32.     beq.s   @Return     ; if not, branch
  33.     move.l  #((_Font1PatBase|_pal2|_pr)<<16)|(_Font1PatBase|_pal2|_pr),(a2) ; 2 Solid bar tiles
  34.     cmpi.w  #3*2,d2     ; is next row last?
  35.     bne.s   @DoRow
  36.  
  37. ; ----------------------------------------------------------
  38.     ; Row 03 specific code
  39.     move.l  d7,(a1)     ; setup VDP access
  40.     move.w  #_UIPatBase+1|_pal3|_pr|_fv,(a2)    ; Pattern
  41.     bra.s   @DoTab
  42.  
  43. @Return:
  44.     move.l  #((_UIPatBase+1|_pal3|_pr|_fv)<<16)|(_UIPatBase+1|_pal3|_pr|_fv),(a2)   ; 2 patterns
  45.     rts
  46.  
  47. ; ----------------------------------------------------------
  48. @TabData_Offsets:
  49.     dc.w    @F0-@ActiveTabData  ; $00
  50.     dc.w    @F1-@ActiveTabData  ; $02
  51.     dc.w    @F1-@ActiveTabData  ; $04
  52.     dc.w    @F2-@ActiveTabData  ; $06
  53.  
  54. ; ----------------------------------------------------------
  55. @RowRoutines:
  56.     bra.s   @Tab_Top        ; $00
  57.     bra.s   @Tab_Text_Row1      ; $02
  58.     bra.s   @Tab_Text_Row2      ; $04
  59.     bra.s   @Tab_Bottom     ; $06
  60.  
  61. ; ----------------------------------------------------------
  62. @Tab_Top:
  63.     move.w  (a0)+,(a2)  ; left corner
  64.     moveq   #0,d3
  65.     move.b  (a3),d3     ; d3 = tab len
  66.     move.w  (a0)+,d4    ; d4 = pattern
  67.  
  68. @0  move.w  d4,(a2)     ; fill middle
  69.     dbf d3,@0
  70.  
  71.         move.w  (a0)+,(a2)  ; right corner
  72.     rts
  73.  
  74. ; ----------------------------------------------------------
  75. @Tab_Bottom:
  76.     move.w  (a0)+,(a2)  ; corner
  77.     moveq   #0,d3
  78.     move.b  (a3)+,d3    ; d3 = tab len
  79.     move.w  (a0)+,d4    ; d4 = fill pattern
  80.  
  81. @3  move.w  d4,(a2)
  82.     dbf d3,@3
  83.    
  84.     move.w  (a0)+,(a2)  ; corner
  85.     rts
  86.  
  87. ; ----------------------------------------------------------
  88. @Tab_Text_Row1:
  89.     moveq   #0,d6       ; d6 = row index
  90.     bra.s   @Tab_Text
  91.  
  92. @Tab_Text_Row2:
  93.     moveq   #1,d6
  94.  
  95. @Tab_Text:
  96.     move.w  (a0)+,d3    ; left corner base
  97.     add.w   d6,d3
  98.     move.w  d3,(a2)
  99.     moveq   #0,d3
  100.     move.b  (a3)+,d3    ; d3 = tab len
  101.     move.w  (a0)+,d4    ; d4 = pattern base
  102.  
  103. @2  moveq   #0,d5
  104.     move.b  (a3)+,d5    ; load letter tile
  105.     add.w   d4,d5       ; add pattern base
  106.     add.w   d6,d5       ; add row index
  107.     move.w  d5,(a2)     ; output tile
  108.     dbf d3,@2
  109.    
  110.     move.w  (a0),d3     ; corner
  111.     add.w   d6,d3
  112.     move.w  d3,(a2)
  113.     rts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement