Given that there are still a lot of 16-bit code fans, I've updated DosBasic, the little brother of MasmBasic. Here is an example:
include \masm32\MasmBasic\DosBasic.inc
; download the complete MasmBasic library
Init ; open the DosBasic include file - inspired by DednDave
mov dx,
Chr$("DOS is fun", 13, 10, "isn't it?
$")
; display the message
mov ah, 9
; the traditional DOS way,
int 21h
; ending with the $ delimiter
mov cx,
Chr$(13, 10, "More fun")
; display the message
Print cx, 13, 10
; using the cx register
Print "Real fun", 13, 10
; the simplest option Print Str$(123), " is 123", 13, 10
; even that one works - Str$ takes immediates, ax, al, ah, si, ...
Print cx, " again", 13, 10
; Print and Str$ do not trash cx mov cx,
Input$("Type something and hit Enter: ")
Open "O",
#1, "MyTyping.txt"
Print #1, cx
; save the typed text to file Close #1
Print cx, " was typed and written to file, now we are reading it back", 13, 10, 10
Make$ My$, 60000
; let's create a fat buffer FileRead My$, "MyTyping.txt"
.if Carry?
Print "FileRead ERROR", 13, 10
.else
Print Str$(ax), ' bytes read from "MyTest.txt" - contents:', 13, 10, 10, "["
Print My$, "]", 13, 10, 10
.endif
Inkey "bye"
; wait for a key Exit ; ExitProcess, DOS style
end start
"Library" attached - it will be integrated into future MasmBasic releases.The DosBasic library is now integrated -
download here.