1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-26 20:29:34 +00:00

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
*/
#include <stdlib.h>
#include <geos.h>

View File

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

View File

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

View File

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

View File

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

View File

@ -4,44 +4,44 @@
; 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
.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
.import __VLIR0_START__, __VLIR0_SIZE__ ; Linker generated
.import __STACKSIZE__ ; Linker generated
.import initlib, donelib
.import callmain
.import zerobss
.importzp sp
.include "jumptab.inc"
.include "jumptab.inc"
; ------------------------------------------------------------------------
; Place the startup code in a special segment.
.segment "STARTUP"
.segment "STARTUP"
; Clear the BSS data
jsr zerobss
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
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
jsr initlib
; Push arguments and call main()
cli
jsr callmain
jsr callmain
; 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
;
@ -10,6 +9,6 @@
.export _EnterDeskTop
_EnterDeskTop:
lda #0
tax
jmp _exit
lda #0
tax
jmp _exit

View File

@ -8,11 +8,16 @@
.exportzp cursor_x, cursor_y, cursor_flag
.exportzp cursor_c, cursor_r
.segment "EXTZP" : zeropage
.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_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)
cursor_c:
.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
;
@ -10,4 +9,4 @@
.include "jumptab.inc"
_FirstInit = FirstInit
_FirstInit = FirstInit

View File

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

View File

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

View File

@ -12,72 +12,66 @@
; on icon of your application
;
.constructor initmainargs, 24
.import __argc, __argv
.constructor initmainargs, 24
.import __argc, __argv
.include "const.inc"
.include "geossym.inc"
.include "const.inc"
.include "geossym.inc"
.segment "INIT"
;---------------------------------------------------------------------------
; Setup arguments for main
.segment "INIT"
.proc initmainargs
initmainargs:
; Setup a pointer to our argv vector
lda #<argv
sta __argv
lda #>argv
sta __argv+1
lda #<argv
sta __argv
lda #>argv
sta __argv+1
; Copy program name
ldy #0
ldy #0
@fn_loop:
lda dirEntryBuf+OFF_FNAME,y
lda dirEntryBuf+OFF_FNAME,y
.ifdef __GEOS_CBM__
cmp #$a0
cmp #$a0
.else
cmp #0
cmp #0
.endif
beq @fn_end
sta argv0,y
beq @fn_end
sta argv0,y
iny
cpy #16+1
bne @fn_loop
cpy #16+1
bne @fn_loop
@fn_end:
lda #0
sta argv0,y
sta __argc+1
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
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
bne @setargc
@threeargs:
ldx #3 ; there are three arguments
ldx #3 ; there are three arguments
@setargc:
stx __argc
rts
.endproc
;---------------------------------------------------------------------------
; Data
stx __argc
rts
.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
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
argv0:
.res 17 ; Program name

View File

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

View File

@ -14,27 +14,27 @@
; 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?)
; Regular entry
.macro sys_oserr_entry code, msg
.local Start, End
Start: .byte End - Start
.byte code
.asciiz msg
.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
.macro sys_oserr_sentinel msg
.byte 0 ; Length is always zero
.byte 0 ; Code is unused
.asciiz msg
.endmacro
;----------------------------------------------------------------------------
@ -43,52 +43,50 @@ End:
.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"
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"

View File

@ -7,80 +7,81 @@
; /* Map a system specific error into a system independent code */
;
.export __osmaperrno
.include "errno.inc"
.include "const.inc"
.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
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
lda #<EINVAL
ldx #>EINVAL
rts
; Found the code
@L2: lda ErrTab-1,x
ldx #$00 ; High byte always zero
@L2: lda ErrTab-1,x
ldx #$00 ; High byte always zero
rts
.rodata
ErrTab:
.byte NO_BLOCKS, EINVAL ; ???
.byte INV_TRACK, EINVAL ; invalid track&sector 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 NO_BLOCKS, EINVAL ; ???
.byte INV_TRACK, EINVAL ; invalid track&sector 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
; .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)
ErrTabSize = (* - ErrTab)

View File

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

View File

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

View File

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

View File

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

View File

@ -4,11 +4,10 @@
; 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.
@ -16,24 +15,24 @@
.rodata
utsdata:
; sysname
.asciiz "cc65"
; sysname
.asciiz "cc65"
; nodename
.asciiz ""
; nodename
.asciiz ""
; release
.byte ((.VERSION >> 8) & $0F) + '0'
.byte '.'
.byte ((.VERSION >> 4) & $0F) + '0'
.byte $00
; release
.byte ((.VERSION >> 8) & $0F) + '0'
.byte '.'
.byte ((.VERSION >> 4) & $0F) + '0'
.byte $00
; version
.byte (.VERSION & $0F) + '0'
.byte $00
; version
.byte (.VERSION & $0F) + '0'
.byte $00
; machine
.asciiz "GEOS"
; machine
.asciiz "GEOS"