Moved non-driver files from 'geos-cbm/devel' to 'geos-common/system' which are believed to work as-is on Apple GEOS too.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5488 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -8,10 +8,16 @@
|
||||
C_OBJS += systime.o
|
||||
|
||||
S_OBJS += callroutine.o \
|
||||
crt0.o \
|
||||
enterdesktop.o \
|
||||
extzp.o \
|
||||
firstinit.o \
|
||||
getrandom.o \
|
||||
getserialnumber.o \
|
||||
mainargs.o \
|
||||
mainloop.o \
|
||||
oserror.o \
|
||||
oserrlist.o \
|
||||
panic.o \
|
||||
randomize.o \
|
||||
sysuname.o
|
||||
|
||||
47
libsrc/geos-common/system/crt0.s
Normal file
47
libsrc/geos-common/system/crt0.s
Normal file
@@ -0,0 +1,47 @@
|
||||
;
|
||||
; Startup code for geos
|
||||
;
|
||||
; Maciej 'YTM/Elysium' Witkowiak
|
||||
; 26.10.99, 10.3.2000, 15.8.2001, 23.12.2002
|
||||
|
||||
.export _exit
|
||||
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
||||
|
||||
.import __VLIR0_START__, __VLIR0_SIZE__ ; Linker generated
|
||||
.import __STACKSIZE__ ; Linker generated
|
||||
.import initlib, donelib
|
||||
.import callmain
|
||||
.import zerobss
|
||||
.importzp sp
|
||||
.include "jumptab.inc"
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Place the startup code in a special segment.
|
||||
|
||||
.segment "STARTUP"
|
||||
|
||||
; Clear the BSS data
|
||||
|
||||
jsr zerobss
|
||||
|
||||
; Setup stack
|
||||
|
||||
lda #<(__VLIR0_START__ + __VLIR0_SIZE__ + __STACKSIZE__)
|
||||
sta sp
|
||||
lda #>(__VLIR0_START__ + __VLIR0_SIZE__ + __STACKSIZE__)
|
||||
sta sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call module constructors
|
||||
|
||||
jsr initlib
|
||||
|
||||
; Push arguments and call main()
|
||||
|
||||
cli
|
||||
jsr callmain
|
||||
|
||||
; Call module destructors.
|
||||
|
||||
_exit: jsr donelib ; Run module destructors
|
||||
|
||||
jmp EnterDeskTop ; return control to the system
|
||||
18
libsrc/geos-common/system/extzp.s
Normal file
18
libsrc/geos-common/system/extzp.s
Normal file
@@ -0,0 +1,18 @@
|
||||
;
|
||||
; Maciej 'YTM/Elysium' Witkowiak <ytm@elysium.pl>
|
||||
; 31.12.2002
|
||||
;
|
||||
; zeropage locations for exclusive use by the library
|
||||
;
|
||||
|
||||
.exportzp cursor_x, cursor_y, cursor_flag
|
||||
.exportzp cursor_c, cursor_r
|
||||
|
||||
.segment "EXTZP" : zeropage
|
||||
|
||||
cursor_x: .res 2 ; Cursor column (0-319/639)
|
||||
cursor_y: .res 1 ; Cursor row (0-199)
|
||||
cursor_flag: .res 1 ; Cursor on/off (0-off)
|
||||
|
||||
cursor_c: .res 1 ; Cursor column (0-39/79)
|
||||
cursor_r: .res 1 ; Cursor row (0-24)
|
||||
83
libsrc/geos-common/system/mainargs.s
Normal file
83
libsrc/geos-common/system/mainargs.s
Normal file
@@ -0,0 +1,83 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 2003-03-07
|
||||
; Maciej Witkowiak, 2003-05-02
|
||||
;
|
||||
; Setup arguments for main
|
||||
;
|
||||
; There is always either 1 or 3 arguments:
|
||||
; <program name>,0
|
||||
; or
|
||||
; <program name>, <data file name>, <data disk name>, 0
|
||||
; the 2nd case is when using DeskTop user drags an icon of a file and drops it
|
||||
; on icon of your application
|
||||
;
|
||||
|
||||
.constructor initmainargs, 24
|
||||
.import __argc, __argv
|
||||
|
||||
.include "const.inc"
|
||||
.include "geossym.inc"
|
||||
|
||||
;---------------------------------------------------------------------------
|
||||
; Setup arguments for main
|
||||
|
||||
.segment "INIT"
|
||||
|
||||
.proc initmainargs
|
||||
|
||||
; Setup a pointer to our argv vector
|
||||
|
||||
lda #<argv
|
||||
sta __argv
|
||||
lda #>argv
|
||||
sta __argv+1
|
||||
|
||||
; Copy program name
|
||||
|
||||
ldy #0
|
||||
@fn_loop:
|
||||
lda dirEntryBuf+OFF_FNAME,y
|
||||
.ifdef __GEOS_CBM__
|
||||
cmp #$a0
|
||||
.else
|
||||
cmp #0
|
||||
.endif
|
||||
beq @fn_end
|
||||
sta argv0,y
|
||||
iny
|
||||
cpy #16+1
|
||||
bne @fn_loop
|
||||
@fn_end:
|
||||
lda #0
|
||||
sta argv0,y
|
||||
sta __argc+1
|
||||
|
||||
; Check if there are any more arguments
|
||||
|
||||
lda dataFileName
|
||||
bne @threeargs
|
||||
ldx #0 ; no dataFileName - NULL the 2nd argument
|
||||
stx argv+2
|
||||
stx argv+3
|
||||
inx ; there is only one argument
|
||||
bne @setargc
|
||||
@threeargs:
|
||||
ldx #3 ; there are three arguments
|
||||
@setargc:
|
||||
stx __argc
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
;---------------------------------------------------------------------------
|
||||
; Data
|
||||
|
||||
.data
|
||||
|
||||
argv: .word argv0 ; Pointer to program name
|
||||
.word dataFileName ; dataFileName or NULL if last one
|
||||
.word dataDiskName ; dataDiskName
|
||||
.word $0000 ; last one must be NULL
|
||||
|
||||
.bss
|
||||
argv0: .res 17 ; Program name
|
||||
94
libsrc/geos-common/system/oserrlist.s
Normal file
94
libsrc/geos-common/system/oserrlist.s
Normal file
@@ -0,0 +1,94 @@
|
||||
;
|
||||
; Maciej 'YTM/Elysium' Witkowiak <ytm@elysium.pl>
|
||||
; 25.12.2002
|
||||
;
|
||||
; Defines the platform specific error list.
|
||||
;
|
||||
; The table is built as a list of entries
|
||||
;
|
||||
; .byte entrylen
|
||||
; .byte errorcode
|
||||
; .asciiz errormsg
|
||||
;
|
||||
; and terminated by an entry with length zero that is returned if the
|
||||
; error code could not be found.
|
||||
;
|
||||
|
||||
.include "const.inc"
|
||||
|
||||
.export __sys_oserrlist
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; Macros used to generate the list (may get moved to an include file?)
|
||||
|
||||
; Regular entry
|
||||
.macro sys_oserr_entry code, msg
|
||||
.local Start, End
|
||||
Start: .byte End - Start
|
||||
.byte code
|
||||
.asciiz msg
|
||||
End:
|
||||
.endmacro
|
||||
|
||||
; Sentinel entry
|
||||
.macro sys_oserr_sentinel msg
|
||||
.byte 0 ; Length is always zero
|
||||
.byte 0 ; Code is unused
|
||||
.asciiz msg
|
||||
.endmacro
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; The error message table
|
||||
|
||||
.rodata
|
||||
|
||||
__sys_oserrlist:
|
||||
sys_oserr_entry NO_BLOCKS, "No free blocks"
|
||||
sys_oserr_entry INV_TRACK, "Illegal track or sector"
|
||||
sys_oserr_entry INSUFF_SPACE, "Disk full"
|
||||
sys_oserr_entry FULL_DIRECTORY, "Directory full"
|
||||
sys_oserr_entry FILE_NOT_FOUND, "File not found"
|
||||
sys_oserr_entry BAD_BAM, "Inconsistent BAM"
|
||||
sys_oserr_entry UNOPENED_VLIR, "VLIR file not opened"
|
||||
sys_oserr_entry INV_RECORD, "Invalid VLIR record"
|
||||
sys_oserr_entry OUT_OF_RECORDS, "Out of VLIR records"
|
||||
sys_oserr_entry STRUCT_MISMAT, "Structure mismatch"
|
||||
sys_oserr_entry BFR_OVERFLOW, "Buffer overflow"
|
||||
sys_oserr_entry CANCEL_ERR, "Operation cancelled"
|
||||
sys_oserr_entry DEV_NOT_FOUND, "Device not found"
|
||||
sys_oserr_entry INCOMPATIBLE, "Incompatible device"
|
||||
sys_oserr_entry 20, "Read error"
|
||||
sys_oserr_entry 21, "Read error"
|
||||
sys_oserr_entry 22, "Read error"
|
||||
sys_oserr_entry 23, "Read error"
|
||||
sys_oserr_entry 24, "Read error"
|
||||
sys_oserr_entry 25, "Write error"
|
||||
sys_oserr_entry 26, "Write protect on"
|
||||
sys_oserr_entry 27, "Read error"
|
||||
sys_oserr_entry 28, "Write error"
|
||||
sys_oserr_entry 29, "Disk ID mismatch"
|
||||
sys_oserr_entry 30, "Syntax error"
|
||||
sys_oserr_entry 31, "Syntax error"
|
||||
sys_oserr_entry 32, "Syntax error"
|
||||
sys_oserr_entry 33, "Syntax error (invalid file name)"
|
||||
sys_oserr_entry 34, "Syntax error (no file given)"
|
||||
sys_oserr_entry 39, "Syntax error"
|
||||
sys_oserr_entry 50, "Record not present"
|
||||
sys_oserr_entry 51, "Overflow in record"
|
||||
sys_oserr_entry 52, "File too large"
|
||||
sys_oserr_entry 60, "Write file open"
|
||||
sys_oserr_entry 61, "File not open"
|
||||
sys_oserr_entry 62, "File not found"
|
||||
sys_oserr_entry 63, "File exists"
|
||||
sys_oserr_entry 64, "File type mismatch"
|
||||
sys_oserr_entry 65, "No block"
|
||||
sys_oserr_entry 66, "Illegal track or sector"
|
||||
sys_oserr_entry 67, "Illegal system track or sector"
|
||||
sys_oserr_entry 70, "No channel"
|
||||
sys_oserr_entry 71, "Directory error"
|
||||
sys_oserr_entry 72, "Disk full"
|
||||
sys_oserr_entry 73, "DOS version mismatch"
|
||||
sys_oserr_entry 74, "Drive not ready"
|
||||
sys_oserr_sentinel "Unknown error"
|
||||
|
||||
|
||||
86
libsrc/geos-common/system/oserror.s
Normal file
86
libsrc/geos-common/system/oserror.s
Normal file
@@ -0,0 +1,86 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 17.05.2000
|
||||
; GEOS port: Maciej 'YTM/Elysium' Witkowiak
|
||||
; 2.7.2001
|
||||
;
|
||||
; int __fastcall__ _osmaperrno (unsigned char oserror);
|
||||
; /* Map a system specific error into a system independent code */
|
||||
;
|
||||
|
||||
.export __osmaperrno
|
||||
.include "errno.inc"
|
||||
.include "const.inc"
|
||||
|
||||
.code
|
||||
|
||||
__osmaperrno:
|
||||
ldx #ErrTabSize
|
||||
@L1: cmp ErrTab-2,x ; Search for the error code
|
||||
beq @L2 ; Jump if found
|
||||
dex
|
||||
dex
|
||||
bne @L1 ; Next entry
|
||||
|
||||
; Code not found, return EINVAL
|
||||
|
||||
lda #<EINVAL
|
||||
ldx #>EINVAL
|
||||
rts
|
||||
|
||||
; Found the code
|
||||
|
||||
@L2: lda ErrTab-1,x
|
||||
ldx #$00 ; High byte always zero
|
||||
rts
|
||||
|
||||
.rodata
|
||||
|
||||
ErrTab:
|
||||
.byte NO_BLOCKS, EINVAL ; ???
|
||||
.byte INV_TRACK, EINVAL ; invalid track§or pair
|
||||
.byte INSUFF_SPACE, ENOSPC ; out of space
|
||||
.byte FULL_DIRECTORY, ENOSPC ; directory is full
|
||||
.byte FILE_NOT_FOUND, ENOENT ; file not found
|
||||
.byte BAD_BAM, EIO ; bam inconsistent
|
||||
.byte UNOPENED_VLIR, EINVAL ; using VLIR file without opening
|
||||
.byte INV_RECORD, EINVAL ; using >128 VLIR record number
|
||||
.byte OUT_OF_RECORDS, ENOSPC ; cannot insert/add record
|
||||
.byte STRUCT_MISMAT, EINVAL ; ???
|
||||
.byte BFR_OVERFLOW, ENOMEM ; file longer than buffer or end of file
|
||||
.byte CANCEL_ERR, EIO ; ???
|
||||
.byte DEV_NOT_FOUND, ENODEV ; device not found
|
||||
.byte INCOMPATIBLE, EINVAL ; ???
|
||||
|
||||
; .byte 20, ; Read error
|
||||
; .byte 21, ; Read error
|
||||
; .byte 22, ; Read error
|
||||
; .byte 23, ; Read error
|
||||
; .byte 24, ; Read error
|
||||
; .byte 25, ; Write error
|
||||
.byte 26, EACCES ; Write protect on
|
||||
; .byte 27, ; Read error
|
||||
; .byte 28, ; Write error
|
||||
; .byte 29, ; Disk ID mismatch
|
||||
; .byte 30, ; Syntax error
|
||||
; .byte 31, ; Syntax error
|
||||
; .byte 32, ; Syntax error
|
||||
.byte 33, EINVAL ; Syntax error (invalid file name)
|
||||
.byte 34, EINVAL ; Syntax error (no file given)
|
||||
; .byte 39, ; Syntax error
|
||||
; .byte 50, ; Record not present
|
||||
; .byte 51, ; Overflow in record
|
||||
; .byte 52, ; File too large
|
||||
.byte 60, EINVAL ; Write file open
|
||||
.byte 61, EINVAL ; File not open
|
||||
.byte 62, ENOENT ; File not found
|
||||
.byte 63, EEXIST ; File exists
|
||||
.byte 64, EINVAL ; File type mismatch
|
||||
; .byte 65, ; No block
|
||||
; .byte 66, ; Illegal track or sector
|
||||
; .byte 67, ; Illegal system track or sector
|
||||
.byte 70, EBUSY ; No channel
|
||||
; .byte 71, ; Directory error
|
||||
; .byte 72, ; Disk full
|
||||
; .byte 73, ; DOS version mismatch
|
||||
|
||||
ErrTabSize = (* - ErrTab)
|
||||
16
libsrc/geos-common/system/randomize.s
Normal file
16
libsrc/geos-common/system/randomize.s
Normal file
@@ -0,0 +1,16 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 05.11.2002
|
||||
;
|
||||
; void _randomize (void);
|
||||
; /* Initialize the random number generator */
|
||||
;
|
||||
|
||||
.export __randomize
|
||||
.import _srand
|
||||
|
||||
.include "geossym.inc"
|
||||
|
||||
__randomize:
|
||||
lda random ; get random value from internal generator
|
||||
ldx random+1
|
||||
jmp _srand ; and use it as seed
|
||||
Reference in New Issue
Block a user