8086 machine code, 11 bytes (as a function, non-competing)
Not really competing since it doesn't have visible output. This is just showing the shortest way to find the current screen dimensions, without the boilerplate code required for printing.
00000000 6a 40 1f a0 84 00 40 8a 26 4a 00 |j@....@.&J.|
0000000b
How it works:
6a 40 | push 0x40 ; bios data segment
1f | pop ds
a0 84 00 | mov al, [0x84] ; console rows - 1
40 | inc ax
8a 26 4a 00 | mov ah, [0x4a] ; console columns
8086 machine code, 48 bytes (as a complete program)
00000000 1f bf 30 01 a0 84 04 40 e8 1a 00 b0 78 aa a0 4a |[email protected]|
00000010 04 e8 11 00 8d 8d d0 fe 8d 75 ff 06 1f fd ac cd |.........u......|
00000020 29 e2 fb cd 20 d4 0a 0c 30 aa c1 e8 08 75 f6 c3 |)... ...0....u..|
00000030
How it works:
| org 0x100
| use16
1f | pop ds ; clear ds (the stack always contains 0 on entry)
bf 30 01 | mov di, d ; set destination ptr
a0 84 04 | mov al, [0x484] ; console rows - 1
40 | inc ax
e8 1a 00 | call to_ascii ; convert to ascii
b0 78 | mov al, 'x'
aa | stosb
a0 4a 04 | mov al, [0x44a] ; console columns
e8 11 00 | call to_ascii
8d 8d d0 fe | lea cx, [di-d] ; number of characters to print
8d 75 ff | lea si, [di-1] ; set source ptr
06 | push es
1f | pop ds
fd | std ; reverse direction flag
ac | @@: lodsb ; load (al = *si--)
cd 29 | int 0x29 ; print al to console, bypassing stdout
e2 fb | loop @b ; repeat while (--cx != 0)
cd 20 | int 0x20 ; terminate
|
| to_ascii:
d4 0a | aam 10 ; ah = (al / 10), al = (al % 10)
0c 30 | or al, 0x30 ; convert al to ascii number
aa | stosb ; store (*di++ = al)
c1 e8 08 | shr ax, 8 ; shift ah to al
75 f6 | jnz to_ascii ; repeat if non-zero
c3 | ret
|
| d rb 0