mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-02-22 03:29:01 +00:00
Merge branch 'newplasma' of https://github.com/badvision/lawless-legends into newplasma
This commit is contained in:
commit
0f8dbaba4a
@ -1,35 +1,45 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2015 The 8-Bit Bunch. Licensed under the Apache License, Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-1.1>.
|
||||
// Unless required by applicable law or agreed to in writing, software distributed under
|
||||
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
// ANY KIND, either express or implied. See the License for the specific language
|
||||
// governing permissions and limitations under the License.
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
import cmdsys
|
||||
predef putc, putln, puts, getc, gets
|
||||
predef call, syscall
|
||||
predef heapmark, heapallocallign, heapalloc, heaprelease, heapavail
|
||||
predef memset, memcpy
|
||||
predef isugt, isuge, isult, isule
|
||||
predef modload, modexec, modaddr
|
||||
word MACHID, sysvars
|
||||
//
|
||||
// System flags: memory allocator screen holes.
|
||||
//
|
||||
const restxt1 = $0001
|
||||
const restxt2 = $0002
|
||||
const resxtxt1 = $0004
|
||||
const resxtxt2 = $0008
|
||||
const reshgr1 = $0010
|
||||
const reshgr2 = $0020
|
||||
const resxhgr1 = $0040
|
||||
const resxhgr2 = $0080
|
||||
//
|
||||
// Module don't free memory
|
||||
//
|
||||
const modkeep = $2000
|
||||
const modinitkeep = $4000
|
||||
const MACHID_CLOCK = $01
|
||||
const MACHID_80COL = $02
|
||||
const MACHID_MEM = $03
|
||||
const MACHID_48K = $10
|
||||
const MACHID_64K = $20
|
||||
const MACHID_128K = $30
|
||||
const MACHID_MODEL = $C8
|
||||
const MACHID_II = $00
|
||||
const MACHID_IIPLUS= $40
|
||||
const MACHID_IIE = $80
|
||||
const MACHID_III = $C0
|
||||
const MACHID_IIC = $88
|
||||
const MACHID_I = $08
|
||||
word MACHID
|
||||
//
|
||||
// System flags: memory allocator screen holes.
|
||||
//
|
||||
const restxt1 = $0001
|
||||
const restxt2 = $0002
|
||||
const resxtxt1 = $0004
|
||||
const resxtxt2 = $0008
|
||||
const reshgr1 = $0010
|
||||
const reshgr2 = $0020
|
||||
const resxhgr1 = $0040
|
||||
const resxhgr2 = $0080
|
||||
//
|
||||
// Module don't free memory
|
||||
//
|
||||
const modkeep = $2000
|
||||
const modinitkeep = $4000
|
||||
//
|
||||
// System vars
|
||||
//
|
||||
word sysvars
|
||||
//
|
||||
// CMD exported functions
|
||||
//
|
||||
predef putc, putln, puts, getc, gets
|
||||
predef call, syscall
|
||||
predef heapmark, heapallocalign, heapalloc, heaprelease, heapavail
|
||||
predef memset, memcpy
|
||||
predef isugt, isuge, isult, isule
|
||||
predef modload, modexec, modaddr
|
||||
end
|
||||
|
@ -1478,7 +1478,7 @@ int parse_mods(void)
|
||||
emit_moddep(0, 0);
|
||||
return (0);
|
||||
}
|
||||
iint parse_lambda(void)
|
||||
int parse_lambda(void)
|
||||
{
|
||||
int func_tag;
|
||||
int cfnparms;
|
||||
@ -1552,7 +1552,7 @@ iint parse_lambda(void)
|
||||
idlocal_restore();
|
||||
return (func_tag);
|
||||
}
|
||||
nt parse_defs(void)
|
||||
int parse_defs(void)
|
||||
{
|
||||
char c, *idstr;
|
||||
int idlen, func_tag, cfnparms, cfnvals, type = GLOBAL_TYPE, pretype;
|
||||
|
@ -1,12 +1,3 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The 8-Bit Bunch. Licensed under the Apache License, Version 1.1
|
||||
* (the "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-1.1>.
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under
|
||||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
* ANY KIND, either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@ -785,7 +776,9 @@ void interp(code *ip)
|
||||
fp += PLA;
|
||||
case 0x5C: // RET : IP = TOFP
|
||||
return;
|
||||
case 0x5E: // ???
|
||||
case 0x5E: // CFFB : TOS = CONSTANTBYTE(IP) | 0xFF00
|
||||
PUSH(BYTE_PTR(ip) | 0xFF00);
|
||||
ip++;
|
||||
break;
|
||||
/*
|
||||
* 0x60-0x6F
|
||||
|
@ -1,13 +1,3 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2015 The 8-Bit Bunch. Licensed under the Apache License, Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-1.1>.
|
||||
// Unless required by applicable law or agreed to in writing, software distributed under
|
||||
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
// ANY KIND, either express or implied. See the License for the specific language
|
||||
// governing permissions and limitations under the License.
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// Include all imported modules and their data/functions.
|
||||
//
|
||||
@ -42,17 +32,18 @@ byte constr = "Constant expression = "
|
||||
byte[] offsets = "Structure offsets:"
|
||||
word array[] = 1, 10, 100, 1000, 10000
|
||||
word ptr
|
||||
byte spaces = " "
|
||||
//
|
||||
// Define functions.
|
||||
//
|
||||
def tens(start)
|
||||
word i
|
||||
word i, pptr
|
||||
|
||||
i = start
|
||||
pptr = @print
|
||||
repeat
|
||||
print:hex(i)
|
||||
print:str(@spaces)
|
||||
print:dec(i)
|
||||
print:str(" ")
|
||||
pptr=>dec(i)
|
||||
print:newln()
|
||||
i = i / 10
|
||||
until i == 0
|
||||
@ -67,16 +58,40 @@ def ascii
|
||||
end
|
||||
def nums(range)
|
||||
word i
|
||||
byte j
|
||||
for i = range downto -range step range/10
|
||||
puti(i)
|
||||
putln
|
||||
next
|
||||
puti(array[0]);putln
|
||||
puti(array[1]);putln
|
||||
i++
|
||||
j = 2
|
||||
j++
|
||||
array[1]++
|
||||
array[0] = array[0] + 1
|
||||
array++
|
||||
a1[0]++
|
||||
a1++
|
||||
puti(array[0]);putln
|
||||
puti(array[1]);putln
|
||||
end
|
||||
def printfunc(a, b, lambda)#0
|
||||
puts("func(a,b)=")
|
||||
puti(lambda(a,b))
|
||||
putln
|
||||
end
|
||||
export def main(range)
|
||||
byte a
|
||||
word lambda
|
||||
|
||||
a = 10
|
||||
nums(*range)
|
||||
tens(*range*10)
|
||||
ascii
|
||||
putln
|
||||
puts("10 * 8 = "); puti(a * 8); putln
|
||||
puts("10 / 2 = "); puti(a / 2); putln
|
||||
puts(@hello)
|
||||
when MACHID & $C8
|
||||
is $08
|
||||
@ -101,7 +116,26 @@ export def main(range)
|
||||
putc('?')
|
||||
wend
|
||||
putln
|
||||
printfunc(1, 2, &(a,b) a+b)
|
||||
printfunc(1, 2, &(a,b) (a-b))
|
||||
lambda = &(x,y) x * y
|
||||
puti(lambda(2,3));putln
|
||||
end
|
||||
|
||||
def dummy(zz)#0
|
||||
puts("dummy func"); putln
|
||||
end
|
||||
|
||||
puti(array[0]);putc(' ')
|
||||
puti(array[1]);putc(' ')
|
||||
puti(array[2]);putc(' ')
|
||||
puti(array[3]);putc(' ')
|
||||
puti(array[4]);putln
|
||||
puti((@array)=>0);putc(' ')
|
||||
puti((@array)=>2);putc(' ')
|
||||
puti((@array)=>4);putc(' ')
|
||||
puti((@array)=>6);putc(' ')
|
||||
puti((@array)=>8);putln
|
||||
ptr = @main
|
||||
ptr(@array:6)
|
||||
ptr = @array
|
||||
@ -124,6 +158,6 @@ putln
|
||||
puti(mystruc)
|
||||
putln
|
||||
puts(@constr); puti(constval); putln
|
||||
puts("Hello from in-line string!\n")
|
||||
puts("Hi \$41pple.\n");
|
||||
puts("Signed byte constant:"); puti(-3); putln
|
||||
puts("Hello from in-line string!\$7F\n")
|
||||
done
|
||||
|
@ -1,13 +1,3 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2015 The 8-Bit Bunch. Licensed under the Apache License, Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-1.1>.
|
||||
// Unless required by applicable law or agreed to in writing, software distributed under
|
||||
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
// ANY KIND, either express or implied. See the License for the specific language
|
||||
// governing permissions and limitations under the License.
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// Include all imported modules and their data/functions.
|
||||
//
|
||||
@ -15,7 +5,7 @@ include "cmdsys.plh"
|
||||
//
|
||||
// Module data.
|
||||
//
|
||||
predef puti, puth, putln
|
||||
predef puti, puth
|
||||
export word print[] = @puti, @puth, @putln, @puts, @putc
|
||||
byte valstr[] = '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
|
||||
byte loadstr[] = "testlib loaded!"
|
||||
|
@ -1,15 +1,5 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2015 The 8-Bit Bunch. Licensed under the Apache License, Version 1.1
|
||||
// (the "License"); you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-1.1>.
|
||||
// Unless required by applicable law or agreed to in writing, software distributed under
|
||||
// the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
// ANY KIND, either express or implied. See the License for the specific language
|
||||
// governing permissions and limitations under the License.
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
import testlib
|
||||
predef puti, putln
|
||||
predef puti
|
||||
word print
|
||||
const dec = 0
|
||||
const hex = 2
|
||||
|
Loading…
x
Reference in New Issue
Block a user