#x86-16 machine code, IBM PC DOS, (削除) 27 (削除ここまで) 23 bytes
x86-16 machine code, IBM PC DOS, (削除) 27 (削除ここまで) 23 bytes
Binary:
00000000: b408 cd21 b40e cd10 483c 617d f9b0 0acd ...!....H<a}....
00000010: 10b0 0dcd 10eb e9 .......
Test and build using xxd -r from above.
Unassembled:
IN_LOOP:
B4 08 MOV AH, 08H ; DOS read char without echo function
CD 21 INT 21H ; load next char from STDIN
B4 0E MOV AH, 0EH ; BIOS write char teletype output function
CHR_LOOP:
CD 10 INT 10H ; write to console
48 DEC AX ; move to next char
3C 61 CMP AL, 'a' ; end with an 'a'
7D F9 JGE CHR_LOOP ; keep looping descending chars
B0 0A MOV AL, 0AH ; CR char
CD 10 INT 10H ; write to console
B0 0D MOV AL, 0DH ; LF char
CD 10 INT 10H ; write to console
EB E9 JMP IN_LOOP ; keep looping until ^C/^Break
I/O:
Input via STDIN or interactive input, output to console. Will run until EOF or ^C/^Break.
Iterative approach. Of course, it's 8 bytes just to write a newline character...
#x86-16 machine code, IBM PC DOS, (削除) 27 (削除ここまで) 23 bytes
Binary:
00000000: b408 cd21 b40e cd10 483c 617d f9b0 0acd ...!....H<a}....
00000010: 10b0 0dcd 10eb e9 .......
Test and build using xxd -r from above.
Unassembled:
IN_LOOP:
B4 08 MOV AH, 08H ; DOS read char without echo function
CD 21 INT 21H ; load next char from STDIN
B4 0E MOV AH, 0EH ; BIOS write char teletype output function
CHR_LOOP:
CD 10 INT 10H ; write to console
48 DEC AX ; move to next char
3C 61 CMP AL, 'a' ; end with an 'a'
7D F9 JGE CHR_LOOP ; keep looping descending chars
B0 0A MOV AL, 0AH ; CR char
CD 10 INT 10H ; write to console
B0 0D MOV AL, 0DH ; LF char
CD 10 INT 10H ; write to console
EB E9 JMP IN_LOOP ; keep looping until ^C/^Break
I/O:
Input via STDIN or interactive input, output to console. Will run until EOF or ^C/^Break.
Iterative approach. Of course, it's 8 bytes just to write a newline character...
x86-16 machine code, IBM PC DOS, (削除) 27 (削除ここまで) 23 bytes
Binary:
00000000: b408 cd21 b40e cd10 483c 617d f9b0 0acd ...!....H<a}....
00000010: 10b0 0dcd 10eb e9 .......
Test and build using xxd -r from above.
Unassembled:
IN_LOOP:
B4 08 MOV AH, 08H ; DOS read char without echo function
CD 21 INT 21H ; load next char from STDIN
B4 0E MOV AH, 0EH ; BIOS write char teletype output function
CHR_LOOP:
CD 10 INT 10H ; write to console
48 DEC AX ; move to next char
3C 61 CMP AL, 'a' ; end with an 'a'
7D F9 JGE CHR_LOOP ; keep looping descending chars
B0 0A MOV AL, 0AH ; CR char
CD 10 INT 10H ; write to console
B0 0D MOV AL, 0DH ; LF char
CD 10 INT 10H ; write to console
EB E9 JMP IN_LOOP ; keep looping until ^C/^Break
I/O:
Input via STDIN or interactive input, output to console. Will run until EOF or ^C/^Break.
Iterative approach. Of course, it's 8 bytes just to write a newline character...
#x86-16 machine code, IBM PC DOS, 27(削除) 27 (削除ここまで) 23 bytes
00000000: d1eeb408 adb4cd21 0e8ab40e c849cd10 accd483c 1048617d 3c61f9b0 7df90acd ...!....IH<a}...H<a}.
00000010: b00a10b0 cd100dcd b00d10eb cd10e9 e2ee c3 ...........
D1 EE SHR SI, 1 ; SI to DOS command line input (80H)
AD LODSW ; AL = input string lengthIN_LOOP:
B4 0E08 MOV AH, 0EH08H ; BIOSDOS writeread char function
8A C8 MOV CL, AL ; string length intowithout CXecho function
49 CD 21 DEC INT CX 21H ; removeload leadingnext char from length count
IN_LOOP: STDIN
AC B4 0E LODSB MOV AH, 0EH ; loadBIOS nextwrite char teletype output function
CHR_LOOP:
CD 10 INT 10H ; write to console
48 DEC AX ; move to next char
3C 61 CMP AL, 'a' ; end with an 'a'
7D F9 JGE CHR_LOOP ; keep looping descending chars
B0 0A MOV AL, 0AH ; CR char
CD 10 INT 10H ; write to console
B0 0D MOV AL, 0DH ; LF char
CD 10 INT 10H ; write to console
E2EB EEE9 LOOPJMP IN_LOOP ; keep looping input string
C3 RET ; return to DOSuntil ^C/^Break
Example II/O:
enter image description here Input via STDIN or interactive input, output to console. Will run until EOF or ^C/^Break.
Iterative approach. Of course, it's 8 bytes just to write a newline character...
#x86-16 machine code, IBM PC DOS, 27 bytes
00000000: d1ee adb4 0e8a c849 accd 1048 3c61 7df9 .......I...H<a}.
00000010: b00a cd10 b00d cd10 e2ee c3 ...........
D1 EE SHR SI, 1 ; SI to DOS command line input (80H)
AD LODSW ; AL = input string length
B4 0E MOV AH, 0EH ; BIOS write char function
8A C8 MOV CL, AL ; string length into CX
49 DEC CX ; remove leading char from length count
IN_LOOP:
AC LODSB ; load next char
CHR_LOOP:
CD 10 INT 10H ; write to console
48 DEC AX ; move to next char
3C 61 CMP AL, 'a' ; end with an 'a'
7D F9 JGE CHR_LOOP ; keep looping descending chars
B0 0A MOV AL, 0AH ; CR char
CD 10 INT 10H ; write to console
B0 0D MOV AL, 0DH ; LF char
CD 10 INT 10H ; write to console
E2 EE LOOP IN_LOOP ; keep looping input string
C3 RET ; return to DOS
Example I/O:
#x86-16 machine code, IBM PC DOS, (削除) 27 (削除ここまで) 23 bytes
00000000: b408 cd21 b40e cd10 483c 617d f9b0 0acd ...!....H<a}....
00000010: 10b0 0dcd 10eb e9 .......
IN_LOOP:
B4 08 MOV AH, 08H ; DOS read char without echo function
CD 21 INT 21H ; load next char from STDIN
B4 0E MOV AH, 0EH ; BIOS write char teletype output function
CHR_LOOP:
CD 10 INT 10H ; write to console
48 DEC AX ; move to next char
3C 61 CMP AL, 'a' ; end with an 'a'
7D F9 JGE CHR_LOOP ; keep looping descending chars
B0 0A MOV AL, 0AH ; CR char
CD 10 INT 10H ; write to console
B0 0D MOV AL, 0DH ; LF char
CD 10 INT 10H ; write to console
EB E9 JMP IN_LOOP ; keep looping until ^C/^Break
I/O:
Input via STDIN or interactive input, output to console. Will run until EOF or ^C/^Break.
Iterative approach. Of course, it's 8 bytes just to write a newline character...
#x86-16 machine code, IBM PC DOS, 27 bytes
Binary:
00000000: d1ee adb4 0e8a c849 accd 1048 3c61 7df9 .......I...H<a}.
00000010: b00a cd10 b00d cd10 e2ee c3 ...........
Test and build using xxd -r from above.
Unassembled:
D1 EE SHR SI, 1 ; SI to DOS command line input (80H)
AD LODSW ; AL = input string length
B4 0E MOV AH, 0EH ; BIOS write char function
8A C8 MOV CL, AL ; string length into CX
49 DEC CX ; remove leading char from length count
IN_LOOP:
AC LODSB ; load next char
CHR_LOOP:
CD 10 INT 10H ; write to console
48 DEC AX ; move to next char
3C 61 CMP AL, 'a' ; end with an 'a'
7D F9 JGE CHR_LOOP ; keep looping descending chars
B0 0A MOV AL, 0AH ; CR char
CD 10 INT 10H ; write to console
B0 0D MOV AL, 0DH ; LF char
CD 10 INT 10H ; write to console
E2 EE LOOP IN_LOOP ; keep looping input string
C3 RET ; return to DOS
Example I/O: