init work

This commit is contained in:
Kyle J Cardoza 2024-07-11 22:28:44 -04:00
parent 9ab9d8ba79
commit 213ef1dc5f
1 changed files with 6 additions and 42 deletions

View File

@ -40,29 +40,15 @@ __program_root_section:
txs ; set stack
lda ##_DirectPageStart
tcd ; set direct page
#ifdef __CALYPSI_DATA_MODEL_SMALL__
lda ##0
#else
lda ##.word2 _NearBaseAddress
#endif
stz dp:.tiny(_Vfp+2)
xba ; A upper half = data bank
pha
plb ; pop 8 dummy
plb ; set data bank
#ifdef __CALYPSI_CODE_MODEL_COMPACT__
jmp long:_Trampoline_program_start
.section compactcode, noreorder
_Trampoline_program_start:
#define CODE compactcode
#else
#define CODE code
#endif
call __low_level_init
;;; **** Initialize data sections if needed.
.section CODE, noroot, noreorder
.section code, noroot, noreorder
.pubweak __data_initialization_needed
.extern __initialize_sections
__data_initialization_needed:
@ -77,24 +63,17 @@ __data_initialization_needed:
call __initialize_sections
;;; **** Initialize streams if needed.
.section CODE, noroot, noreorder
.section code, noroot, noreorder
.pubweak __call_initialize_global_streams
.extern __initialize_global_streams
__call_initialize_global_streams:
call __initialize_global_streams
;;; **** Initialize heap if needed.
.section CODE, noroot, noreorder
.section code, noroot, noreorder
.pubweak __call_heap_initialize
.extern __heap_initialize, __default_heap
__call_heap_initialize:
#ifdef __CALYPSI_DATA_MODEL_SMALL__
lda ##.sectionSize heap
sta dp:.tiny(_Dp+2)
lda ##.sectionStart heap
sta dp:.tiny(_Dp+0)
lda ##__default_heap
#else
lda ##.word2 (.sectionStart heap)
sta dp:.tiny(_Dp+6)
lda ##.word0 (.sectionStart heap)
@ -105,24 +84,9 @@ __call_heap_initialize:
sta dp:.tiny(_Dp+0)
ldx ##.word2 (.sectionSize heap)
lda ##.word0 (.sectionSize heap)
#endif
call __heap_initialize
.section CODE, root, noreorder
.section code, root, noreorder
lda ##0 ; argc = 0
call main
jump exit
;;; ***************************************************************************
;;;
;;; __low_level_init - custom low level initialization
;;;
;;; This default routine just returns doing nothing. You can provide your own
;;; routine, either in C or assembly for doing custom low leve initialization.
;;;
;;; ***************************************************************************
.section libcode
.pubweak __low_level_init
__low_level_init:
return
jsl long:main
jump exit