// This file is part of the materials accompanying the book // "The Elements of Computing Systems" by Nisan and Schocken, // MIT Press. Book site: www.idc.ac.il/tecs // File name: projects/06/rect/Rect.asm // Draws a rectangle at the top left corner of the screen. // The rectangle is 16 pixels wide and R0 pixels high. @0 D=M //height is in D @INFINITE_LOOP //jump if 0 or neg D;JLE @counter //counter begins with the value of height M=D @SCREEN D=A @address M=D (LOOP) @address //where to write on the screen A=M //write pixels by setting individual pixels to 1 M=-1 //this -1 sets 16 pixels at a time @address D=M @32 //32 is the number of 16 bit words in a row (512 bits per row) D=D+A @address //where to write on the screen -the next row in this case M=D @counter //counter (height) is decremented by 1 MD=M-1 @LOOP D;JGT (INFINITE_LOOP) @INFINITE_LOOP 0;JMP