ASM: INVERT$ ( addr len -- addr len ) *sp r1 mov, \ len to r1 2 sp () r0 mov, \ addr to r0 r2 clr, begin, r0 ** r2 movb, \ get a character in r2 r2 $8000 ci, \ compare to inverted space he if, r2 char z 96 + 256 * ci, \ compare to inverted z le if, r2 -$6000 ai, \ convert to non-inverted character r2 r0 ** movb, \ write the character back endif, else, r2 bl 256 * ci, \ compare to space he if, r2 char z 256 * ci, \ compare to z le if, r2 $6000 ai, \ convert to inverted character r2 r0 ** movb, \ write the character back endif, endif, endif, r0 inc, \ next address r1 dec, \ decrement len eq until, \ repeat if len>0 ;ASM : all cr 256 0 do i emit loop ; : test s" THIS IS A TEST! this is a test 0123" ; : ? test invert$ type ; CODE: INVERT$ C054 C024 0002 04C2 D090 0282 8000 1A07 0282 DA00 1B03 0222 A000 D402 1009 0282 2000 1A06 0282 7A00 1B03 0222 6000 D402 0580 0601 16E9 ;CODE