Reverse ASCII character map
x86-16 Machine Code, 62 bytes
Hex dump:
BC0100B101B07EBAFE0581EAE00080EA02B402CD1085E4750830E439C5750A30C0B40ACD1084C074094884D275E085D275D831C031E4CD1630E489C5EBC7
Assembly:
mov sp, 0x0001 ; Stack pointer is used as a flag; 0 - Print all characters, 1 - Delete specific character
mov cl, 0x01 ; Number of characters to print per interrupt call
printString:
mov al, 0x7E ; Last character to print
mov dx, 0x05FE ; Row: 0x05, Collumn: 0xFE
printRow:
sub dx, 0x00E0 ; Decrement row number + 2 extra characters
printChar:
sub dl, 0x02 ; Decrement collumn index + 1 space
mov ah, 0x02 ; Prepare for interrupt call, 0x02 - Set cursor position
int 0x10 ; BIOS interrupt
test sp, sp ; Are we printing all characters or removing specific character
jnz print ; In first case just print it and go on
xor ah, ah ; Otherwise reset the upper byte of ax (shorter than "and ax, 0x00FF")
cmp bp, ax ; Is the current character same as the input character
jne after ; If no, continue searching
xor al, al ; If yes, remove it
print:
mov ah, 0x0A ; Prepare for print
int 0x10 ; Print
test al, al ; If we found target character
jz loop ; then stop searching
after:
dec ax ; Shorter than "dec, al"
test dl, dl ; Is it the last character in the row
jnz printChar ; If no, continue searching
test dx, dx ; Is it last char
jnz printRow ; If no, go to next row
loop:
xor ax, ax ; Remove "ah" cache
xor sp, sp ; Reset sp (it will never become 1 again)
int 0x16 ; BIOS interrupt for reading keyboard input
xor ah, ah ; Again reset "ah", because BIOS may change it
mov bp, ax ; Save it in stack base pointer
jmp printString ; Remove the character from the list
SOGL V0.12, 23 bytes
] ~Δ8«n"5αx2⁰³⁄¹‘→č@ŗ░T
Try it Here!
Takes input in the input box. I hope that it isn't too big of an issue that characters can be deleted :p
Explanation:
] do.. while (popping (which makes the stack not blow up luckily :D))
~Δ push the ascii characters (range("~"))
8«n split into lines of length 16
"...‘ push "inputs.value" (could be 2 bytes less if my dictionary contained the word "inputs". I even added "input", but only now realise that the input box is id=inputs :/)
→ evaluate as JavaScript, then push the result
č chop into characters
@ŗ replace each of the characters in the array with space
░ clear the output
T output without popping (so do..while continues looping)
C++ (Visual C++), 253 (@Step Hen) 261 bytes
#include<cstdlib>
#include<iostream>
#include<conio.h>
int main(){char a[0x5E];for(int i=0;i<0x5E;i++)a[i]=(char)(i+0x20);while(true){system("cls");for(int i=0;i<0x5E;i++)if(i&&!(i%16))printf("\n%c ",a[i]);else printf("%c ",a[i]);a[_getch()-0x20]=' ';}}