SMAL32 (rev 9/03) MP1 solved by Douglas Jone 13:15:57 Page 1 Fri Oct 1 2004 1 TITLE MP1 solved by Douglas Jones 2 ; program to output a leaning triangle of letters, starting with 3 ; the letter a on the first line. Successive lines begin one 4 ; space to the left of the preceeding line, use the next letter 5 ; in the alphabet, and repeat it one more time than the preceeding 6 ; line until a line of 8 letters h is printed. 7 8 S START 9 USE "hawk.macs" 10 USE "monitor.h" +000000:+00000000 11 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 +00000000 12 COMMON STACK,#1000 +000030:+00000000 13 PSTACK: W STACK 14 15 ; the program starts here! 16 START: LOAD R2,PSTACK ; set up the stack +000034: F250 FFF8 17 18 LOAD R1,PDSPINI +000038: F150 FFC8 19 JSRS R1,R1 ; dspini() -- initialize display +00003C: F1B1 20 21 LIS R8,0 ; i = 0 +00003E: D800 22 23 OUTERLOOP: ; do { 24 25 MOVE R3,R8 +000040: F3F8 26 MOVE R4,R8 +000042: F4F8 27 LOAD R1,PDSPAT +000044: F150 FFC0 28 JSRS R1,R1 ; dspat(i,i) +000048: F1B1 29 30 MOVE R9,R8 ; j = i +00004A: F9F8 31 32 INNERLOOP: ; do { 33 34 ADDI R3,R8,'a' +00004C: F368 0061 35 LOAD R1,PDSPCH +000050: F150 FFB8 36 JSRS R1,R1 ; dspch( 'a' + i ) +000054: F1B1 37 38 ADDSI R9,-1 ; j = j - 1; +000056: 19CF 39 40 CMPI R9,0 +000058: F069 0000 41 BGE INNERLOOP ; } while (j >= 0) +00005C: 0DF7 42 43 ADDSI R8,1 ; i = i + 1 +00005E: 18C1 44 45 CMPI R8,7 +000060: F068 FFF9 46 BLE OUTERLOOP ; } while (i <= 7) +000064: 06ED 47 48 LOAD R1,PEXIT +000066: F150 FF96 49 JSRS R1,R1 ; exit() +00006A: F1B1 50 51 END no errors