Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved demo dasm16 files

  • Loading branch information...
commit 4f989c7eb94ed81d9957ac19a6f0e3a48fcdf52e 1 parent 32a4c51
@jamie124 authored
View
BIN  dcpu_emulator.suo
Binary file not shown
View
5 dcpu_emulator/assembler.cpp
@@ -350,6 +350,11 @@ int Assembler::compile(std::string filename)
std::ifstream sourceFile(filename);
+ if (!sourceFile.is_open()) {
+ std::cout << "ERROR: Could not open " << filename.c_str() << std::endl;
+ return -1;
+ }
+
// TODO: Add automatic file naming
FILE* compiledFile = fopen(compiledFilename.c_str(), "w");
View
17 dcpu_emulator/dcpu_emulator.vcxproj
@@ -73,15 +73,16 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <None Include="demo.asm" />
- <None Include="demo2.asm" />
- <None Include="hello.asm" />
- <None Include="notch.asm" />
- <None Include="os_test.asm" />
- <None Include="rain.asm" />
+ <None Include="demo_asm\demo.dasm16" />
+ <None Include="demo_asm\demo2.dasm16" />
+ <None Include="demo_asm\hello.dasm16" />
+ <None Include="demo_asm\loop.dasm16" />
+ <None Include="demo_asm\notch.dasm16" />
+ <None Include="demo_asm\os_test.dasm16" />
+ <None Include="demo_asm\rain.dasm16" />
+ <None Include="demo_asm\simple.dasm16" />
+ <None Include="demo_asm\terminal.dasm16" />
<None Include="ReadMe.txt" />
- <None Include="simple.asm" />
- <None Include="terminal.asm" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="assembler.h" />
View
38 dcpu_emulator/dcpu_emulator.vcxproj.filters
@@ -13,32 +13,38 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
+ <Filter Include="demo_asm">
+ <UniqueIdentifier>{d98c5ec3-74eb-4f8e-9d0d-c786cc9422d1}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
- <None Include="demo.asm">
- <Filter>Source Files</Filter>
+ <None Include="demo_asm\demo.dasm16">
+ <Filter>demo_asm</Filter>
</None>
- <None Include="demo2.asm">
- <Filter>Source Files</Filter>
+ <None Include="demo_asm\demo2.dasm16">
+ <Filter>demo_asm</Filter>
</None>
- <None Include="hello.asm">
- <Filter>Source Files</Filter>
+ <None Include="demo_asm\hello.dasm16">
+ <Filter>demo_asm</Filter>
</None>
- <None Include="terminal.asm">
- <Filter>Source Files</Filter>
+ <None Include="demo_asm\loop.dasm16">
+ <Filter>demo_asm</Filter>
</None>
- <None Include="os_test.asm">
- <Filter>Source Files</Filter>
+ <None Include="demo_asm\notch.dasm16">
+ <Filter>demo_asm</Filter>
</None>
- <None Include="rain.asm">
- <Filter>Source Files</Filter>
+ <None Include="demo_asm\os_test.dasm16">
+ <Filter>demo_asm</Filter>
</None>
- <None Include="notch.asm">
- <Filter>Source Files</Filter>
+ <None Include="demo_asm\rain.dasm16">
+ <Filter>demo_asm</Filter>
</None>
- <None Include="simple.asm">
- <Filter>Source Files</Filter>
+ <None Include="demo_asm\simple.dasm16">
+ <Filter>demo_asm</Filter>
+ </None>
+ <None Include="demo_asm\terminal.dasm16">
+ <Filter>demo_asm</Filter>
</None>
</ItemGroup>
<ItemGroup>
View
0  dcpu_emulator/demo.asm → dcpu_emulator/demo_asm/demo.dasm16
File renamed without changes
View
0  dcpu_emulator/demo2.asm → dcpu_emulator/demo_asm/demo2.dasm16
File renamed without changes
View
0  dcpu_emulator/hello.asm → dcpu_emulator/demo_asm/hello.dasm16
File renamed without changes
View
16 dcpu_emulator/demo_asm/loop.dasm16
@@ -0,0 +1,16 @@
+set i, 1
+
+:loop IFG i, 0x77
+SET PC, next
+SET [0x000e], i
+SET a, I
+MOD a, 8
+ADD a, 1
+MUL a, 0x1001
+SET [0x0020], a
+ADD i, 1
+SET PC, loop
+
+:next SET [0x0018], 0x1234
+
+SUB PC, 1
View
0  dcpu_emulator/notch.asm → dcpu_emulator/demo_asm/notch.dasm16
File renamed without changes
View
103 dcpu_emulator/demo_asm/os_test.dasm16
@@ -0,0 +1,103 @@
+;0x1200 Data For nextchar
+;0x1201 Position used in nextchar
+;0x1335 Char Position
+;0x1334 Text Color
+;0x1333 Used in nextchar but only there
+
+
+
+ set j, 0
+ set [0x1200], data
+ set [0x1335], 1
+ set [0x1334], 0xf100
+ jsr print
+ set [0x1200], text
+ jsr printnl
+ SET PC, Input
+:printnl
+set j, 0
+jsr Nextline
+jsr print
+jsr Nextline
+SET PC, pop
+
+:print
+ set [0x1333], [0x1200]
+ add [0x1333], j
+ set a, [0x1333]
+ ife [a], 0x0003
+ set PC, pop
+ ifg [a], 0xff
+ set PC, print
+ bor [a], [0x1334]
+ set b, 0x8000
+ add b, [line]
+ add b, j
+ set [b], [a]
+ add j, 1
+ set PC, print
+
+:data dat "Logon - ver 0.1!", 0x0003
+:line dat 0
+:text dat "New line BITCHES",0x0003
+:RedditData dat "asdf",0x0003
+
+:Write
+bor [0x9000], [0x1334]
+set [0x1335], 0x8000
+add [0x1335], Y
+add [0x1335], [line]
+set C, [0x1335]
+SET [C], [0x9000]
+add [0x5000], [0x9000]
+SET [0x9000], 0
+ADD Y, 1
+SET PC, Input
+
+:CommandCheck
+SET PC, pop
+
+:Nextline
+SET [0x9000], 0
+add [line], 32
+set Y, 0
+SET PC, pop
+
+:Input
+SET [0x1336], [0x9000]
+Set [0x1337], 0x8020
+IFE [0x1336], 0
+ SET PC, Input
+IFE [0x1336], 0x0020
+ SET PC, Clearscreen
+IFE [0x1336], 0x8
+ SET PC, BackSpace
+IFE [0x1336], 0xA
+ jsr Nextline
+IFN [0x1336], 0x0000
+ SET PC, Write
+SET PC, Input
+
+:Clearscreen
+SET [0x9000], 0
+SET Y, 0
+set [line], 32
+jsr Clearscreenloop
+set PC, Input
+
+:Clearscreenloop
+set C, [0x1337]
+SET [C], 0
+add [0x1337], 1
+IFG [0x1337], 0x8060
+ set PC, pop
+SET PC, Clearscreenloop
+
+:BackSpace
+SET [0x9000], 0
+sub Y, 1
+set b, 0x8000
+add b, [line]
+add b, y
+set [b], 0x0000
+set PC, Input
View
0  dcpu_emulator/rain.asm → dcpu_emulator/demo_asm/rain.dasm16
File renamed without changes
View
0  dcpu_emulator/simple.asm → dcpu_emulator/demo_asm/simple.dasm16
File renamed without changes
View
0  dcpu_emulator/terminal.asm → dcpu_emulator/demo_asm/terminal.dasm16
File renamed without changes
View
4 dcpu_emulator/main.cpp
@@ -15,13 +15,13 @@ int _tmain(int argc, _TCHAR* argv[])
Assembler* assembler = new Assembler();
- assembler->compile("simple.asm");
+ assembler->compile("demo_asm/loop.dasm16");
delete assembler;
Cpu* cpu = new Cpu();
- cpu->run("simple.bin");
+ cpu->run("loop.bin");
delete cpu;
Please sign in to comment.
Something went wrong with that request. Please try again.