Re: A89: map routines


[Prev][Next][Index][Thread]

Re: A89: map routines




Depends on the ouput you want... I have a decent 8x8 tile 2 plane
routine that could be easily modified to do any size tiles and plane
count. Btw, it also supports having the screen be a arbitrary section of
tiles in a large tilemap...

DrawScreenWidth equ 16  ; Tile count horizontally
DrawScreenHeight equ 12 ; Tile count vertically
MapWidth equ 50         ; Tilemap width

GetScreenXY macro ;In: d0 = X, d1 = Y Out: \1 = loc
   mulu #MapWidth,d1
   add d0,d1
   move.l curMap,\1
   add d1,\1
 endm

drawCurScreen:
   move.w curScreenX,d0
   move.w curScreenY,d1
   GetScreenXY a5

   move.w #DrawScreenWidth-1,d6 ;X
   move.w #DrawScreenHeight-1,d7 ;Y
drawTileMapLoop:
   clr.w d0
   move.b (a5),d0
   mulu #16,d0
   lea Tiles(pc),a0
   add d0,a0

   move.w #DrawScreenWidth-1,d0
   sub d6,d0
;   mulu #8,d0
   move.w #DrawScreenHeight-1,d1
   sub d7,d1
   mulu #8,d1
   mulu #30,d1
   add d0,d1

   move.l graphlib::plane0,a1
   add d1,a1
   move.w #7,d5
copyloop:
   move.b (a0)+,(a1)+
   add #29,a1
   dbra.b d5,copyloop

   clr.w d0
   move.b (a5),d0
   mulu #16,d0
   add #8,d0
   lea Tiles(pc),a0
   add d0,a0

   move.w #DrawScreenWidth-1,d0
   sub d6,d0
;   mulu #8,d0
   move.w #DrawScreenHeight-1,d1
   sub d7,d1
   mulu #8,d1
   mulu #30,d1
   add d0,d1

   move.l graphlib::plane1,a1
   add d1,a1
   move.w #7,d5
copyloop2:
   move.b (a0)+,(a1)+
   add #29,a1
   dbra.b d5,copyloop2

   add #1,a5
   dbra d6,drawTileMapLoop
   move.w #DrawScreenHeight-1,d1
   sub d7,d1
   move.w curScreenX,d0
   GetScreenXY a5
   move.w #DrawScreenWidth-1,d6
   dbra d7,drawTileMapLoop
   rts

-- 
Scott "_Wrath_" Dial
wrath@calc.org
ICQ#3608935
Member of TCPA - tcpa.calc.org
__________________________________________
NetZero - Defenders of the Free World
Get your FREE Internet Access and Email at
http://www.netzero.net/download/index.html


References: