-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Credit and thanks to Ladislau Szilagyi. Co-Authored-By: ladislau szilagyi <87603175+laci1953@users.noreply.github.com>
- Loading branch information
Showing
46 changed files
with
1,451 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
===== Cowgol 2.0 for CP/M ===== | ||
|
||
This disk contains the Cowgol 2.0 compiler and related tools. | ||
These files were provided by Ladislau Szilagyi and were sourced | ||
from his GitHub repository at https://github.com/Laci1953/Cowgol_on_CP_M. | ||
|
||
The COWFE program included here is the RomWBW-specific version that | ||
is tailored to RomWBW memory management. | ||
|
||
The primary distribution site for Cowgol 2.0 is at | ||
https://github.com/davidgiven/cowgol. | ||
|
||
The Hi-Tech C compiler components were sourced from the updated | ||
version by Tony Nicholson at https://github.com/agn453/HI-TECH-Z80-C. | ||
However, the CPP.COM component was sourced from Ladislau Szilagyi's | ||
enhanced Hi-Tech C at https://github.com/Laci1953/HiTech-C-compiler-enhanced. | ||
|
||
Note that only the minimum required Hi-Tech C compiler components | ||
are provided. Additional components from Hi-Tech C may be required | ||
depending on your needs. | ||
|
||
There are two example Cowgol applications included: | ||
|
||
- HEXDUMP is a simple hex dump utility and is purely a Cowgol | ||
application (no assembler or C components). The command | ||
line to build the application is: | ||
|
||
COWGOL HEXDUMP.COW | ||
|
||
- DYNMSORT demonstrates a sort algorithm and is composed of | ||
Cowgol, C, and assembler components. The command line to | ||
build the application is: | ||
|
||
COWGOL -LC DYNMSORT.COW MERGES.C RAND.AS | ||
|
||
There are also SUBMIT files provided to build the example | ||
applications which can be used as follows: | ||
|
||
SUBMIT HEXDUMP | ||
SUBMIT DYNMSORT | ||
|
||
-- WBW 12:38 PM 2/10/2024 | ||
|
||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
var argv_pointer: [uint8]; | ||
|
||
sub ArgvInit() is | ||
argv_pointer := 0x81 as [uint8]; | ||
[argv_pointer + [0x80 as [uint8]] as intptr] := 0; | ||
end sub; | ||
|
||
# Returns null is there's no next argument. | ||
sub ArgvNext(): (arg: [uint8]) is | ||
# No more arguments? | ||
|
||
if argv_pointer == (0 as [uint8]) then | ||
arg := argv_pointer; | ||
return; | ||
end if; | ||
|
||
# Skip leading whitespace. | ||
|
||
var c: uint8; | ||
loop | ||
c := [argv_pointer]; | ||
if c != ' ' then | ||
break; | ||
end if; | ||
argv_pointer := argv_pointer + 1; | ||
end loop; | ||
|
||
arg := argv_pointer; | ||
|
||
# Skip to end of word and terminate. | ||
|
||
loop | ||
c := [argv_pointer]; | ||
if (c == ' ') or (c == '\n') or (c == 0) then | ||
break; | ||
end if; | ||
argv_pointer := argv_pointer + 1; | ||
end loop; | ||
[argv_pointer] := 0; | ||
|
||
if c == ' ' then | ||
argv_pointer := argv_pointer + 1; | ||
else | ||
argv_pointer := 0 as [uint8]; | ||
end if; | ||
end sub; | ||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
sub FCBPutString(fcb: [FCB], s: [uint8]) is | ||
loop | ||
var c := [s]; | ||
if c == 0 then | ||
break; | ||
end if; | ||
FCBPutChar(fcb, c); | ||
s := @next s; | ||
end loop; | ||
end sub; | ||
|
||
sub FCBGetBlock(fcb: [FCB], buffer: [uint8], length: intptr) is | ||
while length != 0 loop; | ||
[buffer] := FCBGetChar(fcb); | ||
buffer := buffer + 1; | ||
length := length - 1; | ||
end loop; | ||
end sub; | ||
|
||
sub FCBPutBlock(fcb: [FCB], buffer: [uint8], length: intptr) is | ||
while length != 0 loop; | ||
FCBPutChar(fcb, [buffer]); | ||
buffer := buffer + 1; | ||
length := length - 1; | ||
end loop; | ||
end sub; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
sub print(ptr: [uint8]) is | ||
loop | ||
var c := [ptr]; | ||
if c == 0 then | ||
return; | ||
end if; | ||
print_char(c); | ||
ptr := ptr + 1; | ||
end loop; | ||
end sub; | ||
|
||
sub print_nl() is | ||
print_char('\n'); | ||
end sub; | ||
|
||
sub UIToA(value: uint32, base: uint8, buffer: [uint8]): (ptr: [uint8]) is | ||
ptr := buffer; | ||
loop | ||
var rem := value % (base as uint32); | ||
value := value / (base as uint32); | ||
if rem < 10 then | ||
rem := rem + '0'; | ||
else | ||
rem := rem + ('a' - 10); | ||
end if; | ||
[ptr] := rem as uint8; | ||
ptr := @next ptr; | ||
|
||
if value == 0 then | ||
break; | ||
end if; | ||
end loop; | ||
|
||
var s1 := buffer; | ||
var s2 := @prev ptr; | ||
while s2 > s1 loop | ||
var c := [s1]; | ||
[s1] := [s2]; | ||
[s2] := c; | ||
s1 := @next s1; | ||
s2 := @prev s2; | ||
end loop; | ||
|
||
[ptr] := 0; | ||
end sub; | ||
|
||
sub IToA(value: int32, base: uint8, buffer: [uint8]): (ptr: [uint8]) is | ||
if value < 0 then | ||
[buffer] := '-'; | ||
buffer := @next buffer; | ||
value := -value; | ||
end if; | ||
ptr := UIToA(value as uint32, base, buffer); | ||
end sub; | ||
|
||
sub print_i32(value: uint32) is | ||
var buffer: uint8[12]; | ||
var pe := UIToA(value, 10, &buffer[0]); | ||
print(&buffer[0]); | ||
end sub; | ||
|
||
sub print_i16(value: uint16) is | ||
print_i32(value as uint32); | ||
end sub; | ||
|
||
sub print_i8(value: uint8) is | ||
print_i32(value as uint32); | ||
end sub; | ||
|
||
sub print_hex_i8(value: uint8) is | ||
var i: uint8 := 2; | ||
loop | ||
var digit := value >> 4; | ||
if digit < 10 then | ||
digit := digit + '0'; | ||
else | ||
digit := digit + ('a' - 10); | ||
end if; | ||
print_char(digit); | ||
value := value << 4; | ||
i := i - 1; | ||
if i == 0 then | ||
break; | ||
end if; | ||
end loop; | ||
end sub; | ||
|
||
sub print_hex_i16(value: uint16) is | ||
print_hex_i8((value >> 8) as uint8); | ||
print_hex_i8(value as uint8); | ||
end sub; | ||
|
||
sub print_hex_i32(value: uint32) is | ||
print_hex_i8((value >> 24) as uint8); | ||
print_hex_i8((value >> 16) as uint8); | ||
print_hex_i8((value >> 8) as uint8); | ||
print_hex_i8(value as uint8); | ||
end sub; | ||
|
||
sub AToI(buffer: [uint8]): (result: int32, ptr: [uint8]) is | ||
var negative: uint8 := 0; | ||
var base: uint8 := 10; | ||
ptr := buffer; | ||
result := 0; | ||
|
||
var c := [ptr]; | ||
if (c == '-') then | ||
negative := 1; | ||
ptr := ptr + 1; | ||
c := [ptr]; | ||
end if; | ||
if (c == '0') then | ||
case [ptr+1] is | ||
when 'x': base := 16; | ||
when 'o': base := 8; | ||
when 'b': base := 2; | ||
when 'd': base := 10; | ||
|
||
when else: ptr := ptr - 2; | ||
end case; | ||
ptr := ptr + 2; | ||
c := [ptr]; | ||
end if; | ||
|
||
loop | ||
if c >= 'a' then | ||
c := c - 'a' + 10; | ||
elseif c >= 'A' then | ||
c := c - 'A' + 10; | ||
else | ||
c := c - '0'; | ||
end if; | ||
if c >= (base as uint8) then | ||
break; | ||
end if; | ||
result := (result * base as int32) + (c as int32); | ||
|
||
ptr := ptr + 1; | ||
c := [ptr]; | ||
end loop; | ||
|
||
if negative != 0 then | ||
result := -result; | ||
end if; | ||
end sub; | ||
|
||
sub MemZero(ptr: [uint8], size: intptr) is | ||
MemSet(ptr, 0, size); | ||
end sub; | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.