Skip to navigation

Lander on the Acorn Archimedes

Drawing triangles: DrawTriangleFromBuffer

Name: DrawTriangleFromBuffer [Show more] Type: Subroutine Category: Drawing triangles Summary: Process the "draw triangle" command from the graphics buffer Deep dive: Depth-sorting with the graphics buffers Drawing triangles
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * bufferJump calls DrawTriangleFromBuffer

The seven parameter words for this command match the arguments for the DrawTriangle routine: * Pixel coordinate of corner 1 (x1, y1) * Pixel coordinate of corner 2 (x2, y2) * Pixel coordinate of corner 3 (x3, y3) * Colour This command draws a triangle of the specified shape and colour.
Arguments: R9 The address of the seven parameter words in the graphics buffer
Returns: R9 Updated to point to the next word in the graphics buffer R12 R12 is preserved
.DrawTriangleFromBuffer LDMIA R9!, {R0-R5, R8} \ Fetch the seven parameter words from the \ graphics buffer into R0 to R5 and R8, \ incrementing R9 to point to the next \ command in the buffer STMFD R13!, {R9, R12} \ Store R9 and R12 on the stack so they \ don't get corrupted by the following call \ to DrawTriangle BL DrawTriangle \ Draw a triangle at the coordinates \ specified in R0 to R5 and R8 LDMFD R13!, {R9, R12} \ Retrieve the values of R9 and R12 that we \ stored above B DrawNextFromGraphicsBuffer \ Draw the next command from the graphics \ buffer