Skip to main content
Commonmark migration
Source Link

###Whitespace, 61 57 characters

Whitespace, 61 57 characters

It's not the shortest but it probably has the simplest logic (it's just a loop really).

Here it is completely commented, where S is space, T is tab, L is line feed:

SSSTSSSSSL # push 0x20 LSSSL # label S SSSTL # push 1 TSSS # add SLS # duplicate top of stack SLS # duplicate again TLSS # output ASCII character SSSTTTTTTSL # push 0x7E TSST # subtract (result - 0x7E) LTTSL # branch to label S if top of stack is negative LLL # end 

Thanks to @r.e.s. for correction to the above (required extra duplicate for the branch instruction) and for smaller numbers to push on the stack.

###Whitespace, 61 57 characters

It's not the shortest but it probably has the simplest logic (it's just a loop really).

Here it is completely commented, where S is space, T is tab, L is line feed:

SSSTSSSSSL # push 0x20 LSSSL # label S SSSTL # push 1 TSSS # add SLS # duplicate top of stack SLS # duplicate again TLSS # output ASCII character SSSTTTTTTSL # push 0x7E TSST # subtract (result - 0x7E) LTTSL # branch to label S if top of stack is negative LLL # end 

Thanks to @r.e.s. for correction to the above (required extra duplicate for the branch instruction) and for smaller numbers to push on the stack.

Whitespace, 61 57 characters

It's not the shortest but it probably has the simplest logic (it's just a loop really).

Here it is completely commented, where S is space, T is tab, L is line feed:

SSSTSSSSSL # push 0x20 LSSSL # label S SSSTL # push 1 TSSS # add SLS # duplicate top of stack SLS # duplicate again TLSS # output ASCII character SSSTTTTTTSL # push 0x7E TSST # subtract (result - 0x7E) LTTSL # branch to label S if top of stack is negative LLL # end 

Thanks to @r.e.s. for correction to the above (required extra duplicate for the branch instruction) and for smaller numbers to push on the stack.

removed code block which was messed up anyway
Source Link

###Whitespace, 61 57 characters

It's not the shortest but it probably has the simplest logic (it's just a loop really).

| 		 				 							 	 	 						 	 	 		 |

I've probably messed up transcribing the above, so hereHere it is completely commented, where S is space, T is tab, L is line feed:

SSSTSSSSSL # push 0x20 LSSSL # label S SSSTL # push 1 TSSS # add SLS # duplicate top of stack SLS # duplicate again TLSS # output ASCII character SSSTTTTTTSL # push 0x7E TSST # subtract (result - 0x7E) LTTSL # branch to label S if top of stack is negative LLL # end 

Thanks to @r.e.s. for correction to the above (required extra duplicate for the branch instruction) and for smaller numbers to push on the stack.

###Whitespace, 61 57 characters

It's not the shortest but it probably has the simplest logic (it's just a loop really).

| 		 				 							 	 	 						 	 	 		 |

I've probably messed up transcribing the above, so here it is completely commented, where S is space, T is tab, L is line feed:

SSSTSSSSSL # push 0x20 LSSSL # label S SSSTL # push 1 TSSS # add SLS # duplicate top of stack SLS # duplicate again TLSS # output ASCII character SSSTTTTTTSL # push 0x7E TSST # subtract (result - 0x7E) LTTSL # branch to label S if top of stack is negative LLL # end 

Thanks to @r.e.s. for correction to the above (required extra duplicate for the branch instruction) and for smaller numbers to push on the stack.

###Whitespace, 61 57 characters

It's not the shortest but it probably has the simplest logic (it's just a loop really).

Here it is completely commented, where S is space, T is tab, L is line feed:

SSSTSSSSSL # push 0x20 LSSSL # label S SSSTL # push 1 TSSS # add SLS # duplicate top of stack SLS # duplicate again TLSS # output ASCII character SSSTTTTTTSL # push 0x7E TSST # subtract (result - 0x7E) LTTSL # branch to label S if top of stack is negative LLL # end 

Thanks to @r.e.s. for correction to the above (required extra duplicate for the branch instruction) and for smaller numbers to push on the stack.

Correction + golfing
Source Link
DPenner1
  • 1.1k
  • 10
  • 18

###Whitespace, 6161 57 characters

It's not the shortest but it probably has the simplest logic (it's just a loop really).

| 		 				 							 	 	 						 	 	 		 |

I've probably messed up transcribing the above, so here it is completely commented, where S is space, T is tab, L is line feed:

SSTTSTTTTSLSSSTSSSSSL  # push -0x5E0x20 LSSSL # label S SSSTTTTTTTLSSSTL  # push 0x7F1 TSSS # add SLS # duplicate top of stack SLS # duplicate again TLSS # output ASCII character SSSTTTTTTSL # push 0x7E TSST # subtract (result - 0x7E) LTTSL # branch to label S if top of stack is negative LLL # end 

Thanks to @r.e.s. for correction to the above (required extra duplicate for the branch instruction) and for smaller numbers to push on the stack.

###Whitespace, 61 characters

It's not the shortest but it probably has the simplest logic (it's just a loop really).

| 		 				 							 	 	 						 	 	 		 |

I've probably messed up transcribing the above, so here it is completely commented, where S is space, T is tab, L is line feed:

SSTTSTTTTSL # push -0x5E LSSSL # label S SSSTTTTTTTL # push 0x7F TSSS # add SLS # duplicate top of stack TLSS # output ASCII character SSSTTTTTTSL # push 0x7E TSST # subtract (result - 0x7E) LTTSL # branch to label S if top of stack is negative LLL # end 

###Whitespace, 61 57 characters

It's not the shortest but it probably has the simplest logic (it's just a loop really).

| 		 				 							 	 	 						 	 	 		 |

I've probably messed up transcribing the above, so here it is completely commented, where S is space, T is tab, L is line feed:

SSSTSSSSSL  # push 0x20 LSSSL # label S SSSTL  # push 1 TSSS # add SLS # duplicate top of stack SLS # duplicate again TLSS # output ASCII character SSSTTTTTTSL # push 0x7E TSST # subtract (result - 0x7E) LTTSL # branch to label S if top of stack is negative LLL # end 

Thanks to @r.e.s. for correction to the above (required extra duplicate for the branch instruction) and for smaller numbers to push on the stack.

Source Link
DPenner1
  • 1.1k
  • 10
  • 18
Loading