8088组件,IBM PC DOS,34字节
字节数xxd
:
00000000: 43e8 0900 e806 00b0 20cd 10eb f3b1 04d2 C....... .......
00000010: c38a c324 0f3c 0a7c 0204 0704 30b4 0ecd ...$.<.|....0...
00000020: 10c3
未组装:
BYTE_LOOP:
43 INC BX ; increment counter
E8 0009 CALL HB ; display high byte
E8 0006 CALL HB ; display low byte
B0 20 MOV AL, ' ' ; display space delimiter
CD 10 INT 10H ; call BIOS, write char to console
EB F3 JMP BYTE_LOOP ; keep looping forever
HB PROC
B1 04 MOV CL, 4 ; set up bitshift for 4 bits
D2 C3 ROL BL, CL ; shift counter left 4 bits
8A C3 MOV AL, BL ; put counter into AL
24 0F AND AL, 0FH ; isolate nibble
3C 0A CMP AL, 0AH ; is nibble A-F?
7C 02 JL NOT_ALPHA ; if not, skip adjustment
04 07 ADD AL, 'A'-'9'-1 ; adjust ASCII value to A-F
NOT_ALPHA:
04 30 ADD AL, '0' ; decimal to binary convert
B4 0E MOV AH, 0EH ; BIOS tty function
CD 10 INT 10H ; call BIOS, write char to console
C3 RET ; return to program
HB ENDP
可以使用独立PC DOS,输出到控制台,并且将一直显示直到程序停止。这里只是一个临时的ASCII操作程序。x86或DOS / BIOS API中没有内置或便捷方法来将二进制值转换为字符串以进行输出。
输出: