-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgramHelloAsm.cs
More file actions
45 lines (40 loc) · 1.15 KB
/
ProgramHelloAsm.cs
File metadata and controls
45 lines (40 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) Alexandre Mutel. All rights reserved.
// Licensed under the BSD-Clause 2 license.
// See license.txt file in the project root for full license information.
using Asm6502;
using RetroC64;
using RetroC64.App;
using static RetroC64.C64Registers;
return await C64AppBuilder.Run<HelloAsm>(args);
public class HelloAsm : C64AppAsmProgram
{
private bool FlickerColors { get; set; } = false;
protected override Mos6502Label Build(C64AppBuildContext context, C64Assembler asm)
{
asm
.Label(out var start)
.BeginCodeSection("Main");
if (FlickerColors)
{
asm
.CLC()
.LDX_Imm(0)
.Label(out var loop)
.STX(VIC2_BG_COLOR0)
.STX(VIC2_BORDER_COLOR)
.INX()
.BCC(loop); // infinite loop
}
else
{
asm
.LDA_Imm(COLOR_RED)
.STA(VIC2_BG_COLOR0)
.LDA_Imm(COLOR_GREEN)
.STA(VIC2_BORDER_COLOR)
.InfiniteLoop();
}
asm.EndCodeSection();
return start;
}
}