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