Skip to content

Commit b11162e

Browse files
committed
Merge branch 'dosbox' into next
2 parents a315c35 + 53a1dfc commit b11162e

File tree

8 files changed

+62
-39
lines changed

8 files changed

+62
-39
lines changed

README.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,25 @@ when you are editing `assembly` files ,you can right click at the editor panel,t
2525

2626
### Demo 1: Run and Debug Assembly
2727

28-
|using TASM via DOSBox|using MASM via msdos-player|
29-
|-----|----|
30-
|![demo dosbox tasm](https://github.com/xsro/masm-tasm/raw/master/pics/demo_dosbox_tasm.gif)|![demo msdos-player masm](https://github.com/xsro/masm-tasm/raw/master/pics/demo_msdos_masm.gif)|
28+
| using TASM via DOSBox | using MASM via msdos-player |
29+
| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
30+
| ![demo dosbox tasm](https://github.com/xsro/masm-tasm/raw/master/pics/demo_dosbox_tasm.gif) | ![demo msdos-player masm](https://github.com/xsro/masm-tasm/raw/master/pics/demo_msdos_masm.gif) |
3131

3232
When opened a ASM file in Editor, Right click on the Editor, then run or debug the code. Default mode is using `DOSBox` and `TASM`, you can change it in `preference->settings` like the second gif(using MASM via msdos-palyer).
3333

3434
### Demo 2: code Formate,Diagnose and more
3535

36-
|Formate Codes|Diagnose|
37-
|----|-----|
38-
|![programmatic lanaguage features](https://github.com/xsro/masm-tasm/raw/master/pics/demo_PLFeature.gif)|![diagnose](https://github.com/xsro/masm-tasm/raw/master/pics/demo_diagnose_tasm.gif)|
36+
| Formate Codes | Diagnose |
37+
| -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
38+
| ![programmatic lanaguage features](https://github.com/xsro/masm-tasm/raw/master/pics/demo_PLFeature.gif) | ![diagnose](https://github.com/xsro/masm-tasm/raw/master/pics/demo_diagnose_tasm.gif) |
3939

4040
The extension offer some programmatic features like "hover","formate","jump to definition",you can close them in the `preferece->settings`
4141

4242
### Demo 3: Open dosbox and type the command you need
4343

44-
|Single-File (command `Open DOSBox`)|Multi-Files (command `Dosbox here`)|
45-
|---|---|
46-
|![Open in Dosbox](https://github.com/xsro/masm-tasm/raw/master/pics/opendosbox.gif)|[![pacman](https://github.com/xsro/masm-tasm/raw/master/pics/demo_pacman.gif)](https://github.com/dpisdaniel/assembly-pacman)|
44+
| Single-File (command `Open DOSBox`) | Multi-Files (command `Dosbox here`) |
45+
| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
46+
| ![Open in Dosbox](https://github.com/xsro/masm-tasm/raw/master/pics/opendosbox.gif) | [![pacman](https://github.com/xsro/masm-tasm/raw/master/pics/demo_pacman.gif)](https://github.com/dpisdaniel/assembly-pacman) |
4747

4848
- some ASM commands you may need: [ASM_commands](https://github.com/xsro/masm-tasm/blob/master/doc/ASM_commands.md).
4949
- Some interesting assembly codes you may need: [DOSBox ASM codes](https://github.com/xsro/masm-tasm/wiki/dosbox)
@@ -93,12 +93,11 @@ Folder dosbox and player are emulator for windows and this extension will not us
9393

9494
The extension will mount some folder to DOSBox 's disk. Please don't modify them.
9595

96-
|in DOSBox|real path in the computor|
97-
|---|---|
98-
|C:|the path of tools folder|
99-
|D:|the path of the work space|
100-
|E:|the path of the editor file's folder(when using command `dosbox here`)|
101-
|X:|the path of some scripts for the extension to use|
96+
| in DOSBox | real path in the computor |
97+
| --------- | ---------------------------------------------------------------------- |
98+
| C: | the path of tools folder |
99+
| D: | the path of the work space |
100+
| E: | the path of the editor file's folder(when using command `dosbox here`) |
102101

103102
## Docs & Thanks & Licenses
104103

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "MASM/TASM",
44
"publisher": "xsro",
55
"description": "DOS汇编语言开发环境和语法支持,win下安装即用,自带DOSBox.exe和TASM/MASM工具",
6-
"version": "0.3.1",
6+
"version": "0.4.0-dev",
77
"keywords": [
88
"dosbox",
99
"16位",

scripts/boxasm.bat

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,62 @@
11
::this batch file will be used in dosbox by vscode extension
22
@echo off
3-
43
if exist T.exe del T.exe
54
if exist T.OBJ del T.OBJ
5+
if exist T.lst del T.lst
66
if "%1"=="MASM" goto MASM
77
if "%1"=="TASM" goto TASM
8+
echo %1 is not MASM or TASM
89
goto end
10+
911
:MASM
1012
set path=%path%;c:\masm
13+
echo ...masm T.asm;
1114
masm T.ASM;>T.txt
15+
echo ...link T.obj;
1216
link T.OBJ;>>T.txt
1317
if exist T.exe goto MASMNEXT
14-
exit
15-
:MASMNEXT
16-
if "%2"=="run" goto run
17-
if "%2"=="debug" goto MASMdebug
18-
goto end
19-
18+
goto ERR
2019
:TASM
2120
set path=%path%;c:\tasm
21+
echo ...tasm T.ASM
2222
tasm /zi T.ASM>T.txt
23+
echo ...tlink T.OBJ
2324
tlink /v/3 T.OBJ>>T.txt
2425
if exist T.exe goto TASMNEXT
25-
exit
26+
goto ERR
27+
28+
:MASMNEXT
29+
if "%2"=="run" goto run
30+
if "%2"=="debug" goto MASMdebug
31+
echo %2 is not run or debug
32+
goto end
2633
:TASMNEXT
2734
if "%2"=="run" goto run
2835
if "%2"=="debug" goto TASMdebug
36+
echo %2 is not run or debug
37+
goto end
2938

3039
:MASMdebug
40+
echo ...debug T.EXE
3141
debug T.EXE
32-
exit
42+
goto end
3343
:TASMdebug
3444
if exist c:\tasm\TDC2.TD copy c:\tasm\TDC2.TD TDCONFIG.TD
45+
echo ...TD T.EXE
3546
TD T.EXE
47+
goto end
48+
49+
:ERR
50+
echo assemble FAILED, Output has been redireted to VSCODE's output pannel
3651
exit
3752
:run
53+
echo ...T.EXE
3854
T.EXE
3955
echo (END)
4056
echo ----------------------------------------------------------
4157
echo The symbol "(END)" means there is the END of your program's output
58+
:end
4259
if "%3"=="p" pause
43-
if "%3"=="k" goto end
60+
if "%3"=="k" goto final
4461
exit
45-
:end
62+
:final

scripts/work/ignore.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
masmtasm 工作文件夹,本文件可以自行删除
1+
This file is used to make sure workspace of xsro.masm-tasm exist

src/DOSBox.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class DOSBox {
1717
public openDOSBox(conf: Config, more?: string, doc?: TextDocument, diag?: AssemblerDiag) {
1818
let boxcmd: string = '@echo off\n';
1919
//mount the necessary path
20-
boxcmd += `mount c \\\"${conf.path}\\\"\nmount d \\\"${conf.workpath}\\\"\nmount x \\\"${conf.batchpath}\\\"\n`;
20+
boxcmd += `mount c \\\"${conf.path}\\\"\nmount d \\\"${conf.workpath}\\\"\n`;
2121
//switch to the working space and add path\
2222
boxcmd += "d:\nset PATH=%%PATH%%;c:\\tasm;c:\\masm\n";
2323
if (doc) { boxcmd += "echo Your file has been copied as D:\\T.ASM\n"; };
@@ -30,15 +30,20 @@ export class DOSBox {
3030
//command for open dosbox
3131
let command = conf.OpenDosbox + ' -conf "' + conf.dosboxconfuri.fsPath + '" ';
3232
//exec command by terminal
33-
let callback = (error: any) => {
34-
if (error) { console.error(error); };
35-
if (diag && doc) { this.BOXdiag(conf, diag, doc); }
33+
let callback = (error: any, stdout: string, stderr: string) => {
34+
if (error) { console.error(error); }
35+
else {
36+
if (diag && doc) { this.BOXdiag(conf, diag, doc); }
37+
console.log(stderr, stdout);
38+
}
3639
};
3740
if (process.platform === 'win32') {
41+
if (more) { command = "copy/Y ..\\boxasm.bat boxasm.bat & " + command; }
3842
if (doc) { command = 'del/Q T*.* & copy "' + doc.fileName + '" "T.ASM" & ' + command; }
3943
exec(command + boxcommand, { cwd: conf.workpath, shell: 'cmd.exe' }, callback);
4044
}
4145
else {
46+
if (more) { command = "cp ../boxasm.bat ./; " + command; }
4247
if (doc) { command = 'rm -f [Tt]*.*;cp "' + doc.fileName + '" T.ASM;' + command; }
4348
exec(command + boxcommand, { cwd: conf.workpath }, callback);
4449
}

src/MSDOS-player.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class MSDOSplayer {
8787
else {
8888
let box = new DOSBox();
8989
if (runordebug) {
90-
box.openDOSBox(conf, 'T.EXE\n' + conf.boxruncmd);
90+
box.openDOSBox(conf, 'T.EXE' + conf.boxruncmd);
9191
}
9292
else {
9393
box.openDOSBox(conf, debug);

src/configration.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ export class Config {
107107
let command: string = ' ';
108108
switch (this._BOXrun) {
109109
case "keep": command = ' '; break;
110-
case "exit after run": command = 'exit'; break;
111-
case "pause then exit after run": command = 'pause \n exit'; break;
110+
case "exit": command = '\n exit'; break;
111+
case "pause":
112+
default: command = '\n pause \n exit'; break;
112113
}
113114
return command;
114115
}
@@ -119,8 +120,9 @@ export class Config {
119120
let param: string = ' ';
120121
switch (this._BOXrun) {
121122
case "keep": param = 'k'; break;
122-
case "exit after run": param = 'e'; break;
123-
case "pause then exit after run": param = 'p'; break;
123+
case "exit": param = 'e'; break;
124+
case "pause":
125+
default: param = 'p'; break;
124126
}
125127
return param;
126128
}

src/runcode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class AsmAction {
4040
switch (this._config.DOSemu) {
4141
case 'msdos player': this.msdosplayer.PlayerASM(this._config, true, true, this.landiag, doc); break;
4242
case 'dosbox':
43-
let text = 'x:\\boxasm.bat ' + this._config.MASMorTASM + ' run ' + this._config.boxrunbat;
43+
let text = 'boxasm.bat ' + this._config.MASMorTASM + ' run ' + this._config.boxrunbat;
4444
this.dosbox.openDOSBox(this._config, text, doc, this.landiag);
4545
break;
4646
case 'auto': this.msdosplayer.PlayerASM(this._config, true, false, this.landiag, doc); break;
@@ -63,7 +63,7 @@ export class AsmAction {
6363
this.msdosplayer.PlayerASM(this._config, false, inplayer, this.landiag, doc);
6464
}
6565
else {
66-
let text = 'x:\\boxasm.bat ' + this._config.MASMorTASM + ' debug';
66+
let text = 'boxasm.bat ' + this._config.MASMorTASM + ' debug';
6767
this.dosbox.openDOSBox(this._config, text, doc, this.landiag);
6868
}
6969
}

0 commit comments

Comments
 (0)