-
Notifications
You must be signed in to change notification settings - Fork 0
/
SCC.ASM
59 lines (50 loc) · 1.19 KB
/
SCC.ASM
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
; -----------------------------------------------------------
; Small C Compiler for TRDOS 386 (v2.0.9 and later)
; Erdogan Tan - 2024
; Beginning: 05/09/2024
; Last Update: 26/09/2024
; -----------------------------------------------------------
; Derived from 'scc.asm' file of KolibriOS SCC source code
; 2024
;B+ System header
use32
org 0x0
jmp START ; TRDOS 386 PRG file doesn't contain header
dd 0
;B+ Include C files
; Compiler tools
include "INTRINS.ASM"
; C Library ("stdio.asm")
include "LIBSTD.ASM"
; MenuetOS implement
include "OSFUNC.ASM"
_fopen equ _OS_fopen
_fputc equ _OS_fputc
_fgetc equ _OS_fgetc
_fclose equ _OS_fclos
; Main program (compiled from C)
include "GETARG.ASM"
include "CC1.ASM"
include "CC2.ASM"
include "CC3.ASM"
include "CC4.ASM"
;E:.
START:
; esp = argc
; esp+4 = argv[0] address
pop eax ; argc (value)
mov ebx,esp ; argv[0] address (not value)
push eax ; argc
push ebx
call _main
;add esp,8
pop ebx
;
xor ebx,ebx ; exit code = 0
mov eax,1 ; sysexit
int 40h
db 0
db "Small C Compiler v1.0 for TRDOS 386"
db 0
db "Erdogan Tan - 2024"
db 0