~aleteoryx/uxn

uxn/dos2unix.tal -rw-r--r-- 242 bytes
55f239d0 — Aleteoryx ibm, fold, dos<->unix 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
@on-reset ( -> )
	;on-input #10 DEO2
	BRK

@on-input ( last-byte -> last-byte )
	#12 DEI

	[ LIT &need-byte 01 ]
	[ LIT2 00 _/need-byte ] STR
	?{
		SWP
		DUP2 #0a0d NEQ2 ?{
			POP
			[ LIT2 01 _/need-byte ] STR
		}
		#18 DEO ( #010e DEO )
	}