home *** CD-ROM | disk | FTP | other *** search
/ Dream 44 / Amiga_Dream_44.iso / RiscPc / jeux / biohazard.arc / s / Map < prev    next >
Text File  |  1995-03-26  |  12KB  |  519 lines

  1. ; Use the GET directive to include register definitions as if typed here
  2.  
  3.       KEEP
  4.           GET     h.WolfReg
  5.  
  6. ; Use the GET directive to include a list of SWI names as if typed here
  7.  
  8.           GET     h.SWInames
  9.  
  10. ; Area name C$$code advisable as wanted to link with C output
  11.  
  12.           AREA    |C$$code|, CODE, READONLY
  13.  
  14. ; Export global symbols
  15.  
  16.       EXPORT  |PlotMap|
  17.       EXPORT  |DrawNumber|
  18.  
  19. PltMapX   DCB     "PlotMap", 0
  20.           ALIGN
  21. PltMapY   DCD     &ff000000 + PltMapY - PltMapX
  22.  
  23. ;on entry
  24. ;
  25. ; r0 = pointer to data block where :-
  26. ;
  27. ; 0 = pointer to x1
  28. ; 1 = pointer to y1
  29. ; 2 = screen address (of the first line to draw on)
  30. ; 3 = pointer to map data to use as map.
  31. ;        This is simply a 64x64 block of data
  32. ; 4 = x pixel increment
  33. ; 5 = y pixel increment
  34. ; 6 = x line increment
  35. ; 7 = y line increment
  36.  
  37. |PlotMap|
  38.       STMFD   r13!,{r0-r12,link}
  39.       ;LDMFD   r13!,{r0-r12,pc}
  40.  
  41.       ;load up block data
  42.           MOV     r14,r0
  43.           LDMIA   r14,{r0-r5}
  44.  
  45.           ;set outer counter
  46.           MOV     r12,#192<<16
  47.  
  48. Outer_Draw_Line
  49.       ;set inner counter
  50.           ORR     r12,r12,#192
  51.  
  52. Draw_Line
  53.           ;clear registers
  54.           MOV     r8,#0
  55.           MOV     r9,#0
  56.           MOV     r10,#0
  57.           MOV     r11,#0
  58.  
  59.       ;check limits of x and y
  60.           CMP     r0,#64<<16
  61.           BGE     skip_1
  62.           CMP     r0,#0
  63.           BLT     skip_1
  64.  
  65.           CMP     r1,#64<<16
  66.           BGE     skip_1
  67.           CMP     r0,#0
  68.           BLT     skip_1
  69.  
  70.       ;construct address from x & y values
  71.           MOV     r6,r0,ASR #16
  72.           MOV     r7,r1,ASR #16
  73.           ADD     r6,r6,r7,LSL #6
  74.  
  75.           ;load byte from map + (x + 64(y))
  76.           LDRB    r8,[r3,r6]
  77.  
  78. skip_1    ;update x & y
  79.           ADD     r0,r0,r4
  80.           ADD     r1,r1,r5
  81.  
  82.  
  83.       ;load byte 2 word 1
  84.       ;check limits of x and y
  85.           CMP     r0,#64<<16
  86.           BGE     skip_2
  87.           CMP     r0,#0
  88.           BLT     skip_2
  89.  
  90.           CMP     r1,#64<<16
  91.           BGE     skip_2
  92.           CMP     r0,#0
  93.           BLT     skip_2
  94.  
  95.       ;construct address from x & y values
  96.           MOV     r6,r0,ASR #16
  97.           MOV     r7,r1,ASR #16
  98.           ADD     r6,r6,r7,LSL #6
  99.  
  100.           ;load byte from map + (x + 64(y))
  101.           LDRB    r9,[r3,r6]
  102.           ORR     r8,r8,r9,LSL #8
  103.  
  104. skip_2    ;update x & y
  105.           ADD     r0,r0,r4
  106.           ADD     r1,r1,r5
  107.  
  108.  
  109.       ;load byte 3 word 1
  110.       ;check limits of x and y
  111.           CMP     r0,#64<<16
  112.           BGE     skip_3
  113.           CMP     r0,#0
  114.           BLT     skip_3
  115.  
  116.           CMP     r1,#64<<16
  117.           BGE     skip_3
  118.           CMP     r0,#0
  119.           BLT     skip_3
  120.  
  121.       ;construct address from x & y values
  122.           MOV     r6,r0,ASR #16
  123.           MOV     r7,r1,ASR #16
  124.           ADD     r6,r6,r7,LSL #6
  125.  
  126.           ;load byte from map + (x + 64(y))
  127.           LDRB    r9,[r3,r6]
  128.           ORR     r8,r8,r9,LSL #16
  129.  
  130. skip_3    ;update x & y
  131.           ADD     r0,r0,r4
  132.           ADD     r1,r1,r5
  133.  
  134.       ;load byte 4 word 1
  135.       ;check limits of x and y
  136.           CMP     r0,#64<<16
  137.           BGE     skip_4
  138.           CMP     r0,#0
  139.           BLT     skip_4
  140.  
  141.           CMP     r1,#64<<16
  142.           BGE     skip_4
  143.           CMP     r0,#0
  144.           BLT     skip_4
  145.  
  146.       ;construct address from x & y values
  147.           MOV     r6,r0,ASR #16
  148.           MOV     r7,r1,ASR #16
  149.           ADD     r6,r6,r7,LSL #6
  150.  
  151.           ;load byte from map + (x + 64(y))
  152.           LDRB    r9,[r3,r6]
  153.           ORR     r8,r8,r9,LSL #24
  154.  
  155. skip_4    ;update x & y
  156.           ADD     r0,r0,r4
  157.           ADD     r1,r1,r5
  158.  
  159.       ;load byte 1 word 2
  160.       ;check limits of x and y
  161.           CMP     r0,#64<<16
  162.           BGE     skip_5
  163.           CMP     r0,#0
  164.           BLT     skip_5
  165.  
  166.           CMP     r1,#64<<16
  167.           BGE     skip_5
  168.           CMP     r0,#0
  169.           BLT     skip_5
  170.  
  171.       ;construct address from x & y values
  172.           MOV     r6,r0,ASR #16
  173.           MOV     r7,r1,ASR #16
  174.           ADD     r6,r6,r7,LSL #6
  175.  
  176.           ;load byte from map + (x + 64(y))
  177.           LDRB    r9,[r3,r6]
  178.  
  179. skip_5    ;update x & y
  180.           ADD     r0,r0,r4
  181.           ADD     r1,r1,r5
  182.  
  183.       ;load byte 2 word 2
  184.       ;check limits of x and y
  185.           CMP     r0,#64<<16
  186.           BGE     skip_6
  187.           CMP     r0,#0
  188.           BLT     skip_6
  189.  
  190.           CMP     r1,#64<<16
  191.           BGE     skip_6
  192.           CMP     r0,#0
  193.           BLT     skip_6
  194.  
  195.       ;construct address from x & y values
  196.           MOV     r6,r0,ASR #16
  197.           MOV     r7,r1,ASR #16
  198.           ADD     r6,r6,r7,LSL #6
  199.  
  200.           ;load byte from map + (x + 64(y))
  201.           LDRB    r10,[r3,r6]
  202.           ORR     r9,r9,r10,LSL #8
  203.  
  204. skip_6    ;update x & y
  205.           ADD     r0,r0,r4
  206.           ADD     r1,r1,r5
  207.  
  208.       ;load byte 3 word 2
  209.       ;check limits of x and y
  210.           CMP     r0,#64<<16
  211.           BGE     skip_7
  212.           CMP     r0,#0
  213.           BLT     skip_7
  214.  
  215.           CMP     r1,#64<<16
  216.           BGE     skip_7
  217.           CMP     r0,#0
  218.           BLT     skip_7
  219.  
  220.       ;construct address from x & y values
  221.           MOV     r6,r0,ASR #16
  222.           MOV     r7,r1,ASR #16
  223.           ADD     r6,r6,r7,LSL #6
  224.  
  225.           ;load byte from map + (x + 64(y))
  226.           LDRB    r10,[r3,r6]
  227.           ORR     r9,r9,r10,LSL #16
  228.  
  229. skip_7    ;update x & y
  230.           ADD     r0,r0,r4
  231.           ADD     r1,r1,r5
  232.  
  233.       ;load byte 4 word 2
  234.       ;check limits of x and y
  235.           CMP     r0,#64<<16
  236.           BGE     skip_8
  237.           CMP     r0,#0
  238.           BLT     skip_8
  239.  
  240.           CMP     r1,#64<<16
  241.           BGE     skip_8
  242.           CMP     r0,#0
  243.           BLT     skip_8
  244.  
  245.       ;construct address from x & y values
  246.           MOV     r6,r0,ASR #16
  247.           MOV     r7,r1,ASR #16
  248.           ADD     r6,r6,r7,LSL #6
  249.  
  250.           ;load byte from map + (x + 64(y))
  251.           LDRB    r10,[r3,r6]
  252.           ORR     r9,r9,r10,LSL #24
  253.  
  254. skip_8    ;update x & y
  255.           ADD     r0,r0,r4
  256.           ADD     r1,r1,r5
  257.  
  258.       ;load byte 1 word 3
  259.       ;check limits of x and y
  260.           CMP     r0,#64<<16
  261.           BGE     skip_9
  262.           CMP     r0,#0
  263.           BLT     skip_9
  264.  
  265.           CMP     r1,#64<<16
  266.           BGE     skip_9
  267.           CMP     r0,#0
  268.           BLT     skip_9
  269.  
  270.       ;construct address from x & y values
  271.           MOV     r6,r0,ASR #16
  272.           MOV     r7,r1,ASR #16
  273.           ADD     r6,r6,r7,LSL #6
  274.  
  275.           ;load byte from map + (x + 64(y))
  276.           LDRB    r10,[r3,r6]
  277.  
  278. skip_9    ;update x & y
  279.           ADD     r0,r0,r4
  280.           ADD     r1,r1,r5
  281.  
  282.       ;load byte 2 word 3
  283.       ;check limits of x and y
  284.           CMP     r0,#64<<16
  285.           BGE     skip_10
  286.           CMP     r0,#0
  287.           BLT     skip_10
  288.  
  289.           CMP     r1,#64<<16
  290.           BGE     skip_10
  291.           CMP     r0,#0
  292.           BLT     skip_10
  293.  
  294.       ;construct address from x & y values
  295.           MOV     r6,r0,ASR #16
  296.           MOV     r7,r1,ASR #16
  297.           ADD     r6,r6,r7,LSL #6
  298.  
  299.           ;load byte from map + (x + 64(y))
  300.           LDRB    r11,[r3,r6]
  301.           ORR     r10,r10,r11,LSL #8
  302.  
  303. skip_10   ;update x & y
  304.           ADD     r0,r0,r4
  305.           ADD     r1,r1,r5
  306.  
  307.       ;load byte 3 word 3
  308.       ;check limits of x and y
  309.           CMP     r0,#64<<16
  310.           BGE     skip_11
  311.           CMP     r0,#0
  312.           BLT     skip_11
  313.  
  314.           CMP     r1,#64<<16
  315.           BGE     skip_11
  316.           CMP     r0,#0
  317.           BLT     skip_11
  318.  
  319.       ;construct address from x & y values
  320.           MOV     r6,r0,ASR #16
  321.           MOV     r7,r1,ASR #16
  322.           ADD     r6,r6,r7,LSL #6
  323.  
  324.           ;load byte from map + (x + 64(y))
  325.           LDRB    r11,[r3,r6]
  326.           ORR     r10,r10,r11,LSL #16
  327.  
  328. skip_11   ;update x & y
  329.           ADD     r0,r0,r4
  330.           ADD     r1,r1,r5
  331.  
  332.       ;load byte 4 word 3
  333.       ;check limits of x and y
  334.           CMP     r0,#64<<16
  335.           BGE     skip_12
  336.           CMP     r0,#0
  337.           BLT     skip_12
  338.  
  339.           CMP     r1,#64<<16
  340.           BGE     skip_12
  341.           CMP     r0,#0
  342.           BLT     skip_12
  343.  
  344.       ;construct address from x & y values
  345.           MOV     r6,r0,ASR #16
  346.           MOV     r7,r1,ASR #16
  347.           ADD     r6,r6,r7,LSL #6
  348.  
  349.           ;load byte from map + (x + 64(y))
  350.           LDRB    r11,[r3,r6]
  351.           ORR     r10,r10,r11,LSL #24
  352.  
  353. skip_12   ;update x & y
  354.           ADD     r0,r0,r4
  355.           ADD     r1,r1,r5
  356.  
  357.       ;load byte 1 word 4
  358.       ;check limits of x and y
  359.           CMP     r0,#64<<16
  360.           BGE     skip_13
  361.           CMP     r0,#0
  362.           BLT     skip_13
  363.  
  364.           CMP     r1,#64<<16
  365.           BGE     skip_13
  366.           CMP     r0,#0
  367.           BLT     skip_13
  368.  
  369.       ;construct address from x & y values
  370.           MOV     r6,r0,ASR #16
  371.           MOV     r7,r1,ASR #16
  372.           ADD     r6,r6,r7,LSL #6
  373.  
  374.           ;load byte from map + (x + 64(y))
  375.           LDRB    r11,[r3,r6]
  376.  
  377. skip_13   ;update x & y
  378.           ADD     r0,r0,r4
  379.           ADD     r1,r1,r5
  380.  
  381.       ;load byte 2 word 4
  382.       ;check limits of x and y
  383.           CMP     r0,#64<<16
  384.           BGE     skip_14
  385.           CMP     r0,#0
  386.           BLT     skip_14
  387.  
  388.           CMP     r1,#64<<16
  389.           BGE     skip_14
  390.           CMP     r0,#0
  391.           BLT     skip_14
  392.  
  393.       ;construct address from x & y values
  394.           MOV     r6,r0,ASR #16
  395.           MOV     r7,r1,ASR #16
  396.           ADD     r6,r6,r7,LSL #6
  397.  
  398.           ;load byte from map + (x + 64(y))
  399.           LDRB    r7,[r3,r6]
  400.           ORR     r11,r11,r7,LSL #8
  401.  
  402. skip_14   ;update x & y
  403.           ADD     r0,r0,r4
  404.           ADD     r1,r1,r5
  405.  
  406.       ;load byte 3 word 4
  407.       ;check limits of x and y
  408.           CMP     r0,#64<<16
  409.           BGE     skip_15
  410.           CMP     r0,#0
  411.           BLT     skip_15
  412.  
  413.           CMP     r1,#64<<16
  414.           BGE     skip_15
  415.           CMP     r0,#0
  416.           BLT     skip_15
  417.  
  418.       ;construct address from x & y values
  419.           MOV     r6,r0,ASR #16
  420.           MOV     r7,r1,ASR #16
  421.           ADD     r6,r6,r7,LSL #6
  422.  
  423.           ;load byte from map + (x + 64(y))
  424.           LDRB    r7,[r3,r6]
  425.           ORR     r11,r11,r7,LSL #16
  426.  
  427. skip_15   ;update x & y
  428.           ADD     r0,r0,r4
  429.           ADD     r1,r1,r5
  430.  
  431.       ;load byte 4 word 4
  432.       ;check limits of x and y
  433.           CMP     r0,#64<<16
  434.           BGE     skip_16
  435.           CMP     r0,#0
  436.           BLT     skip_16
  437.  
  438.           CMP     r1,#64<<16
  439.           BGE     skip_16
  440.           CMP     r0,#0
  441.           BLT     skip_16
  442.  
  443.       ;construct address from x & y values
  444.           MOV     r6,r0,ASR #16
  445.           MOV     r7,r1,ASR #16
  446.           ADD     r6,r6,r7,LSL #6
  447.  
  448.           ;load byte from map + (x + 64(y))
  449.           LDRB    r7,[r3,r6]
  450.           ORR     r11,r11,r7,LSL #24
  451.  
  452. skip_16   ;update x & y
  453.           ADD     r0,r0,r4
  454.           ADD     r1,r1,r5
  455.  
  456.       ;store on screen
  457.       STMIA   r2!,{r8-r11}
  458.  
  459.       ;update inner counter
  460.           SUB     r12,r12,#16
  461.           MOVS    r6,r12,LSL #16
  462.       BNE     Draw_Line
  463.  
  464.              ;update line start coordinates
  465.  
  466.           ;load original points from last line
  467.       LDMIA   r14,{r0,r1}
  468.           ;load line increments
  469.           LDR     r6,[r14,#24]
  470.           LDR     r7,[r14,#28]
  471.  
  472.       ADD     r0,r0,r6
  473.           ADD     r1,r1,r7
  474.  
  475.       STMIA   r14,{r0,r1}
  476.  
  477.       ;update screen start for next line
  478.       ADD     r2,r2,#128
  479.  
  480.           ;update inner counter
  481.           SUB     r12,r12,#1<<16
  482.       MOVS    r6,r12,LSR #16
  483.       BNE     Outer_Draw_Line
  484.  
  485. EndPlotMap
  486.           LDMFD   r13!,{r0-r12,pc}
  487.  
  488. ;on entry
  489. ;
  490. ; r0 = screen address
  491. ; r1 = Number to draw (1..4)
  492. ; r2 = pointer to number graphics data
  493.  
  494. |DrawNumber|
  495.       STMFD   r13!,{r0-r6,link}
  496.  
  497.           ;modify number pointer to point to correct number
  498.           SUB     r1,r1,#1
  499.           ;multiply number by 20x16.
  500.           MOV     r1,r1,LSL #4
  501.           MOV     r3,r1,LSL #4
  502.           ADD     r1,r3,r1,LSL #2
  503.           ADD     r2,r2,r1
  504.  
  505.           ;plot number on screen
  506.           MOV     r1,#20
  507.  
  508. NumberLoop
  509.           LDMIA   r2!,{r3-r6}
  510.           STMIA   r0,{r3-r6}
  511.           ADD     r0,r0,#320
  512.           SUBS    r1,r1,#1
  513.           BNE     NumberLoop
  514.  
  515. EndDrawNumber
  516.           LDMFD   r13!,{r0-r6,pc}
  517.  
  518.       END
  519.