Normalized coding style.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5500 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
ol.sc
2012-02-08 16:56:54 +00:00
parent 00ddcaeb93
commit 5149fea3e1
20 changed files with 323 additions and 342 deletions

View File

@@ -4,8 +4,6 @@
* Maciej 'YTM/Elysium' Witkowiak 15.7.2001 * Maciej 'YTM/Elysium' Witkowiak 15.7.2001
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <geos.h> #include <geos.h>

View File

@@ -3,22 +3,21 @@
; ;
; 2.7.2001 ; 2.7.2001
; ;
; Wrapper for GEOS standard input device interface ; Driver for GEOS standard input device interface
; ;
.export _mouse_init, _mouse_done .export _mouse_init, _mouse_done
.export _mouse_hide, _mouse_show .export _mouse_hide, _mouse_show
.export _mouse_box .export _mouse_box
.export _mouse_pos, _mouse_info .export _mouse_pos, _mouse_info
.export _mouse_move, _mouse_buttons .export _mouse_move, _mouse_buttons
.import popsreg, addysp1 .import popsreg, addysp1
.importzp sp, sreg, ptr1 .importzp sp, sreg, ptr1
.include "const.inc"
.include "jumptab.inc"
.include "geossym.inc"
.include "const.inc"
.include "jumptab.inc"
.include "geossym.inc"
.code .code
@@ -28,36 +27,36 @@
; ;
_mouse_init: _mouse_init:
jsr StartMouseMode jsr StartMouseMode
jsr MouseOff jsr MouseOff
lda #0 lda #0
sta mouseTop sta mouseTop
sta mouseLeft sta mouseLeft
sta mouseLeft+1 sta mouseLeft+1
.ifdef __GEOS_CBM__ .ifdef __GEOS_CBM__
lda #199 lda #199
sta mouseBottom sta mouseBottom
lda graphMode lda graphMode
bpl _mse_screen320 bpl _mse_screen320
lda #<639 ; 80 columns on C128 lda #<639 ; 80 columns on C128
ldx #>639 ldx #>639
bne _mse_storex bne _mse_storex
_mse_screen320: _mse_screen320:
lda #<319 ; 40 columns on C64/C128 lda #<319 ; 40 columns on C64/C128
ldx #>319 ldx #>319
_mse_storex: _mse_storex:
.else .else
lda #191 lda #191
sta mouseBottom sta mouseBottom
lda #<559 lda #<559
ldx #>559 ldx #>559
.endif .endif
sta mouseRight sta mouseRight
stx mouseRight+1 stx mouseRight+1
_mse_initend: _mse_initend:
lda #0 lda #0
tax tax
; -------------------------------------------------------------------------- ; --------------------------------------------------------------------------
; ;
@@ -71,14 +70,14 @@ _mouse_done:
; void mouse_hide (void); ; void mouse_hide (void);
; ;
_mouse_hide = MouseOff _mouse_hide = MouseOff
; -------------------------------------------------------------------------- ; --------------------------------------------------------------------------
; ;
; void mouse_show (void); ; void mouse_show (void);
; ;
_mouse_show = MouseUp _mouse_show = MouseUp
; -------------------------------------------------------------------------- ; --------------------------------------------------------------------------
; ;
@@ -86,29 +85,29 @@ _mouse_show = MouseUp
; ;
_mouse_box: _mouse_box:
ldy #0 ; Stack offset ldy #0 ; Stack offset
sta mouseBottom sta mouseBottom
lda (sp),y lda (sp),y
sta mouseRight sta mouseRight
iny iny
lda (sp),y lda (sp),y
sta mouseRight+1 ; maxx sta mouseRight+1 ; maxx
iny iny
lda (sp),y lda (sp),y
sta mouseTop sta mouseTop
iny ; Skip high byte iny ; Skip high byte
iny iny
lda (sp),y lda (sp),y
sta mouseLeft sta mouseLeft
iny iny
lda (sp),y lda (sp),y
sta mouseLeft+1 ; minx sta mouseLeft+1 ; minx
jmp addysp1 ; Drop params, return jmp addysp1 ; Drop params, return
; -------------------------------------------------------------------------- ; --------------------------------------------------------------------------
; ;
@@ -117,28 +116,28 @@ _mouse_box:
; ;
_mouse_pos: _mouse_pos:
sta ptr1 sta ptr1
stx ptr1+1 ; Remember the argument pointer stx ptr1+1 ; Remember the argument pointer
ldy #0 ; Structure offset ldy #0 ; Structure offset
php php
sei ; Disable interrupts sei ; Disable interrupts
lda mouseXPos ; Transfer the position lda mouseXPos ; Transfer the position
sta (ptr1),y sta (ptr1),y
lda mouseXPos+1 lda mouseXPos+1
iny iny
sta (ptr1),y sta (ptr1),y
lda mouseYPos lda mouseYPos
iny
sta (ptr1),y
lda #$00
iny iny
sta (ptr1),y sta (ptr1),y
lda #$00
iny
sta (ptr1),y
plp ; Reenable interrupts plp ; Reenable interrupts
rts ; Done rts ; Done
; -------------------------------------------------------------------------- ; --------------------------------------------------------------------------
; ;
@@ -153,15 +152,15 @@ _mouse_info:
; call _mouse_pos to initialize the struct pointer and fill the position ; call _mouse_pos to initialize the struct pointer and fill the position
; fields. ; fields.
jsr _mouse_pos jsr _mouse_pos
; Fill in the button state ; Fill in the button state
jsr _mouse_buttons ; Will not touch ptr1 jsr _mouse_buttons ; Will not touch ptr1
iny iny
sta (ptr1),y sta (ptr1),y
rts rts
; -------------------------------------------------------------------------- ; --------------------------------------------------------------------------
; ;
@@ -169,15 +168,15 @@ _mouse_info:
; ;
_mouse_move: _mouse_move:
jsr popsreg ; Get X jsr popsreg ; Get X
php php
sei ; Disable interrupts sei ; Disable interrupts
sta mouseYPos sta mouseYPos
lda sreg lda sreg
ldx sreg+1 ldx sreg+1
sta mouseXPos sta mouseXPos
stx mouseXPos+1 stx mouseXPos+1
plp ; Enable interrupts plp ; Enable interrupts
rts rts
; -------------------------------------------------------------------------- ; --------------------------------------------------------------------------
@@ -186,9 +185,8 @@ _mouse_move:
; ;
_mouse_buttons: _mouse_buttons:
ldx #0 ldx #0
lda pressFlag lda pressFlag
and #SET_MOUSE and #SET_MOUSE
lsr lsr
rts rts

View File

@@ -5,8 +5,8 @@
; CC65 runtime: call function via pointer in ax ; CC65 runtime: call function via pointer in ax
; ;
.export callax
.include "jumptab.inc" .include "jumptab.inc"
.export callax callax = CallRoutine
callax = CallRoutine

View File

@@ -16,8 +16,8 @@ S_OBJS += callroutine.o \
getserialnumber.o \ getserialnumber.o \
mainargs.o \ mainargs.o \
mainloop.o \ mainloop.o \
oserror.o \
oserrlist.o \ oserrlist.o \
oserror.o \
panic.o \ panic.o \
randomize.o \ randomize.o \
setoserror.o \ setoserror.o \

View File

@@ -1,4 +1,3 @@
; ;
; Maciej 'YTM/Alliance' Witkowiak ; Maciej 'YTM/Alliance' Witkowiak
; ;
@@ -10,4 +9,4 @@
.include "jumptab.inc" .include "jumptab.inc"
_CallRoutine = CallRoutine _CallRoutine = CallRoutine

View File

@@ -4,44 +4,44 @@
; Maciej 'YTM/Elysium' Witkowiak ; Maciej 'YTM/Elysium' Witkowiak
; 26.10.99, 10.3.2000, 15.8.2001, 23.12.2002 ; 26.10.99, 10.3.2000, 15.8.2001, 23.12.2002
.export _exit .export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup .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
.import __VLIR0_START__, __VLIR0_SIZE__ ; Linker generated .include "jumptab.inc"
.import __STACKSIZE__ ; Linker generated
.import initlib, donelib
.import callmain
.import zerobss
.importzp sp
.include "jumptab.inc"
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Place the startup code in a special segment. ; Place the startup code in a special segment.
.segment "STARTUP" .segment "STARTUP"
; Clear the BSS data ; Clear the BSS data
jsr zerobss jsr zerobss
; Setup stack ; Setup stack
lda #<(__VLIR0_START__ + __VLIR0_SIZE__ + __STACKSIZE__) lda #<(__VLIR0_START__ + __VLIR0_SIZE__ + __STACKSIZE__)
sta sp sta sp
lda #>(__VLIR0_START__ + __VLIR0_SIZE__ + __STACKSIZE__) lda #>(__VLIR0_START__ + __VLIR0_SIZE__ + __STACKSIZE__)
sta sp+1 ; Set argument stack ptr sta sp+1 ; Set argument stack ptr
; Call module constructors ; Call module constructors
jsr initlib jsr initlib
; Push arguments and call main() ; Push arguments and call main()
cli cli
jsr callmain jsr callmain
; Call module destructors. ; Call module destructors.
_exit: jsr donelib ; Run module destructors _exit: jsr donelib ; Run module destructors
jmp EnterDeskTop ; return control to the system jmp EnterDeskTop ; return control to the system

View File

@@ -1,4 +1,3 @@
; ;
; Maciej 'YTM/Elysium' Witkowiak ; Maciej 'YTM/Elysium' Witkowiak
; ;
@@ -10,6 +9,6 @@
.export _EnterDeskTop .export _EnterDeskTop
_EnterDeskTop: _EnterDeskTop:
lda #0 lda #0
tax tax
jmp _exit jmp _exit

View File

@@ -8,11 +8,16 @@
.exportzp cursor_x, cursor_y, cursor_flag .exportzp cursor_x, cursor_y, cursor_flag
.exportzp cursor_c, cursor_r .exportzp cursor_c, cursor_r
.segment "EXTZP" : zeropage .segment "EXTZP" : zeropage
cursor_x: .res 2 ; Cursor column (0-319/639) cursor_x:
cursor_y: .res 1 ; Cursor row (0-199) .res 2 ; Cursor column (0-319/639)
cursor_flag: .res 1 ; Cursor on/off (0-off) 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_c:
cursor_r: .res 1 ; Cursor row (0-24) .res 1 ; Cursor column (0-39/79)
cursor_r:
.res 1 ; Cursor row (0-24)

View File

@@ -1,4 +1,3 @@
; ;
; Maciej 'YTM/Alliance' Witkowiak ; Maciej 'YTM/Alliance' Witkowiak
; ;
@@ -10,4 +9,4 @@
.include "jumptab.inc" .include "jumptab.inc"
_FirstInit = FirstInit _FirstInit = FirstInit

View File

@@ -1,4 +1,3 @@
; ;
; Maciej 'YTM/Elysium' Witkowiak ; Maciej 'YTM/Elysium' Witkowiak
; ;
@@ -11,6 +10,6 @@
.include "jumptab.inc" .include "jumptab.inc"
_GetRandom: _GetRandom:
jsr GetRandom jsr GetRandom
ldx #0 ldx #0
rts rts

View File

@@ -1,4 +1,3 @@
; ;
; Maciej 'YTM/Alliance' Witkowiak ; Maciej 'YTM/Alliance' Witkowiak
; ;
@@ -12,8 +11,7 @@
.include "geossym.inc" .include "geossym.inc"
_GetSerialNumber: _GetSerialNumber:
jsr GetSerialNumber
jsr GetSerialNumber lda r0L
lda r0L ldx r0H
ldx r0H rts
rts

View File

@@ -12,72 +12,66 @@
; on icon of your application ; on icon of your application
; ;
.constructor initmainargs, 24 .constructor initmainargs, 24
.import __argc, __argv .import __argc, __argv
.include "const.inc" .include "const.inc"
.include "geossym.inc" .include "geossym.inc"
.segment "INIT"
;---------------------------------------------------------------------------
; Setup arguments for main ; Setup arguments for main
.segment "INIT" initmainargs:
.proc initmainargs
; Setup a pointer to our argv vector ; Setup a pointer to our argv vector
lda #<argv lda #<argv
sta __argv sta __argv
lda #>argv lda #>argv
sta __argv+1 sta __argv+1
; Copy program name ; Copy program name
ldy #0
ldy #0
@fn_loop: @fn_loop:
lda dirEntryBuf+OFF_FNAME,y lda dirEntryBuf+OFF_FNAME,y
.ifdef __GEOS_CBM__ .ifdef __GEOS_CBM__
cmp #$a0 cmp #$a0
.else .else
cmp #0 cmp #0
.endif .endif
beq @fn_end beq @fn_end
sta argv0,y sta argv0,y
iny iny
cpy #16+1 cpy #16+1
bne @fn_loop bne @fn_loop
@fn_end: @fn_end:
lda #0 lda #0
sta argv0,y sta argv0,y
sta __argc+1 sta __argc+1
; Check if there are any more arguments ; Check if there are any more arguments
lda dataFileName
lda dataFileName bne @threeargs
bne @threeargs ldx #0 ; no dataFileName - NULL the 2nd argument
ldx #0 ; no dataFileName - NULL the 2nd argument stx argv+2
stx argv+2 stx argv+3
stx argv+3
inx ; there is only one argument inx ; there is only one argument
bne @setargc bne @setargc
@threeargs: @threeargs:
ldx #3 ; there are three arguments ldx #3 ; there are three arguments
@setargc: @setargc:
stx __argc stx __argc
rts rts
.endproc
;---------------------------------------------------------------------------
; Data
.data .data
argv: .word argv0 ; Pointer to program name argv:
.word dataFileName ; dataFileName or NULL if last one .word argv0 ; Pointer to program name
.word dataDiskName ; dataDiskName .word dataFileName ; dataFileName or NULL if last one
.word $0000 ; last one must be NULL .word dataDiskName ; dataDiskName
.word $0000 ; last one must be NULL
.bss .bss
argv0: .res 17 ; Program name
argv0:
.res 17 ; Program name

View File

@@ -1,4 +1,3 @@
; ;
; Maciej 'YTM/Elysium' Witkowiak ; Maciej 'YTM/Elysium' Witkowiak
; ;
@@ -10,4 +9,4 @@
.include "jumptab.inc" .include "jumptab.inc"
_MainLoop = MainLoop _MainLoop = MainLoop

View File

@@ -14,27 +14,27 @@
; error code could not be found. ; error code could not be found.
; ;
.include "const.inc" .export __sys_oserrlist
.export __sys_oserrlist .include "const.inc"
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; Macros used to generate the list (may get moved to an include file?) ; Macros used to generate the list (may get moved to an include file?)
; Regular entry ; Regular entry
.macro sys_oserr_entry code, msg .macro sys_oserr_entry code, msg
.local Start, End .local Start, End
Start: .byte End - Start Start: .byte End - Start
.byte code .byte code
.asciiz msg .asciiz msg
End: End:
.endmacro .endmacro
; Sentinel entry ; Sentinel entry
.macro sys_oserr_sentinel msg .macro sys_oserr_sentinel msg
.byte 0 ; Length is always zero .byte 0 ; Length is always zero
.byte 0 ; Code is unused .byte 0 ; Code is unused
.asciiz msg .asciiz msg
.endmacro .endmacro
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
@@ -43,52 +43,50 @@ End:
.rodata .rodata
__sys_oserrlist: __sys_oserrlist:
sys_oserr_entry NO_BLOCKS, "No free blocks" sys_oserr_entry NO_BLOCKS, "No free blocks"
sys_oserr_entry INV_TRACK, "Illegal track or sector" sys_oserr_entry INV_TRACK, "Illegal track or sector"
sys_oserr_entry INSUFF_SPACE, "Disk full" sys_oserr_entry INSUFF_SPACE, "Disk full"
sys_oserr_entry FULL_DIRECTORY, "Directory full" sys_oserr_entry FULL_DIRECTORY, "Directory full"
sys_oserr_entry FILE_NOT_FOUND, "File not found" sys_oserr_entry FILE_NOT_FOUND, "File not found"
sys_oserr_entry BAD_BAM, "Inconsistent BAM" sys_oserr_entry BAD_BAM, "Inconsistent BAM"
sys_oserr_entry UNOPENED_VLIR, "VLIR file not opened" sys_oserr_entry UNOPENED_VLIR, "VLIR file not opened"
sys_oserr_entry INV_RECORD, "Invalid VLIR record" sys_oserr_entry INV_RECORD, "Invalid VLIR record"
sys_oserr_entry OUT_OF_RECORDS, "Out of VLIR records" sys_oserr_entry OUT_OF_RECORDS, "Out of VLIR records"
sys_oserr_entry STRUCT_MISMAT, "Structure mismatch" sys_oserr_entry STRUCT_MISMAT, "Structure mismatch"
sys_oserr_entry BFR_OVERFLOW, "Buffer overflow" sys_oserr_entry BFR_OVERFLOW, "Buffer overflow"
sys_oserr_entry CANCEL_ERR, "Operation cancelled" sys_oserr_entry CANCEL_ERR, "Operation cancelled"
sys_oserr_entry DEV_NOT_FOUND, "Device not found" sys_oserr_entry DEV_NOT_FOUND, "Device not found"
sys_oserr_entry INCOMPATIBLE, "Incompatible device" sys_oserr_entry INCOMPATIBLE, "Incompatible device"
sys_oserr_entry 20, "Read error" sys_oserr_entry 20, "Read error"
sys_oserr_entry 21, "Read error" sys_oserr_entry 21, "Read error"
sys_oserr_entry 22, "Read error" sys_oserr_entry 22, "Read error"
sys_oserr_entry 23, "Read error" sys_oserr_entry 23, "Read error"
sys_oserr_entry 24, "Read error" sys_oserr_entry 24, "Read error"
sys_oserr_entry 25, "Write error" sys_oserr_entry 25, "Write error"
sys_oserr_entry 26, "Write protect on" sys_oserr_entry 26, "Write protect on"
sys_oserr_entry 27, "Read error" sys_oserr_entry 27, "Read error"
sys_oserr_entry 28, "Write error" sys_oserr_entry 28, "Write error"
sys_oserr_entry 29, "Disk ID mismatch" sys_oserr_entry 29, "Disk ID mismatch"
sys_oserr_entry 30, "Syntax error" sys_oserr_entry 30, "Syntax error"
sys_oserr_entry 31, "Syntax error" sys_oserr_entry 31, "Syntax error"
sys_oserr_entry 32, "Syntax error" sys_oserr_entry 32, "Syntax error"
sys_oserr_entry 33, "Syntax error (invalid file name)" sys_oserr_entry 33, "Syntax error (invalid file name)"
sys_oserr_entry 34, "Syntax error (no file given)" sys_oserr_entry 34, "Syntax error (no file given)"
sys_oserr_entry 39, "Syntax error" sys_oserr_entry 39, "Syntax error"
sys_oserr_entry 50, "Record not present" sys_oserr_entry 50, "Record not present"
sys_oserr_entry 51, "Overflow in record" sys_oserr_entry 51, "Overflow in record"
sys_oserr_entry 52, "File too large" sys_oserr_entry 52, "File too large"
sys_oserr_entry 60, "Write file open" sys_oserr_entry 60, "Write file open"
sys_oserr_entry 61, "File not open" sys_oserr_entry 61, "File not open"
sys_oserr_entry 62, "File not found" sys_oserr_entry 62, "File not found"
sys_oserr_entry 63, "File exists" sys_oserr_entry 63, "File exists"
sys_oserr_entry 64, "File type mismatch" sys_oserr_entry 64, "File type mismatch"
sys_oserr_entry 65, "No block" sys_oserr_entry 65, "No block"
sys_oserr_entry 66, "Illegal track or sector" sys_oserr_entry 66, "Illegal track or sector"
sys_oserr_entry 67, "Illegal system track or sector" sys_oserr_entry 67, "Illegal system track or sector"
sys_oserr_entry 70, "No channel" sys_oserr_entry 70, "No channel"
sys_oserr_entry 71, "Directory error" sys_oserr_entry 71, "Directory error"
sys_oserr_entry 72, "Disk full" sys_oserr_entry 72, "Disk full"
sys_oserr_entry 73, "DOS version mismatch" sys_oserr_entry 73, "DOS version mismatch"
sys_oserr_entry 74, "Drive not ready" sys_oserr_entry 74, "Drive not ready"
sys_oserr_sentinel "Unknown error" sys_oserr_sentinel "Unknown error"

View File

@@ -7,80 +7,81 @@
; /* Map a system specific error into a system independent code */ ; /* Map a system specific error into a system independent code */
; ;
.export __osmaperrno .export __osmaperrno
.include "errno.inc"
.include "const.inc" .include "errno.inc"
.include "const.inc"
.code .code
__osmaperrno: __osmaperrno:
ldx #ErrTabSize ldx #ErrTabSize
@L1: cmp ErrTab-2,x ; Search for the error code @L1: cmp ErrTab-2,x ; Search for the error code
beq @L2 ; Jump if found beq @L2 ; Jump if found
dex dex
dex dex
bne @L1 ; Next entry bne @L1 ; Next entry
; Code not found, return EINVAL ; Code not found, return EINVAL
lda #<EINVAL lda #<EINVAL
ldx #>EINVAL ldx #>EINVAL
rts rts
; Found the code ; Found the code
@L2: lda ErrTab-1,x @L2: lda ErrTab-1,x
ldx #$00 ; High byte always zero ldx #$00 ; High byte always zero
rts rts
.rodata .rodata
ErrTab: ErrTab:
.byte NO_BLOCKS, EINVAL ; ??? .byte NO_BLOCKS, EINVAL ; ???
.byte INV_TRACK, EINVAL ; invalid track&sector pair .byte INV_TRACK, EINVAL ; invalid track&sector pair
.byte INSUFF_SPACE, ENOSPC ; out of space .byte INSUFF_SPACE, ENOSPC ; out of space
.byte FULL_DIRECTORY, ENOSPC ; directory is full .byte FULL_DIRECTORY, ENOSPC ; directory is full
.byte FILE_NOT_FOUND, ENOENT ; file not found .byte FILE_NOT_FOUND, ENOENT ; file not found
.byte BAD_BAM, EIO ; bam inconsistent .byte BAD_BAM, EIO ; bam inconsistent
.byte UNOPENED_VLIR, EINVAL ; using VLIR file without opening .byte UNOPENED_VLIR, EINVAL ; using VLIR file without opening
.byte INV_RECORD, EINVAL ; using >128 VLIR record number .byte INV_RECORD, EINVAL ; using >128 VLIR record number
.byte OUT_OF_RECORDS, ENOSPC ; cannot insert/add record .byte OUT_OF_RECORDS, ENOSPC ; cannot insert/add record
.byte STRUCT_MISMAT, EINVAL ; ??? .byte STRUCT_MISMAT, EINVAL ; ???
.byte BFR_OVERFLOW, ENOMEM ; file longer than buffer or end of file .byte BFR_OVERFLOW, ENOMEM ; file longer than buffer or end of file
.byte CANCEL_ERR, EIO ; ??? .byte CANCEL_ERR, EIO ; ???
.byte DEV_NOT_FOUND, ENODEV ; device not found .byte DEV_NOT_FOUND, ENODEV ; device not found
.byte INCOMPATIBLE, EINVAL ; ??? .byte INCOMPATIBLE, EINVAL ; ???
; .byte 20, ; Read error ; .byte 20, ; Read error
; .byte 21, ; Read error ; .byte 21, ; Read error
; .byte 22, ; Read error ; .byte 22, ; Read error
; .byte 23, ; Read error ; .byte 23, ; Read error
; .byte 24, ; Read error ; .byte 24, ; Read error
; .byte 25, ; Write error ; .byte 25, ; Write error
.byte 26, EACCES ; Write protect on .byte 26, EACCES ; Write protect on
; .byte 27, ; Read error ; .byte 27, ; Read error
; .byte 28, ; Write error ; .byte 28, ; Write error
; .byte 29, ; Disk ID mismatch ; .byte 29, ; Disk ID mismatch
; .byte 30, ; Syntax error ; .byte 30, ; Syntax error
; .byte 31, ; Syntax error ; .byte 31, ; Syntax error
; .byte 32, ; Syntax error ; .byte 32, ; Syntax error
.byte 33, EINVAL ; Syntax error (invalid file name) .byte 33, EINVAL ; Syntax error (invalid file name)
.byte 34, EINVAL ; Syntax error (no file given) .byte 34, EINVAL ; Syntax error (no file given)
; .byte 39, ; Syntax error ; .byte 39, ; Syntax error
; .byte 50, ; Record not present ; .byte 50, ; Record not present
; .byte 51, ; Overflow in record ; .byte 51, ; Overflow in record
; .byte 52, ; File too large ; .byte 52, ; File too large
.byte 60, EINVAL ; Write file open .byte 60, EINVAL ; Write file open
.byte 61, EINVAL ; File not open .byte 61, EINVAL ; File not open
.byte 62, ENOENT ; File not found .byte 62, ENOENT ; File not found
.byte 63, EEXIST ; File exists .byte 63, EEXIST ; File exists
.byte 64, EINVAL ; File type mismatch .byte 64, EINVAL ; File type mismatch
; .byte 65, ; No block ; .byte 65, ; No block
; .byte 66, ; Illegal track or sector ; .byte 66, ; Illegal track or sector
; .byte 67, ; Illegal system track or sector ; .byte 67, ; Illegal system track or sector
.byte 70, EBUSY ; No channel .byte 70, EBUSY ; No channel
; .byte 71, ; Directory error ; .byte 71, ; Directory error
; .byte 72, ; Disk full ; .byte 72, ; Disk full
; .byte 73, ; DOS version mismatch ; .byte 73, ; DOS version mismatch
ErrTabSize = (* - ErrTab) ErrTabSize = (* - ErrTab)

View File

@@ -1,4 +1,3 @@
; ;
; Maciej 'YTM/Alliance' Witkowiak ; Maciej 'YTM/Alliance' Witkowiak
; ;
@@ -10,4 +9,4 @@
.include "jumptab.inc" .include "jumptab.inc"
_Panic = Panic _Panic = Panic

View File

@@ -5,12 +5,12 @@
; /* Initialize the random number generator */ ; /* Initialize the random number generator */
; ;
.export __randomize .export __randomize
.import _srand .import _srand
.include "geossym.inc" .include "geossym.inc"
__randomize: __randomize:
lda random ; get random value from internal generator lda random ; get random value from internal generator
ldx random+1 ldx random+1
jmp _srand ; and use it as seed jmp _srand ; and use it as seed

View File

@@ -1,4 +1,3 @@
; ;
; Maciej 'YTM/Elysium' Witkowiak ; Maciej 'YTM/Elysium' Witkowiak
; ;
@@ -9,8 +8,8 @@
.import __oserror .import __oserror
setoserror: setoserror:
stx __oserror stx __oserror
txa txa
ldx #0 ; X is cleared (high byte for promoting char to int) ldx #0 ; X is cleared (high byte for promoting char to int)
tay ; Y register is used just to save flags state tay ; Y register is used just to save flags state
rts rts

View File

@@ -1,4 +1,3 @@
/* /*
* systime.c * systime.c
* *
@@ -8,9 +7,9 @@
#include <time.h> #include <time.h>
#include <geos.h> #include <geos.h>
time_t _systime(void) { time_t _systime(void)
{
struct tm currentTime; struct tm currentTime;
currentTime.tm_sec = system_date.s_seconds; currentTime.tm_sec = system_date.s_seconds;
currentTime.tm_min = system_date.s_minutes; currentTime.tm_min = system_date.s_minutes;
@@ -24,11 +23,9 @@ struct tm currentTime;
currentTime.tm_isdst = -1; currentTime.tm_isdst = -1;
return mktime(&currentTime); return mktime(&currentTime);
} }
clock_t clock(void) { clock_t clock(void)
{
return _systime(); return _systime();
} }

View File

@@ -4,11 +4,10 @@
; unsigned char __fastcall__ _sysuname (struct utsname* buf); ; unsigned char __fastcall__ _sysuname (struct utsname* buf);
; ;
.export __sysuname, utsdata .import utscopy
.export __sysuname, utsdata
.import utscopy __sysuname = utscopy
__sysuname = utscopy
;-------------------------------------------------------------------------- ;--------------------------------------------------------------------------
; Data. We define a fixed utsname struct here and just copy it. ; Data. We define a fixed utsname struct here and just copy it.
@@ -16,24 +15,24 @@
.rodata .rodata
utsdata: utsdata:
; sysname ; sysname
.asciiz "cc65" .asciiz "cc65"
; nodename ; nodename
.asciiz "" .asciiz ""
; release ; release
.byte ((.VERSION >> 8) & $0F) + '0' .byte ((.VERSION >> 8) & $0F) + '0'
.byte '.' .byte '.'
.byte ((.VERSION >> 4) & $0F) + '0' .byte ((.VERSION >> 4) & $0F) + '0'
.byte $00 .byte $00
; version ; version
.byte (.VERSION & $0F) + '0' .byte (.VERSION & $0F) + '0'
.byte $00 .byte $00
; machine ; machine
.asciiz "GEOS" .asciiz "GEOS"