Skip to content

Commit

Permalink
v1.0.1 - Small-Make Update
Browse files Browse the repository at this point in the history
  • Loading branch information
humbertocsjr committed May 23, 2023
1 parent 5655320 commit e976439
Show file tree
Hide file tree
Showing 14 changed files with 164 additions and 14 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ emu/stderr.txt

# Allow
!/code/bin/*.EXE
!/code/smalllib/clib/CALL.ASM
!/code/lib/clib/*.ASM
!/code/infozip/*.EXE
!/code/setup/*.*
Binary file modified code/DISTRO.ZIP
Binary file not shown.
Binary file modified code/bin/make.exe
Binary file not shown.
Binary file added code/infozip/UNZIP.exe
Binary file not shown.
Binary file added code/infozip/ZIP16.EXE
Binary file not shown.
146 changes: 146 additions & 0 deletions code/lib/clib/CALL.ASM
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
;
; Small-C Run Time Library for MS/PC-DOS
;
extrn __main: near
extrn _exit: near
extrn __memptr: word

data segment public
dw 1
data ends

stack segment stack
dw 32 dup(?)
stack ends

code segment public
assume cs:code
start:
mov ax,data ; set data segment for program
mov ds,ax
mov ax,es:[2] ; paragraphs of memory on system
sub ax,data ; paragraphs beyond code segment
cmp ah,10h ; more than 64K?
jb start_1 ; no
mov ax,1000h ; only use 64K
start_1:
mov cl,4
shl ax,cl ; byte offset to end of data/free/stack
cli ; disable interrupts
mov bx,ds
mov ss,bx ; make data and stack segments coincide
mov sp,ax ; top of stack = end of data/free/stack
push ax ; force sp non-zero (if 64K used)
sti ; reenable interrupts
mov ax,stack ; paragraph following data
sub ax,data ; number of data paragraphs
shl ax,cl ; number of data bytes (offset to free/stack)
mov bx,ax
inc bh ; adjust for minimum stack space
cmp bx,sp ; enough memory?
jb start_2 ; yes
mov ax,1 ; no, terminate with exit code 1
push ax
call _exit
start_2:
mov __memptr,ax ; set memory allocation pointer
;
; ------------ release unused memory -----------
; ------ cannot run debug with this code -------
; mov bx,sp
; mov ah,4AH
; int 21H
; ----------------------------------------------
;
; make sure that es -> psp, because __main requires it
;
jmp __main ; __main never returns

public _ccargc
_ccargc:
mov al,cl
xor ah,ah
ret

;
; Test if Secondary (BX) <oper> Primary (AX)
;-------------------------- MASM version
;compare macro name, cond
; public __&name
;__&name:
; cmp ax,bx
; j&cond true
; xor ax,ax ; returns zero
; ret
; endm
;-------------------------- ASM version
compare macro name, cond
public __?1
__?1:
cmp ax,bx
j?2 true
xor ax,ax ; returns zero
ret
endm
;--------------------------
compare ult,a
compare ugt,b
compare ule,ae
compare uge,be
compare eq,e
compare ne,ne
compare lt,g
compare gt,l
compare le,ge
compare ge,le

;
; Logical Negate of Primary
;
public __lneg
__lneg:
or ax,ax
jnz false
true: mov ax,1 ; returns one
ret
false: xor ax,ax ; returns zero
ret
;
;
; execute "switch" statement
;
; ax = switch value
; (sp) -> switch table
; dw addr1, value1
; dw addr2, value2
; ...
; dw 0
; [jmp default]
; continuation
;
public __switch
__switch:
pop bx ; bx -> switch table
jmp skip ; skip the pre-increment
back:
add bx,4
skip: mov cx,cs:[bx]
jcxz default ; end of table -- jump out
cmp ax,cs:[bx+2]
jnz back
jmp cx ; match -- jump to case
default:
inc bx
inc bx
jmp bx ; jump to default/continuation
;
; dummy entry point to resolve the external reference _LINK
; which is no longer generated by Small-C but which exists in
; library modules and .OBJ files compiled by earlier versions
; of Small-C
public __link
__link: ret

code ends
end start

2 changes: 1 addition & 1 deletion code/make/make.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ runTgt(target) int target;
printf("%s\n", line);
if (i = system(line))
{
printf("Exit code %d\n", i);
printf("Exit code %d from command:\n%s\n", i, line);
return i;
}
}
Expand Down
10 changes: 7 additions & 3 deletions code/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,25 @@ all:
onlycc:
cd cc
make
make install
cd ..

onlyasm:
cd asm
make
make install
cd ..

onlymake:
cd make
make
..\bin\make
..\bin\make install
cd ..

onlyylink:
cd cc
ylink
make
make install
cd ..

onlylib:
Expand Down Expand Up @@ -53,7 +57,7 @@ clean:
make clean
cd ..
cd make
make clean
..\bin\make clean
cd ..
cd ylink
make clean
Expand Down
Binary file modified code/setup/BIN.ZIP
Binary file not shown.
Binary file modified code/setup/CC.ZIP
Binary file not shown.
Binary file modified code/setup/MAKE.ZIP
Binary file not shown.
Binary file added code/setup/UNZIP.EXE
Binary file not shown.
6 changes: 4 additions & 2 deletions emu/smallc.conf
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ memsize=16
# to fill the screen entirely, depending on your hardware, a different scaler/fullresolution might work.
# Possible values: none, normal2x, normal3x, advmame2x, advmame3x, advinterp2x, advinterp3x, hq2x, hq3x, 2xsai, super2xsai, supereagle, tv2x, tv3x, rgb2x, rgb3x, scan2x, scan3x.

frameskip=0
frameskip=10
aspect=false
scaler=normal2x

Expand All @@ -84,7 +84,7 @@ scaler=normal2x

core=auto
cputype=auto
cycles=auto
cycles=fixed 10000
cycleup=10
cycledown=20

Expand Down Expand Up @@ -249,3 +249,5 @@ ipx=false

C:
set PATH=Z:\;C:\BIN
cls
make
10 changes: 3 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ YLink was written by Zane Wagner in 2017.
Version 2.2, Revision Level 117
Copyright 1982, 1983, 1985, 1988 J. E. Hendrix

Enhancements by Zane Wagner:
* Replaced Quote[] with inline string literal.
* Consolidated Type recognition in dodeclare(), dofunction(), and statement().
* C99 style comments are allowed (//)
* C89/C90 argument list types.
* Support for 'static' access modifier for functions and globals.
* Support for longer variable names.
* Rollback to original sources, Zane Wagner version isnt compile.

## Small-Assembler
Version 1.2, Revision Level 14
Expand All @@ -37,6 +31,8 @@ Copyright 1988 J. E. Hendrix
## YLink
Copyright 2017 Zane Wagner

* Adapted to original Small C Compiler by Humberto Costa

## Notice of Public Domain Status
The source code for the Small-C Compiler and runtime libraries (CP/M & DOS),
Small-Mac Assembler (CP/M), Small-Assembler (DOS), Small-Tools programs and
Expand Down

0 comments on commit e976439

Please sign in to comment.