mirror of
https://github.com/cc65/cc65.git
synced 2025-01-11 11:30:13 +00:00
1d1ba3ed3b
The constructors are _NOT_ allowed anymore to access the BSS. Rather they must use the DATA segment or the INIT segment. The latter isn't cleared at any point so the constructors may use it to expose values to the main program. However they must make sure to always write the values as they are not pre-initialized.
54 lines
1.2 KiB
ArmAsm
54 lines
1.2 KiB
ArmAsm
;
|
|
; Freddy Offenga, Stefan Haubenthal, Christian Groessler, March 2007
|
|
;
|
|
; detect the DOS version we're running on
|
|
;
|
|
|
|
.include "atari.inc"
|
|
.constructor detect, 26
|
|
.export __dos_type
|
|
|
|
; ------------------------------------------------------------------------
|
|
; DOS type detection
|
|
|
|
.segment "ONCE"
|
|
|
|
detect: lda DOS
|
|
cmp #'S' ; SpartaDOS
|
|
beq spdos
|
|
cmp #'M' ; MyDOS
|
|
beq mydos
|
|
cmp #'X' ; XDOS
|
|
beq xdos
|
|
|
|
lda #$4C ; probably default
|
|
ldy #COMTAB
|
|
cmp (DOSVEC),y
|
|
bne done
|
|
ldy #ZCRNAME
|
|
cmp (DOSVEC),y
|
|
bne done
|
|
|
|
ldy #6 ; OS/A+ has a jmp here
|
|
cmp (DOSVEC),y
|
|
beq done
|
|
lda #OSADOS
|
|
.byte $2C ; BIT <abs>
|
|
|
|
spdos: lda #SPARTADOS
|
|
.byte $2C ; BIT <abs>
|
|
|
|
mydos: lda #MYDOS
|
|
.byte $2C ; BIT <abs>
|
|
|
|
xdos: lda #XDOS
|
|
sta __dos_type
|
|
done: rts
|
|
|
|
; ------------------------------------------------------------------------
|
|
; Data
|
|
|
|
.data
|
|
|
|
__dos_type: .byte 0 ; default to ATARIDOS
|