1: / 2: / 3: 4: / io2 -- format cracker 5: 6: .globl iowf 7: .globl iowp 8: .globl iorf 9: 10: iowp: 11: mov (sp)+,formp 12: mov $6,r1 13: br 1f 14: 15: iowf: 16: mov (sp)+,formp 17: tst (sp)+ 18: mov (sp)+,r1 19: 1: 20: jsr r5,setio; 2 / write 21: clr rdflg 22: br 1f 23: 24: iorf: 25: mov (sp)+,formp 26: tst (sp)+ 27: mov (sp)+,r1 28: jsr r5,setio; 1 / read 29: mov pc,rdflg 30: 31: 1: 32: clr binflg 33: clr slcnt 34: clr itmfnd 35: clr scale 36: clr itmflg 37: mov $pbuf,ppar 38: mov $-1,llpcnt 39: jsr r5,fmtchr 40: mov formp,llp 41: cmp r0,$'( 42: beq crack 43: jsr r5,rerr; 106. 44: sys exit 45: crack: 46: clr ngflg 47: mov $1,rep 48: item: 49: jsr r5,fmtchr 50: cmp $' ,r0 51: beq item 52: cmp $'\t,r0 53: beq item 54: jsr r5,switch; mswitch 55: jsr r5,rerr; 105. 56: sys exit 57: 58: mswitch: 59: 'a; afmt 60: 'f; ffmt 61: 'e; efmt 62: 'g; gfmt 63: 'd; dfmt 64: 'i; ifmt 65: 'l; lfmt 66: 'h; hfmt 67: 'x; xfmt 68: 'p; scal 69: '-; minus 70: '0; numb 71: '1; numb 72: '2; numb 73: '3; numb 74: '4; numb 75: '5; numb 76: '6; numb 77: '7; numb 78: '8; numb 79: '9; numb 80: ',; crack 81: '/; slash 82: '(; lpar 83: '); rpar 84: '"; quote 85: ' ; item 86: 0; 0 87: 88: minus: 89: jsr r5,gnum 90: neg r0 91: br 1f 92: numb: 93: dec formp 94: jsr r5,gnum 95: 1: 96: mov r0,rep 97: br item 98: 99: scal: 100: mov rep,scale 101: br crack 102: 103: elist: 104: tst _nocr 105: beq 1f 106: tst rdflg 107: bne 1f 108: jsr r5,eorec1 109: br 2f 110: 1: 111: jsr r5,eorec 112: 2: 113: jmp *(r4)+ 114: 115: slash: 116: jsr r5,eorec 117: br crack 118: 119: rpar: 120: mov ppar,r0 121: cmp r0,$pbuf / see if outer parens 122: blos 2f 123: dec -2(r0) 124: ble 1f / no repeats left 125: mov -4(r0),formp / reset scan 126: br crack 127: 1: 128: sub $4,ppar 129: br crack / pop parens 130: 2: 131: jsr r5,getitm 132: br elist 133: tst itmfnd 134: bne 1f 135: jsr r5,rerr; 107. 136: sys exit 137: 1: 138: jsr r5,eorec 139: inc itmflg 140: mov llpcnt,r1 141: bpl 1f 142: mov llp,formp 143: jmp crack 144: 1: 145: mov llp,r2 146: mov r2,formp 147: mov ppar,r0 148: mov r2,(r0)+ 149: mov r1,(r0)+ 150: mov r0,ppar 151: jbr crack1 152: 153: lpar: 154: mov ppar,r0 155: cmp r0,$pbuf+10 156: blo 1f 157: jsr r5,rerr; 108. 158: sys exit 159: 1: 160: mov formp,(r0)+ 161: mov rep,(r0)+ 162: mov r0,ppar 163: cmp r0,$pbuf+4 164: bhi 1f 165: mov formp,llp 166: mov rep,llpcnt 167: 1: 168: jmp crack 169: quote: 170: inc ngflg 171: mov $44,-(sp) 172: br 3f 173: 174: hfmt: 175: inc ngflg 176: mov $40,-(sp) 177: br 3f 178: 179: xfmt: 180: inc ngflg 181: mov $34,-(sp) 182: br 3f 183: 184: afmt: 185: mov $30,-(sp) 186: br 1f 187: 188: ifmt: 189: clr -(sp) 190: br 1f 191: 192: lfmt: 193: mov $4,-(sp) 194: 1: 195: jsr r5,gnum 196: mov r0,width 197: br 2f 198: 199: ffmt: 200: mov $10,-(sp) 201: br 1f 202: 203: dfmt: 204: mov $14,-(sp) 205: br 1f 206: 207: gfmt: 208: mov $20,-(sp) 209: br 1f 210: 211: efmt: 212: mov $24,-(sp) 213: 214: 1: 215: jsr r5,gnum 216: mov r0,width 217: 4: 218: jsr r5,fmtchr 219: cmp r0,$' / 220: beq 4b 221: cmp r0,$'. 222: bne err1 223: jsr r5,gnum 224: mov r0,ndig 225: 2: 226: inc itmfnd 227: 3: 228: add $cvsw,(sp) 229: tst rdflg 230: beq 1f 231: add $2,(sp) 232: 1: 233: mov *(sp)+,-(sp) 234: 1: 235: tst ngflg 236: bne 2f 237: jsr r5,getitm 238: br 1f 239: 2: 240: clr gflg 241: jsr r5,*(sp) 242: dec rep 243: bgt 1b 244: tst (sp)+ 245: br crack1 246: 1: 247: tst (sp)+ 248: jmp elist 249: 250: cvsw: 251: iocv; iicv / 0 252: locv; licv / 4 253: focv; ficv / 10 254: docv; dicv / 14 255: gocv; gicv / 20 256: eocv; eicv / 24 257: aocv; aicv / 30 258: xocv; xicv / 34 259: hocv; hicv / 40 260: qocv; qicv / 44 261: 262: crack1: 263: jmp crack 264: 265: err1: 266: jsr r5,rerr; 109. 267: sys exit