! Program draws a grid pattern that maps an arc. ! MAXLINES 1 to n are drawn where ! x1, y1 = 0, 512-(DELTA*(n-1)) ! x2, y2 = DELTA*n, 0 ! ! DELTA pixels = 8. ! ! Register Usage: ! main prog ! %r1 - the address of the (memory mapped) GX device ! %r2 - holds the command for the GX device ! %r3 - used in computation of x2 ! %r4 - used in computation of y1 ! %r5 - used in computation of y1 ! %r8 - used as a loop counter ! ! Limitations: ! Program geometry is hardcoded to fill the GX device window. ! .include "gx.h" .data .set MAXLINES, 64 .set DELTA, 8 .set MAX_XY, 512 .text set GX_BUFFER, %r1 ! open the device st %r0, [%r1 + GX_CMD] set MAXLINES, %r8 ! draw line loop loop: tst %r8 be end umul %r8, DELTA, %r3 dec %r3 sub %r8, 1, %r4 umul %r4, DELTA, %r4 set MAX_XY, %r5 sub %r5, %r4, %r4 st %r0, [%r1+GX_LINE_X1] st %r3, [%r1+GX_LINE_Y1] st %r4, [%r1+GX_LINE_X2] st %r0, [%r1+GX_LINE_Y2] mov GX_LINE, %r2 st %r2, [%r1+GX_CMD] ba loop deccc %r8 end: ta 0