8086 machine code, (削除) 56 (削除ここまで) 53 bytes
00000000 bf 35 01 57 ba 01 00 52 be 82 00 b3 ff ac 59 51 |.5.W...R......YQ|
00000010 aa 3c 0d 74 07 b0 20 e2 f7 43 eb f1 b0 0a aa 59 |.<.t.. ..C.....Y|
00000020 00 d1 e3 08 38 cb d6 08 c2 51 eb dc c6 05 24 5a |....8....Q....$Z|
00000030 b4 09 cd 21 c3 |...!.|
00000035
Assembled from:
org 0x100
use16
mov di, buffer
push di
mov dx, 1
push dx
nextl: mov si, 0x82
mov bl, -1
nextc: lodsb
pop cx
push cx
stor: stosb
cmp al, 0x0d
je cr
mov al, ' '
loop stor
inc bx
jmp nextc
cr: mov al, 0x0a
stosb
pop cx
add cl, dl
jcxz done
cmp bl, cl
salc
or dl, al
push cx
jmp nextl
done: mov [di], byte '$'
pop dx
mov ah, 0x09
int 0x21
ret
buffer:
Test case:
[![screenshot][1]][1] [1]: https://i.sstatic.net/AheJe.pngscreenshot
8086 machine code, (削除) 56 (削除ここまで) 53 bytes
00000000 bf 35 01 57 ba 01 00 52 be 82 00 b3 ff ac 59 51 |.5.W...R......YQ|
00000010 aa 3c 0d 74 07 b0 20 e2 f7 43 eb f1 b0 0a aa 59 |.<.t.. ..C.....Y|
00000020 00 d1 e3 08 38 cb d6 08 c2 51 eb dc c6 05 24 5a |....8....Q....$Z|
00000030 b4 09 cd 21 c3 |...!.|
00000035
Assembled from:
org 0x100
use16
mov di, buffer
push di
mov dx, 1
push dx
nextl: mov si, 0x82
mov bl, -1
nextc: lodsb
pop cx
push cx
stor: stosb
cmp al, 0x0d
je cr
mov al, ' '
loop stor
inc bx
jmp nextc
cr: mov al, 0x0a
stosb
pop cx
add cl, dl
jcxz done
cmp bl, cl
salc
or dl, al
push cx
jmp nextl
done: mov [di], byte '$'
pop dx
mov ah, 0x09
int 0x21
ret
buffer:
Test case:
[![screenshot][1]][1] [1]: https://i.sstatic.net/AheJe.png
8086 machine code, (削除) 56 (削除ここまで) 53 bytes
00000000 bf 35 01 57 ba 01 00 52 be 82 00 b3 ff ac 59 51 |.5.W...R......YQ|
00000010 aa 3c 0d 74 07 b0 20 e2 f7 43 eb f1 b0 0a aa 59 |.<.t.. ..C.....Y|
00000020 00 d1 e3 08 38 cb d6 08 c2 51 eb dc c6 05 24 5a |....8....Q....$Z|
00000030 b4 09 cd 21 c3 |...!.|
00000035
Assembled from:
org 0x100
use16
mov di, buffer
push di
mov dx, 1
push dx
nextl: mov si, 0x82
mov bl, -1
nextc: lodsb
pop cx
push cx
stor: stosb
cmp al, 0x0d
je cr
mov al, ' '
loop stor
inc bx
jmp nextc
cr: mov al, 0x0a
stosb
pop cx
add cl, dl
jcxz done
cmp bl, cl
salc
or dl, al
push cx
jmp nextl
done: mov [di], byte '$'
pop dx
mov ah, 0x09
int 0x21
ret
buffer:
Test case:
8086 machine code, 56(削除) 56 (削除ここまで) 53 bytes
00000000 bf 3835 01 57 6a 00ba 3101 db00 52 b2 01be 5982 00 d1b3 39ff cbac 7559 51 |.85.WjW.1..R.Y..9.u|..YQ|
00000010 02aa f63c da0d 5174 be07 82b0 0020 31e2 dbf7 ac43 59eb e3f1 12b0 510a aa 3c59 |.<.t.Q...1C..Y..Q.<|Y|
00000020 0d00 74d1 07e3 b008 2038 e2cb f7d6 4308 ebc2 ef51 b0eb 0adc aac6 eb05 db24 b05a |.t....C8....Q....|$Z|
00000030 24 aa 5a b4 09 cd 21 c3 |$.Z |...!.|
0000003800000035
org 0x100
use16
mov di, buffer ; store output past the end of the program
push di
push 0
xor bx, bx
mov dl, 1
nextl: pop cx
add cl, dl ; add dx to counter (either 1 or -1)
cmp bx, cx
jne @f1
neg dl ; negatepush dx if counter == string length
@@nextl: push cx
mov si, 0x82 ; argument list
xormov bxbl, bx-1
nextc: lodsb
pop cx
jcxz done
push cx
stor: stosb
cmp al, 0x0d ; CR marks the end of input
je cr
mov al, ' '
loop stor inc bx
; store spaces while (--CX != 0)jmp nextc
cr: mov al, 0x0a
inc bx stosb
;pop countcx
number of characters
add cl, dl
jmp nextc
cr: mov al,jcxz 0x0adone
;cmp addbl, LFcl
stosbsalc
jmpor nextl
done:dl, al
mov al, '$' push cx
; end of string
jmp nextl
done: mov [di], byte stosb'$'
pop dx
mov ah, 0x09 ; print string
int 0x21 ; dos syscall
ret
buffer:
[![screenshot][1]][1] [1]: https://i.imgursstatic.comnet/XPMQegCAheJe.png
8086 machine code, 56 bytes
00000000 bf 38 01 57 6a 00 31 db b2 01 59 00 d1 39 cb 75 |.8.Wj.1...Y..9.u|
00000010 02 f6 da 51 be 82 00 31 db ac 59 e3 12 51 aa 3c |...Q...1..Y..Q.<|
00000020 0d 74 07 b0 20 e2 f7 43 eb ef b0 0a aa eb db b0 |.t....C........|
00000030 24 aa 5a b4 09 cd 21 c3 |$.Z...!.|
00000038
org 0x100
use16
mov di, buffer ; store output past the end of the program
push di
push 0
xor bx, bx
mov dl, 1
nextl: pop cx
add cl, dl ; add dx to counter (either 1 or -1)
cmp bx, cx
jne @f
neg dl ; negate dx if counter == string length
@@: push cx
mov si, 0x82 ; argument list
xor bx, bx
nextc: lodsb
pop cx
jcxz done
push cx
stor: stosb
cmp al, 0x0d ; CR marks the end of input
je cr
mov al, ' '
loop stor ; store spaces while (--CX != 0)
inc bx ; count number of characters
jmp nextc
cr: mov al, 0x0a ; add LF
stosb
jmp nextl
done: mov al, '$' ; end of string
stosb
pop dx
mov ah, 0x09 ; print string
int 0x21 ; dos syscall
ret
buffer:
[![screenshot][1]][1] [1]: https://i.imgur.com/XPMQegC.png
8086 machine code, (削除) 56 (削除ここまで) 53 bytes
00000000 bf 35 01 57 ba 01 00 52 be 82 00 b3 ff ac 59 51 |.5.W...R......YQ|
00000010 aa 3c 0d 74 07 b0 20 e2 f7 43 eb f1 b0 0a aa 59 |.<.t....C.....Y|
00000020 00 d1 e3 08 38 cb d6 08 c2 51 eb dc c6 05 24 5a |....8....Q....$Z|
00000030 b4 09 cd 21 c3 |...!.|
00000035
org 0x100
use16
mov di, buffer
push di
mov dx, 1
push dx
nextl: mov si, 0x82
mov bl, -1
nextc: lodsb
pop cx
push cx
stor: stosb
cmp al, 0x0d
je cr
mov al, ' '
loop stor inc bx
jmp nextc
cr: mov al, 0x0a
stosb
pop cx
add cl, dl
jcxz done
cmp bl, cl
salc
or dl, al
push cx
jmp nextl
done: mov [di], byte '$'
pop dx
mov ah, 0x09
int 0x21
ret
buffer:
[![screenshot][1]][1] [1]: https://i.sstatic.net/AheJe.png
8086 machine code, 5756 bytes
00000000 bf 3938 01 57 6a 00 31 db ba ffb2 ff01 59 00 d1 39 cb 75 02 |.98.Wj.1...Y.Y9.u9.|u|
00000010 f7 da02 01f6 d1da 51 be 82 00 31 db ac 59 e3 12 51 43aa 3c |....Q...1..Y..QC|Q.<|
00000020 aa 3c 0d 74 0607 b0 20 e2 f7 43 eb ef b0 0a aa eb db b0 |.<.t.. ..C........|
00000030 b0 24 aa 5a b4 09 cd 21 c3 |.$ |$.Z...!.|
0000003900000038
org 0x100
use16
mov di, buffer ; store output past the end of the program
push di
push 0
xor bx, bx
mov dxdl, -1
nextl: pop cx
add cl, dl ; add dx to counter (either 1 or -1)
cmp bx, cx
jne @f
neg dx
@@:dl add cx, ; negate dx if counter == string length
@@: push cx
mov si, 0x82 ; argument list
xor bx, bx
nextc: lodsb
pop cx
jcxz done
push cx
stor: stosb
inc bx
stor: cmp stosb
al, 0x0d cmp al,; 0x0dCR marks the end of input
je cr
mov al, ' '
loop stor ; store spaces while (--CX != 0)
inc bx ; count number of characters
jmp nextc
cr: mov al, 0x0a ; add LF
stosb
jmp nextl
done: mov al, '$' ; end of string
stosb
pop dx
mov ah, 0x09 ; print string
int 0x21 ; dos syscall
ret
buffer:
[![screenshot][1]][1] [1]: https://i.sstaticimgur.netcom/7k7PsXPMQegC.png
8086 machine code, 57 bytes
00000000 bf 39 01 57 6a 00 31 db ba ff ff 59 39 cb 75 02 |.9.Wj.1....Y9.u.|
00000010 f7 da 01 d1 51 be 82 00 31 db ac 59 e3 12 51 43 |....Q...1..Y..QC|
00000020 aa 3c 0d 74 06 b0 20 e2 f7 eb ef b0 0a aa eb db |.<.t.. .........|
00000030 b0 24 aa 5a b4 09 cd 21 c3 |.$.Z...!.|
00000039
org 0x100
use16
mov di, buffer
push di
push 0
xor bx, bx
mov dx, -1
nextl: pop cx
cmp bx, cx
jne @f
neg dx
@@: add cx, dx push cx
mov si, 0x82
xor bx, bx
nextc: lodsb
pop cx
jcxz done
push cx
inc bx
stor: stosb
cmp al, 0x0d
je cr
mov al, ' '
loop stor
jmp nextc
cr: mov al, 0x0a
stosb
jmp nextl
done: mov al, '$'
stosb
pop dx
mov ah, 0x09
int 0x21
ret
buffer:
[![screenshot][1]][1] [1]: https://i.sstatic.net/7k7Ps.png
8086 machine code, 56 bytes
00000000 bf 38 01 57 6a 00 31 db b2 01 59 00 d1 39 cb 75 |.8.Wj.1...Y..9.u|
00000010 02 f6 da 51 be 82 00 31 db ac 59 e3 12 51 aa 3c |...Q...1..Y..Q.<|
00000020 0d 74 07 b0 20 e2 f7 43 eb ef b0 0a aa eb db b0 |.t.. ..C........|
00000030 24 aa 5a b4 09 cd 21 c3 |$.Z...!.|
00000038
org 0x100
use16
mov di, buffer ; store output past the end of the program
push di
push 0
xor bx, bx
mov dl, 1
nextl: pop cx
add cl, dl ; add dx to counter (either 1 or -1)
cmp bx, cx
jne @f
neg dl ; negate dx if counter == string length
@@: push cx
mov si, 0x82 ; argument list
xor bx, bx
nextc: lodsb
pop cx
jcxz done
push cx
stor: stosb
cmp al, 0x0d ; CR marks the end of input
je cr
mov al, ' '
loop stor ; store spaces while (--CX != 0)
inc bx ; count number of characters
jmp nextc
cr: mov al, 0x0a ; add LF
stosb
jmp nextl
done: mov al, '$' ; end of string
stosb
pop dx
mov ah, 0x09 ; print string
int 0x21 ; dos syscall
ret
buffer:
[![screenshot][1]][1] [1]: https://i.imgur.com/XPMQegC.png