^C works now

This commit is contained in:
minjaesong
2020-06-16 08:15:57 +09:00
parent 810e9e0c0b
commit 4e9dcf71e0
2 changed files with 6 additions and 10 deletions

View File

@@ -33,11 +33,11 @@ con.getyx = function() {
}; };
con.hitterminate = function() { // ^C con.hitterminate = function() { // ^C
sys.poke(-40, 1); sys.poke(-40, 1);
return (sys.peek(-41) == 31 && (sys.peek(-41) == 129 || sys.peek(-41) == 130)); return (sys.peek(-41) == 31 && (sys.peek(-42) == 129 || sys.peek(-42) == 130));
}; };
con.hiteof = function() { // ^D con.hiteof = function() { // ^D
sys.poke(-40, 1); sys.poke(-40, 1);
return (sys.peek(-41) == 32 && (sys.peek(-41) == 129 || sys.peek(-41) == 130)); return (sys.peek(-41) == 32 && (sys.peek(-42) == 129 || sys.peek(-42) == 130));
}; };
con.color_fore = function(n) { // 0..7; -1 for transparent con.color_fore = function(n) { // 0..7; -1 for transparent
if (n < 0) if (n < 0)

View File

@@ -17,9 +17,9 @@ var cmdbufMemFootPrint = 0;
var prompt = "Ok"; var prompt = "Ok";
var lang = {}; var lang = {};
lang.badNumberFormat = "Bad number format"; lang.badNumberFormat = "Illegal number format";
lang.badOperatorFormat = "Bad number format"; lang.badOperatorFormat = "Illegal number format";
lang.badFunctionCallFormat = "Bad function call format"; lang.badFunctionCallFormat = "Illegal function call";
lang.unmatchedBrackets = "Unmatched brackets"; lang.unmatchedBrackets = "Unmatched brackets";
lang.syntaxfehler = function(line, reason) { lang.syntaxfehler = function(line, reason) {
return "Syntax error" + ((line !== undefined) ? (" in "+line) : "") + (reason !== undefined) ? (": "+reason) : ""; return "Syntax error" + ((line !== undefined) ? (" in "+line) : "") + (reason !== undefined) ? (": "+reason) : "";
@@ -1170,9 +1170,6 @@ basicFunctions.fre = function(args) {
basicFunctions.run = function(args) { // RUN function basicFunctions.run = function(args) { // RUN function
var linenumber = 1; var linenumber = 1;
var oldnum = 1; var oldnum = 1;
var countup = 0;
do { do {
if (cmdbuf[linenumber] !== undefined) { if (cmdbuf[linenumber] !== undefined) {
oldnum = linenumber; oldnum = linenumber;
@@ -1181,8 +1178,7 @@ basicFunctions.run = function(args) { // RUN function
else { else {
linenumber += 1; linenumber += 1;
} }
countup += 1; if (con.hitterminate()) {
if (con.hitterminate() || countup >= 100) {
println("Break in "+oldnum); println("Break in "+oldnum);
break; break;
} }