Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/ce/delay.src
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ _delay:

.set _msleep, _delay

extern ___sleep_common.3
extern __lmulu
extern _clock
.extern ___sleep_common.3
.extern __lmulu
.extern _clock
2 changes: 1 addition & 1 deletion src/ce/getstringinput.src
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ _os_GetStringInput:
ld (ti.curRow), hl
jp .L.start

extern __frameset0
.extern __frameset0
2 changes: 1 addition & 1 deletion src/ce/gettokeninput.src
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ _os_GetTokenInput:
ex de, hl
jp .L.start

extern __frameset0
.extern __frameset0
1 change: 0 additions & 1 deletion src/ce/lz4.src
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ _lz4_Decompress:
; Fallthrough

.local lz4_decompress_block_internal
.type lz4_decompress_block_internal, @function

Comment on lines 47 to 49
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@calc84maniac is this .local function supposed to have @function?

; Input: IY = compressed block, DE = decompression buffer, BC = size of block
; Output: IY = after compressed block, DE = after decompressed data, carry flag clear
Expand Down
2 changes: 1 addition & 1 deletion src/ce/random.src
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ __setstate:
.section .data
.local __state
__state:
.d32 0d0e0f10h,090a0b0ch,05060708h,01020304h
.d32 0x0d0e0f10,0x090a0b0c,0x05060708,0x01020304
2 changes: 1 addition & 1 deletion src/ce/runprgm.src
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ ___prgm_to_run:
___prgm_to_run_size:
.d24 0

section .data.___prgm_caller
.section .data.___prgm_caller
.global ___prgm_caller
___prgm_caller:
.zero 9
Expand Down
6 changes: 3 additions & 3 deletions src/ce/sleep.src
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ _sleep:
jp ___sleep_common.1


extern ___sleep_common.1
extern __lmulu
extern _clock
.extern ___sleep_common.1
.extern __lmulu
.extern _clock
4 changes: 2 additions & 2 deletions src/ce/sleep_common.src
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ___sleep_common:
; Timing assumes fetching from RAM (4cc) and the first timer read being valid.

; Calculate the end time.
section .text

.global ___sleep_common.1
.type ___sleep_common.1, @function
___sleep_common.1:
Expand Down Expand Up @@ -56,4 +56,4 @@ ___sleep_common.3:
; 202 - 75 + 31 + 48 + 13 + 24 = 243 cc after end time captured


extern _clock
.extern _clock
4 changes: 2 additions & 2 deletions src/ce/ticksleep.src
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ _ticksleep:
jp ___sleep_common.1


extern ___sleep_common.1
extern _clock
.extern ___sleep_common.1
.extern _clock
4 changes: 3 additions & 1 deletion src/crt/and.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

.section .text
.global __land
.type __land, @function
.section .text
.global __iand
.type __iand, @function

.ifdef PREFER_OS_CRT

.set __land, 0x0001A4
.set __iand, 000134h
.set __iand, 0x000134

.else

Expand Down
3 changes: 3 additions & 0 deletions src/crt/and_fast.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

.section .text
.global __land_fast
.type __land_fast, @function
.global __iand_fast
.type __iand_fast, @function
.global __sand_fast
.type __sand_fast, @function

__land_fast:
; CC: 24*r(PC)+8*r(SPL)+7*w(SPL)+1
Expand Down
2 changes: 1 addition & 1 deletion src/crt/crt.src
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.assume adl = 1
.assume adl=1

.section .init.weak_crt,"ax",@progbits

Expand Down
2 changes: 1 addition & 1 deletion src/crt/crt0.S
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "crt.h"

.assume adl = 1
.assume adl=1

.equ ti.mpTmr1Counter, 0x0F20000
.equ ti.mpTmrCtrl, 0x0F20030
Expand Down
6 changes: 3 additions & 3 deletions src/crt/ctlz.src
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
.type __bctlz, @function

__bctlz:
cp a, 010h
cp a, 0x10
jr c, .L.low4
cp a, 040h
cp a, 0x40
jr c, .L.low6
add a, a
sbc a, a
inc a
ret
.L.low6:
add a, -020h
add a, -0x20
sbc a, a
add a, 3
ret
Expand Down
3 changes: 2 additions & 1 deletion src/crt/daddsub.src
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ __daddsub:
pop af
ret

.extern _softfloat_addMagsF64, _softfloat_subMagsF64
.extern _softfloat_addMagsF64
.extern _softfloat_subMagsF64
2 changes: 1 addition & 1 deletion src/crt/dneg.src
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.global __dneg
.type __dneg, @function

; .assumes BC:UDE:UHL
; assumes BC:UDE:UHL
__dneg:
rl b
ccf
Expand Down
2 changes: 1 addition & 1 deletion src/crt/errno.src
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.assume adl = 1
.assume adl=1

.global _errno
.equ _errno, 0xD008DC
2 changes: 1 addition & 1 deletion src/crt/fpupop2.src
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

__fpupop2:
push bc
ld bc, 0800000h
ld bc, 0x800000
add hl, bc
jr nc, .ncarry
add hl, bc
Expand Down
3 changes: 2 additions & 1 deletion src/crt/lpopcnt.src
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ __lpopcnt:
pop hl
ret

.extern __popcnt_common_init_full, __popcnt_common_iter_adjusted
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this is a valid extension or not, but we only use .extern , twice toolchain wide so probably should make this consistent. Also, this could also hide bugs possibly if it is not a valid extension? Also it seems like GAS .extern is a lot more forgiving than FASMG extern, since I won't get linker errors if I forget to put .extern sometimes

.extern __popcnt_common_init_full
.extern __popcnt_common_iter_adjusted
16 changes: 12 additions & 4 deletions src/crt/ltod.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@

.section .text

.global __ulltod ; (long double)unsigned long long
.global __lltod ; (long double)long long
.global __ultod ; (long double)unsigned long
.global __ltod ; (long double)long
.global __ulltod
.type __ulltod, @function
.global __lltod
.type __lltod, @function
.global __ultod
.type __ultod, @function
.global __ltod
.type __ltod, @function

__ulltod:
; (long double)unsigned long long
cp a, a ; set Z flag
push af
jr .L.lltod_common
__lltod:
; (long double)long long
bit 7, b
push af
call nz, __llneg ; abs(BC:UDE:UHL)
Expand Down Expand Up @@ -115,10 +121,12 @@ __lltod:
jr .L.int_to_f64_shl.finish

__ultod:
; (long double)unsigned long
cp a, a ; set Z flag
push af
jr .L.ltod_common
__ltod:
; (long double)long
bit 7, e
push af
call nz, __lneg ; abs(E:UHL)
Expand Down
4 changes: 2 additions & 2 deletions src/libc/abs.src
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.assume ADL=1
.assume adl=1

.section .text
.global _abs
.type _abs,@function
.type _abs, @function
_abs:
pop hl
pop de
Expand Down
2 changes: 1 addition & 1 deletion src/libc/allocator/allocator_simple.src
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.assume adl = 1
.assume adl=1

.section .text._malloc

Expand Down
2 changes: 1 addition & 1 deletion src/libc/atof.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

.section .text
.global _atof
.global _atoff
.type _atof, @function
.global _atoff
.type _atoff, @function

.ifdef PREFER_OS_LIBC
Expand Down
2 changes: 1 addition & 1 deletion src/libc/ceilf.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

.section .text
.global _ceil
.global _ceilf
.type _ceil, @function
.global _ceilf
.type _ceilf, @function

Comment on lines 4 to 8
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what I mean by canonicalizing the order of @function. And this makes it consistent with how it has been done elsewhere.

.ifdef PREFER_OS_LIBC
Expand Down
2 changes: 1 addition & 1 deletion src/libc/cimagf.src
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
.section .text

.global _cimagf
.global _cimag
.type _cimagf, @function
.global _cimag
.type _cimag, @function

; float cimagf(float _Complex)
Expand Down
2 changes: 2 additions & 0 deletions src/libc/fminmaxf.src
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ _fminmaxf_common.x_maybe_NaN:
.section .text

.global _fmaxf
.type _fmaxf, @function
.global _fmax
.type _fmax, @function

_fmaxf:
_fmax:
Expand Down
2 changes: 1 addition & 1 deletion src/libc/fmodl.src
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.assume adl = 1
.assume adl=1

.section .text

Expand Down
2 changes: 1 addition & 1 deletion src/libc/issignalingf.src
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.global __issignalingf
.type __issignalingf, @function

; .assumes quiet NaN is NaN with bit 22 set
; assumes quiet NaN is NaN with bit 22 set
; bool _issignalingf(float)
__issignalingf:
; based off __isnanf, unoptimized
Expand Down
2 changes: 1 addition & 1 deletion src/libc/issignalingl.src
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.global __issignalingl
.type __issignalingl, @function

; .assumes quiet NaN is NaN with bit 51 set
; assumes quiet NaN is NaN with bit 51 set
; bool _issignalingl(long double)
__issignalingl:
ld hl, 9
Expand Down
8 changes: 4 additions & 4 deletions src/libc/logbf.src
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ _logbf:
add a, 130
jr .L.int_to_float

extern __ltof
extern __ictlz
extern ___fe_cur_env
extern _errno
.extern __ltof
.extern __ictlz
.extern ___fe_cur_env
.extern _errno
1 change: 0 additions & 1 deletion src/libc/memmem.src
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
.global _memmem
.type _memmem, @function
.local _memcmp_fast
.type _memcmp_fast, @function
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_memcmp_fast is a private function, so I don't think it needs @function, and I don't see it used with other .local functions


; void *memmem(const void *haystack, size_t haystack_len, const void *needle, size_t needle_len)
.equ haystack, 3
Expand Down
2 changes: 2 additions & 0 deletions src/libc/strcspn.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

.section .text
.global _strcspn
.type _strcspn, @function
_strcspn:
call __strcspn_strpbrk_common
sbc hl, de ; Calculate number of mismatching characters
ret

.section .text
.global _strpbrk
.type _strpbrk, @function
_strpbrk:
call __strcspn_strpbrk_common
ret nz ; Return pointer if not end of string
Expand Down
1 change: 1 addition & 0 deletions src/libc/strdup.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

.section .text
.global _strdup
.type _strdup, @function
_strdup:
pop de
ex (sp), hl
Expand Down
1 change: 1 addition & 0 deletions src/libc/strlcat.src
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.section .text

.global _strlcat
.type _strlcat, @function

_strlcat:
ld iy, 0
Expand Down
1 change: 1 addition & 0 deletions src/libc/strlcpy.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

.section .text
.global _strlcpy
.type _strlcpy, @function

; BSD variant of strncpy that ensures the destination is null-terminated.
; OpenBSD reference: https://github.com/openbsd/src/blob/master/lib/libc/string/strlcpy.c
Expand Down
1 change: 1 addition & 0 deletions src/libc/strlen.src
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

.section .text
.global _strlen
.type _strlen, @function

.ifdef PREFER_OS_LIBC

Expand Down
1 change: 1 addition & 0 deletions src/libc/strtol.src
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ ___strtoui:
.section .text._strtoul

.global _strtoul
.type _strtoul, @function
_strtoul:
call .L__strtol_common
; overflow occured if B is non-zero
Expand Down
3 changes: 2 additions & 1 deletion src/softfloat/s_normSubnormalF64Sig.src
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
.assume adl = 1
.assume adl=1

.section .text

.global _softfloat_normSubnormalF64Sig
.type _softfloat_normSubnormalF64Sig, @function

; saves 78 bytes
; this function is called in the float64_ldexp tests
Expand Down
1 change: 1 addition & 0 deletions src/softfloat/s_propagateNaNF64UI.src
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.section .text

.global _softfloat_propagateNaNF64UI
.type _softfloat_propagateNaNF64UI, @function

; at least one of the arguments is NaN
; returns x if it is NaN, otherwise returns y
Expand Down
Loading
Loading