| ??? 10/16/01 06:04 Read: times |
#15720 - RE: loops |
this looks more like a pc problem than a micro since we don't have standardized scrolling output displays. but if we were to pretend:
assumptions: (1) the output addressing is assumed to be like a teletype... character prints left to right in sequence and line feeds advance to the next line. (2) the input is assumbed to be handed to the routine through a register. hardware and some driver a responsible to placing it there before the routine is called. its assumed to be a binary number between 1 and 40. 0 and 40+ are assumbed to be filtered by the input routine and are not tested herein. variable and constants: (chr) the fixed printed character '*' (col) a column counter for each row (row) a line counter. (cnt) a binary count routines: (getinput) load cnt with a legal number (putchar) writes the acc character algorithm: ;assume everything is running ;call (getinput) for square size ;initialize (row) for outside loop loopline: ;initialize (col) for inside loop loopchar: ;load character to send ;call putchar;djnz (col) loopchar ;load linefeed to send ;call putchar;djnz (row) loopline;end ;--------------- call getinput ;load r2 mov r0,r2 ;load (row) loopline: mov r1,r2 ;load or reload (col) loopchar: mov a,#'*' ;character to print call putchar djnz r1,loopchar mov a,#0Ah ;linefeed maybe call putchar djnz r0,loopline ;end duh ;--------------- |
| Topic | Author | Date |
| loops | 01/01/70 00:00 | |
| RE: loops | 01/01/70 00:00 | |
| RE: loops | 01/01/70 00:00 | |
| RE: loops | 01/01/70 00:00 | |
RE: loops | 01/01/70 00:00 |



