macro/hw2.mac
2022-03-10 20:40:38 +09:00

50 lines
665 B
Plaintext

TITLE HW2 DIAMOND - Homework 2
SEARCH MONSYM
Comment $ (Gorin p. 65)
Accumulator usage:
10 line counter (L: [-6, 6])
11 star pairs on current line (P: [0, 6] (L<=0)
[5, 0] (L>0))
12 filler space counter (F: |L| (initial))
13 star pair counter
$
START: RESET
MOVNI 10,6
MOVEI 11,0
LINE: MOVM 12,10
MOVE 13,11
FILL: JUMPE 12,PAIRS
HRROI 1,SPACE
PSOUT
SOJA 12,FILL
PAIRS: JUMPE 13,ENDLIN
HRROI 1,STRSTR
PSOUT
SOJA 13,PAIRS
ENDLIN: HRROI 1,STRNL
PSOUT
AOJ 10,
CAILE 10,6
JRST END
CAILE 10,0
SOSA 11
AOJ 11,
JRST LINE
END: HALTF
SPACE: ASCIZ / /
STRSTR: ASCIZ /**/
STRNL: ASCIZ /*
/
END START