Skip to navigation

Lander on the Acorn Archimedes

Drawing triangles: DrawQuadrilateral

Name: DrawQuadrilateral [Show more] Type: Subroutine Category: Drawing triangles Summary: Draw a quadrilateral (i.e. two triangles) Deep dive: Drawing the landscape Drawing triangles
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * DrawLandscapeAndBuffers (Part 2 of 4) calls DrawQuadrilateral

Arguments: (R0, R1) Pixel coordinate of corner 1 (R2, R3) Pixel coordinate of corner 2 (R4, R5) Pixel coordinate of corner 3 (R6, R7) Pixel coordinate of corner 3 R8 Colour
.DrawQuadrilateral STMFD R13!, {R2-R7, R9-R12, R14} \ Store R2 to R7 on the stack, as well as \ the registers that we want to use on the \ stack so they can be preserved BL DrawTriangle \ Draw a triangle in colour R8 with the \ following corner coordinates: \ \ (R0, R1) \ (R2, R3) \ (R4, R5) LDMFD R13!, {R0-R5} \ Set R0 to R5 to the original values of \ R2 to R7, to (R0, R2) is the pixel \ coordinate of corner 2, and so on BL DrawTriangle \ Draw a triangle in colour R8 with the \ following corner coordinates, in terms \ of the original arguments to the routine: \ \ (R2, R3) \ (R4, R5) \ (R6, R7) \ \ So overall this draws a quadrilateral in \ colour R8 with corners at: \ \ (R0, R1) \ (R2, R3) \ (R4, R5) \ (R6, R7) LDMFD R13!, {R9-R12, PC} \ Retrieve the registers that we stored on \ the stack and return from the subroutine