To get around the issue of Debug.exe hanging while attempting to redirect input from a text file into DOS debug (explained on StackOverflow DOSBox: debug.exe reads file – processes commands incorrectly) use the FreeDOS DEBUG.COM replacement.
A cool 16 Bit COM file example to show how this works is fireasm.scp
To assemble fire.com from fireasm.scp, place debug.com and fireasm.scp in the same folder and run DOSBox. Mount the folder in DOSBox and type:
debug < fire.scp
fire.com