Merge branch 'master' into kbrepeat

This commit is contained in:
Bob Andrews
2017-08-06 20:22:52 +02:00
committed by GitHub
602 changed files with 20833 additions and 8109 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
* text=auto

8
.gitignore vendored
View File

@@ -1,13 +1,9 @@
/bin/ /bin/
/emd/
/html/ /html/
/info/ /info/
/joy/
/lib/ /lib/
/libwrk/ /libwrk/
/mou/ /target/
/ser/
/targetutil/
/testwrk/ /testwrk/
/tgi/
/wrk/ /wrk/
/cc65.zip

View File

@@ -6,13 +6,9 @@ install:
script: script:
- make bin USER_CFLAGS=-Werror - make bin USER_CFLAGS=-Werror
- make lib QUIET=1 - make lib QUIET=1
- make -C test - make -C test QUIET=1
- make -C src clean - make -C src clean
- make bin USER_CFLAGS=-Werror CROSS_COMPILE=i686-w64-mingw32- - make bin USER_CFLAGS=-Werror CROSS_COMPILE=i686-w64-mingw32-
- make doc zip - make doc zip
after_success: after_success:
- make -f Makefile.travis - make -f Makefile.travis
env:
global:
- secure: "h+hoQdEHGPLNwaqGKmSaM8NBRDLc2X+W05VsnNG2Feq/wPv/AiBjONNlzN7jRf6D6f3aoPXaQ2Lc3bYWdxGvFRCmwiofdxkJI9n5L8HPHLZ2lf37MQsXmGJzoTFOvjPLj73H6HlbI9Ux0El3zO6hvalxiXj6TfoZ41dbhNyvpYk="
- secure: "A4hMEe5RRfUtYjFGbT7QAvT1Tyo434N+/TiuQeQ4q0L46c79LnXuGQzbFLOFZshZiplLkJr7lFg466CoI1bf2L0cQOew/LesMhE75v0HQ7tZnExWhdpAk0ri6nWixbjn/dmQ0+HxjzJ48A44DMMBYcvSIsO4vflvuJ8etfSg42k="

View File

@@ -1,23 +1,27 @@
.PHONY: all mostlyclean clean install zip avail unavail bin lib doc .PHONY: all mostlyclean clean install zip avail unavail bin lib doc html info samples
.SUFFIXES: .SUFFIXES:
all mostlyclean clean install zip: all mostlyclean clean install zip:
@$(MAKE) -C src --no-print-directory $@ @$(MAKE) -C src --no-print-directory $@
@$(MAKE) -C libsrc --no-print-directory $@ @$(MAKE) -C libsrc --no-print-directory $@
@$(MAKE) -C doc --no-print-directory $@ @$(MAKE) -C doc --no-print-directory $@
@$(MAKE) -C samples --no-print-directory $@
avail unavail bin: avail unavail bin:
@$(MAKE) -C src --no-print-directory $@ @$(MAKE) -C src --no-print-directory $@
lib: lib:
@$(MAKE) -C libsrc --no-print-directory $@ @$(MAKE) -C libsrc --no-print-directory $@
doc: doc html info:
@$(MAKE) -C doc --no-print-directory $@ @$(MAKE) -C doc --no-print-directory $@
samples:
@$(MAKE) -C samples --no-print-directory $@
%65: %65:
@$(MAKE) -C src --no-print-directory $@ @$(MAKE) -C src --no-print-directory $@
%: %:
@$(MAKE) -C libsrc --no-print-directory $@ @$(MAKE) -C libsrc --no-print-directory $@

View File

@@ -26,10 +26,12 @@ including
- the Atari 5200 console. - the Atari 5200 console.
- GEOS for the C64, C128 and Apple //e. - GEOS for the C64, C128 and Apple //e.
- the Bit Corporation Gamate console. - the Bit Corporation Gamate console.
- the NEC PC-Engine (aka TurboGrafx-16). - the NEC PC-Engine (aka TurboGrafx-16) console.
- the Nintendo Entertainment System (NES) console. - the Nintendo Entertainment System (NES) console.
- the Watara Supervision console. - the Watara Supervision console.
- the VTech Creativision console.
- the Oric Atmos. - the Oric Atmos.
- the Oric Telestrat.
- the Lynx console. - the Lynx console.
- the Ohio Scientific Challenger 1P. - the Ohio Scientific Challenger 1P.

48
asminc/apple2.mac Normal file
View File

@@ -0,0 +1,48 @@
; Convert characters to screen codes
; Helper macro that converts and outputs one character
.macro _scrcode char
.if (char < 256)
.byte (char + 128)
.else
.error "scrcode: Character constant out of range"
.endif
.endmacro
.macro scrcode arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
; Bail out if next argument is empty
.if .blank (arg1)
.exitmacro
.endif
; Check for a string
.if .match ({arg1}, "")
; Walk over all string chars
.repeat .strlen (arg1), i
_scrcode {.strat (arg1, i)}
.endrepeat
; Check for a number
.elseif .match (.left (1, {arg1}), 0)
; Just output the number
_scrcode arg1
; Check for a character
.elseif .match (.left (1, {arg1}), 'a')
; Just output the character
_scrcode arg1
; Anything else is an error
.else
.error "scrcode: invalid argument type"
.endif
; Call the macro recursively with the remaining args
scrcode arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
.endmacro

View File

@@ -183,6 +183,7 @@ FNTFND = 170 ;($AA) file not found
PNTINV = 171 ;($AB) point invalid PNTINV = 171 ;($AB) point invalid
BADDSK = 173 ;($AD) bad disk BADDSK = 173 ;($AD) bad disk
INCFMT = 176 ;($B0) DOS 3: incompatible file system INCFMT = 176 ;($B0) DOS 3: incompatible file system
XNTBIN = 180 ;($B4) XDOS: file not binary
; DCB Device Bus Equates ; DCB Device Bus Equates
@@ -889,6 +890,10 @@ SETVBV_org = $E45C ;vector to set VBLANK parameters
CIOV = $E456 ;vector to CIO CIOV = $E456 ;vector to CIO
SIOV = $E459 ;vector to SIO SIOV = $E459 ;vector to SIO
SETVBV = $E45C ;vector to set VBLANK parameters SETVBV = $E45C ;vector to set VBLANK parameters
; aliases in order not to have to sprinkle common code with .ifdefs
CIOV_org = CIOV
SIOV_org = SIOV
SETVBV_org = SETVBV
.endif .endif
SYSVBV = $E45F ;vector to process immediate VBLANK SYSVBV = $E45F ;vector to process immediate VBLANK
XITVBV = $E462 ;vector to process deferred VBLANK XITVBV = $E462 ;vector to process deferred VBLANK
@@ -997,12 +1002,38 @@ diopp_size = 5 ; size of structure
; VALUES for dos_type ; VALUES for dos_type
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------
ATARIDOS = 0 SPARTADOS = 0
SPARTADOS = 1 OSADOS = 1 ; OS/A+
OSADOS = 2 ; OS/A+ XDOS = 2
MYDOS = 3 ATARIDOS = 3
XDOS = 4 MYDOS = 4
NODOS = 255 NODOS = 255
; The DOSes with dos_type below or equal MAX_DOS_WITH_CMDLINE do support
; command line arguments.
MAX_DOS_WITH_CMDLINE = XDOS
;-------------------------------------------------------------------------
; XDOS defines (version 2.4, taken from xdos24.pdf)
;-------------------------------------------------------------------------
XOPT = $070B ; XDOS options
XCAR = $070C ; XDOS cartridge address (+ $70D)
XPAT = $086F ; XDOS bugfix and patch number
XVER = $0870 ; XDOS version number
XFILE = $087D ; XDOS filename buffer
XLINE = $0880 ; XDOS DUP input line
XGLIN = $0871 ; get line
XSKIP = $0874 ; skip parameter
.ifdef __ATARIXL__
.ifndef SHRAM_HANDLERS
.import XMOVE_handler
.endif
.define XMOVE XMOVE_handler
XMOVE_org = $0877 ; move filename
.else
XMOVE = $0877 ; move filename
.endif
XGNUM = $087A ; get number
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------
; End of atari.inc ; End of atari.inc

7
asminc/atari2600.inc Normal file
View File

@@ -0,0 +1,7 @@
; Atari 2600 TIA & RIOT read / write registers
;
; Florent Flament (contact@florentflament.com), 2017
; TIA & RIOT registers mapping
.include "atari2600_tia.inc"
.include "atari2600_riot.inc"

20
asminc/atari2600_riot.inc Normal file
View File

@@ -0,0 +1,20 @@
; Atari 2600 RIOT read / write registers
;
; Source: DASM - vcs.h
; Details available in: Stella Programmer's Guide by Steve Wright
;
; Florent Flament (contact@florentflament.com), 2017
; Read registers
SWCHA := $0280
SWACNT := $0281
SWCHB := $0282
SWBCNT := $0283
INTIM := $0284
TIMINT := $0285
; Write registers
TIM1T := $0294
TIM8T := $0295
TIM64T := $0296
T1024T := $0297

69
asminc/atari2600_tia.inc Normal file
View File

@@ -0,0 +1,69 @@
; Atari 2600 TIA read / write registers
;
; Source: DASM - vcs.h
; Details available in: Stella Programmer's Guide by Steve Wright
;
; Florent Flament (contact@florentflament.com), 2017
; Read registers
VSYNC := $00
VBLANK := $01
WSYNC := $02
RSYNC := $03
NUSIZ0 := $04
NUSIZ1 := $05
COLUP0 := $06
COLUP1 := $07
COLUPF := $08
COLUBK := $09
CTRLPF := $0A
REFP0 := $0B
REFP1 := $0C
PF0 := $0D
PF1 := $0E
PF2 := $0F
RESP0 := $10
RESP1 := $11
RESM0 := $12
RESM1 := $13
RESBL := $14
AUDC0 := $15
AUDC1 := $16
AUDF0 := $17
AUDF1 := $18
AUDV0 := $19
AUDV1 := $1A
GRP0 := $1B
GRP1 := $1C
ENAM0 := $1D
ENAM1 := $1E
ENABL := $1F
HMP0 := $20
HMP1 := $21
HMM0 := $22
HMM1 := $23
HMBL := $24
VDELP0 := $25
VDELP1 := $26
VDELBL := $27
RESMP0 := $28
RESMP1 := $29
HMOVE := $2A
HMCLR := $2B
CXCLR := $2C
; Write registers
CXM0P := $00
CXM1P := $01
CXP0FB := $02
CXP1FB := $03
CXM0FB := $04
CXM1FB := $05
CXBLPF := $06
CXPPMM := $07
INPT0 := $08
INPT1 := $09
INPT2 := $0A
INPT3 := $0B
INPT4 := $0C
INPT5 := $0D

View File

@@ -8,42 +8,42 @@
; ATASCII CHARACTER DEFS ; ATASCII CHARACTER DEFS
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------
ATEOL = $9B ;END-OF-LINE, used by CONIO ATEOL = $9B ; END-OF-LINE, used by CONIO
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------
; Zero Page ; Zero Page
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------
POKMSK = $00 ;Mask for Pokey IRQ enable POKMSK = $00 ; Mask for Pokey IRQ enable
RTCLOK = $01 ;60 hz. clock RTCLOK = $01 ; 60 hz. clock
JUMP = $01 JUMP = $01
CRITIC = $03 ;Critical section CRITIC = $03 ; Critical section
ATRACT = $04 ;Attract Mode ATRACT = $04 ; Attract Mode
SDLSTL = $05 ;DLISTL Shadow SDLSTL = $05 ; DLISTL Shadow
SDLSTH = $06 ;DLISTH " SDLSTH = $06 ; DLISTH "
SDMCTL = $07 ;DMACTL " SDMCTL = $07 ; DMACTL "
PCOLR0 = $08 ;COLPM0 Shadow PCOLR0 = $08 ; COLPM0 Shadow
PCOLR1 = $09 ;COLPM1 " PCOLR1 = $09 ; COLPM1 "
PCOLR2 = $0A ;COLPM2 " PCOLR2 = $0A ; COLPM2 "
PCOLR3 = $0B ;COLPM3 " PCOLR3 = $0B ; COLPM3 "
COLOR0 = $0C ;COLPF0 Shadow COLOR0 = $0C ; COLPF0 Shadow
COLOR1 = $0D ;COLPF1 " COLOR1 = $0D ; COLPF1 "
COLOR2 = $0E ;COLPF2 " COLOR2 = $0E ; COLPF2 "
COLOR3 = $0F ;COLPF3 " COLOR3 = $0F ; COLPF3 "
COLOR4 = $10 ;COLBK " COLOR4 = $10 ; COLBK "
PADDL0 = $11 ;POT0 Shadow PADDL0 = $11 ; POT0 Shadow
PADDL1 = $12 ;POT1 " PADDL1 = $12 ; POT1 "
PADDL2 = $13 ;POT2 " PADDL2 = $13 ; POT2 "
PADDL3 = $14 ;POT3 " PADDL3 = $14 ; POT3 "
PADDL4 = $15 ;POT4 " PADDL4 = $15 ; POT4 "
PADDL5 = $16 ;POT5 " PADDL5 = $16 ; POT5 "
PADDL6 = $17 ;POT6 " PADDL6 = $17 ; POT6 "
PADDL7 = $18 ;POT7 " PADDL7 = $18 ; POT7 "
; cc65 runtime zero page variables ; cc65 runtime zero page variables
@@ -57,26 +57,26 @@ SAVMSC = $1B ; pointer to screen memory (conio)
;Interrupt Vectors ;Interrupt Vectors
VIMIRQ = $0200 ;Immediate IRQ VIMIRQ = $0200 ; Immediate IRQ
;Preset $FC03 (SYSIRQ) ; Preset $FC03 (SYSIRQ)
VVBLKI = $0202 ;Vblank immediate VVBLKI = $0202 ; Vblank immediate
;Preset $FCB8 (SYSVBL) ; Preset $FCB8 (SYSVBL)
VVBLKD = $0204 ;Vblank deferred VVBLKD = $0204 ; Vblank deferred
;Preset $FCB2 (XITVBL) ; Preset $FCB2 (XITVBL)
VDSLST = $0206 ;Display List VDSLST = $0206 ; Display List
;Preset $FEA1 (OSDLI) ; Preset $FEA1 (OSDLI)
VKYBDI = $0208 ;Keyboard immediate VKYBDI = $0208 ; Keyboard immediate
;Preset $FD02 (SYSKBD) ; Preset $FD02 (SYSKBD)
VKYBDF = $020A ;Deferred Keyboard VKYBDF = $020A ; Deferred Keyboard
;Preset $FCB2 (XITVBL) ; Preset $FCB2 (XITVBL)
VTRIGR = $020C ;Soft Trigger VTRIGR = $020C ; Soft Trigger
VBRKOP = $020E ;BRK Opcode VBRKOP = $020E ; BRK Opcode
VSERIN = $0210 ;Serial in Ready VSERIN = $0210 ; Serial in Ready
VSEROR = $0212 ;Serial Out Ready VSEROR = $0212 ; Serial Out Ready
VSEROC = $0214 ;Serial Output complete VSEROC = $0214 ; Serial Output complete
VTIMR1 = $0216 ;Pokey Timer 1 VTIMR1 = $0216 ; Pokey Timer 1
VTIMR2 = $0218 ;Pokey Timer 2 VTIMR2 = $0218 ; Pokey Timer 2
VTIMR4 = $021A ;Pokey Timer 4 VTIMR4 = $021A ; Pokey Timer 4
@@ -84,21 +84,21 @@ VTIMR4 = $021A ;Pokey Timer 4
; CTIA/GTIA Address Equates ; CTIA/GTIA Address Equates
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------
GTIA = $C000 ;CTIA/GTIA area GTIA = $C000 ; CTIA/GTIA area
.include "atari_gtia.inc" .include "atari_gtia.inc"
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------
; ANTIC Address Equates ; ANTIC Address Equates
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------
ANTIC = $D400 ;ANTIC area ANTIC = $D400 ; ANTIC area
.include "atari_antic.inc" .include "atari_antic.inc"
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------
; POKEY Address Equates ; POKEY Address Equates
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------
POKEY = $E800 ;POKEY area POKEY = $E800 ; POKEY area
.include "atari_pokey.inc" .include "atari_pokey.inc"
@@ -106,11 +106,10 @@ POKEY = $E800 ;POKEY area
; Cartridge Parameters ; Cartridge Parameters
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------
CARTNM = $BFE8 ;Cartridge Name Area CARTNM = $BFE8 ; Cartridge Name Area
COPYD = $BFFC ;Copyright Decade in Cart COPYD = $BFFC ; Copyright Decade in Cart
COPYR = $BFFD ;Copyright Year in Cart COPYR = $BFFD ; Copyright Year in Cart
; $FF=Diagnostic Cart ; $FF=Diagnostic Cart
GOCART = $BFFE ;Cartridge Start Vector GOCART = $BFFE ; Cartridge Start Vector
CHRORG = $F800 ; Character Generator Base
CHRORG = $F800 ;Character Generator Base

View File

@@ -33,16 +33,16 @@ NMIRES = ANTIC + $0F ;NMI interrupt reset
; ScreenDL: ; ScreenDL:
; .byte DL_BLK8 ; .byte DL_BLK8
; .byte DL_BLK8 ; .byte DL_BLK8
; .byte DL_CHR40x8x1 + DL_LMS + DL_DLI ; .byte DL_CHR40x8x1 | DL_LMS | DL_DLI
; .word ScreenAlignment ; .word ScreenAlignment
; .byte DL_BLK1 + DL_DLI ; .byte DL_BLK1 | DL_DLI
; .byte DL_MAP320x1x1 + DL_LMS ; .byte DL_MAP320x1x1 | DL_LMS
; .word Screen ; .word Screen
; ;
; .repeat 99 ; .repeat 99
; .byte DL_MAP320x1x1 ; .byte DL_MAP320x1x1
; .endrepeat ; .endrepeat
; .byte DL_MAP320x1x1 + DL_LMS ; .byte DL_MAP320x1x1 | DL_LMS
; .word Screen + 40 * 100 ; 100 lines a 40 byte, 'Screen' has to be aligned correctly! ; .word Screen + 40 * 100 ; 100 lines a 40 byte, 'Screen' has to be aligned correctly!
; .repeat 92 ; .repeat 92
; .byte DL_MAP320x1x1 ; .byte DL_MAP320x1x1
@@ -55,6 +55,8 @@ NMIRES = ANTIC + $0F ;NMI interrupt reset
DL_JMP = 1 DL_JMP = 1
DL_JVB = 65 DL_JVB = 65
; DL_BLKn display n empty lines (just background)
DL_BLK1 = 0 DL_BLK1 = 0
DL_BLK2 = 16 DL_BLK2 = 16
DL_BLK3 = 32 DL_BLK3 = 32

View File

@@ -7,6 +7,8 @@ CPU_ISET_65C02 = $0010
CPU_ISET_65816 = $0020 CPU_ISET_65816 = $0020
CPU_ISET_SWEET16 = $0040 CPU_ISET_SWEET16 = $0040
CPU_ISET_HUC6280 = $0080 CPU_ISET_HUC6280 = $0080
;CPU_ISET_M740 = $0100 not actually implemented
CPU_ISET_4510 = $0200
; CPU capabilities ; CPU capabilities
CPU_NONE = CPU_ISET_NONE CPU_NONE = CPU_ISET_NONE
@@ -17,3 +19,4 @@ CPU_65C02 = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65C02
CPU_65816 = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65816 CPU_65816 = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65816
CPU_SWEET16 = CPU_ISET_SWEET16 CPU_SWEET16 = CPU_ISET_SWEET16
CPU_HUC6280 = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65C02|CPU_ISET_HUC6280 CPU_HUC6280 = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65C02|CPU_ISET_HUC6280
CPU_4510 = CPU_ISET_6502|CPU_ISET_65SC02|CPU_ISET_65C02|CPU_ISET_4510

61
asminc/creativision.inc Normal file
View File

@@ -0,0 +1,61 @@
;*
;** VTech Creativision Definitions
;*
;** Screen
SCREEN_ROWS = 24
SCREEN_COLS = 32
SCREEN_PTR = $3A
CURSOR_X = $3C
CURSOR_Y = $3D
;** VDP
VDP_DATA_R = $2000
VDP_STATUS_R = $2001
VDP_DATA_W = $3000
VDP_CONTROL_W = $3001
;** PIA
PIA0_DATA = $1000
PIA0_STATUS = $1001
PIA1_DATA = $1002
PIA1_STATUS = $1003
;** General
CH_VLINE = 33
CH_HLINE = 34
CH_ULCORNER = 35
CH_URCORNER = 36
CH_LLCORNER = 37
CH_LRCORNER = 38
;** I/O (Zero-page variables)
ZP_KEYBOARD = $10
ZP_JOY0_DIR = $11
ZP_JOY1_DIR = $13
ZP_JOY0_BUTTONS = $16
ZP_JOY1_BUTTONS = $17
;** Joystick direction values (ZP_JOY0_DIR/ZP_JOY1_DIR)
JOY_N = $49
JOY_NNE = $48
JOY_NE = $47
JOY_ENE = $46
JOY_E = $45
JOY_ESE = $44
JOY_SE = $43
JOY_SSE = $42
JOY_S = $41
JOY_SSW = $40
JOY_SW = $4F
JOY_WSW = $4E
JOY_W = $4D
JOY_WNW = $4C
JOY_NW = $4B
JOY_NNW = $4A
;** BIOS
BIOS_IRQ1_ADDR = $FF3F
BIOS_IRQ2_ADDR = $FF52
BIOS_NMI_RESET_ADDR = $F808
BIOS_WRITE_VDP_REG = $FE1F

View File

@@ -28,6 +28,7 @@
ESPIPE ; Illegal seek ESPIPE ; Illegal seek
ERANGE ; Range error ERANGE ; Range error
EBADF ; Bad file number EBADF ; Bad file number
ENOEXEC ; Exec format error
EUNKNOWN ; Unknown OS specific error - must be last! EUNKNOWN ; Unknown OS specific error - must be last!
EMAX = EUNKNOWN ; Highest error code EMAX = EUNKNOWN ; Highest error code

View File

@@ -4,7 +4,7 @@
; ;
; Reference: ; Reference:
; Bastian Schick's Lynx Documentation ; Bastian Schick's Lynx Documentation
; http://www.geocities.com/SiliconValley/Byte/4242/lynx/ ; http://www.geocities.ws/SiliconValley/Byte/4242/lynx/
; ;
; *** ; ***

View File

@@ -1,7 +1,7 @@
; smc.mac ; smc.mac
; ca65 Macro-Pack for Self Modifying Code (SMC) ; ca65 Macro-Pack for Self Modifying Code (SMC)
; ;
; (c) Christian Kr<EFBFBD>ger, latest change: 09-Nov-2011 ; (c) Christian Krüger, latest change: 17-Jul-2016
; ;
; This software is provided 'as-is', without any expressed or implied ; This software is provided 'as-is', without any expressed or implied
; warranty. In no event will the authors be held liable for any damages ; warranty. In no event will the authors be held liable for any damages
@@ -53,7 +53,7 @@ _SMCDesignator: statement
.endmacro .endmacro
.macro SMC_TransferOpcode label, opcode, register .macro SMC_TransferOpcode label, opcode, register
.if .paramcount = 2 .or .match ({register}, a) .if .paramcount = 2 .or .match ({register}, a) .or .match ({register}, )
lda #opcode lda #opcode
sta _SMCDesignator sta _SMCDesignator
.elseif .match ({register}, x) .elseif .match ({register}, x)
@@ -62,44 +62,52 @@ _SMCDesignator: statement
.elseif .match ({register}, y) .elseif .match ({register}, y)
ldy #opcode ldy #opcode
sty _SMCDesignator sty _SMCDesignator
.else
.error "Invalid usage of macro 'SMC_TransferOpcode'"
.endif .endif
.endmacro .endmacro
.macro SMC_LoadOpcode label, register .macro SMC_LoadOpcode label, register
.if .paramcount = 1 .or .match ({register}, a) .if .paramcount = 1 .or .match ({register}, a) .or .match ({register}, )
lda _SMCDesignator lda _SMCDesignator
.elseif .match ({register}, x) .elseif .match ({register}, x)
ldx _SMCDesignator ldx _SMCDesignator
.elseif .match ({register}, y) .elseif .match ({register}, y)
ldy _SMCDesignator ldy _SMCDesignator
.else
.error "Invalid usage of macro 'SMC_LoadOpcode'"
.endif .endif
.endmacro .endmacro
.macro SMC_StoreOpcode label, register .macro SMC_StoreOpcode label, register
.if .paramcount = 1 .or .match ({register}, a) .if .paramcount = 1 .or .match ({register}, a) .or .match ({register}, )
sta _SMCDesignator sta _SMCDesignator
.elseif .match ({register}, x) .elseif .match ({register}, x)
stx _SMCDesignator stx _SMCDesignator
.elseif .match ({register}, y) .elseif .match ({register}, y)
sty _SMCDesignator sty _SMCDesignator
.else
.error "Invalid usage of macro 'SMC_StoreOpcode'"
.endif .endif
.endmacro .endmacro
.macro SMC_ChangeBranch label, destination, register .macro SMC_ChangeBranch label, destination, register
.if .paramcount = 2 .or .match ({register}, a) .if .paramcount = 2 .or .match ({register}, a) .or .match ({register}, )
lda #(destination - _SMCDesignator -2) lda #(<(destination - _SMCDesignator -2))
sta _SMCDesignator+1 sta _SMCDesignator+1
.elseif .match ({register}, x) .elseif .match ({register}, x)
ldx #(destination - _SMCDesignator - 2) ldx #(<(destination - _SMCDesignator - 2))
stx _SMCDesignator+1 stx _SMCDesignator+1
.elseif .match ({register}, y) .elseif .match ({register}, y)
ldy #(destination - _SMCDesignator - 2) ldy #(<(destination - _SMCDesignator - 2))
sty _SMCDesignator+1 sty _SMCDesignator+1
.else
.error "Invalid usage of macro 'SMC_ChangeBranch'"
.endif .endif
.endmacro .endmacro
.macro SMC_TransferValue label, value, register .macro SMC_TransferValue label, value, register
.if .paramcount = 2 .or .match ({register}, a) .if .paramcount = 2 .or .match ({register}, a) .or .match ({register}, )
lda value lda value
sta _SMCDesignator+1 sta _SMCDesignator+1
.elseif .match ({register}, x) .elseif .match ({register}, x)
@@ -108,26 +116,32 @@ _SMCDesignator: statement
.elseif .match ({register}, y) .elseif .match ({register}, y)
ldy value ldy value
sty _SMCDesignator+1 sty _SMCDesignator+1
.else
.error "Invalid usage of macro 'SMC_TransferValue'"
.endif .endif
.endmacro .endmacro
.macro SMC_LoadValue label, register .macro SMC_LoadValue label, register
.if .paramcount = 1 .or .match ({register}, a) .if .paramcount = 1 .or .match ({register}, a) .or .match ({register}, )
lda _SMCDesignator+1 lda _SMCDesignator+1
.elseif .match ({register}, x) .elseif .match ({register}, x)
ldx _SMCDesignator+1 ldx _SMCDesignator+1
.elseif .match ({register}, y) .elseif .match ({register}, y)
ldy _SMCDesignator+1 ldy _SMCDesignator+1
.else
.error "Invalid usage of macro 'SMC_LoadValue'"
.endif .endif
.endmacro .endmacro
.macro SMC_StoreValue label, register .macro SMC_StoreValue label, register
.if .paramcount = 1 .or .match ({register}, a) .if .paramcount = 1 .or .match ({register}, a) .or .match ({register}, )
sta _SMCDesignator+1 sta _SMCDesignator+1
.elseif .match ({register}, x) .elseif .match ({register}, x)
stx _SMCDesignator+1 stx _SMCDesignator+1
.elseif .match ({register}, y) .elseif .match ({register}, y)
sty _SMCDesignator+1 sty _SMCDesignator+1
.else
.error "Invalid usage of macro 'SMC_StoreValue'"
.endif .endif
.endmacro .endmacro
@@ -145,7 +159,7 @@ SMC_StoreValue label, register
.endmacro .endmacro
.macro SMC_TransferHighByte label, value, register .macro SMC_TransferHighByte label, value, register
.if .paramcount = 2 .or .match ({register}, a) .if .paramcount = 2 .or .match ({register}, a) .or .match ({register}, )
lda value lda value
sta _SMCDesignator+2 sta _SMCDesignator+2
.elseif .match ({register}, x) .elseif .match ({register}, x)
@@ -154,31 +168,37 @@ SMC_StoreValue label, register
.elseif .match ({register}, y) .elseif .match ({register}, y)
ldy value ldy value
sty _SMCDesignator+2 sty _SMCDesignator+2
.else
.error "Invalid usage of macro 'SMC_TransferHighByte'"
.endif .endif
.endmacro .endmacro
.macro SMC_LoadHighByte label, register .macro SMC_LoadHighByte label, register
.if .paramcount = 1 .or .match ({register}, a) .if .paramcount = 1 .or .match ({register}, a) .or .match ({register}, )
lda _SMCDesignator+2 lda _SMCDesignator+2
.elseif .match ({register}, x) .elseif .match ({register}, x)
ldx _SMCDesignator+2 ldx _SMCDesignator+2
.elseif .match ({register}, y) .elseif .match ({register}, y)
ldy _SMCDesignator+2 ldy _SMCDesignator+2
.else
.error "Invalid usage of macro 'SMC_LoadHighByte'"
.endif .endif
.endmacro .endmacro
.macro SMC_StoreHighByte label, register .macro SMC_StoreHighByte label, register
.if .paramcount = 1 .or .match ({register}, a) .if .paramcount = 1 .or .match ({register}, a) .or .match ({register}, )
sta _SMCDesignator+2 sta _SMCDesignator+2
.elseif .match ({register}, x) .elseif .match ({register}, x)
stx _SMCDesignator+2 stx _SMCDesignator+2
.elseif .match ({register}, y) .elseif .match ({register}, y)
sty _SMCDesignator+2 sty _SMCDesignator+2
.else
.error "Invalid usage of macro 'SMC_StoreHighByte'"
.endif .endif
.endmacro .endmacro
.macro SMC_TransferAddressSingle label, address, register .macro SMC_TransferAddressSingle label, address, register
.if .paramcount = 2 .or .match ((register), a) .if .paramcount = 2 .or .match ((register), a) .or .match ({register}, )
.if (.match (.left (1, {address}), #)) .if (.match (.left (1, {address}), #))
; immediate mode ; immediate mode
lda #<(.right (.tcount ({address})-1, {address})) lda #<(.right (.tcount ({address})-1, {address}))
@@ -220,6 +240,8 @@ SMC_StoreValue label, register
ldy 1+(address) ldy 1+(address)
sty _SMCDesignator+2 sty _SMCDesignator+2
.endif .endif
.else
.error "Invalid usage of macro 'SMC_TransferAddressSingle'"
.endif .endif
.endmacro .endmacro

View File

@@ -1,8 +1,7 @@
; supervision symbols ; supervision symbols
; supervision 65c02s ; supervision 65c02s
; in cc65 up to 2.9.1 65c02 means 65c02s ; in cc65 up to 2.9.1 65c02 means 65sc02
.pc02
lcd_addr = $4000 lcd_addr = $4000
LCD_LINESIZE = $30 LCD_LINESIZE = $30

156
asminc/telestrat.inc Normal file
View File

@@ -0,0 +1,156 @@
;
; Oric Telemon definition
; Telemon 2.4 & Telemon 3.0
; For telemon 3.0 check http://orix.oric.org
;
; ---------------------------------------------------------------------------
; Constants
SCREEN_XSIZE = 40 ; screen columns
SCREEN_YSIZE = 28 ; screen rows
FUNCTKEY = $A5
FNAME_LEN = 11 ; maximum length of file-name
; ---------------------------------------------------------------------------
; Zero page
; ---------------------------------------------------------------------------
; Page 00
RES := $00
RESB := $02
TR0 := $0C
TR1 := $0D
PTR_READ_DEST := $2C ; used for XFREAD and XWRITE only in telemon 3.0
HRSX := $46
HRSY := $47
HRS1 := $4D
HRS2 := $4F
HRS3 := $51
HRS4 := $53
HRS5 := $55
; ---------------------------------------------------------------------------
; Low memory
; ---------------------------------------------------------------------------
; I/O locations
; 6522
.struct VIA ; Versatile Interface Adapter
.res $0300
PRB .byte ; Port Register B
PRA .byte ; Port Register A
DDRB .byte ; Data Direction Register B
DDRA .byte ; Data Direction Register A
T1 .word ; Timer 1
T1L .word ; Timer 1 Latch
T2 .word ; Timer 2
SR .byte ; Shift Register
ACR .byte ; Auxiliary Control Register
PCR .byte ; Peripheral Control Register
IFR .byte ; Interrupt Flags Register
IER .byte ; Interrupt Enable Register
PRA2 .byte ; Port Register A without handshaking
.endstruct
.struct VIA2 ; Versatile Interface Adapter
.res $0320
PRB .byte ; Port Register B
PRA .byte ; Port Register A
DDRB .byte ; Data Direction Register B
DDRA .byte ; Data Direction Register A
T1 .word ; Timer 1
T1L .word ; Timer 1 Latch
T2 .word ; Timer 2
SR .byte ; Shift Register
ACR .byte ; Auxiliary Control Register
PCR .byte ; Peripheral Control Register
IFR .byte ; Interrupt Flags Register
IER .byte ; Interrupt Enable Register
PRA2 .byte ; Port Register A without handshaking
.endstruct
; 6551
.struct ACIA ; Asynchronous Communications Interface Adapter
.res $031C
DATA .byte
STATUS .byte
CMD .byte ; Command register
CTRL .byte ; Control register
.endstruct
SCREEN := $BB80
; ---------------------------------------------------------------------------
; ROM entries
; primitives telemon 2.4
XRD0 = $08
XRDW0 = $0C
XWR0 = $10
XWSTR0 = $14
XTEXT = $19
XHIRES = $1A
XFILLM = $1C
XMINMA = $1F
XFREAD = $27 ; only in TELEMON 3.0
XOPEN = $30 ; only in TELEMON 3.0
XCOSCR = $34 ; switch off cursor
XCSSCR = $35 ; switch on cursor
XCLOSE = $3A ; only in TELEMON 3.0 Close file
XFWRITE = $3B ; only in TELEMON 3.0 write file
XSONPS = $40
XOUPS = $42
XPLAY = $43
XSOUND = $44
XMUSIC = $45
XZAP = $46
XSHOOT = $47
XCIRCL = $8F
XCURSE = $90
XPAPER = $92
XINK = $93
XEXPLO = $9C
XPING = $9D
; ---------------------------------------------------------------------------
; Page $200
SCRX := $220
SCRY := $224
ADSCRL := $218
ADSCRH := $21C
; ---------------------------------------------------------------------------
; Page $500
BUFNOM := $517
BUFEDT := $590
MAX_BUFEDT_LENGTH=110
; Hardware
CH376_DATA :=$340
CH376_COMMAND :=$341
; MACRO
.macro BRK_TELEMON value
.byte $00,value
.endmacro

View File

@@ -3,20 +3,17 @@
FEATURES { FEATURES {
STARTADDRESS: default = $0803; STARTADDRESS: default = $0803;
} }
SYMBOLS {
__LOADADDR__: type = weak, value = __CODE_RUN__;
__LOADSIZE__: type = weak, value = __BSS_RUN__ - __CODE_RUN__;
}
MEMORY { MEMORY {
ZP: start = $0080, size = $001A, define = yes; ZP: file = "", start = $0000, size = $00FF;
HEADER: file = %O, start = $0000, size = $0004; HEADER: file = %O, start = %S - 4, size = $0004;
RAM: file = %O, start = %S, size = $C000 - %S; MAIN: file = %O, define = yes, start = %S, size = $C000 - %S;
BSS: file = "", start = __MAIN_LAST__, size = $C000 - __MAIN_LAST__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp, optional = yes; ZEROPAGE: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro, optional = yes; EXEHDR: load = HEADER, type = ro, optional = yes;
CODE: load = RAM, type = rw, optional = yes, define = yes; CODE: load = MAIN, type = rw;
RODATA: load = RAM, type = ro, optional = yes; RODATA: load = MAIN, type = ro, optional = yes;
DATA: load = RAM, type = rw, optional = yes; DATA: load = MAIN, type = rw, optional = yes;
BSS: load = RAM, type = bss, optional = yes, define = yes; BSS: load = BSS, type = bss, optional = yes, define = yes;
} }

View File

@@ -12,21 +12,18 @@ FEATURES {
} }
SYMBOLS { SYMBOLS {
__EXEHDR__: type = import; __EXEHDR__: type = import;
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__HIMEM__: type = weak, value = $9600; # Presumed RAM end __HIMEM__: type = weak, value = $9600; # Presumed RAM end
__LCADDR__: type = weak, value = $D400; # Behind quit code __LCADDR__: type = weak, value = $D400; # Behind quit code
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two __LCSIZE__: type = weak, value = $0C00; # Rest of bank two
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay __OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay
__LOADADDR__: type = weak, value = __STARTUP_RUN__;
__LOADSIZE__: type = weak, value = __INITBSS_RUN__ - __STARTUP_RUN__ +
__MOVE_LAST__ - __MOVE_START__;
} }
MEMORY { MEMORY {
ZP: define = yes, start = $0080, size = $001A; ZP: file = "", define = yes, start = $0080, size = $001A;
HEADER: file = %O, start = $0000, size = $0004; HEADER: file = %O, start = %S - 4, size = $0004;
RAM: file = %O, start = %S + __OVERLAYSIZE__, size = __HIMEM__ - __STACKSIZE__ - __OVERLAYSIZE__ - %S; MAIN: file = %O, define = yes, start = %S + __OVERLAYSIZE__, size = __HIMEM__ - __OVERLAYSIZE__ - %S;
MOVE: file = %O, define = yes, start = $0000, size = $FFFF; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
LC: define = yes, start = __LCADDR__, size = __LCSIZE__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__; OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__;
OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__; OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__;
OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__; OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__;
@@ -38,32 +35,32 @@ MEMORY {
OVL9: file = "%O.9", start = %S, size = __OVERLAYSIZE__; OVL9: file = "%O.9", start = %S, size = __OVERLAYSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro, define = yes; STARTUP: load = MAIN, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss, define = yes; INIT: load = MAIN, type = rw;
BSS: load = RAM, type = bss, define = yes; ONCE: load = MAIN, type = ro, define = yes;
INIT: load = MOVE, run = RAM, type = ro, define = yes, optional = yes; LC: load = MAIN, run = LC, type = ro, optional = yes;
LC: load = MOVE, run = LC, type = ro, optional = yes; BSS: load = BSS, type = bss, define = yes;
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes; OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes; OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes;
OVERLAY3: load = OVL3, type = ro, define = yes, optional = yes; OVERLAY3: load = OVL3, type = ro, define = yes, optional = yes;
OVERLAY4: load = OVL4, type = ro, define = yes, optional = yes; OVERLAY4: load = OVL4, type = ro, define = yes, optional = yes;
OVERLAY5: load = OVL5, type = ro, define = yes, optional = yes; OVERLAY5: load = OVL5, type = ro, define = yes, optional = yes;
OVERLAY6: load = OVL6, type = ro, define = yes, optional = yes; OVERLAY6: load = OVL6, type = ro, define = yes, optional = yes;
OVERLAY7: load = OVL7, type = ro, define = yes, optional = yes; OVERLAY7: load = OVL7, type = ro, define = yes, optional = yes;
OVERLAY8: load = OVL8, type = ro, define = yes, optional = yes; OVERLAY8: load = OVL8, type = ro, define = yes, optional = yes;
OVERLAY9: load = OVL9, type = ro, define = yes, optional = yes; OVERLAY9: load = OVL9, type = ro, define = yes, optional = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -1,36 +1,33 @@
# Configuration for ProDOS 8 system programs (without the header) # Configuration for ProDOS 8 system programs (without the header)
SYMBOLS { SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__LCADDR__: type = weak, value = $D400; # Behind quit code __LCADDR__: type = weak, value = $D400; # Behind quit code
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two __LCSIZE__: type = weak, value = $0C00; # Rest of bank two
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__LOADADDR__: type = weak, value = __STARTUP_RUN__;
__LOADSIZE__: type = weak, value = __INITBSS_RUN__ - __STARTUP_RUN__ +
__MOVE_LAST__ - __MOVE_START__;
} }
MEMORY { MEMORY {
ZP: define = yes, start = $0080, size = $001A; ZP: file = "", define = yes, start = $0080, size = $001A;
RAM: file = %O, start = $2000, size = $9F00 - __STACKSIZE__; MAIN: file = %O, start = $2000, size = $BF00 - $2000;
MOVE: file = %O, define = yes, start = $0000, size = $FFFF; BSS: file = "", start = __ONCE_RUN__, size = $BF00 - __STACKSIZE__ - __ONCE_RUN__;
LC: define = yes, start = __LCADDR__, size = __LCSIZE__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
STARTUP: load = RAM, type = ro, define = yes; STARTUP: load = MAIN, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss, define = yes; INIT: load = MAIN, type = rw;
BSS: load = RAM, type = bss, define = yes; ONCE: load = MAIN, type = ro, define = yes;
INIT: load = MOVE, run = RAM, type = ro, define = yes, optional = yes; LC: load = MAIN, run = LC, type = ro, optional = yes;
LC: load = MOVE, run = LC, type = ro, optional = yes; BSS: load = BSS, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -5,39 +5,36 @@ FEATURES {
} }
SYMBOLS { SYMBOLS {
__EXEHDR__: type = import; __EXEHDR__: type = import;
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__HIMEM__: type = weak, value = $9600; # Presumed RAM end __HIMEM__: type = weak, value = $9600; # Presumed RAM end
__LCADDR__: type = weak, value = $D400; # Behind quit code __LCADDR__: type = weak, value = $D400; # Behind quit code
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two __LCSIZE__: type = weak, value = $0C00; # Rest of bank two
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__LOADADDR__: type = weak, value = __STARTUP_RUN__;
__LOADSIZE__: type = weak, value = __INITBSS_RUN__ - __STARTUP_RUN__ +
__MOVE_LAST__ - __MOVE_START__;
} }
MEMORY { MEMORY {
ZP: define = yes, start = $0080, size = $001A; ZP: file = "", define = yes, start = $0080, size = $001A;
HEADER: file = %O, start = $0000, size = $0004; HEADER: file = %O, start = %S - 4, size = $0004;
RAM: file = %O, start = %S, size = __HIMEM__ - __STACKSIZE__ - %S; MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S;
MOVE: file = %O, define = yes, start = $0000, size = $FFFF; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
LC: define = yes, start = __LCADDR__, size = __LCSIZE__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro, define = yes; STARTUP: load = MAIN, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss, define = yes; INIT: load = MAIN, type = rw;
BSS: load = RAM, type = bss, define = yes; ONCE: load = MAIN, type = ro, define = yes;
INIT: load = MOVE, run = RAM, type = ro, define = yes, optional = yes; LC: load = MAIN, run = LC, type = ro, optional = yes;
LC: load = MOVE, run = LC, type = ro, optional = yes; BSS: load = BSS, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -3,18 +3,17 @@
FEATURES { FEATURES {
STARTADDRESS: default = $0803; STARTADDRESS: default = $0803;
} }
SYMBOLS {
__LOADADDR__: type = weak, value = __CODE_RUN__;
__LOADSIZE__: type = weak, value = __BSS_RUN__ - __CODE_RUN__;
}
MEMORY { MEMORY {
HEADER: file = %O, start = $0000, size = $0004; ZP: file = "", start = $0000, size = $00FF;
RAM: file = %O, start = %S, size = $C000 - %S; HEADER: file = %O, start = %S - 4, size = $0004;
MAIN: file = %O, define = yes, start = %S, size = $C000 - %S;
BSS: file = "", start = __MAIN_LAST__, size = $C000 - __MAIN_LAST__;
} }
SEGMENTS { SEGMENTS {
EXEHDR: load = HEADER, type = ro, optional = yes; ZEROPAGE: load = ZP, type = zp, optional = yes;
CODE: load = RAM, type = rw, optional = yes, define = yes; EXEHDR: load = HEADER, type = ro, optional = yes;
RODATA: load = RAM, type = ro, optional = yes; CODE: load = MAIN, type = rw;
DATA: load = RAM, type = rw, optional = yes; RODATA: load = MAIN, type = ro, optional = yes;
BSS: load = RAM, type = bss, optional = yes, define = yes; DATA: load = MAIN, type = rw, optional = yes;
BSS: load = BSS, type = bss, optional = yes, define = yes;
} }

View File

@@ -12,21 +12,18 @@ FEATURES {
} }
SYMBOLS { SYMBOLS {
__EXEHDR__: type = import; __EXEHDR__: type = import;
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__HIMEM__: type = weak, value = $9600; # Presumed RAM end __HIMEM__: type = weak, value = $9600; # Presumed RAM end
__LCADDR__: type = weak, value = $D400; # Behind quit code __LCADDR__: type = weak, value = $D400; # Behind quit code
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two __LCSIZE__: type = weak, value = $0C00; # Rest of bank two
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay __OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay
__LOADADDR__: type = weak, value = __STARTUP_RUN__;
__LOADSIZE__: type = weak, value = __INITBSS_RUN__ - __STARTUP_RUN__ +
__MOVE_LAST__ - __MOVE_START__;
} }
MEMORY { MEMORY {
ZP: define = yes, start = $0080, size = $001A; ZP: file = "", define = yes, start = $0080, size = $001A;
HEADER: file = %O, start = $0000, size = $0004; HEADER: file = %O, start = %S - 4, size = $0004;
RAM: file = %O, start = %S + __OVERLAYSIZE__, size = __HIMEM__ - __STACKSIZE__ - __OVERLAYSIZE__ - %S; MAIN: file = %O, define = yes, start = %S + __OVERLAYSIZE__, size = __HIMEM__ - __OVERLAYSIZE__ - %S;
MOVE: file = %O, define = yes, start = $0000, size = $FFFF; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
LC: define = yes, start = __LCADDR__, size = __LCSIZE__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__; OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__;
OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__; OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__;
OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__; OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__;
@@ -38,32 +35,32 @@ MEMORY {
OVL9: file = "%O.9", start = %S, size = __OVERLAYSIZE__; OVL9: file = "%O.9", start = %S, size = __OVERLAYSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro, define = yes; STARTUP: load = MAIN, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss, define = yes; INIT: load = MAIN, type = rw;
BSS: load = RAM, type = bss, define = yes; ONCE: load = MAIN, type = ro, define = yes;
INIT: load = MOVE, run = RAM, type = ro, define = yes, optional = yes; LC: load = MAIN, run = LC, type = ro, optional = yes;
LC: load = MOVE, run = LC, type = ro, optional = yes; BSS: load = BSS, type = bss, define = yes;
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes; OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes; OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes;
OVERLAY3: load = OVL3, type = ro, define = yes, optional = yes; OVERLAY3: load = OVL3, type = ro, define = yes, optional = yes;
OVERLAY4: load = OVL4, type = ro, define = yes, optional = yes; OVERLAY4: load = OVL4, type = ro, define = yes, optional = yes;
OVERLAY5: load = OVL5, type = ro, define = yes, optional = yes; OVERLAY5: load = OVL5, type = ro, define = yes, optional = yes;
OVERLAY6: load = OVL6, type = ro, define = yes, optional = yes; OVERLAY6: load = OVL6, type = ro, define = yes, optional = yes;
OVERLAY7: load = OVL7, type = ro, define = yes, optional = yes; OVERLAY7: load = OVL7, type = ro, define = yes, optional = yes;
OVERLAY8: load = OVL8, type = ro, define = yes, optional = yes; OVERLAY8: load = OVL8, type = ro, define = yes, optional = yes;
OVERLAY9: load = OVL9, type = ro, define = yes, optional = yes; OVERLAY9: load = OVL9, type = ro, define = yes, optional = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -1,36 +1,33 @@
# Configuration for ProDOS 8 system programs (without the header) # Configuration for ProDOS 8 system programs (without the header)
SYMBOLS { SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__LCADDR__: type = weak, value = $D400; # Behind quit code __LCADDR__: type = weak, value = $D400; # Behind quit code
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two __LCSIZE__: type = weak, value = $0C00; # Rest of bank two
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__LOADADDR__: type = weak, value = __STARTUP_RUN__;
__LOADSIZE__: type = weak, value = __INITBSS_RUN__ - __STARTUP_RUN__ +
__MOVE_LAST__ - __MOVE_START__;
} }
MEMORY { MEMORY {
ZP: define = yes, start = $0080, size = $001A; ZP: file = "", define = yes, start = $0080, size = $001A;
RAM: file = %O, start = $2000, size = $9F00 - __STACKSIZE__; MAIN: file = %O, start = $2000, size = $BF00 - $2000;
MOVE: file = %O, define = yes, start = $0000, size = $FFFF; BSS: file = "", start = __ONCE_RUN__, size = $BF00 - __STACKSIZE__ - __ONCE_RUN__;
LC: define = yes, start = __LCADDR__, size = __LCSIZE__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
STARTUP: load = RAM, type = ro, define = yes; STARTUP: load = MAIN, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss, define = yes; INIT: load = MAIN, type = rw;
BSS: load = RAM, type = bss, define = yes; ONCE: load = MAIN, type = ro, define = yes;
INIT: load = MOVE, run = RAM, type = ro, define = yes, optional = yes; LC: load = MAIN, run = LC, type = ro, optional = yes;
LC: load = MOVE, run = LC, type = ro, optional = yes; BSS: load = BSS, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -5,39 +5,36 @@ FEATURES {
} }
SYMBOLS { SYMBOLS {
__EXEHDR__: type = import; __EXEHDR__: type = import;
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__HIMEM__: type = weak, value = $9600; # Presumed RAM end __HIMEM__: type = weak, value = $9600; # Presumed RAM end
__LCADDR__: type = weak, value = $D400; # Behind quit code __LCADDR__: type = weak, value = $D400; # Behind quit code
__LCSIZE__: type = weak, value = $0C00; # Rest of bank two __LCSIZE__: type = weak, value = $0C00; # Rest of bank two
__STACKSIZE__: type = weak, value = $0800; # 2k stack
__LOADADDR__: type = weak, value = __STARTUP_RUN__;
__LOADSIZE__: type = weak, value = __INITBSS_RUN__ - __STARTUP_RUN__ +
__MOVE_LAST__ - __MOVE_START__;
} }
MEMORY { MEMORY {
ZP: define = yes, start = $0080, size = $001A; ZP: file = "", define = yes, start = $0080, size = $001A;
HEADER: file = %O, start = $0000, size = $0004; HEADER: file = %O, start = %S - 4, size = $0004;
RAM: file = %O, start = %S, size = __HIMEM__ - __STACKSIZE__ - %S; MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S;
MOVE: file = %O, define = yes, start = $0000, size = $FFFF; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
LC: define = yes, start = __LCADDR__, size = __LCSIZE__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro, define = yes; STARTUP: load = MAIN, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss, define = yes; INIT: load = MAIN, type = rw;
BSS: load = RAM, type = bss, define = yes; ONCE: load = MAIN, type = ro, define = yes;
INIT: load = MOVE, run = RAM, type = ro, define = yes, optional = yes; LC: load = MAIN, run = LC, type = ro, optional = yes;
LC: load = MOVE, run = LC, type = ro, optional = yes; BSS: load = BSS, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -2,29 +2,29 @@ FEATURES {
STARTADDRESS: default = $2E00; STARTADDRESS: default = $2E00;
} }
SYMBOLS { SYMBOLS {
__EXEHDR__: type = import; __EXEHDR__: type = import;
__AUTOSTART__: type = import; # force inclusion of autostart "trailer" __AUTOSTART__: type = import; # force inclusion of autostart "trailer"
__STARTADDRESS__: type = export, value = %S; __STARTADDRESS__: type = export, value = %S;
} }
MEMORY { MEMORY {
ZP: file = "", define = yes, start = $0082, size = $007E; ZP: file = "", define = yes, start = $0082, size = $007E;
# file header, just $FFFF # file header, just $FFFF
HEADER: file = %O, start = $0000, size = $0002; HEADER: file = %O, start = $0000, size = $0002;
# "main program" load chunk # "main program" load chunk
MAINHDR: file = %O, start = $0000, size = $0004; MAINHDR: file = %O, start = $0000, size = $0004;
RAM: file = %O, define = yes, start = %S, size = $BC20 - %S; MAIN: file = %O, define = yes, start = %S, size = $BC20 - %S;
TRAILER: file = %O, start = $0000, size = $0006; TRAILER: file = %O, start = $0000, size = $0006;
} }
SEGMENTS { SEGMENTS {
EXEHDR: load = HEADER, type = ro, optional = yes; ZEROPAGE: load = ZP, type = zp, optional = yes;
MAINHDR: load = MAINHDR, type = ro, optional = yes; EXTZP: load = ZP, type = zp, optional = yes; # to enable modules to be able to link to C and assembler programs
CODE: load = RAM, type = ro, define = yes, optional = yes; EXEHDR: load = HEADER, type = ro, optional = yes;
RODATA: load = RAM, type = ro optional = yes; MAINHDR: load = MAINHDR, type = ro, optional = yes;
DATA: load = RAM, type = rw optional = yes; CODE: load = MAIN, type = rw, define = yes;
BSS: load = RAM, type = bss, define = yes, optional = yes; RODATA: load = MAIN, type = ro optional = yes;
ZEROPAGE: load = ZP, type = zp, optional = yes; DATA: load = MAIN, type = rw optional = yes;
EXTZP: load = ZP, type = zp, optional = yes; # to enable modules to be able to link to C and assembler programs BSS: load = MAIN, type = bss, optional = yes, define = yes;
AUTOSTRT: load = TRAILER, type = ro, optional = yes; AUTOSTRT: load = TRAILER, type = ro, optional = yes;
} }

View File

@@ -10,29 +10,29 @@ SYMBOLS {
__CARTFLAGS__: type = weak, value = $01; # see documentation for other possible values __CARTFLAGS__: type = weak, value = $01; # see documentation for other possible values
} }
MEMORY { MEMORY {
ZP: file = "", define = yes, start = $0082, size = $007E; ZP: file = "", define = yes, start = $0082, size = $007E;
RAM: file = "", define = yes, start = %S, size = __CARTSIZE__; MAIN: file = "", define = yes, start = %S, size = __CARTSIZE__;
ROM: file = %O, define = yes, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - 6, fill = yes, fillval = $FF; ROM: file = %O, define = yes, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - 6, fill = yes, fillval = $FF;
CARTID: file = %O, start = $BFFA, size = $0006; CARTID: file = %O, start = $BFFA, size = $0006;
} }
SEGMENTS { SEGMENTS {
STARTUP: load = ROM, type = ro, define = yes, optional = yes; ZEROPAGE: load = ZP, type = zp, optional = yes;
LOWCODE: load = ROM, type = ro, define = yes, optional = yes; EXTZP: load = ZP, type = zp, optional = yes;
INIT: load = ROM, type = ro, optional = yes; STARTUP: load = ROM, type = ro, define = yes, optional = yes;
CODE: load = ROM, type = ro, define = yes; LOWCODE: load = ROM, type = ro, define = yes, optional = yes;
RODATA: load = ROM, type = ro, optional = yes; ONCE: load = ROM, type = ro, optional = yes;
DATA: load = ROM, run = RAM, type = rw, define = yes, optional = yes; CODE: load = ROM, type = ro, define = yes;
INITBSS: load = RAM, type = bss, optional = yes; RODATA: load = ROM, type = ro, optional = yes;
BSS: load = RAM, type = bss, define = yes, optional = yes; DATA: load = ROM, run = MAIN, type = rw, define = yes, optional = yes;
CARTHDR: load = CARTID, type = ro; INIT: load = MAIN, type = bss, optional = yes;
ZEROPAGE: load = ZP, type = zp, optional = yes; BSS: load = MAIN, type = bss, define = yes, optional = yes;
EXTZP: load = ZP, type = zp, optional = yes; CARTHDR: load = CARTID, type = ro;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -8,27 +8,27 @@ SYMBOLS {
_cas_hdr: type = import; _cas_hdr: type = import;
} }
MEMORY { MEMORY {
ZP: file = "", define = yes, start = $0082, size = $007E; ZP: file = "", define = yes, start = $0082, size = $007E;
RAM: file = %O, define = yes, start = %S, size = $BC20 - __STACKSIZE__ - __RESERVED_MEMORY__ - %S; MAIN: file = %O, define = yes, start = %S, size = $BC20 - __STACKSIZE__ - __RESERVED_MEMORY__ - %S;
} }
SEGMENTS { SEGMENTS {
CASHDR: load = RAM, type = ro; ZEROPAGE: load = ZP, type = zp, optional = yes;
STARTUP: load = RAM, type = ro, define = yes, optional = yes; EXTZP: load = ZP, type = zp, optional = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes; CASHDR: load = MAIN, type = ro;
INIT: load = RAM, type = ro, optional = yes; STARTUP: load = MAIN, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro, define = yes; LOWCODE: load = MAIN, type = ro, define = yes, optional = yes;
RODATA: load = RAM, type = ro, optional = yes; ONCE: load = MAIN, type = ro, optional = yes;
DATA: load = RAM, type = rw, optional = yes; CODE: load = MAIN, type = ro, define = yes;
INITBSS: load = RAM, type = bss, optional = yes; RODATA: load = MAIN, type = ro, optional = yes;
BSS: load = RAM, type = bss, define = yes, optional = yes; DATA: load = MAIN, type = rw, optional = yes;
ZEROPAGE: load = ZP, type = zp, optional = yes; BSS: load = MAIN, type = bss, define = yes, optional = yes;
EXTZP: load = ZP, type = zp, optional = yes; INIT: load = MAIN, type = bss, optional = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -11,48 +11,48 @@ SYMBOLS {
__RESERVED_MEMORY__: type = weak, value = $0000; __RESERVED_MEMORY__: type = weak, value = $0000;
} }
MEMORY { MEMORY {
ZP: file = "", define = yes, start = $0082, size = $007E; ZP: file = "", define = yes, start = $0082, size = $007E;
# file header, just $FFFF # file header, just $FFFF
HEADER: file = %O, start = $0000, size = $0002; HEADER: file = %O, start = $0000, size = $0002;
# "system check" load chunk # "system check" load chunk
SYSCHKHDR: file = %O, start = $0000, size = $0004; SYSCHKHDR: file = %O, start = $0000, size = $0004;
SYSCHKCHNK: file = %O, start = $2E00, size = $0300; SYSCHKCHNK: file = %O, start = $2E00, size = $0300;
SYSCHKTRL: file = %O, start = $0000, size = $0006; SYSCHKTRL: file = %O, start = $0000, size = $0006;
# "main program" load chunk # "main program" load chunk
MAINHDR: file = %O, start = $0000, size = $0004; MAINHDR: file = %O, start = $0000, size = $0004;
RAM: file = %O, define = yes, start = %S + __OVERLAYSIZE__, MAIN: file = %O, define = yes, start = %S + __OVERLAYSIZE__, size = $BC20 - __OVERLAYSIZE__ - __STACKSIZE__ - __RESERVED_MEMORY__ - %S;
size = $BC20 - __OVERLAYSIZE__ - __STACKSIZE__ - __RESERVED_MEMORY__ - %S; TRAILER: file = %O, start = $0000, size = $0006;
TRAILER: file = %O, start = $0000, size = $0006;
OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__; # overlays
OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__; OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__;
OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__; OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__;
OVL4: file = "%O.4", start = %S, size = __OVERLAYSIZE__; OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__;
OVL5: file = "%O.5", start = %S, size = __OVERLAYSIZE__; OVL4: file = "%O.4", start = %S, size = __OVERLAYSIZE__;
OVL6: file = "%O.6", start = %S, size = __OVERLAYSIZE__; OVL5: file = "%O.5", start = %S, size = __OVERLAYSIZE__;
OVL7: file = "%O.7", start = %S, size = __OVERLAYSIZE__; OVL6: file = "%O.6", start = %S, size = __OVERLAYSIZE__;
OVL8: file = "%O.8", start = %S, size = __OVERLAYSIZE__; OVL7: file = "%O.7", start = %S, size = __OVERLAYSIZE__;
OVL9: file = "%O.9", start = %S, size = __OVERLAYSIZE__; OVL8: file = "%O.8", start = %S, size = __OVERLAYSIZE__;
OVL9: file = "%O.9", start = %S, size = __OVERLAYSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes; SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes;
SYSCHK: load = SYSCHKCHNK, type = rw, define = yes, optional = yes; SYSCHK: load = SYSCHKCHNK, type = rw, define = yes, optional = yes;
SYSCHKTRL: load = SYSCHKTRL, type = ro, optional = yes; SYSCHKTRL: load = SYSCHKTRL, type = ro, optional = yes;
MAINHDR: load = MAINHDR, type = ro; MAINHDR: load = MAINHDR, type = ro;
STARTUP: load = RAM, type = ro, define = yes; STARTUP: load = MAIN, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes; LOWCODE: load = MAIN, type = ro, define = yes, optional = yes;
INIT: load = RAM, type = ro, optional = yes; ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro, define = yes; CODE: load = MAIN, type = ro, define = yes;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss, optional = yes; INIT: load = MAIN, type = rw, optional = yes;
BSS: load = RAM, type = bss, define = yes; BSS: load = MAIN, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes;
AUTOSTRT: load = TRAILER, type = ro; AUTOSTRT: load = TRAILER, type = ro;
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes; OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes; OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes;
@@ -68,7 +68,7 @@ FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -10,44 +10,44 @@ SYMBOLS {
__RESERVED_MEMORY__: type = weak, value = $0000; __RESERVED_MEMORY__: type = weak, value = $0000;
} }
MEMORY { MEMORY {
ZP: file = "", define = yes, start = $0082, size = $007E; ZP: file = "", define = yes, start = $0082, size = $007E;
# file header, just $FFFF # file header, just $FFFF
HEADER: file = %O, start = $0000, size = $0002; HEADER: file = %O, start = $0000, size = $0002;
# "system check" load chunk # "system check" load chunk
SYSCHKHDR: file = %O, start = $0000, size = $0004; SYSCHKHDR: file = %O, start = $0000, size = $0004;
SYSCHKCHNK: file = %O, start = $2E00, size = $0300; SYSCHKCHNK: file = %O, start = $2E00, size = $0300;
SYSCHKTRL: file = %O, start = $0000, size = $0006; SYSCHKTRL: file = %O, start = $0000, size = $0006;
# "main program" load chunk # "main program" load chunk
MAINHDR: file = %O, start = $0000, size = $0004; MAINHDR: file = %O, start = $0000, size = $0004;
RAM: file = %O, define = yes, start = %S, size = $BC20 - __STACKSIZE__ - __RESERVED_MEMORY__ - %S; MAIN: file = %O, define = yes, start = %S, size = $BC20 - __STACKSIZE__ - __RESERVED_MEMORY__ - %S;
TRAILER: file = %O, start = $0000, size = $0006; TRAILER: file = %O, start = $0000, size = $0006;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes; SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes;
SYSCHK: load = SYSCHKCHNK, type = rw, define = yes, optional = yes; SYSCHK: load = SYSCHKCHNK, type = rw, define = yes, optional = yes;
SYSCHKTRL: load = SYSCHKTRL, type = ro, optional = yes; SYSCHKTRL: load = SYSCHKTRL, type = ro, optional = yes;
MAINHDR: load = MAINHDR, type = ro; MAINHDR: load = MAINHDR, type = ro;
STARTUP: load = RAM, type = ro, define = yes; STARTUP: load = MAIN, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes; LOWCODE: load = MAIN, type = ro, define = yes, optional = yes;
INIT: load = RAM, type = ro, optional = yes; ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro, define = yes; CODE: load = MAIN, type = ro, define = yes;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss, optional = yes; INIT: load = MAIN, type = rw, optional = yes;
BSS: load = RAM, type = bss, define = yes; BSS: load = MAIN, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes;
AUTOSTRT: load = TRAILER, type = ro; AUTOSTRT: load = TRAILER, type = ro;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

22
cfg/atari2600.cfg Normal file
View File

@@ -0,0 +1,22 @@
# Atari VCS 2600 linker configuration file for cc65
#
# Florent Flament (contact@florentflament.com), 2017
SYMBOLS {
__STACKSIZE__: type = weak, value = $0010; # 16 Bytes system stack
}
MEMORY {
RAM: file = "", start = $0080, size = $0080 - __STACKSIZE__, define = yes;
ROM: file = %O, start = $F000, size = $1000, fill = yes, fillval = $FF;
}
SEGMENTS {
ZEROPAGE: load = RAM, type = zp;
STARTUP: load = ROM, type = ro;
CODE: load = ROM, type = ro;
RODATA: load = ROM, type = ro, optional = yes;
DATA: load = ROM, run = RAM, type = rw, optional = yes, define = yes;
BSS: load = RAM, type = bss, optional = yes;
VECTORS: load = ROM, type = ro, start = $FFFA;
}

View File

@@ -13,9 +13,11 @@ MEMORY {
CARTENTRY: file = %O, start = $BFFE, size = $0002; CARTENTRY: file = %O, start = $BFFE, size = $0002;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp, optional = yes;
EXTZP: load = ZP, type = zp, optional = yes;
STARTUP: load = ROM, type = ro, define = yes, optional = yes; STARTUP: load = ROM, type = ro, define = yes, optional = yes;
LOWCODE: load = ROM, type = ro, define = yes, optional = yes; LOWCODE: load = ROM, type = ro, define = yes, optional = yes;
INIT: load = ROM, type = ro, optional = yes; ONCE: load = ROM, type = ro, optional = yes;
CODE: load = ROM, type = ro, define = yes; CODE: load = ROM, type = ro, define = yes;
RODATA: load = ROM, type = ro, optional = yes; RODATA: load = ROM, type = ro, optional = yes;
DATA: load = ROM, run = RAM, type = rw, define = yes, optional = yes; DATA: load = ROM, run = RAM, type = rw, define = yes, optional = yes;
@@ -23,14 +25,12 @@ SEGMENTS {
CARTNAME: load = CARTNAME, type = ro, define = yes; CARTNAME: load = CARTNAME, type = ro, define = yes;
CARTYEAR: load = CARTYEAR, type = ro, define = yes; CARTYEAR: load = CARTYEAR, type = ro, define = yes;
CARTENTRY: load = CARTENTRY, type = ro, define = yes; CARTENTRY: load = CARTENTRY, type = ro, define = yes;
ZEROPAGE: load = ZP, type = zp, optional = yes;
EXTZP: load = ZP, type = zp, optional = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -6,50 +6,46 @@
FEATURES { FEATURES {
STARTADDRESS: default = $2400; STARTADDRESS: default = $2400;
} }
SYMBOLS { SYMBOLS {
__EXEHDR__: type = import; __EXEHDR__: type = import;
__SYSTEM_CHECK__: type = import; # force inclusion of "system check" load chunk __SYSTEM_CHECK__: type = import; # force inclusion of "system check" load chunk
__AUTOSTART__: type = import; # force inclusion of autostart "trailer" __AUTOSTART__: type = import; # force inclusion of autostart "trailer"
__STACKSIZE__: type = weak, value = $0800; # 2k stack __STACKSIZE__: type = weak, value = $0800; # 2k stack
__STARTADDRESS__: type = export, value = %S; __STARTADDRESS__: type = export, value = %S;
} }
MEMORY { MEMORY {
ZP: file = "", define = yes, start = $0082, size = $007E; ZP: file = "", define = yes, start = $0082, size = $007E;
# just $FFFF # just $FFFF
HEADER: file = %O, start = $0000, size = $0002; HEADER: file = %O, start = $0000, size = $0002;
# "system check" load chunk # "system check" load chunk
SYSCHKHDR: file = %O, start = $0000, size = $0004; SYSCHKHDR: file = %O, start = $0000, size = $0004;
SYSCHKCHNK: file = %O, start = $2E00, size = $0300; SYSCHKCHNK: file = %O, start = $2E00, size = $0300;
SYSCHKTRL: file = %O, start = $0000, size = $0006; SYSCHKTRL: file = %O, start = $0000, size = $0006;
# "shadow RAM preparation" load chunk # "shadow RAM preparation" load chunk
SRPREPHDR: file = %O, start = $0000, size = $0004; SRPREPHDR: file = %O, start = $0000, size = $0004;
SRPREPCHNK: file = %O, define = yes, start = %S, size = $7C20 - %S - $07FF; # $07FF: space for temp. chargen buffer, 1K aligned SRPREPCHNK: file = %O, define = yes, start = %S, size = $7C20 - %S - $07FF; # $07FF: space for temp. chargen buffer, 1K aligned
SRPREPTRL: file = %O, start = $0000, size = $0006; SRPREPTRL: file = %O, start = $0000, size = $0006;
# "main program" load chunk # "main program" load chunk
MAINHDR: file = %O, start = $0000, size = $0004; MAINHDR: file = %O, start = $0000, size = $0004;
RAM: file = %O, define = yes, start = %S + MAIN: file = %O, define = yes, start = %S + __LOWBSS_SIZE__, size = $D000 - __STACKSIZE__ - %S - __LOWBSS_SIZE__;
__LOWBSS_SIZE__, size = $D000 -
__STACKSIZE__ -
%S -
__LOWBSS_SIZE__;
# defines entry point into program # defines entry point into program
TRAILER: file = %O, start = $0000, size = $0006; TRAILER: file = %O, start = $0000, size = $0006;
# address of relocated character generator # address of relocated character generator
CHARGEN: file = "", define = yes, start = $D800, size = $0400; CHARGEN: file = "", define = yes, start = $D800, size = $0400;
# memory beneath the ROM # memory beneath the ROM
HIDDEN_RAM: file = "", define = yes, start = $DC00, size = $FFFA - $DC00; HIDDEN_RAM: file = "", define = yes, start = $DC00, size = $FFFA - $DC00;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes; SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes;
@@ -64,23 +60,21 @@ SEGMENTS {
SRPREPTRL: load = SRPREPTRL, type = ro; SRPREPTRL: load = SRPREPTRL, type = ro;
MAINHDR: load = MAINHDR, type = ro; MAINHDR: load = MAINHDR, type = ro;
STARTUP: load = RAM, type = ro, define = yes; STARTUP: load = MAIN, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes; LOWCODE: load = MAIN, type = ro, define = yes, optional = yes;
INIT: load = RAM, type = ro, optional = yes; ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro, define = yes; CODE: load = MAIN, type = ro, define = yes;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss, optional = yes; INIT: load = MAIN, type = rw, optional = yes;
BSS: load = RAM, type = bss, define = yes; BSS: load = MAIN, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes;
AUTOSTRT: load = TRAILER, type = ro; AUTOSTRT: load = TRAILER, type = ro;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -1,67 +1,62 @@
FEATURES { FEATURES {
STARTADDRESS: default = $2400; STARTADDRESS: default = $2400;
} }
SYMBOLS { SYMBOLS {
__EXEHDR__: type = import; __EXEHDR__: type = import;
__SYSTEM_CHECK__: type = import; # force inclusion of "system check" load chunk __SYSTEM_CHECK__: type = import; # force inclusion of "system check" load chunk
__AUTOSTART__: type = import; # force inclusion of autostart "trailer" __AUTOSTART__: type = import; # force inclusion of autostart "trailer"
__STACKSIZE__: type = weak, value = $0800; # 2k stack __STACKSIZE__: type = weak, value = $0800; # 2k stack
__OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay __OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay
__STARTADDRESS__: type = export, value = %S; __STARTADDRESS__: type = export, value = %S;
} }
MEMORY { MEMORY {
ZP: file = "", define = yes, start = $0082, size = $007E; ZP: file = "", define = yes, start = $0082, size = $007E;
# just $FFFF # just $FFFF
HEADER: file = %O, start = $0000, size = $0002; HEADER: file = %O, start = $0000, size = $0002;
# "system check" load chunk # "system check" load chunk
SYSCHKHDR: file = %O, start = $0000, size = $0004; SYSCHKHDR: file = %O, start = $0000, size = $0004;
SYSCHKCHNK: file = %O, start = $2E00, size = $0300; SYSCHKCHNK: file = %O, start = $2E00, size = $0300;
SYSCHKTRL: file = %O, start = $0000, size = $0006; SYSCHKTRL: file = %O, start = $0000, size = $0006;
# "shadow RAM preparation" load chunk # "shadow RAM preparation" load chunk
SRPREPHDR: file = %O, start = $0000, size = $0004; SRPREPHDR: file = %O, start = $0000, size = $0004;
SRPREPCHNK: file = %O, define = yes, start = %S + __OVERLAYSIZE__, size = $7C20 - %S - __OVERLAYSIZE__ - $07FF; # $07FF: space for temp. chargen buffer, 1K aligned SRPREPCHNK: file = %O, define = yes, start = %S + __OVERLAYSIZE__, size = $7C20 - %S - __OVERLAYSIZE__ - $07FF; # $07FF: space for temp. chargen buffer, 1K aligned
SRPREPTRL: file = %O, start = $0000, size = $0006; SRPREPTRL: file = %O, start = $0000, size = $0006;
# "main program" load chunk # "main program" load chunk
MAINHDR: file = %O, start = $0000, size = $0004; MAINHDR: file = %O, start = $0000, size = $0004;
RAM: file = %O, define = yes, start = %S + MAIN: file = %O, define = yes, start = %S + __OVERLAYSIZE__ +
__OVERLAYSIZE__ + __LOWBSS_SIZE__, size = $D000 - __STACKSIZE__ - %S - __OVERLAYSIZE__ - __LOWBSS_SIZE__;
__LOWBSS_SIZE__, size = $D000 -
__STACKSIZE__ -
%S -
__OVERLAYSIZE__ -
__LOWBSS_SIZE__;
# defines entry point into program # defines entry point into program
TRAILER: file = %O, start = $0000, size = $0006; TRAILER: file = %O, start = $0000, size = $0006;
# memory beneath the ROM preceeding the character generator # memory beneath the ROM preceeding the character generator
HIDDEN_RAM2: file = "", define = yes, start = $D800, size = $0800; HIDDEN_RAM2: file = "", define = yes, start = $D800, size = $0800;
# address of relocated character generator (same addess as ROM version) # address of relocated character generator (same addess as ROM version)
CHARGEN: file = "", define = yes, start = $E000, size = $0400; CHARGEN: file = "", define = yes, start = $E000, size = $0400;
# memory beneath the ROM # memory beneath the ROM
HIDDEN_RAM: file = "", define = yes, start = $E400, size = $FFFA - $E400; HIDDEN_RAM: file = "", define = yes, start = $E400, size = $FFFA - $E400;
# overlays # overlays
OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__; OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__;
OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__; OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__;
OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__; OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__;
OVL4: file = "%O.4", start = %S, size = __OVERLAYSIZE__; OVL4: file = "%O.4", start = %S, size = __OVERLAYSIZE__;
OVL5: file = "%O.5", start = %S, size = __OVERLAYSIZE__; OVL5: file = "%O.5", start = %S, size = __OVERLAYSIZE__;
OVL6: file = "%O.6", start = %S, size = __OVERLAYSIZE__; OVL6: file = "%O.6", start = %S, size = __OVERLAYSIZE__;
OVL7: file = "%O.7", start = %S, size = __OVERLAYSIZE__; OVL7: file = "%O.7", start = %S, size = __OVERLAYSIZE__;
OVL8: file = "%O.8", start = %S, size = __OVERLAYSIZE__; OVL8: file = "%O.8", start = %S, size = __OVERLAYSIZE__;
OVL9: file = "%O.9", start = %S, size = __OVERLAYSIZE__; OVL9: file = "%O.9", start = %S, size = __OVERLAYSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes; SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes;
@@ -76,16 +71,14 @@ SEGMENTS {
SRPREPTRL: load = SRPREPTRL, type = ro; SRPREPTRL: load = SRPREPTRL, type = ro;
MAINHDR: load = MAINHDR, type = ro; MAINHDR: load = MAINHDR, type = ro;
STARTUP: load = RAM, type = ro, define = yes; STARTUP: load = MAIN, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes; LOWCODE: load = MAIN, type = ro, define = yes, optional = yes;
INIT: load = RAM, type = ro, optional = yes; ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro, define = yes; CODE: load = MAIN, type = ro, define = yes;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss, optional = yes; INIT: load = MAIN, type = rw, optional = yes;
BSS: load = RAM, type = bss, define = yes; BSS: load = MAIN, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes;
AUTOSTRT: load = TRAILER, type = ro; AUTOSTRT: load = TRAILER, type = ro;
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes; OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
@@ -102,7 +95,7 @@ FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -1,53 +1,49 @@
FEATURES { FEATURES {
STARTADDRESS: default = $2400; STARTADDRESS: default = $2400;
} }
SYMBOLS { SYMBOLS {
__EXEHDR__: type = import; __EXEHDR__: type = import;
__SYSTEM_CHECK__: type = import; # force inclusion of "system check" load chunk __SYSTEM_CHECK__: type = import; # force inclusion of "system check" load chunk
__AUTOSTART__: type = import; # force inclusion of autostart "trailer" __AUTOSTART__: type = import; # force inclusion of autostart "trailer"
__STACKSIZE__: type = weak, value = $0800; # 2k stack __STACKSIZE__: type = weak, value = $0800; # 2k stack
__STARTADDRESS__: type = export, value = %S; __STARTADDRESS__: type = export, value = %S;
} }
MEMORY { MEMORY {
ZP: file = "", define = yes, start = $0082, size = $007E; ZP: file = "", define = yes, start = $0082, size = $007E;
# just $FFFF # just $FFFF
HEADER: file = %O, start = $0000, size = $0002; HEADER: file = %O, start = $0000, size = $0002;
# "system check" load chunk # "system check" load chunk
SYSCHKHDR: file = %O, start = $0000, size = $0004; SYSCHKHDR: file = %O, start = $0000, size = $0004;
SYSCHKCHNK: file = %O, start = $2E00, size = $0300; SYSCHKCHNK: file = %O, start = $2E00, size = $0300;
SYSCHKTRL: file = %O, start = $0000, size = $0006; SYSCHKTRL: file = %O, start = $0000, size = $0006;
# "shadow RAM preparation" load chunk # "shadow RAM preparation" load chunk
SRPREPHDR: file = %O, start = $0000, size = $0004; SRPREPHDR: file = %O, start = $0000, size = $0004;
SRPREPCHNK: file = %O, define = yes, start = %S, size = $7C20 - %S - $07FF; # $07FF: space for temp. chargen buffer, 1K aligned SRPREPCHNK: file = %O, define = yes, start = %S, size = $7C20 - %S - $07FF; # $07FF: space for temp. chargen buffer, 1K aligned
SRPREPTRL: file = %O, start = $0000, size = $0006; SRPREPTRL: file = %O, start = $0000, size = $0006;
# "main program" load chunk # "main program" load chunk
MAINHDR: file = %O, start = $0000, size = $0004; MAINHDR: file = %O, start = $0000, size = $0004;
RAM: file = %O, define = yes, start = %S + MAIN: file = %O, define = yes, start = %S + __LOWBSS_SIZE__, size = $D000 - __STACKSIZE__ - %S - __LOWBSS_SIZE__;
__LOWBSS_SIZE__, size = $D000 -
__STACKSIZE__ -
%S -
__LOWBSS_SIZE__;
# defines entry point into program # defines entry point into program
TRAILER: file = %O, start = $0000, size = $0006; TRAILER: file = %O, start = $0000, size = $0006;
# memory beneath the ROM preceeding the character generator # memory beneath the ROM preceeding the character generator
HIDDEN_RAM2: file = "", define = yes, start = $D800, size = $0800; HIDDEN_RAM2: file = "", define = yes, start = $D800, size = $0800;
# address of relocated character generator (same addess as ROM version) # address of relocated character generator (same addess as ROM version)
CHARGEN: file = "", define = yes, start = $E000, size = $0400; CHARGEN: file = "", define = yes, start = $E000, size = $0400;
# memory beneath the ROM # memory beneath the ROM
HIDDEN_RAM: file = "", define = yes, start = $E400, size = $FFFA - $E400; HIDDEN_RAM: file = "", define = yes, start = $E400, size = $FFFA - $E400;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes; SYSCHKHDR: load = SYSCHKHDR, type = ro, optional = yes;
@@ -62,23 +58,21 @@ SEGMENTS {
SRPREPTRL: load = SRPREPTRL, type = ro; SRPREPTRL: load = SRPREPTRL, type = ro;
MAINHDR: load = MAINHDR, type = ro; MAINHDR: load = MAINHDR, type = ro;
STARTUP: load = RAM, type = ro, define = yes; STARTUP: load = MAIN, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes; LOWCODE: load = MAIN, type = ro, define = yes, optional = yes;
INIT: load = RAM, type = ro, optional = yes; ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro, define = yes; CODE: load = MAIN, type = ro, define = yes;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss, optional = yes; INIT: load = MAIN, type = rw, optional = yes;
BSS: load = RAM, type = bss, define = yes; BSS: load = MAIN, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes;
AUTOSTRT: load = TRAILER, type = ro; AUTOSTRT: load = TRAILER, type = ro;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -8,30 +8,31 @@ SYMBOLS {
__RAMEND__: type = weak, value = $9800 + $1C00 * __GRAB__; __RAMEND__: type = weak, value = $9800 + $1C00 * __GRAB__;
} }
MEMORY { MEMORY {
ZP: file = "", define = yes, start = $00E2, size = $001A; ZP: file = "", define = yes, start = $00E2, size = $001A;
TAPEHDR: file = %O, type = ro, start = $0000, size = $001F; TAPEHDR: file = %O, type = ro, start = $0000, size = $001F;
BASHEAD: file = %O, define = yes, start = $0501, size = $000D; BASHEAD: file = %O, define = yes, start = $0501, size = $000D;
RAM: file = %O, define = yes, start = __BASHEAD_LAST__, size = __RAMEND__ - __RAM_START__ - __STACKSIZE__; MAIN: file = %O, define = yes, start = __BASHEAD_LAST__, size = __RAMEND__ - __MAIN_START__;
BSS: file = "", start = __ONCE_RUN__, size = __RAMEND__ - __STACKSIZE__ - __ONCE_RUN__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
TAPEHDR: load = TAPEHDR, type = ro; TAPEHDR: load = TAPEHDR, type = ro;
BASHDR: load = BASHEAD, type = ro, define = yes, optional = yes; BASHDR: load = BASHEAD, type = ro, optional = yes;
STARTUP: load = RAM, type = ro; STARTUP: load = MAIN, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
INIT: load = RAM, type = ro, define = yes, optional = yes; DATA: load = MAIN, type = rw;
DATA: load = RAM, type = rw; INIT: load = MAIN, type = rw;
ZPSAVE1: load = RAM, type = rw, define = yes; # ZPSAVE1, ZPSAVE2 must be together ONCE: load = MAIN, type = ro, define = yes;
ZPSAVE2: load = RAM, type = bss; # see "libsrc/atmos/crt0.s" BASTAIL: load = MAIN, type = ro, optional = yes;
BSS: load = RAM, type = bss, define = yes; BSS: load = BSS, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -2,24 +2,24 @@ SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack __STACKSIZE__: type = weak, value = $0800; # 2k stack
} }
MEMORY { MEMORY {
ZP: file = "", define = yes, start = $0070, size = $0020; ZP: file = "", define = yes, start = $0070, size = $0020;
RAM: file = %O, start = $0E00, size = $7200 - __STACKSIZE__; MAIN: file = %O, start = $0E00, size = $7200 - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
STARTUP: load = RAM, type = ro, define = yes; ZEROPAGE: load = ZP, type = zp;
LOWCODE: load = RAM, type = ro, optional = yes; STARTUP: load = MAIN, type = ro, define = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; ONCE: load = MAIN, type = ro, optional = yes;
RODATA: load = RAM, type = ro; CODE: load = MAIN, type = ro;
DATA: load = RAM, type = rw; RODATA: load = MAIN, type = ro;
BSS: load = RAM, type = bss, define = yes; DATA: load = MAIN, type = rw;
ZEROPAGE: load = ZP, type = zp; BSS: load = MAIN, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -9,7 +9,7 @@ MEMORY {
ZP: file = "", define = yes, start = $0002, size = $001A; ZP: file = "", define = yes, start = $0002, size = $001A;
LOADADDR: file = %O, start = $1BFF, size = $0002; LOADADDR: file = %O, start = $1BFF, size = $0002;
HEADER: file = %O, start = $1C01, size = $000C; HEADER: file = %O, start = $1C01, size = $000C;
RAM: file = %O, define = yes, start = $1C0D, size = $A3F3 - __OVERLAYSIZE__ - __STACKSIZE__; MAIN: file = %O, define = yes, start = $1C0D, size = $A3F3 - __OVERLAYSIZE__ - __STACKSIZE__;
OVL1ADDR: file = "%O.1", start = $BFFE - __OVERLAYSIZE__, size = $0002; OVL1ADDR: file = "%O.1", start = $BFFE - __OVERLAYSIZE__, size = $0002;
OVL1: file = "%O.1", start = $C000 - __OVERLAYSIZE__, size = __OVERLAYSIZE__; OVL1: file = "%O.1", start = $C000 - __OVERLAYSIZE__, size = __OVERLAYSIZE__;
OVL2ADDR: file = "%O.2", start = $BFFE - __OVERLAYSIZE__, size = $0002; OVL2ADDR: file = "%O.2", start = $BFFE - __OVERLAYSIZE__, size = $0002;
@@ -30,17 +30,17 @@ MEMORY {
OVL9: file = "%O.9", start = $C000 - __OVERLAYSIZE__, size = __OVERLAYSIZE__; OVL9: file = "%O.9", start = $C000 - __OVERLAYSIZE__, size = __OVERLAYSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro; LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro; STARTUP: load = MAIN, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes; ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss; INIT: load = MAIN, type = bss;
BSS: load = RAM, type = bss, define = yes; BSS: load = MAIN, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
OVL1ADDR: load = OVL1ADDR, type = ro; OVL1ADDR: load = OVL1ADDR, type = ro;
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes; OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
OVL2ADDR: load = OVL2ADDR, type = ro; OVL2ADDR: load = OVL2ADDR, type = ro;
@@ -64,7 +64,7 @@ FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -7,26 +7,26 @@ MEMORY {
ZP: file = "", define = yes, start = $0002, size = $001A; ZP: file = "", define = yes, start = $0002, size = $001A;
LOADADDR: file = %O, start = $1BFF, size = $0002; LOADADDR: file = %O, start = $1BFF, size = $0002;
HEADER: file = %O, start = $1C01, size = $000C; HEADER: file = %O, start = $1C01, size = $000C;
RAM: file = %O, define = yes, start = $1C0D, size = $A3F3 - __STACKSIZE__; MAIN: file = %O, define = yes, start = $1C0D, size = $A3F3 - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro; LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro; STARTUP: load = MAIN, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes; ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss; INIT: load = MAIN, type = bss;
BSS: load = RAM, type = bss, define = yes; BSS: load = MAIN, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -7,26 +7,26 @@ MEMORY {
ZP: file = "", define = yes, start = $0002, size = $001A; ZP: file = "", define = yes, start = $0002, size = $001A;
LOADADDR: file = %O, start = $0FFF, size = $0002; LOADADDR: file = %O, start = $0FFF, size = $0002;
HEADER: file = %O, start = $1001, size = $000C; HEADER: file = %O, start = $1001, size = $000C;
RAM: file = %O, start = $100D, size = $6FF3 - __STACKSIZE__; MAIN: file = %O, start = $100D, size = $6FF3 - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro; LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro; STARTUP: load = MAIN, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes; ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss; INIT: load = MAIN, type = bss;
BSS: load = RAM, type = bss, define = yes; BSS: load = MAIN, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -5,16 +5,16 @@ SYMBOLS {
__LOADADDR__: type = import; __LOADADDR__: type = import;
} }
MEMORY { MEMORY {
ZP: file = "", start = $0002, size = $001A, define = yes; ZP: file = "", start = $0002, size = $00FE, define = yes;
LOADADDR: file = %O, start = %S - 2, size = $0002; LOADADDR: file = %O, start = %S - 2, size = $0002;
RAM: file = %O, start = %S, size = $D000 - %S; MAIN: file = %O, start = %S, size = $D000 - %S;
} }
SEGMENTS { SEGMENTS {
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = RAM, type = ro, optional = yes;
CODE: load = RAM, type = rw, optional = yes;
RODATA: load = RAM, type = ro, optional = yes;
DATA: load = RAM, type = rw, optional = yes;
BSS: load = RAM, type = bss, optional = yes;
ZEROPAGE: load = ZP, type = zp, optional = yes; ZEROPAGE: load = ZP, type = zp, optional = yes;
LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = MAIN, type = ro, optional = yes;
CODE: load = MAIN, type = rw;
RODATA: load = MAIN, type = ro, optional = yes;
DATA: load = MAIN, type = rw, optional = yes;
BSS: load = MAIN, type = bss, optional = yes, define = yes;
} }

View File

@@ -1,5 +1,5 @@
FEATURES { FEATURES {
STARTADDRESS: default = $0801; STARTADDRESS: default = $0801;
} }
SYMBOLS { SYMBOLS {
__LOADADDR__: type = import; __LOADADDR__: type = import;
@@ -14,9 +14,8 @@ MEMORY {
ZP: file = "", define = yes, start = $0002, size = $001A; ZP: file = "", define = yes, start = $0002, size = $001A;
LOADADDR: file = %O, start = %S - 2, size = $0002; LOADADDR: file = %O, start = %S - 2, size = $0002;
HEADER: file = %O, define = yes, start = %S, size = $000D; HEADER: file = %O, define = yes, start = %S, size = $000D;
MAIN: file = %O, define = yes, start = __HEADER_LAST__, size = __OVERLAYSTART__ - __STACKSIZE__ - __HEADER_LAST__; MAIN: file = %O, define = yes, start = __HEADER_LAST__, size = __HIMEM__ - __HEADER_LAST__;
MOVE: file = %O, start = __INITBSS_LOAD__, size = __HIMEM__ - __BSS_RUN__; BSS: file = "", start = __ONCE_RUN__, size = __OVERLAYSTART__ - __STACKSIZE__ - __ONCE_RUN__;
INIT: file = "", start = __BSS_RUN__, size = __HIMEM__ - __BSS_RUN__;
OVL1ADDR: file = "%O.1", start = __OVERLAYSTART__ - 2, size = $0002; OVL1ADDR: file = "%O.1", start = __OVERLAYSTART__ - 2, size = $0002;
OVL1: file = "%O.1", start = __OVERLAYSTART__, size = __OVERLAYSIZE__; OVL1: file = "%O.1", start = __OVERLAYSTART__, size = __OVERLAYSIZE__;
OVL2ADDR: file = "%O.2", start = __OVERLAYSTART__ - 2, size = $0002; OVL2ADDR: file = "%O.2", start = __OVERLAYSTART__ - 2, size = $0002;
@@ -37,41 +36,41 @@ MEMORY {
OVL9: file = "%O.9", start = __OVERLAYSTART__, size = __OVERLAYSIZE__; OVL9: file = "%O.9", start = __OVERLAYSTART__, size = __OVERLAYSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro; LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
STARTUP: load = MAIN, type = ro; STARTUP: load = MAIN, type = ro;
LOWCODE: load = MAIN, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = MAIN, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = MAIN, type = bss, define = yes; INIT: load = MAIN, type = rw;
BSS: load = MAIN, type = bss, define = yes; ONCE: load = MAIN, type = ro, define = yes;
INIT: load = MOVE, run = INIT, type = ro, define = yes; BSS: load = BSS, type = bss, define = yes;
OVL1ADDR: load = OVL1ADDR, type = ro; OVL1ADDR: load = OVL1ADDR, type = ro;
OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes; OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes;
OVL2ADDR: load = OVL2ADDR, type = ro; OVL2ADDR: load = OVL2ADDR, type = ro;
OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes; OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes;
OVL3ADDR: load = OVL3ADDR, type = ro; OVL3ADDR: load = OVL3ADDR, type = ro;
OVERLAY3: load = OVL3, type = ro, define = yes, optional = yes; OVERLAY3: load = OVL3, type = ro, define = yes, optional = yes;
OVL4ADDR: load = OVL4ADDR, type = ro; OVL4ADDR: load = OVL4ADDR, type = ro;
OVERLAY4: load = OVL4, type = ro, define = yes, optional = yes; OVERLAY4: load = OVL4, type = ro, define = yes, optional = yes;
OVL5ADDR: load = OVL5ADDR, type = ro; OVL5ADDR: load = OVL5ADDR, type = ro;
OVERLAY5: load = OVL5, type = ro, define = yes, optional = yes; OVERLAY5: load = OVL5, type = ro, define = yes, optional = yes;
OVL6ADDR: load = OVL6ADDR, type = ro; OVL6ADDR: load = OVL6ADDR, type = ro;
OVERLAY6: load = OVL6, type = ro, define = yes, optional = yes; OVERLAY6: load = OVL6, type = ro, define = yes, optional = yes;
OVL7ADDR: load = OVL7ADDR, type = ro; OVL7ADDR: load = OVL7ADDR, type = ro;
OVERLAY7: load = OVL7, type = ro, define = yes, optional = yes; OVERLAY7: load = OVL7, type = ro, define = yes, optional = yes;
OVL8ADDR: load = OVL8ADDR, type = ro; OVL8ADDR: load = OVL8ADDR, type = ro;
OVERLAY8: load = OVL8, type = ro, define = yes, optional = yes; OVERLAY8: load = OVL8, type = ro, define = yes, optional = yes;
OVL9ADDR: load = OVL9ADDR, type = ro; OVL9ADDR: load = OVL9ADDR, type = ro;
OVERLAY9: load = OVL9, type = ro, define = yes, optional = yes; OVERLAY9: load = OVL9, type = ro, define = yes, optional = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -1,5 +1,5 @@
FEATURES { FEATURES {
STARTADDRESS: default = $0801; STARTADDRESS: default = $0801;
} }
SYMBOLS { SYMBOLS {
__LOADADDR__: type = import; __LOADADDR__: type = import;
@@ -8,31 +8,30 @@ SYMBOLS {
__HIMEM__: type = weak, value = $D000; __HIMEM__: type = weak, value = $D000;
} }
MEMORY { MEMORY {
ZP: file = "", define = yes, start = $0002, size = $001A; ZP: file = "", define = yes, start = $0002, size = $001A;
LOADADDR: file = %O, start = %S - 2, size = $0002; LOADADDR: file = %O, start = %S - 2, size = $0002;
HEADER: file = %O, define = yes, start = %S, size = $000D; HEADER: file = %O, define = yes, start = %S, size = $000D;
MAIN: file = %O, define = yes, start = __HEADER_LAST__, size = __HIMEM__ - __STACKSIZE__ - __HEADER_LAST__; MAIN: file = %O, define = yes, start = __HEADER_LAST__, size = __HIMEM__ - __HEADER_LAST__;
MOVE: file = %O, start = __INITBSS_LOAD__, size = __HIMEM__ - __BSS_RUN__; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__;
INIT: file = "", start = __BSS_RUN__, size = __HIMEM__ - __BSS_RUN__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro; LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
STARTUP: load = MAIN, type = ro; STARTUP: load = MAIN, type = ro;
LOWCODE: load = MAIN, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = MAIN, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = MAIN, type = bss, define = yes; INIT: load = MAIN, type = rw;
BSS: load = MAIN, type = bss, define = yes; ONCE: load = MAIN, type = ro, define = yes;
INIT: load = MOVE, run = INIT, type = ro, define = yes; BSS: load = BSS, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -8,30 +8,30 @@ MEMORY {
STARTUP: file = %O, start = $00FE, size = $0102, fill = yes; STARTUP: file = %O, start = $00FE, size = $0102, fill = yes;
PAGE2: file = %O, start = $0200, size = $0100, fill = yes; PAGE2: file = %O, start = $0200, size = $0100, fill = yes;
PAGE3: file = %O, start = $0300, size = $0100, fill = yes; PAGE3: file = %O, start = $0300, size = $0100, fill = yes;
RAM: file = %O, start = $0400, size = $DC00; MAIN: file = %O, start = $0400, size = $DC00;
CHARRAM: file = "", define = yes, start = $E000, size = $1000; CHARRAM: file = "", define = yes, start = $E000, size = $1000;
VIDRAM: file = "", define = yes, start = $F000, size = $0400; VIDRAM: file = "", define = yes, start = $F000, size = $0400;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = rw, define = yes;
EXEHDR: load = HEADER, type = rw; EXEHDR: load = HEADER, type = rw;
STARTUP: load = STARTUP, type = rw; STARTUP: load = STARTUP, type = rw;
PAGE2: load = PAGE2, type = rw; PAGE2: load = PAGE2, type = rw;
PAGE3: load = PAGE3, type = rw; PAGE3: load = PAGE3, type = rw;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes; ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss; INIT: load = MAIN, type = bss, optional = yes;
BSS: load = RAM, type = bss, define = yes; BSS: load = MAIN, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = rw, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -7,28 +7,28 @@ MEMORY {
STARTUP: file = %O, start = $00FE, size = $0102, fill = yes; STARTUP: file = %O, start = $00FE, size = $0102, fill = yes;
PAGE2: file = %O, start = $0200, size = $0100, fill = yes; PAGE2: file = %O, start = $0200, size = $0100, fill = yes;
PAGE3: file = %O, start = $0300, size = $0100, fill = yes; PAGE3: file = %O, start = $0300, size = $0100, fill = yes;
RAM: file = %O, start = $0400, size = $FECB - __STACKSIZE__; MAIN: file = %O, start = $0400, size = $FECB - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = rw, define = yes;
EXEHDR: load = HEADER, type = rw; EXEHDR: load = HEADER, type = rw;
STARTUP: load = STARTUP, type = rw; STARTUP: load = STARTUP, type = rw;
PAGE2: load = PAGE2, type = rw; PAGE2: load = PAGE2, type = rw;
PAGE3: load = PAGE3, type = rw; PAGE3: load = PAGE3, type = rw;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes; ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss; INIT: load = MAIN, type = bss, optional = yes;
BSS: load = RAM, type = bss, define = yes; BSS: load = MAIN, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = rw, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

36
cfg/creativision.cfg Normal file
View File

@@ -0,0 +1,36 @@
SYMBOLS {
__STACKSIZE__: type = weak, value = $0180;
}
MEMORY {
ZP: file = "", define = yes, start = $0020, size = $00E0;
RAM: file = "", define = yes, start = $01FA, size = $0206;
ROM: file = %O, define = yes, start = $B000, size = $1000, fill = yes, fillval = $FF;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
ZP: load = ZP, type = zp, optional = yes;
VECTORS: load = ROM, run = RAM, type = rw, define = yes;
DATA: load = ROM, run = RAM, type = rw, define = yes, start = $0204;
BSS: load = RAM, type = bss, define = yes;
ONCE: load = ROM, type = ro, optional = yes;
CODE: load = ROM, type = ro;
INIT: load = ROM, type = ro;
RODATA: load = ROM, type = ro;
AUDIO: load = ROM, type = ro, optional = yes, start = $BF00;
SETUP: load = ROM, type = ro, start = $BFE8;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
segment = INIT;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
segment = RODATA;
CONDES: type = interruptor,
label = __INTERRUPTOR_TABLE__,
count = __INTERRUPTOR_COUNT__,
segment = RODATA,
import = __CALLIRQ__;
}

View File

@@ -1,41 +1,51 @@
# linker config to produce simple Gamate cartridge (.bin) # linker config to produce simple Gamate cartridge (.bin)
SYMBOLS { SYMBOLS {
__STARTUP__: type = import; __STARTUP__: type = import;
__STACKSIZE__: type = weak, value = $0080; # 1 page stack __STACKSIZE__: type = weak, value = $0080; # 1 page stack
} }
MEMORY { MEMORY {
# 0000-03ff is RAM # 0000-03ff is RAM
# FIXME: what zp range can we actually use? # FIXME: what zp range can we actually use?
# $0a-$11 is used by IRQ/NMI, $e8 is used by NMI # $0a-$11 is used by IRQ/NMI, $e8 is used by NMI
ZP: start = $0012, size = $e8 - $12; ZP: start = $0012, size = $00E8 - $0012;
CPUSTACK: start = $0100, size =$100; CPUSTACK: start = $0100, size = $0100;
RAM: start = $0200, size = $200 - __STACKSIZE__, define = yes; RAM: start = $0200, size = $0200 - __STACKSIZE__, define = yes;
CARTHEADER: file = %O, define = yes, start = %S, size = $0029; CARTHEADER: file = %O, define = yes, start = %S, size = $0029;
# 6000-e000 can be (Cartridge) ROM # 6000-e000 can be (Cartridge) ROM
# WARNING: fill value must be $00 else it will no more work # WARNING: fill value must be $00 else it will no more work
#ROM: start = $6000, size = $1000, fill = yes, fillval = $00, file = %O, define = yes; #ROM: start = $6000, size = $1000, fill = yes, fillval = $00, file = %O, define = yes;
#ROMFILL: start = $7000, size = $7000, fill = yes, fillval = $00, file = %O, define = yes; #ROMFILL: start = $7000, size = $7000, fill = yes, fillval = $00, file = %O, define = yes;
# for images that have code >$6fff we must calculate the checksum! # for images that have code >$6fff we must calculate the checksum!
ROM: start = $6000 + $29, size = $8000 - $29, fill = yes, fillval = $00, file = %O, define = yes; ROM: start = $6000 + $0029, size = $8000 - $0029, fill = yes, fillval = $00, file = %O, define = yes;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp, define = yes; ZEROPAGE: load = ZP, type = zp, define = yes;
EXTZP: load = ZP, type = zp, define = yes, optional = yes; EXTZP: load = ZP, type = zp, define = yes, optional = yes;
APPZP: load = ZP, type = zp, define = yes, optional = yes; APPZP: load = ZP, type = zp, define = yes, optional = yes;
STARTUP: load = CARTHEADER, type = ro, define=yes; STARTUP: load = CARTHEADER, type = ro, define = yes;
INIT: load = ROM, type = ro, define = yes, optional = yes; ONCE: load = ROM, type = ro, optional = yes;
CODE: load = ROM, type = ro, define=yes; CODE: load = ROM, type = ro, define = yes;
RODATA: load = ROM, type = ro, define=yes; RODATA: load = ROM, type = ro, define = yes;
DATA: load = ROM, run=RAM, type = rw, define = yes; DATA: load = ROM, run = RAM, type = rw, define = yes;
BSS: load = RAM, type = bss, define = yes; BSS: load = RAM, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: segment = RODATA, type = constructor, label = __CONSTRUCTOR_TABLE__, count = __CONSTRUCTOR_COUNT__; CONDES: type = constructor,
CONDES: segment = RODATA, type = destructor, label = __DESTRUCTOR_TABLE__, count = __DESTRUCTOR_COUNT__; label = __CONSTRUCTOR_TABLE__,
CONDES: segment = RODATA, type = interruptor, label = __INTERRUPTOR_TABLE__, count = __INTERRUPTOR_COUNT__, import = __CALLIRQ__; count = __CONSTRUCTOR_COUNT__,
segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
segment = RODATA;
CONDES: type = interruptor,
label = __INTERRUPTOR_TABLE__,
count = __INTERRUPTOR_COUNT__,
segment = RODATA,
import = __CALLIRQ__;
} }

View File

@@ -32,7 +32,7 @@ MEMORY {
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: type = zp, load = ZP; ZEROPAGE: type = zp, load = ZP;
EXTZP: type = zp, load = ZP, optional = yes; EXTZP: type = zp, load = ZP, optional = yes;
EXTBSS: type = bss, load = EXT, define = yes, optional = yes; EXTBSS: type = bss, load = EXT, define = yes, optional = yes;
FILEINFO: type = ro, load = CVT, offset = $002; FILEINFO: type = ro, load = CVT, offset = $002;
RECORDS: type = ro, load = CVT, offset = $100, optional = yes; RECORDS: type = ro, load = CVT, offset = $100, optional = yes;
@@ -40,11 +40,12 @@ SEGMENTS {
VLIRIDX0: type = ro, load = CVT, align = $200, optional = yes; VLIRIDX0: type = ro, load = CVT, align = $200, optional = yes;
STARTUP: type = ro, run = VLIR0, load = CVT, align_load = $200, define = yes; STARTUP: type = ro, run = VLIR0, load = CVT, align_load = $200, define = yes;
LOWCODE: type = ro, run = VLIR0, load = CVT, optional = yes; LOWCODE: type = ro, run = VLIR0, load = CVT, optional = yes;
INIT: type = ro, run = VLIR0, load = CVT, define = yes, optional = yes; ONCE: type = ro, run = VLIR0, load = CVT, optional = yes;
CODE: type = ro, run = VLIR0, load = CVT; CODE: type = ro, run = VLIR0, load = CVT;
RODATA: type = ro, run = VLIR0, load = CVT; RODATA: type = ro, run = VLIR0, load = CVT;
DATA: type = rw, run = VLIR0, load = CVT; DATA: type = rw, run = VLIR0, load = CVT;
BSS: type = bss, load = VLIR0, define = yes; INIT: type = bss, load = VLIR0, optional = yes;
BSS: type = bss, load = VLIR0, define = yes;
VLIRIDX1: type = ro, load = CVT, align = $200, optional = yes; VLIRIDX1: type = ro, load = CVT, align = $200, optional = yes;
OVERLAY1: type = ro, run = VLIR1, load = CVT, align_load = $200, optional = yes; OVERLAY1: type = ro, run = VLIR1, load = CVT, align_load = $200, optional = yes;
VLIRIDX2: type = ro, load = CVT, align = $200, optional = yes; VLIRIDX2: type = ro, load = CVT, align = $200, optional = yes;
@@ -88,7 +89,7 @@ FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -31,17 +31,18 @@ MEMORY {
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: type = zp, load = ZP; ZEROPAGE: type = zp, load = ZP;
EXTZP: type = zp, load = ZP, optional = yes; EXTZP: type = zp, load = ZP, optional = yes;
DIRENTRY: type = ro, load = CVT, align = $FE; DIRENTRY: type = ro, load = CVT, align = $FE;
FILEINFO: type = ro, load = CVT, align = $FE; FILEINFO: type = ro, load = CVT, align = $FE;
RECORDS: type = ro, load = CVT, align = $FE, optional = yes; RECORDS: type = ro, load = CVT, align = $FE, optional = yes;
STARTUP: type = ro, run = VLIR0, load = CVT, align_load = $FE, define = yes; STARTUP: type = ro, run = VLIR0, load = CVT, align_load = $FE, define = yes;
LOWCODE: type = ro, run = VLIR0, load = CVT, optional = yes; LOWCODE: type = ro, run = VLIR0, load = CVT, optional = yes;
INIT: type = ro, run = VLIR0, load = CVT, define = yes, optional = yes; ONCE: type = ro, run = VLIR0, load = CVT, optional = yes;
CODE: type = ro, run = VLIR0, load = CVT; CODE: type = ro, run = VLIR0, load = CVT;
RODATA: type = ro, run = VLIR0, load = CVT; RODATA: type = ro, run = VLIR0, load = CVT;
DATA: type = rw, run = VLIR0, load = CVT; DATA: type = rw, run = VLIR0, load = CVT;
BSS: type = bss, load = VLIR0, define = yes; INIT: type = bss, load = VLIR0, optional = yes;
BSS: type = bss, load = VLIR0, define = yes;
OVERLAY1: type = ro, run = VLIR1, load = CVT, align_load = $FE, optional = yes; OVERLAY1: type = ro, run = VLIR1, load = CVT, align_load = $FE, optional = yes;
OVERLAY2: type = ro, run = VLIR2, load = CVT, align_load = $FE, optional = yes; OVERLAY2: type = ro, run = VLIR2, load = CVT, align_load = $FE, optional = yes;
OVERLAY3: type = ro, run = VLIR3, load = CVT, align_load = $FE, optional = yes; OVERLAY3: type = ro, run = VLIR3, load = CVT, align_load = $FE, optional = yes;
@@ -66,7 +67,7 @@ FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -5,24 +5,24 @@ SYMBOLS {
__STACKSIZE__: type = weak, value = $0400; # 1k stack (do typical LUnix apps. need 2k?) __STACKSIZE__: type = weak, value = $0400; # 1k stack (do typical LUnix apps. need 2k?)
} }
MEMORY { MEMORY {
ZP: start = $0080, size = $0040; ZP: start = $0080, size = $0040;
RAM: start = %S, size = $7600 - __STACKSIZE__; MAIN: start = %S, size = $7600 - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp, define = yes; # Pseudo-registers ZEROPAGE: load = ZP, type = zp, define = yes; # Pseudo-registers
STARTUP: load = RAM, type = ro; # First initialization code STARTUP: load = MAIN, type = ro; # First initialization code
LOWCODE: load = RAM, type = ro, optional = yes; # Legacy from other platforms LOWCODE: load = MAIN, type = ro, optional = yes; # Legacy from other platforms
INIT: load = RAM, type = ro, define = yes, optional = yes; # Library initialization code ONCE: load = MAIN, type = ro, optional = yes; # Library initialization code
CODE: load = RAM, type = ro; # Program CODE: load = MAIN, type = ro; # Program
RODATA: load = RAM, type = ro; # Literals, constants RODATA: load = MAIN, type = ro; # Literals, constants
DATA: load = RAM, type = rw; # Initialized variables DATA: load = MAIN, type = rw; # Initialized variables
BSS: load = RAM, type = bss, define = yes; # Uninitialized variables BSS: load = MAIN, type = bss, define = yes; # Uninitialized variables
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -1,32 +1,33 @@
SYMBOLS { SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack __STACKSIZE__: type = weak, value = $0800; # 2k stack
__STARTOFDIRECTORY__: type = weak, value = $00CB; # start just after loader __STARTOFDIRECTORY__: type = weak, value = $00CB; # start just after loader
__BLOCKSIZE__: type = weak, value = $0400; # cart block size __BANK0BLOCKSIZE__: type = weak, value = $0400; # bank 0 cart block size
__BANK1BLOCKSIZE__: type = weak, value = $0000; # bank 1 block size
__BLLHDR__: type = import; __BLLHDR__: type = import;
} }
MEMORY { MEMORY {
ZP: file = "", define = yes, start = $0000, size = $0100; ZP: file = "", define = yes, start = $0000, size = $0100;
HEADER: file = %O, start = $0000, size = $000a; HEADER: file = %O, start = $0000, size = $000a;
RAM: file = %O, define = yes, start = $0400, size = $BC38 - __STACKSIZE__; MAIN: file = %O, define = yes, start = $0400, size = $BC38 - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
BLLHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro, define = yes;
DATA: load = RAM, type = rw, define = yes;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes; EXTZP: load = ZP, type = zp, optional = yes;
APPZP: load = ZP, type = zp, optional = yes; APPZP: load = ZP, type = zp, optional = yes;
BLLHDR: load = HEADER, type = ro;
STARTUP: load = MAIN, type = ro, define = yes;
LOWCODE: load = MAIN, type = ro, define = yes, optional = yes;
ONCE: load = MAIN, type = ro, define = yes, optional = yes;
CODE: load = MAIN, type = ro, define = yes;
RODATA: load = MAIN, type = ro, define = yes;
DATA: load = MAIN, type = rw, define = yes;
BSS: load = MAIN, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -1,7 +1,8 @@
SYMBOLS { SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack __STACKSIZE__: type = weak, value = $0800; # 2k stack
__STARTOFDIRECTORY__: type = weak, value = $00CB; # start just after loader __STARTOFDIRECTORY__: type = weak, value = $00CB; # start just after loader
__BLOCKSIZE__: type = weak, value = $0400; # cart block size __BANK0BLOCKSIZE__: type = weak, value = $0400; # bank 0 cart block size
__BANK1BLOCKSIZE__: type = weak, value = $0000; # bank 1 block size
__EXEHDR__: type = import; __EXEHDR__: type = import;
__BOOTLDR__: type = import; __BOOTLDR__: type = import;
__DEFDIR__: type = import; __DEFDIR__: type = import;
@@ -11,28 +12,28 @@ MEMORY {
HEADER: file = %O, start = $0000, size = $0040; HEADER: file = %O, start = $0000, size = $0040;
BOOT: file = %O, start = $0200, size = __STARTOFDIRECTORY__; BOOT: file = %O, start = $0200, size = __STARTOFDIRECTORY__;
DIR: file = %O, start = $0000, size = 8; DIR: file = %O, start = $0000, size = 8;
RAM: file = %O, define = yes, start = $0200, size = $9E58 - __STACKSIZE__; MAIN: file = %O, define = yes, start = $0200, size = $9E58 - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
EXEHDR: load = HEADER, type = ro;
BOOTLDR: load = BOOT, type = ro;
DIRECTORY: load = DIR, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro, define = yes;
DATA: load = RAM, type = rw, define = yes;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes; EXTZP: load = ZP, type = zp, optional = yes;
APPZP: load = ZP, type = zp, optional = yes; APPZP: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro;
BOOTLDR: load = BOOT, type = ro;
DIRECTORY: load = DIR, type = ro;
STARTUP: load = MAIN, type = ro, define = yes;
LOWCODE: load = MAIN, type = ro, define = yes, optional = yes;
ONCE: load = MAIN, type = ro, define = yes, optional = yes;
CODE: load = MAIN, type = ro, define = yes;
RODATA: load = MAIN, type = ro, define = yes;
DATA: load = MAIN, type = rw, define = yes;
BSS: load = MAIN, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -1,7 +1,8 @@
SYMBOLS { SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack __STACKSIZE__: type = weak, value = $0800; # 2k stack
__STARTOFDIRECTORY__: type = weak, value = $00CB; # start just after loader __STARTOFDIRECTORY__: type = weak, value = $00CB; # start just after loader
__BLOCKSIZE__: type = weak, value = $0400; # cart block size __BANK0BLOCKSIZE__: type = weak, value = $0400; # bank 0 cart block size
__BANK1BLOCKSIZE__: type = weak, value = $0000; # bank 1 block size
__EXEHDR__: type = import; __EXEHDR__: type = import;
__BOOTLDR__: type = import; __BOOTLDR__: type = import;
__DEFDIR__: type = import; __DEFDIR__: type = import;
@@ -12,31 +13,31 @@ MEMORY {
HEADER: file = %O, start = $0000, size = $0040; HEADER: file = %O, start = $0000, size = $0040;
BOOT: file = %O, start = $0200, size = __STARTOFDIRECTORY__; BOOT: file = %O, start = $0200, size = __STARTOFDIRECTORY__;
DIR: file = %O, start = $0000, size = 8; DIR: file = %O, start = $0000, size = 8;
RAM: file = %O, define = yes, start = $0200, size = $BD38 - __STACKSIZE__; MAIN: file = %O, define = yes, start = $0200, size = $BD38 - __STACKSIZE__;
UPLDR: file = %O, define = yes, start = $BFDC, size = $005C; UPLDR: file = %O, define = yes, start = $BFDC, size = $005C;
} }
SEGMENTS { SEGMENTS {
EXEHDR: load = HEADER, type = ro;
BOOTLDR: load = BOOT, type = ro;
DIRECTORY:load = DIR, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro, define = yes;
DATA: load = RAM, type = rw, define = yes;
BSS: load = RAM, type = bss, define = yes;
UPCODE: load = UPLDR, type = ro, define = yes;
UPDATA: load = UPLDR, type = rw, define = yes;
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes; EXTZP: load = ZP, type = zp, optional = yes;
APPZP: load = ZP, type = zp, optional = yes; APPZP: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro;
BOOTLDR: load = BOOT, type = ro;
DIRECTORY:load = DIR, type = ro;
STARTUP: load = MAIN, type = ro, define = yes;
LOWCODE: load = MAIN, type = ro, define = yes, optional = yes;
ONCE: load = MAIN, type = ro, define = yes, optional = yes;
CODE: load = MAIN, type = ro, define = yes;
RODATA: load = MAIN, type = ro, define = yes;
DATA: load = MAIN, type = rw, define = yes;
BSS: load = MAIN, type = bss, define = yes;
UPCODE: load = UPLDR, type = ro, define = yes;
UPDATA: load = UPLDR, type = rw, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -1,7 +1,8 @@
SYMBOLS { SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack __STACKSIZE__: type = weak, value = $0800; # 2k stack
__STARTOFDIRECTORY__: type = weak, value = $00CB; # start just after loader __STARTOFDIRECTORY__: type = weak, value = $00CB; # start just after loader
__BLOCKSIZE__: type = weak, value = 1024; # cart block size __BANK0BLOCKSIZE__: type = weak, value = $0400; # bank 0 cart block size
__BANK1BLOCKSIZE__: type = weak, value = $0000; # bank 1 block size
__EXEHDR__: type = import; __EXEHDR__: type = import;
__BOOTLDR__: type = import; __BOOTLDR__: type = import;
__DEFDIR__: type = import; __DEFDIR__: type = import;
@@ -11,28 +12,28 @@ MEMORY {
HEADER: file = %O, start = $0000, size = $0040; HEADER: file = %O, start = $0000, size = $0040;
BOOT: file = %O, start = $0200, size = __STARTOFDIRECTORY__; BOOT: file = %O, start = $0200, size = __STARTOFDIRECTORY__;
DIR: file = %O, start = $0000, size = 8; DIR: file = %O, start = $0000, size = 8;
RAM: file = %O, define = yes, start = $0200, size = $BE38 - __STACKSIZE__; MAIN: file = %O, define = yes, start = $0200, size = $BE38 - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
EXEHDR: load = HEADER, type = ro;
BOOTLDR: load = BOOT, type = ro;
DIRECTORY: load = DIR, type = ro;
STARTUP: load = RAM, type = ro, define = yes;
LOWCODE: load = RAM, type = ro, define = yes, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = ro, define = yes;
RODATA: load = RAM, type = ro, define = yes;
DATA: load = RAM, type = rw, define = yes;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes; EXTZP: load = ZP, type = zp, optional = yes;
APPZP: load = ZP, type = zp, optional = yes; APPZP: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro;
BOOTLDR: load = BOOT, type = ro;
DIRECTORY: load = DIR, type = ro;
STARTUP: load = MAIN, type = ro, define = yes;
LOWCODE: load = MAIN, type = ro, define = yes, optional = yes;
ONCE: load = MAIN, type = ro, define = yes, optional = yes;
CODE: load = MAIN, type = ro, define = yes;
RODATA: load = MAIN, type = ro, define = yes;
DATA: load = MAIN, type = rw, define = yes;
BSS: load = MAIN, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -6,7 +6,7 @@ SEGMENTS {
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, optional = yes; EXTZP: load = ZP, type = zp, optional = yes;
HEADER: load = COMBINED, type = ro; HEADER: load = COMBINED, type = ro;
INIT: load = COMBINED, type = ro, optional = yes; ONCE: load = COMBINED, type = ro, optional = yes;
CODE: load = COMBINED, type = ro; CODE: load = COMBINED, type = ro;
RODATA: load = COMBINED, type = ro; RODATA: load = COMBINED, type = ro;
DATA: load = COMBINED, type = rw; DATA: load = COMBINED, type = rw;

View File

@@ -12,10 +12,10 @@ MEMORY {
# - code # - code
# - rodata # - rodata
# - data (load) # - data (load)
ROM0: file = %O, start = $8000, size = $7FF4, fill = yes, define = yes; ROM0: file = %O, start = $8000, size = $7FFA, fill = yes, define = yes;
# Hardware Vectors at End of 2nd 8K ROM # Hardware Vectors at End of 2nd 8K ROM
ROMV: file = %O, start = $FFF6, size = $000C, fill = yes; ROMV: file = %O, start = $FFFA, size = $0006, fill = yes;
# 1 8k CHR Bank # 1 8k CHR Bank
ROM2: file = %O, start = $0000, size = $2000, fill = yes; ROM2: file = %O, start = $0000, size = $2000, fill = yes;
@@ -33,23 +33,23 @@ MEMORY {
RAM: file = "", start = $6000, size = $2000, define = yes; RAM: file = "", start = $6000, size = $2000, define = yes;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
HEADER: load = HEADER, type = ro; HEADER: load = HEADER, type = ro;
STARTUP: load = ROM0, type = ro, define = yes; STARTUP: load = ROM0, type = ro, define = yes;
LOWCODE: load = ROM0, type = ro, optional = yes; LOWCODE: load = ROM0, type = ro, optional = yes;
INIT: load = ROM0, type = ro, define = yes, optional = yes; ONCE: load = ROM0, type = ro, optional = yes;
CODE: load = ROM0, type = ro, define = yes; CODE: load = ROM0, type = ro, define = yes;
RODATA: load = ROM0, type = ro, define = yes; RODATA: load = ROM0, type = ro, define = yes;
DATA: load = ROM0, run = RAM, type = rw, define = yes; DATA: load = ROM0, run = RAM, type = rw, define = yes;
VECTORS: load = ROMV, type = rw; VECTORS: load = ROMV, type = rw;
CHARS: load = ROM2, type = rw; CHARS: load = ROM2, type = rw;
BSS: load = RAM, type = bss, define = yes; BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -2,23 +2,23 @@ SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack __STACKSIZE__: type = weak, value = $0800; # 2k stack
} }
MEMORY { MEMORY {
ZP: file = "", define = yes, start = $0000, size = $0001F; ZP: file = "", define = yes, start = $0000, size = $0001F;
RAM: file = %O, start = %S, size = $10000 - __STACKSIZE__; MAIN: file = %O, start = %S, size = $10000 - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
LOWCODE: load = RAM, type = ro, optional = yes; ZEROPAGE: load = ZP, type = zp;
INIT: load = RAM, type = ro, define = yes, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = rw; ONCE: load = MAIN, type = ro, optional = yes;
RODATA: load = RAM, type = rw; CODE: load = MAIN, type = rw;
DATA: load = RAM, type = rw; RODATA: load = MAIN, type = rw;
BSS: load = RAM, type = bss, define = yes; DATA: load = MAIN, type = rw;
ZEROPAGE: load = ZP, type = zp; BSS: load = MAIN, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -10,16 +10,15 @@ SYMBOLS {
} }
MEMORY { MEMORY {
# for size of ZP, see runtime/zeropage.s and c1p/extzp.s # for size of ZP, see runtime/zeropage.s and c1p/extzp.s
ZP: file = "", define = yes, start = $0002, size = $001A + $0006; ZP: file = "", define = yes, start = $0002, size = $00FE;
HEAD: file = %O, start = $0000, size = $00B6; HEAD: file = %O, start = $0000, size = $00B6;
RAM: file = %O, define = yes, start = %S, size = __HIMEM__ - __STACKSIZE__ - %S; MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - __STACKSIZE__ - %S;
} }
SEGMENTS { SEGMENTS {
BOOT: load = HEAD, type = ro, optional = yes; ZEROPAGE: load = ZP, type = zp, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes; BOOT: load = HEAD, type = ro, optional = yes;
CODE: load = RAM, type = rw; CODE: load = MAIN, type = rw;
RODATA: load = RAM, type = rw; RODATA: load = MAIN, type = ro, optional = yes;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw, optional = yes;
BSS: load = RAM, type = bss, define = yes; BSS: load = MAIN, type = bss, optional = yes, define = yes;
ZEROPAGE: load = ZP, type = zp;
} }

View File

@@ -10,27 +10,27 @@ SYMBOLS {
} }
MEMORY { MEMORY {
# for size of ZP, see runtime/zeropage.s and c1p/extzp.s # for size of ZP, see runtime/zeropage.s and c1p/extzp.s
ZP: file = "", define = yes, start = $0002, size = $001A + $0020; ZP: file = "", define = yes, start = $0002, size = $001A + $0020;
HEAD: file = %O, start = $0000, size = $00B6; HEAD: file = %O, start = $0000, size = $00B6;
RAM: file = %O, define = yes, start = %S, size = __HIMEM__ - __STACKSIZE__ - %S; MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - __STACKSIZE__ - %S;
} }
SEGMENTS { SEGMENTS {
BOOT: load = HEAD, type = ro, optional = yes;
STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes;
CODE: load = RAM, type = rw;
RODATA: load = RAM, type = rw;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
EXTZP: load = ZP, type = zp, define = yes, optional = yes; EXTZP: load = ZP, type = zp, define = yes, optional = yes;
BOOT: load = HEAD, type = ro, optional = yes;
STARTUP: load = MAIN, type = ro;
LOWCODE: load = MAIN, type = ro, optional = yes;
ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = MAIN, type = rw;
RODATA: load = MAIN, type = rw;
DATA: load = MAIN, type = rw;
BSS: load = MAIN, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -1,39 +1,39 @@
# linker config to produce simple NEC PC-Engine cartridge (.pce) # linker config to produce simple NEC PC-Engine cartridge (.pce)
SYMBOLS { SYMBOLS {
__STACKSIZE__: type = weak, value = $0300; # 3 pages stack __STACKSIZE__: type = weak, value = $0300; # 3 pages stack
} }
MEMORY { MEMORY {
# FIXME: is this correct? the first 3? bytes cant be used? # FIXME: is this correct? the first 3? bytes cant be used?
ZP: start = $03, size = $fd, type = rw, define = yes; ZP: file = "", start = $0003, size = $00FD, type = rw, define = yes;
# reset-bank and hardware vectors # reset-bank and hardware vectors
ROM0: start = $e000, size = $1ff6, file = %O ,fill = yes, define = yes; ROM0: file = %O, start = $E000, size = $1FF6, fill = yes, define = yes;
ROMV: start = $fff6, size = $a, file = %O,fill = yes; ROMV: file = %O, start = $FFF6, size = $000A, fill = yes;
# first RAM page (also contains stack and zeropage) # first RAM page (also contains stack and zeropage)
RAM: start = $2200, size = $1e00, define = yes; RAM: file = "", start = $2200, size = $1e00, define = yes;
} }
SEGMENTS { SEGMENTS {
STARTUP: load = ROM0, type = ro, define = yes; ZEROPAGE: load = ZP, type = zp, define = yes;
INIT: load = ROM0, type = ro, define = yes, optional = yes; EXTZP: load = ZP, type = zp, define = yes, optional = yes;
CODE: load = ROM0, type = ro, define = yes; APPZP: load = ZP, type = zp, define = yes, optional = yes;
RODATA: load = ROM0, type = ro, define = yes; STARTUP: load = ROM0, type = ro, define = yes;
DATA: load = ROM0, run= RAM, type = rw, define = yes; ONCE: load = ROM0, type = ro, optional = yes;
BSS: load = RAM, type = bss, define = yes; CODE: load = ROM0, type = ro, define = yes;
VECTORS: load = ROMV, type = rw, define = yes; RODATA: load = ROM0, type = ro, define = yes;
ZEROPAGE: load = ZP, type = zp, define = yes; DATA: load = ROM0, run = RAM, type = rw, define = yes;
EXTZP: load = ZP, type = zp, define = yes, optional = yes; BSS: load = RAM, type = bss, define = yes;
APPZP: load = ZP, type = zp, define = yes, optional = yes; VECTORS: load = ROMV, type = rw, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -10,23 +10,23 @@ MEMORY {
RAM: file = %O, start = $040D, size = $7BF3 - __STACKSIZE__; RAM: file = %O, start = $040D, size = $7BF3 - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro; LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro; STARTUP: load = RAM, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = RAM, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes; ONCE: load = RAM, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = RAM, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw; DATA: load = RAM, type = rw;
INITBSS: load = RAM, type = bss; INIT: load = RAM, type = bss;
BSS: load = RAM, type = bss, define = yes; BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -7,26 +7,26 @@ MEMORY {
ZP: file = "", define = yes, start = $0002, size = $001A; ZP: file = "", define = yes, start = $0002, size = $001A;
LOADADDR: file = %O, start = $0FFF, size = $0002; LOADADDR: file = %O, start = $0FFF, size = $0002;
HEADER: file = %O, start = $1001, size = $000C; HEADER: file = %O, start = $1001, size = $000C;
RAM: file = %O, define = yes, start = $100D, size = $ECF3 - __STACKSIZE__; MAIN: file = %O, define = yes, start = $100D, size = $ECF3 - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro; LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro; STARTUP: load = MAIN, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes; ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss; INIT: load = MAIN, type = bss;
BSS: load = RAM, type = bss, define = yes; BSS: load = MAIN, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -3,26 +3,26 @@ SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack __STACKSIZE__: type = weak, value = $0800; # 2k stack
} }
MEMORY { MEMORY {
ZP: file = "", start = $0000, size = $001A; ZP: file = "", start = $0000, size = $001B;
HEADER: file = %O, start = $0000, size = $0001; HEADER: file = %O, start = $0000, size = $0001;
RAM: file = %O, define = yes, start = $0200, size = $FDF0 - __STACKSIZE__; MAIN: file = %O, define = yes, start = $0200, size = $FDF0 - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
EXEHDR: load = HEADER, type = ro; ZEROPAGE: load = ZP, type = zp;
STARTUP: load = RAM, type = ro; EXEHDR: load = HEADER, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes; STARTUP: load = MAIN, type = ro;
INIT: load = RAM, type = ro, define = yes, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; ONCE: load = MAIN, type = ro, optional = yes;
RODATA: load = RAM, type = ro; CODE: load = MAIN, type = ro;
DATA: load = RAM, type = rw; RODATA: load = MAIN, type = ro;
BSS: load = RAM, type = bss, define = yes; DATA: load = MAIN, type = rw;
ZEROPAGE: load = ZP, type = zp; BSS: load = MAIN, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -3,26 +3,26 @@ SYMBOLS {
__STACKSIZE__: type = weak, value = $0800; # 2k stack __STACKSIZE__: type = weak, value = $0800; # 2k stack
} }
MEMORY { MEMORY {
ZP: file = "", start = $0000, size = $001A; ZP: file = "", start = $0000, size = $001B;
HEADER: file = %O, start = $0000, size = $0001; HEADER: file = %O, start = $0000, size = $0001;
RAM: file = %O, define = yes, start = $0200, size = $FDF0 - __STACKSIZE__; MAIN: file = %O, define = yes, start = $0200, size = $FDF0 - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
EXEHDR: load = HEADER, type = ro; ZEROPAGE: load = ZP, type = zp;
STARTUP: load = RAM, type = ro; EXEHDR: load = HEADER, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes; STARTUP: load = MAIN, type = ro;
INIT: load = RAM, type = ro, define = yes, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; ONCE: load = MAIN, type = ro, optional = yes;
RODATA: load = RAM, type = ro; CODE: load = MAIN, type = ro;
DATA: load = RAM, type = rw; RODATA: load = MAIN, type = ro;
BSS: load = RAM, type = bss, define = yes; DATA: load = MAIN, type = rw;
ZEROPAGE: load = ZP, type = zp; BSS: load = MAIN, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -20,8 +20,8 @@ MEMORY {
ROM: file = %O, start = $c000, size = $4000, fill = yes, fillval = $FF; ROM: file = %O, start = $c000, size = $4000, fill = yes, fillval = $FF;
} }
SEGMENTS { SEGMENTS {
LOWCODE: load = ROM, type = ro, optional = yes; LOWCODE: load = ROM, type = ro, optional = yes;
INIT: load = ROM, type = ro, define = yes, optional = yes; ONCE: load = ROM, type = ro, optional = yes;
CODE: load = ROM, type = ro; CODE: load = ROM, type = ro;
BANK1: load = BANKROM1, type = ro; BANK1: load = BANKROM1, type = ro;
BANK2: load = BANKROM2, type = ro; BANK2: load = BANKROM2, type = ro;
@@ -30,8 +30,8 @@ SEGMENTS {
BANK5: load = BANKROM5, type = ro; BANK5: load = BANKROM5, type = ro;
BANK6: load = BANKROM6, type = ro; BANK6: load = BANKROM6, type = ro;
BANK7: load = BANKROM7, type = ro; BANK7: load = BANKROM7, type = ro;
ZEROPAGE: load = RAM, type = bss, define = yes; ZEROPAGE: load = RAM, type = bss, define = yes;
DATA: load = RAM, type = bss, define = yes, offset = $0200; DATA: load = RAM, type = bss, define = yes, offset = $0200;
BSS: load = RAM, type = bss, define = yes; BSS: load = RAM, type = bss, define = yes;
VECTOR: load = ROM, type = ro, offset = $3FFA; VECTOR: load = ROM, type = ro, offset = $3FFA;
} }

View File

@@ -14,21 +14,21 @@ MEMORY {
ROM: file = %O, start = $C000, size = $4000, fill = yes, fillval = $ff, define=yes; ROM: file = %O, start = $C000, size = $4000, fill = yes, fillval = $ff, define=yes;
} }
SEGMENTS { SEGMENTS {
LOWCODE: load = ROM, type = ro, optional = yes; ZEROPAGE: load = ZP, type = zp, define = yes;
INIT: load = ROM, type = ro, define = yes, optional = yes; LOWCODE: load = ROM, type = ro, optional = yes;
CODE: load = ROM, type = ro, define = yes; ONCE: load = ROM, type = ro, optional = yes;
RODATA: load = ROM, type = ro, define = yes; CODE: load = ROM, type = ro, define = yes;
DATA: load = ROM, run = RAM, type = rw, define = yes; RODATA: load = ROM, type = ro, define = yes;
FFF0: load = ROM, type = ro, offset = $3FF0; DATA: load = ROM, run = RAM, type = rw, define = yes;
VECTOR: load = ROM, type = ro, offset = $3FFA; FFF0: load = ROM, type = ro, offset = $3FF0;
BSS: load = RAM, type = bss, define = yes; VECTOR: load = ROM, type = ro, offset = $3FFA;
ZEROPAGE: load = ZP, type = zp, define = yes; BSS: load = RAM, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -16,15 +16,15 @@ MEMORY {
ROM: file = %O, start = $C000, size = $4000, fill = yes, fillval = $FF; ROM: file = %O, start = $C000, size = $4000, fill = yes, fillval = $FF;
} }
SEGMENTS { SEGMENTS {
LOWCODE: load = ROM, type = ro, optional = yes; LOWCODE: load = ROM, type = ro, optional = yes;
INIT: load = ROM, type = ro, define = yes, optional = yes; ONCE: load = ROM, type = ro, optional = yes;
CODE: load = ROM, type = ro; CODE: load = ROM, type = ro;
RODATA: load = ROM, type = ro; RODATA: load = ROM, type = ro;
BANK1: load = BANKROM1, type = ro; BANK1: load = BANKROM1, type = ro;
BANK2: load = BANKROM2, type = ro; BANK2: load = BANKROM2, type = ro;
BANK3: load = BANKROM3, type = ro; BANK3: load = BANKROM3, type = ro;
ZEROPAGE: load = RAM, type = bss, define = yes; ZEROPAGE: load = RAM, type = bss, define = yes;
DATA: load = RAM, type = bss, define = yes, offset = $0200; DATA: load = RAM, type = bss, define = yes, offset = $0200;
BSS: load = RAM, type = bss, define = yes; BSS: load = RAM, type = bss, define = yes;
VECTOR: load = ROM, type = ro, offset = $3FFA; VECTOR: load = ROM, type = ro, offset = $3FFA;
} }

View File

@@ -2,29 +2,32 @@
# make sure the halves are mirrored in the 64kbyte cartridge image # make sure the halves are mirrored in the 64kbyte cartridge image
# or reset from code >0xc000 and switch bank to the 3rd bank # or reset from code >0xc000 and switch bank to the 3rd bank
SYMBOLS {
__STACKSIZE__: type = weak, value = $0100; # 1 page stack
}
MEMORY { MEMORY {
ZP: file = "", start = $0000, size = $0100; ZP: file = "", start = $0000, size = $0100;
CPUSTACK: file = "", start = $0100, size = $0100; CPUSTACK: file = "", start = $0100, size = $0100;
RAM: file = "", start = $0200, size = $1E00, define = yes; RAM: file = "", start = $0200, size = $1E00 - __STACKSIZE__;
VRAM: file = "", start = $4000, size = $2000; VRAM: file = "", start = $4000, size = $2000;
ROM: file = %O, start = $8000, size = $8000, fill = yes, fillval = $FF, define = yes; ROM: file = %O, start = $8000, size = $8000, fill = yes, fillval = $FF, define = yes;
} }
SEGMENTS { SEGMENTS {
LOWCODE: load = ROM, type = ro, optional = yes; ZEROPAGE: load = ZP, type = zp, define = yes;
INIT: load = ROM, type = ro, define = yes, optional = yes; LOWCODE: load = ROM, type = ro, optional = yes;
CODE: load = ROM, type = ro, define = yes; ONCE: load = ROM, type = ro, optional = yes;
RODATA: load = ROM, type = ro, define = yes; CODE: load = ROM, type = ro, define = yes;
DATA: load = ROM, run = RAM, type = rw, define = yes; RODATA: load = ROM, type = ro, define = yes;
FFF0: load = ROM, type = ro, offset = $7FF0; DATA: load = ROM, run = RAM, type = rw, define = yes;
VECTOR: load = ROM, type = ro, offset = $7FFA; FFF0: load = ROM, type = ro, offset = $7FF0;
BSS: load = RAM, type = bss, define = yes; VECTOR: load = ROM, type = ro, offset = $7FFA;
ZEROPAGE: load = ZP, type = zp, define = yes; BSS: load = RAM, type = bss, define = yes;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

40
cfg/telestrat.cfg Normal file
View File

@@ -0,0 +1,40 @@
SYMBOLS {
__ORIXHDR__: type = import;
__STACKSIZE__: type = weak, value = $0800; # 2K stack
__RAMEND__: type = weak, value = $9800;
}
MEMORY {
ZP: file = "", define = yes, start = $00E0, size = $001A;
ORIXHDR: file = %O, type = ro, start = $0000, size = $001F;
BASHEAD: file = %O, define = yes, start = $0801, size = $000D;
MAIN: file = %O, define = yes, start = __BASHEAD_LAST__, size = __RAMEND__ - __MAIN_START__;
BSS: file = "", start = __ONCE_RUN__, size = __RAMEND__ - __STACKSIZE__ - __ONCE_RUN__;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
ORIXHDR: load = ORIXHDR, type = ro;
STARTUP: load = MAIN, type = ro;
LOWCODE: load = MAIN, type = ro, optional = yes;
CODE: load = MAIN, type = ro;
RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw;
INIT: load = MAIN, type = rw;
ONCE: load = MAIN, type = ro, define = yes;
BASTAIL: load = MAIN, type = ro, optional = yes;
BSS: load = BSS, type = bss, define = yes;
}
FEATURES {
CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__,
segment = ONCE;
CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__,
segment = RODATA;
CONDES: type = interruptor,
label = __INTERRUPTOR_TABLE__,
count = __INTERRUPTOR_COUNT__,
segment = RODATA,
import = __CALLIRQ__;
}

View File

@@ -9,26 +9,26 @@ MEMORY {
ZP: file = "", define = yes, start = $0002, size = $001A; ZP: file = "", define = yes, start = $0002, size = $001A;
LOADADDR: file = %O, start = $11FF, size = $0002; LOADADDR: file = %O, start = $11FF, size = $0002;
HEADER: file = %O, start = $1201, size = $000C; HEADER: file = %O, start = $1201, size = $000C;
RAM: file = %O, define = yes, start = $120D, size = $6DF3 - __STACKSIZE__; MAIN: file = %O, define = yes, start = $120D, size = $6DF3 - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro; LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro; STARTUP: load = MAIN, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes; ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss; INIT: load = MAIN, type = bss;
BSS: load = RAM, type = bss, define = yes; BSS: load = MAIN, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -7,26 +7,26 @@ MEMORY {
ZP: file = "", define = yes, start = $0002, size = $001A; ZP: file = "", define = yes, start = $0002, size = $001A;
LOADADDR: file = %O, start = $0FFF, size = $0002; LOADADDR: file = %O, start = $0FFF, size = $0002;
HEADER: file = %O, start = $1001, size = $000C; HEADER: file = %O, start = $1001, size = $000C;
RAM: file = %O, define = yes, start = $100D, size = $0DF3 - __STACKSIZE__; MAIN: file = %O, define = yes, start = $100D, size = $0DF3 - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
LOADADDR: load = LOADADDR, type = ro; LOADADDR: load = LOADADDR, type = ro;
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
STARTUP: load = RAM, type = ro; STARTUP: load = MAIN, type = ro;
LOWCODE: load = RAM, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
INIT: load = RAM, type = ro, define = yes, optional = yes; ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = RAM, type = ro; CODE: load = MAIN, type = ro;
RODATA: load = RAM, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = RAM, type = rw; DATA: load = MAIN, type = rw;
INITBSS: load = RAM, type = bss; INIT: load = MAIN, type = bss;
BSS: load = RAM, type = bss, define = yes; BSS: load = MAIN, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
} }
FEATURES { FEATURES {
CONDES: type = constructor, CONDES: type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__, count = __CONSTRUCTOR_COUNT__,
segment = INIT; segment = ONCE;
CONDES: type = destructor, CONDES: type = destructor,
label = __DESTRUCTOR_TABLE__, label = __DESTRUCTOR_TABLE__,
count = __DESTRUCTOR_COUNT__, count = __DESTRUCTOR_COUNT__,

View File

@@ -6,14 +6,12 @@ endif
.SUFFIXES: .SUFFIXES:
htmldir = $(prefix)/share/doc/cc65$(DESTPACKAGE_SUFFIX)/html htmldir = $(PREFIX)/share/doc/cc65$(DESTPACKAGE_SUFFIX)/html
infodir = $(prefix)/share/info infodir = $(PREFIX)/share/info
all mostlyclean:
ifdef CMD_EXE ifdef CMD_EXE
clean install zip doc: doc clean install zip:
else # CMD_EXE else # CMD_EXE
@@ -26,23 +24,6 @@ TOC_LEVEL = 2
INSTALL = install INSTALL = install
clean:
$(RM) -r ../html ../info
install:
$(if $(prefix),,$(error variable `prefix' must be set))
ifeq ($(wildcard ../html),../html)
$(INSTALL) -d $(DESTDIR)$(htmldir)
$(INSTALL) -m644 ../html/*.* $(DESTDIR)$(htmldir)
endif
ifeq ($(wildcard ../info),../info)
$(INSTALL) -d $(DESTDIR)$(infodir)
$(INSTALL) -m644 ../info/*.* $(DESTDIR)$(infodir)
endif
zip:
@cd .. && zip cc65 html/*.*
doc: html info doc: html info
html: $(addprefix ../html/,$(SGMLS:.sgml=.html) doc.css doc.png) html: $(addprefix ../html/,$(SGMLS:.sgml=.html) doc.css doc.png)
@@ -61,4 +42,25 @@ info: $(addprefix ../info/,$(SGMLS:.sgml=.info))
../info/%.info: %.sgml | ../info ../info/%.info: %.sgml | ../info
@cd ../info && linuxdoc -B info ../doc/$< @cd ../info && linuxdoc -B info ../doc/$<
clean:
$(RM) -r ../html ../info
install:
$(if $(PREFIX),,$(error variable `PREFIX' must be set))
ifeq ($(wildcard ../html),../html)
$(INSTALL) -d $(DESTDIR)$(htmldir)
$(INSTALL) -m0644 ../html/*.* $(DESTDIR)$(htmldir)
endif
ifeq ($(wildcard ../info),../info)
$(INSTALL) -d $(DESTDIR)$(infodir)
$(INSTALL) -m0644 ../info/*.* $(DESTDIR)$(infodir)
endif
zip:
ifneq "$(wildcard ../html)" ""
@cd .. && zip cc65 html/*.*
endif
endif # CMD_EXE endif # CMD_EXE
all mostlyclean:

View File

@@ -75,13 +75,30 @@ However while running module constructors/destructors the Language Card is disab
Enabling the Language Card allows to use it as additional memory for cc65 Enabling the Language Card allows to use it as additional memory for cc65
generated code. However code is never automatically placed there. Rather code generated code. However code is never automatically placed there. Rather code
needs to be explicitly placed in the Language Card either per file by compiling needs to be explicitly placed in the Language Card either per file by compiling
with <tt/--code-name HIGHCODE/ or per function by enclosing in <tt/#pragma with <tt/--code-name LC/ or per function by enclosing in <tt/#pragma code-name
code-name (push, "HIGHCODE")/ and <tt/#pragma code-name (pop)/. In either case the (push, "LC")/ and <tt/#pragma code-name (pop)/. In either case the cc65 runtime
cc65 runtime system takes care of actually moving the code into the Language system takes care of actually moving the code into the Language Card.
Card.
The amount of memory available in the Language Card for generated code depends The amount of memory available in the Language Card for generated code depends
on the chosen <ref id="link-configs" name="linker configuration">. on the <ref id="link-configs" name="linker configuration"> parameters. There are
several usefull settings:
<descrip>
<tag>LC address: &dollar;D400, LC size: &dollar;C00</tag>
For plain vanilla ProDOS 8 which doesn't actually use the Language Card bank 2
memory from &dollar;D400 to &dollar;DFFF. This is the default setting.
<tag>LC address: &dollar;D000, LC size: &dollar;1000</tag>
For ProDOS 8 together with the function <tt/rebootafterexit()/. If a program
doesn't quit to the ProDOS 8 dispatcher but rather reboots the machine after
exit then a plain vanilla ProDOS 8 doesn't make use of the Language Card bank
2 at all.
<tag>LC address: &dollar;D000, LC size: &dollar;3000</tag>
For plain vanilla DOS 3.3 which doesn't make use of the Language Card at all.
</descrip><p>
@@ -93,126 +110,118 @@ The apple2 package comes with additional secondary linker config files, which
are used via <tt/-t apple2 -C &lt;configfile&gt;/. are used via <tt/-t apple2 -C &lt;configfile&gt;/.
<sect1>default config file (<tt/apple2.cfg/)<p> <sect1>default config file (<tt/apple2.cfg/)<label id="apple-def-cfg"><p>
Default configuration optimized for a binary program running on ProDOS 8 with Default configuration for a binary program.
BASIC.SYSTEM. A plain vanilla ProDOS 8 doesn't actually use the Language Card
bank 2 memory from &dollar;D400 to &dollar;DFFF. Parameters:
<descrip> <descrip>
<tag><tt/RAM:/ Main memory area</tag>
From &dollar;803 to &dollar;95FF (35.5 KB)
<tag><tt/LC:/ Language Card memory area</tag>
From &dollar;D400 to &dollar;DFFF (3 KB)
<tag><tt/STARTADDRESS:/ Program start address</tag> <tag><tt/STARTADDRESS:/ Program start address</tag>
Variable (default: &dollar;803) Default: &dollar;803. Use <tt/-S &lt;addr&gt;/ to set a different start address.
<tag><tt/HEADER:/ Binary file header</tag> <tag><tt/__EXEHDR__:/ Executable file header</tag>
DOS 3.3 header (address and length) Default: DOS 3.3 header (address and length). Use <tt/-D __EXEHDR__=0/ to omit
the header.
</descrip><p> <tag><tt/__STACKSIZE__:/ C runtime stack size</tag>
Default: &dollar;800. Use <tt/-D __STACKSIZE__=&lt;size&gt;/ to set a different
stack size.
<tag><tt/__HIMEM__:/ Highest usable memory address presumed at link time</tag>
Default: &dollar;9600. Use <tt/-D __HIMEM__=&lt;addr&gt;/ to set a different
highest usable address.
<sect1><tt/apple2-dos33.cfg/<p> <tag><tt/__LCADDR__:/ Address of code in the Language Card</tag>
Default: &dollar;D400. Use <tt/-D __LCADDR__=&lt;addr&gt;/ to set a different
code address.
Configuration optimized for a binary program running on DOS 3.3. A plain <tag><tt/__LCSIZE__:/ Size of code in the Language Card</tag>
vanilla DOS 3.3 doesn't make use of the Language Card at all. Default: &dollar;C00. Use <tt/-D __LCSIZE__=&lt;size&gt;/ to set a different
code size.
<descrip>
<tag><tt/RAM:/ Main memory area</tag>
From &dollar;803 to &dollar;95FF (35.5 KB)
<tag><tt/LC:/ Language Card memory area</tag>
From &dollar;D000 to &dollar;FFFF (12 KB)
<tag><tt/STARTADDRESS:/ Program start address</tag>
Variable (default: &dollar;803)
<tag><tt/HEADER:/ Binary file header</tag>
DOS 3.3 header (address and length)
</descrip><p> </descrip><p>
<sect1><tt/apple2-system.cfg/<label id="apple-sys-cfg"><p> <sect1><tt/apple2-system.cfg/<label id="apple-sys-cfg"><p>
Configuration for a system program running on ProDOS 8. Configuration for a system program running on ProDOS 8 and using the memory from
&dollar;2000 to &dollar;BEFF.
Parameters:
<descrip> <descrip>
<tag><tt/RAM:/ Main memory area</tag> <tag><tt/__STACKSIZE__:/ C runtime stack size</tag>
From &dollar;2000 to &dollar;BEFF (39.75 KB) Default: &dollar;800. Use <tt/-D __STACKSIZE__=&lt;size&gt;/ to set a different
stack size.
<tag><tt/LC:/ Language Card memory area</tag> <tag><tt/__LCADDR__:/ Address of code in the Language Card</tag>
From &dollar;D400 to &dollar;DFFF (3 KB) Default: &dollar;D400. Use <tt/-D __LCADDR__=&lt;addr&gt;/ to set a different
code address.
<tag><tt/STARTADDRESS:/ Program start address</tag> <tag><tt/__LCSIZE__:/ Size of code in the Language Card</tag>
Fixed (&dollar;2000) Default: &dollar;C00. Use <tt/-D __LCSIZE__=&lt;size&gt;/ to set a different
code size.
<tag><tt/HEADER:/ Binary file header</tag>
None
</descrip><p> </descrip><p>
<sect1><tt/apple2-loader.cfg/<label id="apple-load-cfg"><p> <sect1><tt/apple2-overlay.cfg/<p>
Configuration optimized for a binary program running on ProDOS 8 without Configuration for overlay programs with the up to nine overlays. The overlay files
BASIC.SYSTEM. Intended to be used with <bf/LOADER.SYSTEM - an don't include the DOS 3.3 header. See <tt>samples/overlaydemo.c</tt> for more
Apple&nbsp;&rsqb;&lsqb; ProDOS 8 loader for cc65 programs/, which is available information on overlays.
in the cc65 User Contributions section.
A program loaded by LOADER.SYSTEM works like a ProDOS 8 system program but Parameters:
isn't tied to the start address &dollar;2000. Thus with the default start
address &dollar;800 the main memory area is increased by 6 KB.
<descrip> <descrip>
<tag><tt/RAM:/ Main memory area</tag>
From &dollar;800 to &dollar;BEFF (45.75 KB)
<tag><tt/LC:/ Language Card memory area</tag>
From &dollar;D400 to &dollar;DFFF (3 KB)
<tag><tt/STARTADDRESS:/ Program start address</tag> <tag><tt/STARTADDRESS:/ Program start address</tag>
Variable (default: &dollar;800) Default: &dollar;803. Use <tt/-S &lt;addr&gt;/ to set a different start address.
<tag><tt/HEADER:/ Binary file header</tag> <tag><tt/__EXEHDR__:/ Executable file header</tag>
DOS 3.3 header (address and length) Default: DOS 3.3 header (address and length). Use <tt/-D __EXEHDR__=0/ to omit
the header.
<tag><tt/__STACKSIZE__:/ C runtime stack size</tag>
Default: &dollar;800. Use <tt/-D __STACKSIZE__=&lt;size&gt;/ to set a different
stack size.
<tag><tt/__HIMEM__:/ Highest usable memory address presumed at link time</tag>
Default: &dollar;9600. Use <tt/-D __HIMEM__=&lt;addr&gt;/ to set a different
highest usable address.
<tag><tt/__LCADDR__:/ Address of code in the Language Card</tag>
Default: &dollar;D400. Use <tt/-D __LCADDR__=&lt;addr&gt;/ to set a different
code address.
<tag><tt/__LCSIZE__:/ Size of code in the Language Card</tag>
Default: &dollar;C00. Use <tt/-D __LCSIZE__=&lt;size&gt;/ to set a different
code size.
<tag><tt/__OVERLAYSIZE__:/ Size of code in the overlays</tag>
Default: &dollar;1000. Use <tt/-D __OVERLAYSIZE__=&lt;size&gt;/ to set a different
code size.
</descrip><p> </descrip><p>
<sect1><tt/apple2-reboot.cfg/<p> <sect1><tt/apple2-asm.cfg/<p>
Configuration optimized for a binary program running on ProDOS 8 without Configuration for a assembler programs which don't need a special setup.
BASIC.SYSTEM. Intended to be used with <bf/LOADER.SYSTEM - an
Apple&nbsp;&rsqb;&lsqb; ProDOS 8 loader for cc65 programs/ (see above) together
with the function <tt/rebootafterexit()/.
If a ProDOS 8 system program doesn't quit to the ProDOS 8 dispatcher but rather Parameters:
reboots the machine after exit then a plain vanilla ProDOS 8 doesn't make use of
the Language Card bank 2 at all.
This setup makes nearly 50 KB available to a cc65 program - on a 64 KB machine!
<descrip> <descrip>
<tag><tt/RAM:/ Main memory area</tag>
From &dollar;800 to &dollar;BEFF (45.75 KB)
<tag><tt/LC:/ Language Card memory area</tag>
From &dollar;D000 to &dollar;DFFF (4 KB)
<tag><tt/STARTADDRESS:/ Program start address</tag> <tag><tt/STARTADDRESS:/ Program start address</tag>
Variable (default: &dollar;800) Default: &dollar;803. Use <tt/-S &lt;addr&gt;/ to set a different start address.
<tag><tt/HEADER:/ Binary file header</tag> <tag><tt/__EXEHDR__:/ Executable file header</tag>
DOS 3.3 header (address and length) Default: No header. Use <tt/-u __EXEHDR__ apple2.lib/ to add a DOS 3.3 header
(address and length).
</descrip><p> </descrip><p>
@@ -230,10 +239,10 @@ range.
The easiest (and for really large programs in fact the only) way to have a cc65 The easiest (and for really large programs in fact the only) way to have a cc65
program use the memory from &dollar;800 to &dollar;2000 is to link it as binary program use the memory from &dollar;800 to &dollar;2000 is to link it as binary
(as opposed to system) program using the linker configuration (as opposed to system) program using the default linker configuration
<ref id="apple-load-cfg" name="apple2-loader.cfg"> with start address <ref id="apple-def-cfg" name="apple2.cfg"> with <tt/__HIMEM__/ set to &dollar;BF00
&dollar;803 and load it with the targetutil LOADER.SYSTEM. The program then works and load it with the LOADER.SYSTEM utility. The program then works like a system
like a system program (i.e. quits to the ProDOS dispatcher). program (i.e. quits to the ProDOS dispatcher).
Using LOADER.SYSTEM is as simple as copying it to the ProDOS 8 directory of the Using LOADER.SYSTEM is as simple as copying it to the ProDOS 8 directory of the
program to load under name &lt;program&gt;.SYSTEM as a system program. For program to load under name &lt;program&gt;.SYSTEM as a system program. For
@@ -325,8 +334,8 @@ The names in the parentheses denote the symbols to be used for static linking of
<tag><tt/a2.hi.tgi (a2_hi_tgi)/</tag> <tag><tt/a2.hi.tgi (a2_hi_tgi)/</tag>
This driver features a resolution of 280&times;192 with 8 colors and two This driver features a resolution of 280&times;192 with 8 colors and two
hires pages. Note that programs using this driver will have to be linked hires pages. Note that programs using this driver will have to be linked
with <tt/--start-addr $4000/ to reserve the first hires page or with with <tt/-S $4000/ to reserve the first hires page or with <tt/-S $6000/
<tt/--start-addr $6000/ to reserve both hires pages. to reserve both hires pages.
The function <tt/tgi_apple2_mix()/ allows to activate 4 lines of text. The The function <tt/tgi_apple2_mix()/ allows to activate 4 lines of text. The
function doesn't clear the corresponding area at the bottom of the screen. function doesn't clear the corresponding area at the bottom of the screen.
@@ -374,7 +383,7 @@ The names in the parentheses denote the symbols to be used for static linking of
for an AppleMouse&nbsp;II Card compatible firmware. The default bounding for an AppleMouse&nbsp;II Card compatible firmware. The default bounding
box is &lsqb;0..279,0..191&rsqb;. box is &lsqb;0..279,0..191&rsqb;.
Programs using this driver will have to be linked with <tt/--start-addr $4000/ Programs using this driver will have to be linked with <tt/-S $4000/
to reserve the first hires page if they are intended to run on an to reserve the first hires page if they are intended to run on an
Apple&nbsp;&rsqb;&lsqb; (in contrast to an Apple&nbsp;//e) because the Apple&nbsp;&rsqb;&lsqb; (in contrast to an Apple&nbsp;//e) because the
AppleMouse&nbsp;II Card firmware writes to the hires page when initializing AppleMouse&nbsp;II Card firmware writes to the hires page when initializing
@@ -426,7 +435,7 @@ BASIC.SYSTEM) there are some limitations for DOS 3.3:
<tag/Interrupts/ <tag/Interrupts/
There's no <tt/interruptor/ support. Any attempt to use it yields the message There's no <tt/interruptor/ support. Any attempt to use it yields the message
'FAILED TO ALLOC INTERRUPT' on program startup. This implicitly means that 'FAILED TO ALLOC INTERRUPT' on program startup. This implicitly means that
<tt/a2.stdmou.mou/ and <tt/a2.ssc.ser/ are not functional as they depend on joystick, mouse and RS232 device drivers are not functional as they depend on
interrupts. interrupts.
</descrip><p> </descrip><p>
@@ -440,10 +449,6 @@ BASIC.SYSTEM) there are some limitations for DOS 3.3:
The Apple&nbsp;&rsqb;&lsqb; has no color text mode. Therefore the functions textcolor(), The Apple&nbsp;&rsqb;&lsqb; has no color text mode. Therefore the functions textcolor(),
bgcolor() and bordercolor() have no effect. bgcolor() and bordercolor() have no effect.
<tag/Cursor/
The Apple&nbsp;&rsqb;&lsqb; has no hardware cursor. Therefore the function cursor() has
no effect.
</descrip><p> </descrip><p>
@@ -506,6 +511,109 @@ url="ca65.html" name="assembler manual">.
</descrip><p> </descrip><p>
<sect1>Specifying file types for fopen<p>
<descrip>
<tag>Explanation of File Types</tag>
ProDOS associates a file type and an auxiliary type with each file.
These type specifications are separate from the file's name, unlike
Windows which uses the file name's suffix (a.k.a.
extension) to specify the file type. For example, <tt/.exe/,
<tt/.doc/, or <tt/.bat/.
The ProDOS low-level
Machine-Language Interface (MLI) functions for creating and opening
files require these types to be specified. And if they don't match
with the file being opened, the operation may fail.
In contrast, the ISO C function <tt/fopen()/ and the POSIX function
<tt/open()/ have no parameter to specify either a file type or an
auxiliary type. Therefore, some additional mechanism for specifying
the file types is needed.
<tag>Specifying the File Type and Auxiliary Type</tag>
There are two global variables provided that allow the file type
and auxiliary type to be specified before a call to <tt/fopen()/
or <tt/open()/. They are defined in <tt/apple2_filetype.h/:
<tscreen>
<verb>
extern unsigned char _filetype; /* Default: PRODOS_T_BIN */
extern unsigned int _auxtype; /* Default: 0 */
</verb>
</tscreen>
The header file <tt/apple2_filetype.h/ also defines many values
that can be used to set these variables. It is included in
<tt/apple2.h/, which is in turn included in <tt/apple2enh.h/.
So it isn't necessary to include it directly. Just
include one of <tt/apple2.h/ or <tt/apple2enh.h/.
<tag>Example</tag>
A text file cannot be created with just the
standard C functions because they default to the binary type
<tt/PRODOS_T_BIN/. The <tt/_filetype/ variable must be set to
<tt/PRODOS_T_TXT/ to create a text file.
For a text file,
<tt/_auxtype/ specifies the record length. A zero record
length text file is referred to as a sequential text file.
This is equivalent to text files on
other operating systems, except that the line terminator is a
carriage return instead of a line-feed (Linux/BSD/MacOS) or
carriage return, line-feed pair (Windows).
The "sequential" text file terminology is in contrast to a
"random-access" text file which would
have a fixed-length, non-zero record length, so that the
file position of any individual record can be calculated.
For this example, the
<tt/_auxtype/ does not need to be set because it defaults to
the desired value, which is zero. To be more explicit,
<tt/_auxtype/ can also be set to <tt/PRODOS_AUX_T_TXT_SEQ/
which is defined as zero.
<tscreen>
<verb>
&num;include &lt;stdio.h&gt;
&num;include &lt;string.h&gt;
&num;include &lt;errno.h&gt;
&num;include &lt;apple2.h&gt;
void main(void)
{
FILE *out;
char *name = "MY.FAVS";
/*-----------------------------*/
_filetype = PRODOS_T_TXT;
_auxtype = PRODOS_AUX_T_TXT_SEQ;
/*-----------------------------*/
if ((out = fopen(name, "w")) != NULL) {
fputs("Jorah Mormont\r", out);
fputs("Brienne of Tarth\r", out);
fputs("Daenerys Targaryen\r", out);
fputs("Sandor Clegane\r", out);
if (fclose(out) == EOF) {
fprintf(stderr, "fclose failed for %s: %s", name, strerror(errno));
}
}
else {
fprintf(stderr, "fopen failed for %s: %s", name, strerror(errno));
}
}
</verb>
</tscreen>
</descrip><p>
<sect>License<p> <sect>License<p>

View File

@@ -75,13 +75,30 @@ However while running module constructors/destructors the Language Card is disab
Enabling the Language Card allows to use it as additional memory for cc65 Enabling the Language Card allows to use it as additional memory for cc65
generated code. However code is never automatically placed there. Rather code generated code. However code is never automatically placed there. Rather code
needs to be explicitly placed in the Language Card either per file by compiling needs to be explicitly placed in the Language Card either per file by compiling
with <tt/--code-name HIGHCODE/ or per function by enclosing in <tt/#pragma with <tt/--code-name LC/ or per function by enclosing in <tt/#pragma code-name
code-name (push, "HIGHCODE")/ and <tt/#pragma code-name (pop)/. In either case the (push, "LC")/ and <tt/#pragma code-name (pop)/. In either case the cc65 runtime
cc65 runtime system takes care of actually moving the code into the Language system takes care of actually moving the code into the Language Card.
Card.
The amount of memory available in the Language Card for generated code depends The amount of memory available in the Language Card for generated code depends
on the chosen <ref id="link-configs" name="linker configuration">. on the <ref id="link-configs" name="linker configuration"> parameters. There are
several usefull settings:
<descrip>
<tag>LC address: &dollar;D400, LC size: &dollar;C00</tag>
For plain vanilla ProDOS 8 which doesn't actually use the Language Card bank 2
memory from &dollar;D400 to &dollar;DFFF. This is the default setting.
<tag>LC address: &dollar;D000, LC size: &dollar;1000</tag>
For ProDOS 8 together with the function <tt/rebootafterexit()/. If a program
doesn't quit to the ProDOS 8 dispatcher but rather reboots the machine after
exit then a plain vanilla ProDOS 8 doesn't make use of the Language Card bank
2 at all.
<tag>LC address: &dollar;D000, LC size: &dollar;3000</tag>
For plain vanilla DOS 3.3 which doesn't make use of the Language Card at all.
</descrip><p>
@@ -93,126 +110,118 @@ The apple2enh package comes with additional secondary linker config files, which
are used via <tt/-t apple2enh -C &lt;configfile&gt;/. are used via <tt/-t apple2enh -C &lt;configfile&gt;/.
<sect1>default config file (<tt/apple2enh.cfg/)<p> <sect1>default config file (<tt/apple2enh.cfg/)<label id="apple-def-cfg"><p>
Default configuration optimized for a binary program running on ProDOS 8 with Default configuration for a binary program.
BASIC.SYSTEM. A plain vanilla ProDOS 8 doesn't actually use the Language Card
bank 2 memory from &dollar;D400 to &dollar;DFFF. Parameters:
<descrip> <descrip>
<tag><tt/RAM:/ Main memory area</tag>
From &dollar;803 to &dollar;95FF (35.5 KB)
<tag><tt/LC:/ Language Card memory area</tag>
From &dollar;D400 to &dollar;DFFF (3 KB)
<tag><tt/STARTADDRESS:/ Program start address</tag> <tag><tt/STARTADDRESS:/ Program start address</tag>
Variable (default: &dollar;803) Default: &dollar;803. Use <tt/-S &lt;addr&gt;/ to set a different start address.
<tag><tt/HEADER:/ Binary file header</tag> <tag><tt/__EXEHDR__:/ Executable file header</tag>
DOS 3.3 header (address and length) Default: DOS 3.3 header (address and length). Use <tt/-D __EXEHDR__=0/ to omit
the header.
</descrip><p> <tag><tt/__STACKSIZE__:/ C runtime stack size</tag>
Default: &dollar;800. Use <tt/-D __STACKSIZE__=&lt;size&gt;/ to set a different
stack size.
<tag><tt/__HIMEM__:/ Highest usable memory address presumed at link time</tag>
Default: &dollar;9600. Use <tt/-D __HIMEM__=&lt;addr&gt;/ to set a different
highest usable address.
<sect1><tt/apple2enh-dos33.cfg/<p> <tag><tt/__LCADDR__:/ Address of code in the Language Card</tag>
Default: &dollar;D400. Use <tt/-D __LCADDR__=&lt;addr&gt;/ to set a different
code address.
Configuration optimized for a binary program running on DOS 3.3. A plain <tag><tt/__LCSIZE__:/ Size of code in the Language Card</tag>
vanilla DOS 3.3 doesn't make use of the Language Card at all. Default: &dollar;C00. Use <tt/-D __LCSIZE__=&lt;size&gt;/ to set a different
code size.
<descrip>
<tag><tt/RAM:/ Main memory area</tag>
From &dollar;803 to &dollar;95FF (35.5 KB)
<tag><tt/LC:/ Language Card memory area</tag>
From &dollar;D000 to &dollar;FFFF (12 KB)
<tag><tt/STARTADDRESS:/ Program start address</tag>
Variable (default: &dollar;803)
<tag><tt/HEADER:/ Binary file header</tag>
DOS 3.3 header (address and length)
</descrip><p> </descrip><p>
<sect1><tt/apple2enh-system.cfg/<label id="apple-sys-cfg"><p> <sect1><tt/apple2enh-system.cfg/<label id="apple-sys-cfg"><p>
Configuration for a system program running on ProDOS 8. Configuration for a system program running on ProDOS 8 and using the memory from
&dollar;2000 to &dollar;BEFF.
Parameters:
<descrip> <descrip>
<tag><tt/RAM:/ Main memory area</tag> <tag><tt/__STACKSIZE__:/ C runtime stack size</tag>
From &dollar;2000 to &dollar;BEFF (39.75 KB) Default: &dollar;800. Use <tt/-D __STACKSIZE__=&lt;size&gt;/ to set a different
stack size.
<tag><tt/LC:/ Language Card memory area</tag> <tag><tt/__LCADDR__:/ Address of code in the Language Card</tag>
From &dollar;D400 to &dollar;DFFF (3 KB) Default: &dollar;D400. Use <tt/-D __LCADDR__=&lt;addr&gt;/ to set a different
code address.
<tag><tt/STARTADDRESS:/ Program start address</tag> <tag><tt/__LCSIZE__:/ Size of code in the Language Card</tag>
Fixed (&dollar;2000) Default: &dollar;C00. Use <tt/-D __LCSIZE__=&lt;size&gt;/ to set a different
code size.
<tag><tt/HEADER:/ Binary file header</tag>
None
</descrip><p> </descrip><p>
<sect1><tt/apple2enh-loader.cfg/<label id="apple-load-cfg"><p> <sect1><tt/apple2enh-overlay.cfg/<p>
Configuration optimized for a binary program running on ProDOS 8 without Configuration for overlay programs with the up to nine overlays. The overlay files
BASIC.SYSTEM. Intended to be used with <bf/LOADER.SYSTEM - an don't include the DOS 3.3 header. See <tt>samples/overlaydemo.c</tt> for more
Apple&nbsp;&rsqb;&lsqb; ProDOS 8 loader for cc65 programs/, which is available information on overlays.
in the cc65 User Contributions section.
A program loaded by LOADER.SYSTEM works like a ProDOS 8 system program but Parameters:
isn't tied to the start address &dollar;2000. Thus with the default start
address &dollar;800 the main memory area is increased by 6 KB.
<descrip> <descrip>
<tag><tt/RAM:/ Main memory area</tag>
From &dollar;800 to &dollar;BEFF (45.75 KB)
<tag><tt/LC:/ Language Card memory area</tag>
From &dollar;D400 to &dollar;DFFF (3 KB)
<tag><tt/STARTADDRESS:/ Program start address</tag> <tag><tt/STARTADDRESS:/ Program start address</tag>
Variable (default: &dollar;800) Default: &dollar;803. Use <tt/-S &lt;addr&gt;/ to set a different start address.
<tag><tt/HEADER:/ Binary file header</tag> <tag><tt/__EXEHDR__:/ Executable file header</tag>
DOS 3.3 header (address and length) Default: DOS 3.3 header (address and length). Use <tt/-D __EXEHDR__=0/ to omit
the header.
<tag><tt/__STACKSIZE__:/ C runtime stack size</tag>
Default: &dollar;800. Use <tt/-D __STACKSIZE__=&lt;size&gt;/ to set a different
stack size.
<tag><tt/__HIMEM__:/ Highest usable memory address presumed at link time</tag>
Default: &dollar;9600. Use <tt/-D __HIMEM__=&lt;addr&gt;/ to set a different
highest usable address.
<tag><tt/__LCADDR__:/ Address of code in the Language Card</tag>
Default: &dollar;D400. Use <tt/-D __LCADDR__=&lt;addr&gt;/ to set a different
code address.
<tag><tt/__LCSIZE__:/ Size of code in the Language Card</tag>
Default: &dollar;C00. Use <tt/-D __LCSIZE__=&lt;size&gt;/ to set a different
code size.
<tag><tt/__OVERLAYSIZE__:/ Size of code in the overlays</tag>
Default: &dollar;1000. Use <tt/-D __OVERLAYSIZE__=&lt;size&gt;/ to set a different
code size.
</descrip><p> </descrip><p>
<sect1><tt/apple2enh-reboot.cfg/<p> <sect1><tt/apple2enh-asm.cfg/<p>
Configuration optimized for a binary program running on ProDOS 8 without Configuration for a assembler programs which don't need a special setup.
BASIC.SYSTEM. Intended to be used with <bf/LOADER.SYSTEM - an
Apple&nbsp;&rsqb;&lsqb; ProDOS 8 loader for cc65 programs/ (see above) together
with the function <tt/rebootafterexit()/.
If a ProDOS 8 system program doesn't quit to the ProDOS 8 dispatcher but rather Parameters:
reboots the machine after exit then a plain vanilla ProDOS 8 doesn't make use of
the Language Card bank 2 at all.
This setup makes nearly 50 KB available to a cc65 program - on a 64 KB machine!
<descrip> <descrip>
<tag><tt/RAM:/ Main memory area</tag>
From &dollar;800 to &dollar;BEFF (45.75 KB)
<tag><tt/LC:/ Language Card memory area</tag>
From &dollar;D000 to &dollar;DFFF (4 KB)
<tag><tt/STARTADDRESS:/ Program start address</tag> <tag><tt/STARTADDRESS:/ Program start address</tag>
Variable (default: &dollar;800) Default: &dollar;803. Use <tt/-S &lt;addr&gt;/ to set a different start address.
<tag><tt/HEADER:/ Binary file header</tag> <tag><tt/__EXEHDR__:/ Executable file header</tag>
DOS 3.3 header (address and length) Default: No header. Use <tt/-u __EXEHDR__ apple2enh.lib/ to add a DOS 3.3 header
(address and length).
</descrip><p> </descrip><p>
@@ -230,10 +239,10 @@ range.
The easiest (and for really large programs in fact the only) way to have a cc65 The easiest (and for really large programs in fact the only) way to have a cc65
program use the memory from &dollar;800 to &dollar;2000 is to link it as binary program use the memory from &dollar;800 to &dollar;2000 is to link it as binary
(as opposed to system) program using the linker configuration (as opposed to system) program using the default linker configuration
<ref id="apple-load-cfg" name="apple2enh-loader.cfg"> with start address <ref id="apple-def-cfg" name="apple2enh.cfg"> with <tt/__HIMEM__/set to &dollar;BF00
&dollar;803 and load it with the targetutil LOADER.SYSTEM. The program then works and load it with the LOADER.SYSTEM utility. The program then works like a system
like a system program (i.e. quits to the ProDOS dispatcher). program (i.e. quits to the ProDOS dispatcher).
Using LOADER.SYSTEM is as simple as copying it to the ProDOS 8 directory of the Using LOADER.SYSTEM is as simple as copying it to the ProDOS 8 directory of the
program to load under name &lt;program&gt;.SYSTEM as a system program. For program to load under name &lt;program&gt;.SYSTEM as a system program. For
@@ -328,8 +337,8 @@ The names in the parentheses denote the symbols to be used for static linking of
<tag><tt/a2e.hi.tgi (a2e_hi_tgi)/</tag> <tag><tt/a2e.hi.tgi (a2e_hi_tgi)/</tag>
This driver features a resolution of 280&times;192 with 8 colors and two This driver features a resolution of 280&times;192 with 8 colors and two
hires pages. Note that programs using this driver will have to be linked hires pages. Note that programs using this driver will have to be linked
with <tt/--start-addr $4000/ to reserve the first hires page or with with <tt/-S $4000/ to reserve the first hires page or with <tt/-S $6000/
<tt/--start-addr $6000/ to reserve both hires pages. to reserve both hires pages.
Note that the second hires page is only available if the text display is not in Note that the second hires page is only available if the text display is not in
80 column mode. This can be asserted by calling <tt/videomode (VIDEOMODE_40COL);/ 80 column mode. This can be asserted by calling <tt/videomode (VIDEOMODE_40COL);/
@@ -427,7 +436,7 @@ BASIC.SYSTEM) there are some limitations for DOS 3.3:
<tag/Interrupts/ <tag/Interrupts/
There's no <tt/interruptor/ support. Any attempt to use it yields the message There's no <tt/interruptor/ support. Any attempt to use it yields the message
'Failed to alloc interrupt' on program startup. This implicitly means that 'Failed to alloc interrupt' on program startup. This implicitly means that
<tt/a2e.stdmou.mou/ and <tt/a2e.ssc.ser/ are not functional as they depend on joystick, mouse and RS232 device drivers are not functional as they depend on
interrupts. interrupts.
</descrip><p> </descrip><p>
@@ -441,10 +450,6 @@ BASIC.SYSTEM) there are some limitations for DOS 3.3:
The enhanced&nbsp;Apple&nbsp;//e has no color text mode. Therefore the functions The enhanced&nbsp;Apple&nbsp;//e has no color text mode. Therefore the functions
textcolor(), bgcolor() and bordercolor() have no effect. textcolor(), bgcolor() and bordercolor() have no effect.
<tag/Cursor/
The enhanced&nbsp;Apple&nbsp;//e has no hardware cursor. Therefore the function
cursor() has no effect.
</descrip><p> </descrip><p>
@@ -494,7 +499,7 @@ url="ca65.html" name="assembler manual">.
<tag/Drive ID/ <tag/Drive ID/
The function <url url="dio.html#s1" name="dio_open()"> has the single The function <url url="dio.html#s1" name="dio_open()"> has the single
parameter <tt/device/ to identify the device to be opened. Therefore an parameter <tt/device/ to identify the device to be opened. Therefore an
Apple&nbsp;II slot and drive pair is mapped to that <tt/drive_id/ according Apple&nbsp;II slot and drive pair is mapped to that <tt/device/ according
to the formula to the formula
<tscreen> <tscreen>
@@ -512,6 +517,109 @@ url="ca65.html" name="assembler manual">.
</descrip><p> </descrip><p>
<sect1>Specifying file types for fopen<p>
<descrip>
<tag>Explanation of File Types</tag>
ProDOS associates a file type and an auxiliary type with each file.
These type specifications are separate from the file's name, unlike
Windows which uses the file name's suffix (a.k.a.
extension) to specify the file type. For example, <tt/.exe/,
<tt/.doc/, or <tt/.bat/.
The ProDOS low-level
Machine-Language Interface (MLI) functions for creating and opening
files require these types to be specified. And if they don't match
with the file being opened, the operation may fail.
In contrast, the ISO C function <tt/fopen()/ and the POSIX function
<tt/open()/ have no parameter to specify either a file type or an
auxiliary type. Therefore, some additional mechanism for specifying
the file types is needed.
<tag>Specifying the File Type and Auxiliary Type</tag>
There are two global variables provided that allow the file type
and auxiliary type to be specified before a call to <tt/fopen()/
or <tt/open()/. They are defined in <tt/apple2_filetype.h/:
<tscreen>
<verb>
extern unsigned char _filetype; /* Default: PRODOS_T_BIN */
extern unsigned int _auxtype; /* Default: 0 */
</verb>
</tscreen>
The header file <tt/apple2_filetype.h/ also defines many values
that can be used to set these variables. It is included in
<tt/apple2.h/, which is in turn included in <tt/apple2enh.h/.
So it isn't necessary to include it directly. Just
include one of <tt/apple2.h/ or <tt/apple2enh.h/.
<tag>Example</tag>
A text file cannot be created with just the
standard C functions because they default to the binary type
<tt/PRODOS_T_BIN/. The <tt/_filetype/ variable must be set to
<tt/PRODOS_T_TXT/ to create a text file.
For a text file,
<tt/_auxtype/ specifies the record length. A zero record
length text file is referred to as a sequential text file.
This is equivalent to text files on
other operating systems, except that the line terminator is a
carriage return instead of a line-feed (Linux/BSD/MacOS) or
carriage return, line-feed pair (Windows).
The "sequential" text file terminology is in contrast to a
"random-access" text file which would
have a fixed-length, non-zero record length, so that the
file position of any individual record can be calculated.
For this example, the
<tt/_auxtype/ does not need to be set because it defaults to
the desired value, which is zero. To be more explicit,
<tt/_auxtype/ can also be set to <tt/PRODOS_AUX_T_TXT_SEQ/
which is defined as zero.
<tscreen>
<verb>
&num;include &lt;stdio.h&gt;
&num;include &lt;string.h&gt;
&num;include &lt;errno.h&gt;
&num;include &lt;apple2.h&gt;
void main(void)
{
FILE *out;
char *name = "MY.FAVS";
/*-----------------------------*/
_filetype = PRODOS_T_TXT;
_auxtype = PRODOS_AUX_T_TXT_SEQ;
/*-----------------------------*/
if ((out = fopen(name, "w")) != NULL) {
fputs("Jorah Mormont\r", out);
fputs("Brienne of Tarth\r", out);
fputs("Daenerys Targaryen\r", out);
fputs("Sandor Clegane\r", out);
if (fclose(out) == EOF) {
fprintf(stderr, "fclose failed for %s: %s", name, strerror(errno));
}
}
else {
fprintf(stderr, "fopen failed for %s: %s", name, strerror(errno));
}
}
</verb>
</tscreen>
</descrip><p>
<sect>License<p> <sect>License<p>

View File

@@ -4,7 +4,7 @@
<title>ar65 Users Guide <title>ar65 Users Guide
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>19.07.2000 <date>2017-05-28
<abstract> <abstract>
ar65 is an archiver for object files generated by ca65. It allows to create ar65 is an archiver for object files generated by ca65. It allows to create
@@ -32,16 +32,17 @@ for the cc65 compiler. ar65 is part of this suite.
The archiver is called as follows: The archiver is called as follows:
<tscreen><verb> <tscreen><verb>
Usage: ar65 <operation> lib file|module ... Usage: ar65 <operation ...> lib file|module ...
Operation is one of: Operations are some of:
a Add modules r Add modules
d Delete modules d Delete modules
l List library contents t List library table
x Extract modules v Increase verbosity (put before other operation)
V Print the archiver version x Extract modules
V Print the archiver version
</verb></tscreen> </verb></tscreen>
You may add modules to a library using the `a' command. If the library You may add modules to a library using the `r' command (`a' is deprecated). If the library
does not exist, it is created (and a warning message is printed which you does not exist, it is created (and a warning message is printed which you
may ignore if creation of the library was your intention). You may may ignore if creation of the library was your intention). You may
specify any number of modules on the command line following the library. specify any number of modules on the command line following the library.
@@ -53,7 +54,7 @@ has a newer timestamp than the one to add.
Here's an example: Here's an example:
<tscreen><verb> <tscreen><verb>
ar65 a mysubs.lib sub1.o sub2.o ar65 r mysubs.lib sub1.o sub2.o
</verb></tscreen> </verb></tscreen>
This will add two modules to the library `mysubs.lib' creating the This will add two modules to the library `mysubs.lib' creating the
@@ -63,10 +64,10 @@ sub2.o, they are replaced by the new ones.
Modules names in the library are stored without the path, so, using Modules names in the library are stored without the path, so, using
<tscreen><verb> <tscreen><verb>
ar65 a mysubs.lib ofiles/sub1.o ofiles/sub2.o ar65 v v r mysubs.lib ofiles/sub1.o ofiles/sub2.o
</verb></tscreen> </verb></tscreen>
will add two modules named `sub1.o' and `sub2.o' to the library. will verbose add two modules named `sub1.o' and `sub2.o' to the library.
Deleting modules from a library is done with the `d' command. You may not Deleting modules from a library is done with the `d' command. You may not
give a path when naming the modules. give a path when naming the modules.
@@ -81,13 +82,13 @@ This will delete the module named `sub1.o' from the library, printing an
error if the library does not contain that module. error if the library does not contain that module.
The `l' command prints a list of all modules in the library. Any module The `t' command prints a table of all modules in the library (`l' is deprecated).
names on the command line are ignored. Any module names on the command line are ignored.
Example: Example:
<tscreen><verb> <tscreen><verb>
ar65 l mysubs.lib ar65 tv mysubs.lib
</verb></tscreen> </verb></tscreen>

View File

@@ -148,7 +148,7 @@ Special locations:
(&dollar;58). (&dollar;58).
<tag/Stack/ <tag/Stack/
The C runtime stack is located at end of the RAM memory area (&dollar;CFFF) The C runtime stack is located at end of the MAIN memory area (&dollar;CFFF)
and grows downwards. and grows downwards.
<tag/Heap/ <tag/Heap/
@@ -229,8 +229,8 @@ for C and assembly language programs.
The size of a cassette boot file is restricted to 32K. Larger programs The size of a cassette boot file is restricted to 32K. Larger programs
would need to be split in more parts and the parts to be loaded manually. would need to be split in more parts and the parts to be loaded manually.
To write the generated file to a cassette, a utility to run To write the generated file to a cassette, a utility (<tt/w2cas.com/) to run
on an Atari is provided in the <tt/targetutil/ directory (<tt/w2cas.com/). on an Atari is provided in the <tt/util/ directory of <tt/atari/ target dir.
<sect1><tt/atarixl/ config files<p> <sect1><tt/atarixl/ config files<p>
@@ -275,6 +275,7 @@ See the <url url="funcref.html" name="function reference"> for declaration and u
<item>_getcolor <item>_getcolor
<item>_getdefdev <item>_getdefdev
<item>_graphics <item>_graphics
<item>_is_cmdline_dos
<item>_rest_vecs <item>_rest_vecs
<item>_save_vecs <item>_save_vecs
<item>_scroll <item>_scroll
@@ -316,6 +317,101 @@ chip registers.
</descrip><p> </descrip><p>
<sect1>Display lists<p>
A major feature of the Atari graphics chip "ANTIC" is to
process instructions for the display generation.
cc65 supports constructing these display lists by offering defines
for the instructions. In conjunction with the "void"-variable extension
of cc65, display lists can be created quite comfortable:
<verb>
...
unsigned char ScreenMemory[100];
void DisplayList =
{
DL_BLK8,
DL_BLK8,
DL_BLK8,
DL_LMS(DL_CHR20x8x2),
ScreenMemory,
DL_CHR20x8x2,
DL_CHR20x8x2,
DL_CHR20x8x2,
DL_BLK4,
DL_CHR20x8x2,
DL_JVB
};
...
POKEW(560,(unsigned int)&amp;DisplayList); // SDLSTL
...
</verb>
Please inspect the <tt/_antic.h/ header file to detemine the supported
instruction names. Modifiers on instructions can be nested without need
for an order:
<tt/DL_LMS(DL_HSCROL(DL_VSCROL(DL_DLI(DL_MAP80x4x2))))/
Please mind that ANTIC has memory alignment requirements for "player
missile graphics"-data, font data, display lists and screen memory. Creation
of a special linker configuration with appropriate aligned segments and
switching to that segment in the c-code is usually neccessary. A more memory
hungry solution consists in using the "<tt/posix_memalign()/" function in
conjunction with copying your data to the allocated memory.
<sect1>Character mapping<p>
The Atari has two representations for characters:
<enum>
<item> ATASCII is character mapping which is similar to ASCII and used
by the CIO system of the OS. This is the default mapping of cc65 when
producing code for the atari target.
<item> The internal/screen mapping represents the real value of the
screen ram when showing a character.
</enum>
For direct memory access (simplicity and speed) enabling the internal
mapping can be useful. This can be achieved by including the
"<tt/atari_screen_charmap.h/" header.
A word of caution: Since the <tt/0x00/ character has to be mapped in an
incompatible way to the C-standard, the usage of string functions in
conjunction with internal character mapped strings delivers unexpected
results regarding the string length. The end of strings are detected where
you may not expect them (too early or (much) too late). Internal mapped
strings typically support the "<tt/mem...()/" functions.
<em>For assembler sources the macro "<tt/scrcode/" from the "<tt/atari.mac/"
package delivers the same feature.</em>
You can switch back to the ATASCII mapping by including
"<tt/atari_atascii_charmap.h/".
A final note: Since cc65 has currently some difficulties with string merging
under different mappings, defining remapped strings works only flawlessly
with static array initialization:
<verb>
#include &lt;atari\_screen\_charmap.h&gt;
char pcScreenMappingString[] = "Hello Atari!";
#include &lt;atari_atascii_charmap.h&gt;
char pcAtasciiMappingString[] = "Hello Atari!";
</verb>
delivers correct results, while
<verb>
#include &lt;atari_screen_charmap.h&gt;
char* pcScreenMappingString = "Hello Atari!";
#include &lt;atari_atascii_charmap.h&gt;
char* pcAtasciiMappingString = "Hello Atari!";
</verb>
does not.
<sect>Loadable drivers<p> <sect>Loadable drivers<p>
@@ -561,7 +657,7 @@ The contents of this chunk come from the SYSCHKCHNK memory area of the linker co
<item>main program&nl; <item>main program&nl;
This load chunk is loaded at the selected program start address (default &dollar;2000) and This load chunk is loaded at the selected program start address (default &dollar;2000) and
contains all of the code and data of the program.&nl; contains all of the code and data of the program.&nl;
The contents of this chunk come from the RAM memory area of the linker config file. The contents of this chunk come from the MAIN memory area of the linker config file.
</enum> </enum>
@@ -743,7 +839,7 @@ segments should go above &dollar;7FFF.
<p> <p>
The main problem is that the EXE header generated by the cc65 runtime The main problem is that the EXE header generated by the cc65 runtime
lib is wrong. It defines a single load chunk with the sizes/addresses lib is wrong. It defines a single load chunk with the sizes/addresses
of the STARTUP, LOWCODE, INIT, CODE, RODATA, and DATA segments, in of the STARTUP, LOWCODE, ONCE, CODE, RODATA, and DATA segments, in
fact, the whole user program (we're disregarding the "system check" fact, the whole user program (we're disregarding the "system check"
load chunk here). load chunk here).
<p> <p>
@@ -796,7 +892,7 @@ SEGMENTS {
NEXEHDR: load = FSTHDR, type = ro; # first load chunk NEXEHDR: load = FSTHDR, type = ro; # first load chunk
STARTUP: load = RAMLO, type = ro, define = yes; STARTUP: load = RAMLO, type = ro, define = yes;
LOWCODE: load = RAMLO, type = ro, define = yes, optional = yes; LOWCODE: load = RAMLO, type = ro, define = yes, optional = yes;
INIT: load = RAMLO, type = ro, optional = yes; ONCE: load = RAMLO, type = ro, optional = yes;
CODE: load = RAMLO, type = ro, define = yes; CODE: load = RAMLO, type = ro, define = yes;
CHKHDR: load = SECHDR, type = ro; # second load chunk CHKHDR: load = SECHDR, type = ro; # second load chunk
@@ -808,7 +904,7 @@ SEGMENTS {
AUTOSTRT: load = RAM, type = ro; # defines program entry point AUTOSTRT: load = RAM, type = ro; # defines program entry point
} }
FEATURES { FEATURES {
CONDES: segment = RODATA, CONDES: segment = ONCE,
type = constructor, type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__; count = __CONSTRUCTOR_COUNT__;
@@ -827,7 +923,7 @@ the MAINHDR segment get discarded.
<p> <p>
The newly added NEXEHDR segment defines the correct chunk header for the The newly added NEXEHDR segment defines the correct chunk header for the
first intended load chunk. It first intended load chunk. It
puts the STARTUP, LOWCODE, INIT, and CODE segments, which are the puts the STARTUP, LOWCODE, ONCE, and CODE segments, which are the
segments containing only code, into load chunk #1 (RAMLO memory area). segments containing only code, into load chunk #1 (RAMLO memory area).
<p> <p>
The header for the second load chunk comes from the new CHKHDR The header for the second load chunk comes from the new CHKHDR
@@ -858,7 +954,7 @@ cl65 -t atari -C split.cfg -o prog.com prog.c split.s
<sect2>Low data and high code example<p> <sect2>Low data and high code example<p>
Goal: Put RODATA and DATA into low memory and STARTUP, LOWCODE, INIT, Goal: Put RODATA and DATA into low memory and STARTUP, LOWCODE, ONCE,
CODE, BSS, ZPSAVE into high memory (split2.cfg): CODE, BSS, ZPSAVE into high memory (split2.cfg):
<tscreen><verb> <tscreen><verb>
@@ -893,7 +989,7 @@ SEGMENTS {
CHKHDR: load = SECHDR, type = ro; # second load chunk CHKHDR: load = SECHDR, type = ro; # second load chunk
STARTUP: load = RAM, type = ro, define = yes; STARTUP: load = RAM, type = ro, define = yes;
INIT: load = RAM, type = ro, optional = yes; ONCE: load = RAM, type = ro, optional = yes;
CODE: load = RAM, type = ro, define = yes; CODE: load = RAM, type = ro, define = yes;
BSS: load = RAM, type = bss, define = yes; BSS: load = RAM, type = bss, define = yes;
@@ -901,7 +997,7 @@ SEGMENTS {
AUTOSTRT: load = RAM, type = ro; # defines program entry point AUTOSTRT: load = RAM, type = ro; # defines program entry point
} }
FEATURES { FEATURES {
CONDES: segment = RODATA, CONDES: segment = ONCE,
type = constructor, type = constructor,
label = __CONSTRUCTOR_TABLE__, label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__; count = __CONSTRUCTOR_COUNT__;

124
doc/atari2600.sgml Normal file
View File

@@ -0,0 +1,124 @@
<!doctype linuxdoc system>
<article>
<title>Atari 2600 specific information for cc65
<author>
<url url="mailto:contact@florentflament.com" name="Florent Flament"><newline>
<date>2017-01-11
<abstract>
An overview over the Atari 2600 runtime system as it is implemented
for the cc65 C compiler.
</abstract>
<!-- Table of contents -->
<toc>
<!-- Begin the document -->
<sect>Overview<p>
This file contains an overview of the Atari 2600 runtime system as it
comes with the cc65 C compiler. It describes the memory layout, Atari
2600 specific header files and any pitfalls specific to that platform.
<sect>Binary format<p>
The default binary output format generated by the linker for the Atari
2600 target is a 4K cartridge image.
<sect>Memory layout<p>
cc65 generated programs with the default setup can use RAM from
&dollar;0080 to &dollar;00FF - __STACKSIZE__, where __STACKSIZE__ is
the size of the system stack with a default value of 16 bytes. The
size of the system stack can be customized by defining the
__STACKSIZE__ linker variable.
Special locations:
<descrip>
<tag/Stack/ The C runtime stack is located at &dollar;00FF -
__STACKSIZE__ and growing downwards.
<tag/Heap/ The C heap is located at &dollar;0080 and grows upwards.
</descrip><p>
<sect>Start-up condition<p>
When powered-up, the Atari 2600 TIA registers contain random
values. During the initialization phase, the start-up code needs to
initialize the TIA registers to sound values (or else the console has
an unpredictable behavior). In this implementation, zeros are written
to all of TIA registers during the start-up phase.
Note that RIOT registers (mostly timers) are left uninitialized, as
they don't have any consequence on the console behavior.
<sect>Platform specific header files<p>
Programs containing Atari 2600 specific code may use the
<tt/atari2600.h/ header file.
The following pseudo variables declared in the <tt/atari2600.h/ header
file allow access to the Atari 2600 TIA & RIOT chips registers.
<descrip>
<tag><tt/TIA/</tag> The <tt/TIA/ structure allows read/write access
to the Atari 2600 TIA chip registers. See the <tt/_tia.h/ header
file located in the include directory for the declaration of the
structure. Also refer to the Stella Programmer's Guide by Steve
Wright for a detailed description of the chip and its registers.
<tag><tt/RIOT/</tag> The <tt/RIOT/ structure allows read/write
access to the Atari 2600 RIOT chip registers. See the
<tt/_riot.h/ header file located in the include directory for the
declaration of the structure. Also refer to the Stella Programmer's
Guide by Steve Wright for a detailed description of the chip and its
registers.
</descrip><p>
<sect>Loadable drivers<p>
There are no drivers for the Atari 2600.
<sect>Limitations<p>
TBD
<sect>Other hints<p>
One may write a custom linker configuration file to tune the memory
layout of a program. See the <tt/atari2600.cfg/ file in the cfg
directory as a starting point.
<sect>License<p>
This software is provided 'as-is', without any expressed or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
<enum>
<item> The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source
distribution.
</enum>
</article>

View File

@@ -191,11 +191,19 @@ missing on VDC, and are translated to the two colors missing from the VIC palett
<descrip> <descrip>
<tag><tt/c128-efnram.emd (c128_efnram_emd)/</tag>
Extended memory driver for the C128 External Function RAM.
Written and contributed by Marco van den Heuvel.
<tag><tt/c128-georam.emd (c128_georam_emd)/</tag> <tag><tt/c128-georam.emd (c128_georam_emd)/</tag>
A driver for the GeoRam cartridge. The driver will always assume 2048 pages A driver for the GeoRam cartridge. The driver will always assume 2048 pages
of 256 bytes each. There are no checks, so if your program knows better, of 256 bytes each. There are no checks, so if your program knows better,
just go ahead. just go ahead.
<tag><tt/c128-ifnram.emd (c128_ifnram_emd)/</tag>
Extended memory driver for the C128 Internal Function RAM.
Written and contributed by Marco van den Heuvel.
<tag><tt/c128-ram.emd (c128_ram_emd)/</tag> <tag><tt/c128-ram.emd (c128_ram_emd)/</tag>
An extended memory driver for the RAM in page 1. The common memory area is An extended memory driver for the RAM in page 1. The common memory area is
excluded, so this driver supports 251 pages of 256 bytes each. excluded, so this driver supports 251 pages of 256 bytes each.
@@ -236,8 +244,9 @@ The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/c128-stdj
<tag><tt/c128-ptvjoy.joy (c128_ptvjoy_joy)/</tag> <tag><tt/c128-ptvjoy.joy (c128_ptvjoy_joy)/</tag>
Driver for the Protovision 4-player adapter originally written by Groepaz Driver for the Protovision 4-player adapter originally written by Groepaz
for the C64, and converted for the C128 by Uz. See <url for the C64, and converted for the C128 by Uz. See <url
url="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and url="http://www.protovision-online.de/hardw/4_player.php?language=en"
building instructions. Up to four joysticks are supported. name="Protovision shop"> for prices and building instructions. Up to four
joysticks are supported.
<tag><tt/c128-stdjoy.joy (c128_stdjoy_joy)/</tag> <tag><tt/c128-stdjoy.joy (c128_stdjoy_joy)/</tag>
Supports up to two joysticks connected to the standard joysticks ports of Supports up to two joysticks connected to the standard joysticks ports of

View File

@@ -3,8 +3,9 @@
<article> <article>
<title>Commodore 64-specific information for cc65 <title>Commodore 64-specific information for cc65
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"><newline>
<date>2014-04-14 <url url="mailto:greg.king5@verizon.net" name="Greg King">
<date>2017-01-18
<abstract> <abstract>
An overview over the C64 runtime system as it is implemented for the cc65 C An overview over the C64 runtime system as it is implemented for the cc65 C
@@ -235,12 +236,22 @@ structures, accessing the struct fields will access the chip registers.
The names in the parentheses denote the symbols to be used for static linking of the drivers. The names in the parentheses denote the symbols to be used for static linking of the drivers.
<label id="graphics-drivers">
<sect1>Graphics drivers<p> <sect1>Graphics drivers<p>
<em>Note:</em> All available graphics drivers for the TGI interface will use <em>Note:</em> All available graphics drivers for the TGI interface will use
the space below the I/O area and kernal ROM, so you can have hires graphics in the space below the I/O area and Kernal ROM; so, you can have hires graphics in
the standard setup without any memory loss or need for a changed the standard setup without any memory loss or need for a changed configuration.
configuration.
You can use a mouse driver at the same time that you use a TGI driver. But, if
you want to see the default mouse pointer on the graphics screen, then you
explicitly must link a special object file into your program. It will put the
arrow into the "high RAM" area where the bitmaps are put. Its name is
"<tt/c64-tgimousedata.o/". Example:
<tscreen><verb>
cl65 -t c64 -o program-file main-code.c subroutines.s c64-tgimousedata.o
</verb></tscreen>
<descrip> <descrip>
<tag><tt/c64-hi.tgi (c64_hi_tgi)/</tag> <tag><tt/c64-hi.tgi (c64_hi_tgi)/</tag>
@@ -251,12 +262,17 @@ configuration.
Note that the graphics drivers are incompatible with the Note that the graphics drivers are incompatible with the
<tt/c64-ram.emd (c64_ram_emd)/ extended memory driver and the <tt/c64-ram.emd (c64_ram_emd)/ extended memory driver and the
<tt/c64-soft80.o/ software 80 columns conio driver. <tt/c64-soft80.o/ software 80-columns conio driver.
<sect1>Extended memory drivers<p> <sect1>Extended memory drivers<p>
<descrip> <descrip>
<tag><tt/c64-65816.emd (c64_65816_emd)/</tag>
Extended memory driver for 65816 (eg SCPU) based extra RAM.
Written and contributed by Marco van den Heuvel.
<tag><tt/c64-c256k.emd (c64_c256k_emd)/</tag> <tag><tt/c64-c256k.emd (c64_c256k_emd)/</tag>
A driver for the C64 256K memory expansion. This driver offers 768 pages of A driver for the C64 256K memory expansion. This driver offers 768 pages of
256 bytes each. Written and contributed by Marco van den Heuvel. 256 bytes each. Written and contributed by Marco van den Heuvel.
@@ -315,8 +331,9 @@ The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/c64-stdjo
<tag><tt/c64-ptvjoy.joy (c64_ptvjoy_joy)/</tag> <tag><tt/c64-ptvjoy.joy (c64_ptvjoy_joy)/</tag>
Driver for the Protovision 4-player adapter contributed by Groepaz. See Driver for the Protovision 4-player adapter contributed by Groepaz. See
<url url="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and <url url="http://www.protovision-online.de/hardw/4_player.php?language=en"
building instructions. Up to four joysticks are supported. name="Protovision shop"> for prices and building instructions. Up to four
joysticks are supported.
<tag><tt/c64-stdjoy.joy (c64_stdjoy_joy)/</tag> <tag><tt/c64-stdjoy.joy (c64_stdjoy_joy)/</tag>
Supports up to two standard joysticks connected to the joysticks port of Supports up to two standard joysticks connected to the joysticks port of
@@ -331,6 +348,9 @@ The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/c64-stdjo
<sect1>Mouse drivers<p> <sect1>Mouse drivers<p>
You can use these drivers in text-mode or graphics-mode (TGI) programs. See
the description of <ref id="graphics-drivers" name="the graphics drivers">.
The default drivers, <tt/mouse_stddrv (mouse_static_stddrv)/, point to <tt/c64-1351.mou (c64_1351_mou)/. The default drivers, <tt/mouse_stddrv (mouse_static_stddrv)/, point to <tt/c64-1351.mou (c64_1351_mou)/.
<descrip> <descrip>

View File

@@ -4,7 +4,7 @@
<title>ca65 Users Guide <title>ca65 Users Guide
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline> <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
<url url="mailto:greg.king5@verizon.net" name="Greg King"> <url url="mailto:greg.king5@verizon.net" name="Greg King">
<date>2015-11-17 <date>2016-06-11
<abstract> <abstract>
ca65 is a powerful macro assembler for the 6502, 65C02, and 65816 CPUs. It is ca65 is a powerful macro assembler for the 6502, 65C02, and 65816 CPUs. It is
@@ -152,7 +152,7 @@ Here is a description of all the command line options:
Set the default for the CPU type. The option takes a parameter, which Set the default for the CPU type. The option takes a parameter, which
may be one of may be one of
6502, 65SC02, 65C02, 65816, sweet16, HuC6280 6502, 6502X, 65SC02, 65C02, 65816, sweet16, HuC6280, 4510
<label id="option-create-dep"> <label id="option-create-dep">
@@ -424,8 +424,10 @@ The assembler accepts
<tt><ref id=".PSC02" name=".PSC02"></tt> command was given). <tt><ref id=".PSC02" name=".PSC02"></tt> command was given).
<item>all valid 65C02 mnemonics when in 65C02 mode (after the <item>all valid 65C02 mnemonics when in 65C02 mode (after the
<tt><ref id=".PC02" name=".PC02"></tt> command was given). <tt><ref id=".PC02" name=".PC02"></tt> command was given).
<item>all valid 65618 mnemonics when in 65816 mode (after the <item>all valid 65816 mnemonics when in 65816 mode (after the
<tt><ref id=".P816" name=".P816"></tt> command was given). <tt><ref id=".P816" name=".P816"></tt> command was given).
<item>all valid 4510 mnemonics when in 4510 mode (after the
<tt><ref id=".P4510" name=".P4510"></tt> command was given).
</itemize> </itemize>
@@ -434,16 +436,16 @@ The assembler accepts
In 65816 mode, several aliases are accepted, in addition to the official In 65816 mode, several aliases are accepted, in addition to the official
mnemonics: mnemonics:
<tscreen><verb> <itemize>
CPA is an alias for CMP <item><tt>CPA</tt> is an alias for <tt>CMP</tt>
DEA is an alias for DEC A <item><tt>DEA</tt> is an alias for <tt>DEC A</tt>
INA is an alias for INC A <item><tt>INA</tt> is an alias for <tt>INC A</tt>
SWA is an alias for XBA <item><tt>SWA</tt> is an alias for <tt>XBA</tt>
TAD is an alias for TCD <item><tt>TAD</tt> is an alias for <tt>TCD</tt>
TAS is an alias for TCS <item><tt>TAS</tt> is an alias for <tt>TCS</tt>
TDA is an alias for TDC <item><tt>TDA</tt> is an alias for <tt>TDC</tt>
TSA is an alias for TSC <item><tt>TSA</tt> is an alias for <tt>TSC</tt>
</verb></tscreen> </itemize>
<sect1>6502X mode<label id="6502X-mode"><p> <sect1>6502X mode<label id="6502X-mode"><p>
@@ -473,6 +475,27 @@ from the mentioned web page, for more information, see there.
</itemize> </itemize>
<sect1>4510 mode<p>
The 4510 is a microcontroller that is the core of the Commodore C65 aka C64DX.
It contains among other functions a slightly modified 65CE02/4502 CPU, to allow
address mapping for 20 bits of address space (1 megabyte addressable area).
As compared to the description of the CPU in the
<url url="http://www.zimmers.net/anonftp/pub/cbm/c65/c65manualupdated.txt.gz"
name="C65 System Specification">
<url url="https://raw.githubusercontent.com/MEGA65/c65-specifications/master/c65manualupdated.txt"
name="(updated version)"> uses these changes:
<itemize>
<item><tt>LDA (d,SP),Y</tt> may also be written as <tt>LDA (d,S),Y</tt>
(matching the 65816 notataion).
<item>All branch instruction allow now 16 bit offsets. To use a 16 bit
branch you have to prefix these with an "L" (e.g. "<tt>LBNE</tt>" instead of
"<tt>BNE</tt>"). This might change at a later implementation of the assembler.
</itemize>
For more information about the Commodore C65/C64DX and the 4510 CPU, see
<url url="http://www.zimmers.net/anonftp/pub/cbm/c65/"> and
<url url="https://en.wikipedia.org/wiki/Commodore_65" name="Wikipedia">.
<sect1>sweet16 mode<label id="sweet16-mode"><p> <sect1>sweet16 mode<label id="sweet16-mode"><p>
@@ -2170,16 +2193,15 @@ Here's a list of all control commands and a description, what they do:
<sect1><tt>.CHARMAP</tt><label id=".CHARMAP"><p> <sect1><tt>.CHARMAP</tt><label id=".CHARMAP"><p>
Apply a custom mapping for characters. The command is followed by two Apply a custom mapping for characters. The command is followed by two
numbers. The first one is the index of the source character (range 1..255), numbers. The first one is the index of the source character (range 0..255);
the second one is the mapping (range 0..255). The mapping applies to all the second one is the mapping (range 0..255). The mapping applies to all
character and string constants when they generate output, and overrides a character and string constants <em/when/ they generate output; and, overrides
mapping table specified with the <tt><ref id="option-t" name="-t"></tt> a mapping table specified with the <tt><ref id="option-t" name="-t"></tt>
command line switch. command line switch.
Example: Example:
<tscreen><verb> <tscreen><verb>
.charmap $41, $61 ; Map 'A' to 'a' .charmap $41, $61 ; Map 'A' to 'a'
</verb></tscreen> </verb></tscreen>
@@ -2699,6 +2721,22 @@ Here's a list of all control commands and a description, what they do:
at character is not allowed to start an identifier, even with this at character is not allowed to start an identifier, even with this
feature enabled. feature enabled.
<tag><tt>bracket_as_indirect</tt><label id="bracket_as_indirect"></tag>
Use <tt>[]</tt> instead of <tt>()</tt> for the indirect addressing modes.
Example:
<tscreen><verb>
lda [$82]
lda [$82,x]
lda [$82],y
jmp [$fffe]
jmp [table,x]
</verb></tscreen>
<em/Note:/ This should not be used in 65186 mode because it conflicts with
the 65816 instruction syntax for far addressing. See the section covering
<tt/<ref id="address-sizes" name="address sizes">/ for more information.
<tag><tt>c_comments</tt><label id="c_comments"></tag> <tag><tt>c_comments</tt><label id="c_comments"></tag>
Allow C like comments using <tt>/*</tt> and <tt>*/</tt> as left and right Allow C like comments using <tt>/*</tt> and <tt>*/</tt> as left and right
@@ -2974,7 +3012,7 @@ Here's a list of all control commands and a description, what they do:
Conditional assembly: Check if there are any remaining tokens in this line, Conditional assembly: Check if there are any remaining tokens in this line,
and evaluate to FALSE if this is the case, and to TRUE otherwise. If the and evaluate to FALSE if this is the case, and to TRUE otherwise. If the
condition is not true, further lines are not assembled until an <tt><ref condition is not true, further lines are not assembled until an <tt><ref
id=".ELSE" name=".ESLE"></tt>, <tt><ref id=".ELSEIF" name=".ELSEIF"></tt> or id=".ELSE" name=".ELSE"></tt>, <tt><ref id=".ELSEIF" name=".ELSEIF"></tt> or
<tt><ref id=".ENDIF" name=".ENDIF"></tt> directive. <tt><ref id=".ENDIF" name=".ENDIF"></tt> directive.
This command is often used to check if a macro parameter was given. Since an This command is often used to check if a macro parameter was given. Since an
@@ -3067,6 +3105,12 @@ Here's a list of all control commands and a description, what they do:
(see <tt><ref id=".P02" name=".P02"></tt> command). (see <tt><ref id=".P02" name=".P02"></tt> command).
<sect1><tt>.IFP4510</tt><label id=".IFP4510"><p>
Conditional assembly: Check if the assembler is currently in 4510 mode
(see <tt><ref id=".P4510" name=".P4510"></tt> command).
<sect1><tt>.IFP816</tt><label id=".IFP816"><p> <sect1><tt>.IFP816</tt><label id=".IFP816"><p>
Conditional assembly: Check if the assembler is currently in 65816 mode Conditional assembly: Check if the assembler is currently in 65816 mode
@@ -3458,7 +3502,18 @@ Here's a list of all control commands and a description, what they do:
<tt><ref id="option--cpu" name="--cpu"></tt> command line option. <tt><ref id="option--cpu" name="--cpu"></tt> command line option.
See: <tt><ref id=".PC02" name=".PC02"></tt>, <tt><ref id=".PSC02" See: <tt><ref id=".PC02" name=".PC02"></tt>, <tt><ref id=".PSC02"
name=".PSC02"></tt> and <tt><ref id=".P816" name=".P816"></tt> name=".PSC02"></tt>, <tt><ref id=".P816" name=".P816"></tt> and
<tt><ref id=".P4510" name=".P4510"></tt>
<sect1><tt>.P4510</tt><label id=".P4510"><p>
Enable the 4510 instruction set. This is a superset of the 65C02 and
6502 instruction sets.
See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PSC02"
name=".PSC02"></tt>, <tt><ref id=".PC02" name=".PC02"></tt> and
<tt><ref id=".P816" name=".P816"></tt>
<sect1><tt>.P816</tt><label id=".P816"><p> <sect1><tt>.P816</tt><label id=".P816"><p>
@@ -3467,7 +3522,8 @@ Here's a list of all control commands and a description, what they do:
6502 instruction sets. 6502 instruction sets.
See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PSC02" See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PSC02"
name=".PSC02"></tt> and <tt><ref id=".PC02" name=".PC02"></tt> name=".PSC02"></tt>, <tt><ref id=".PC02" name=".PC02"></tt> and
<tt><ref id=".P4510" name=".P4510"></tt>
<sect1><tt>.PAGELEN, .PAGELENGTH</tt><label id=".PAGELENGTH"><p> <sect1><tt>.PAGELEN, .PAGELENGTH</tt><label id=".PAGELENGTH"><p>
@@ -3495,7 +3551,8 @@ Here's a list of all control commands and a description, what they do:
6502 and 65SC02 instructions. 6502 and 65SC02 instructions.
See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PSC02" See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PSC02"
name=".PSC02"></tt> and <tt><ref id=".P816" name=".P816"></tt> name=".PSC02"></tt>, <tt><ref id=".P816" name=".P816"></tt> and
<tt><ref id=".P4510" name=".P4510"></tt>
<sect1><tt>.POPCPU</tt><label id=".POPCPU"><p> <sect1><tt>.POPCPU</tt><label id=".POPCPU"><p>
@@ -3568,7 +3625,8 @@ Here's a list of all control commands and a description, what they do:
6502 instructions. 6502 instructions.
See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PC02" See: <tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".PC02"
name=".PC02"></tt> and <tt><ref id=".P816" name=".P816"></tt> name=".PC02"></tt>, <tt><ref id=".P816" name=".P816"></tt> and
<tt><ref id=".P4510" name=".P4510"></tt>
<sect1><tt>.PUSHCPU</tt><label id=".PUSHCPU"><p> <sect1><tt>.PUSHCPU</tt><label id=".PUSHCPU"><p>
@@ -3760,7 +3818,7 @@ Here's a list of all control commands and a description, what they do:
Switch the CPU instruction set. The command is followed by a string that Switch the CPU instruction set. The command is followed by a string that
specifies the CPU. Possible values are those that can also be supplied to specifies the CPU. Possible values are those that can also be supplied to
the <tt><ref id="option--cpu" name="--cpu"></tt> command line option, the <tt><ref id="option--cpu" name="--cpu"></tt> command line option,
namely: 6502, 6502X, 65SC02, 65C02, 65816 and HuC6280. namely: 6502, 6502X, 65SC02, 65C02, 65816, 4510 and HuC6280.
See: <tt><ref id=".CPU" name=".CPU"></tt>, See: <tt><ref id=".CPU" name=".CPU"></tt>,
<tt><ref id=".IFP02" name=".IFP02"></tt>, <tt><ref id=".IFP02" name=".IFP02"></tt>,
@@ -3769,6 +3827,7 @@ Here's a list of all control commands and a description, what they do:
<tt><ref id=".IFPSC02" name=".IFPSC02"></tt>, <tt><ref id=".IFPSC02" name=".IFPSC02"></tt>,
<tt><ref id=".P02" name=".P02"></tt>, <tt><ref id=".P02" name=".P02"></tt>,
<tt><ref id=".P816" name=".P816"></tt>, <tt><ref id=".P816" name=".P816"></tt>,
<tt><ref id=".P4510" name=".P4510"></tt>,
<tt><ref id=".PC02" name=".PC02"></tt>, <tt><ref id=".PC02" name=".PC02"></tt>,
<tt><ref id=".PSC02" name=".PSC02"></tt> <tt><ref id=".PSC02" name=".PSC02"></tt>
@@ -4246,6 +4305,13 @@ different:
some things may be done with both macro types, each type has special some things may be done with both macro types, each type has special
usages. The types complement each other. usages. The types complement each other.
<item> Parentheses work differently from C macros.
The common practice of wrapping C macros in parentheses may cause
unintended problems here, such as accidentally implying an
indirect addressing mode. While the definition of a macro requires
parentheses around its argument list, when invoked they should not be
included.
</itemize> </itemize>
Let's look at a few examples to make the advantages and disadvantages Let's look at a few examples to make the advantages and disadvantages
@@ -4278,18 +4344,42 @@ Macros with parameters may also be useful:
DEBUG "Assembling include file #3" DEBUG "Assembling include file #3"
</verb></tscreen> </verb></tscreen>
Note that, while formal parameters have to be placed in braces, this is Note that, while formal parameters have to be placed in parentheses,
not true for the actual parameters. Beware: Since the assembler cannot the actual argument used when invoking the macro should not be.
detect the end of one parameter, only the first token is used. If you The invoked arguments are separated by commas only, if parentheses are
don't like that, use classic macros instead: used by accident they will become part of the replaced token.
If you wish to have an expression follow the macro invocation, the
last parameter can be enclosed in curly braces {} to indicate the end of that
argument.
Examples:
<tscreen><verb> <tscreen><verb>
.macro DEBUG message .define COMBINE(ta,tb,tc) ta+tb*10+tc*100
.out message
.endmacro .word COMBINE 5,6,7 ; 5+6*10+7*100 = 765
.word COMBINE(5,6,7) ; (5+6*10+7)*100 = 7200 ; incorrect use of parentheses
.word COMBINE 5,6,7+1 ; 5+6*10+7+1*100 = 172
.word COMBINE 5,6,{7}+1 ; 5+6*10+7*100+1 = 766 ; {} encloses the argument
.word COMBINE 5,6-2,7 ; 5+6-2*10+7*100 = 691
.word COMBINE 5,(6-2),7 ; 5+(6-2)*10+7*100 = 745
.word COMBINE 5,6,7+COMBINE 0,1,2 ; 5+6*10+7+0+1*10+2*100*100 = 20082
.word COMBINE 5,6,{7}+COMBINE 0,1,2 ; 5+6*10+7*100+0+1*10+2*100 = 975
</verb></tscreen> </verb></tscreen>
(That is an example where a problem can be solved with both macro types). With C macros it is common to enclose the results in parentheses to
prevent unintended interactions with the text of the arguments, but
additional care must be taken in this assembly context where parentheses
may alter the meaning of a statement. In particular, indirect addressing modes
may be accidentally implied:
<tscreen><verb>
.define DUO(ta,tb) (ta+(tb*10))
lda DUO(5,4), Y ; LDA (indirect), Y
lda 0+DUO(5,4), Y ; LDA absolute indexed, Y
</verb></tscreen>
<sect1>Characters in macros<p> <sect1>Characters in macros<p>
@@ -4434,6 +4524,12 @@ The package defines the following macros:
<sect1><tt>.MACPACK apple2</tt><p>
This macro package defines a macro named <tt/scrcode/. It takes a string
as argument and places this string into memory translated into screen codes.
<sect1><tt>.MACPACK atari</tt><p> <sect1><tt>.MACPACK atari</tt><p>
This macro package defines a macro named <tt/scrcode/. It takes a string This macro package defines a macro named <tt/scrcode/. It takes a string
@@ -4459,6 +4555,7 @@ each supported CPU a constant similar to
CPU_65816 CPU_65816
CPU_SWEET16 CPU_SWEET16
CPU_HUC6280 CPU_HUC6280
CPU_4510
</verb></tscreen> </verb></tscreen>
is defined. These constants may be used to determine the exact type of the is defined. These constants may be used to determine the exact type of the
@@ -4472,6 +4569,7 @@ another constant is defined:
CPU_ISET_65816 CPU_ISET_65816
CPU_ISET_SWEET16 CPU_ISET_SWEET16
CPU_ISET_HUC6280 CPU_ISET_HUC6280
CPU_ISET_4510
</verb></tscreen> </verb></tscreen>
The value read from the <tt/<ref id=".CPU" name=".CPU">/ pseudo variable may The value read from the <tt/<ref id=".CPU" name=".CPU">/ pseudo variable may
@@ -4516,6 +4614,7 @@ compiler, depending on the target system selected:
<itemize> <itemize>
<item><tt/__APPLE2__/ - Target system is <tt/apple2/ or <tt/apple2enh/ <item><tt/__APPLE2__/ - Target system is <tt/apple2/ or <tt/apple2enh/
<item><tt/__APPLE2ENH__/ - Target system is <tt/apple2enh/ <item><tt/__APPLE2ENH__/ - Target system is <tt/apple2enh/
<item><tt/__ATARI2600__/ - Target system is <tt/atari2600/
<item><tt/__ATARI5200__/ - Target system is <tt/atari5200/ <item><tt/__ATARI5200__/ - Target system is <tt/atari5200/
<item><tt/__ATARI__/ - Target system is <tt/atari/ or <tt/atarixl/ <item><tt/__ATARI__/ - Target system is <tt/atari/ or <tt/atarixl/
<item><tt/__ATARIXL__/ - Target system is <tt/atarixl/ <item><tt/__ATARIXL__/ - Target system is <tt/atarixl/

140
doc/cc65-intern.sgml Normal file
View File

@@ -0,0 +1,140 @@
<!doctype linuxdoc system>
<article>
<title>cc65 internals
<author><url url="mailto:bbbradsmith@users.noreply.github.com" name="Brad Smith">
<date>2016-02-27
<abstract>
Internal details of cc65 code generation,
such as calling assembly functions from C.
</abstract>
<!-- Table of contents -->
<toc>
<!-- Begin the document -->
<sect>Calling assembly functions from C<p>
<sect1>Calling conventions<p>
There are two calling conventions used in cc65:
<itemize>
<item><tt/cdecl/ - passes all parameters on the C-stack.
<p>
<item><tt/fastcall/ - passes the rightmost parameter in
registers <tt>A/X/sreg</tt> and all others on the C-stack.
<p>
</itemize>
The default convention is <tt/fastcall/, but this can be changed with
the <tt/--all-cdecl/ command line option. If a convention is specified in
the function's declaration, that convention will be used instead.
Variadic functions will always use <tt/cdecl/ convention.
If the <tt/--standard/ command line option is used,
the <tt/cdecl/ and <tt/fastcall/ keywords will not be available.
The standard compliant variations <tt/__cdecl__/ and <tt/__fastcall__/ are always available.
If a function has a prototype, parameters are pushed to the C-stack as their respective types
(i.e. a <tt/char/ parameter will push 1 byte), but if a function has no prototype, default
promotions will apply. This means that with no prototype, <tt/char/ will be promoted
to <tt/int/ and be pushed as 2 bytes. K &amp; R style function prototypes may be used,
but they will function the same as if no prototype was used.
<sect1>Prologue, before the function call<p>
If the function is declared as fastcall, the rightmost argument will be loaded into
the <tt>A/X/sreg</tt> registers:
<itemize>
<item><tt/A/ - 8-bit parameter, or low byte of larger types<p>
<item><tt/X/ - 16-bit high byte, or second byte of 32-bits<p>
<item><tt/sreg/ - Zeropage pseudo-register including high 2 bytes of 32-bit parameter<p>
</itemize>
All other parameters will be pushed to the C-stack from left to right.
The rightmost parameter will have the lowest address on the stack,
and multi-byte parameters will have their least significant byte at the lower address.
The <tt/sp/ pseudo-register is a zeropage pointer to the base of the C-stack.
If the function has no prototype or is variadic
the <tt/Y/ register will contain the number of bytes pushed to the stack for this function.
Example:
<tscreen><verb>
// C prototype
void cdecl foo(unsigned bar, unsigned char baz);
; C-stack layout within the function:
;
; +------------------+
; | High byte of bar |
; Offset 2 ->+------------------+
; | Low byte of bar |
; Offset 1 ->+------------------+
; | baz |
; Offset 0 ->+------------------+
; Example code for accessing bar. The variable is in A/X after this code snippet:
;
ldy #2 ; Offset of high byte of bar
lda (sp),y ; High byte now in A
tax ; High byte now in X
dey ; Offset of low byte of bar
lda (sp),y ; Low byte now in A
</verb></tscreen>
<sect1>Epilogue, after the function call<p>
<sect2>Return requirements<p>
If the function has a return value, it will appear in the <tt>A/X/sreg</tt> registers.
Functions with an 8-bit return value (<tt/char/ or <tt/unsigned char/) are expected
to promote this value to a 16-bit integer on return, and store the high byte in <tt/X/.
The compiler will depend on the promoted value in some cases (e.g. implicit conversion to <tt/int/),
and failure to return the high byte in <tt/X/ will cause unexpected errors.
This problem does not apply to the <tt/sreg/ pseudo-register, which is only
used if the return type is 32-bit.
If the function has a void return type, the compiler will not depend on the result
of <tt>A/X/sreg</tt>, so these may be clobbered by the function.
The C-stack pointer <tt/sp/ must be restored by the function to its value before the
function call prologue. It may pop all of its parameters from the C-stack
(e.g. using the <tt/runtime/ function <tt/popa/),
or it could adjust <tt/sp/ directly.
If the function has no prototype, or is variadic the <tt/Y/ register contains the
number of bytes pushed to the stack on entry, which may be added to <tt/sp/ to restore its original state.
The internal pseudo-register <tt/regbank/ must not be changed by the function.
<sect2>Clobbered state<p>
The <tt/Y/ register may be clobbered by the function.
The compiler will not depend on its state after a function call.
The <tt>A/X/sreg</tt> registers may be clobbered if any of them
are not used by the return value (see above).
Many of the internal pseudo-registers used by cc65 are available for
free use by any function called by C, and do not need to be preserved.
Note that if another C function is called from your assembly function,
it may clobber any of these itself:
<itemize>
<item><tt>tmp1 .. tmp4</tt><p>
<item><tt>ptr1 .. ptr4</tt><p>
<item><tt>regsave</tt><p>
<item><tt>sreg</tt> (if unused by return)<p>
</itemize>
</article>

View File

@@ -2,8 +2,9 @@
<article> <article>
<title>cc65 Users Guide <title>cc65 Users Guide
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
<date>2015-05-26 <url url="mailto:gregdk@users.sf.net" name="Greg King">
<date>2017-05-20
<abstract> <abstract>
cc65 is a C compiler for 6502 targets. It supports several 6502 based home cc65 is a C compiler for 6502 targets. It supports several 6502 based home
@@ -15,7 +16,6 @@ computers like the Commodore and Atari machines, but it is easily retargetable.
<!-- Begin the document --> <!-- Begin the document -->
<sect>Overview<p> <sect>Overview<p>
cc65 was originally a C compiler for the Atari 8-bit machines written by cc65 was originally a C compiler for the Atari 8-bit machines written by
@@ -58,7 +58,7 @@ Short options:
-O Optimize code -O Optimize code
-Oi Optimize code, inline more code -Oi Optimize code, inline more code
-Or Enable register variables -Or Enable register variables
-Os Inline some known functions -Os Inline some standard functions
-T Include source as comment -T Include source as comment
-V Print the compiler version number -V Print the compiler version number
-W warning[,...] Suppress warnings -W warning[,...] Suppress warnings
@@ -88,9 +88,11 @@ Long options:
--debug-opt name Debug optimization steps --debug-opt name Debug optimization steps
--dep-target target Use this dependency target --dep-target target Use this dependency target
--disable-opt name Disable an optimization step --disable-opt name Disable an optimization step
--eagerly-inline-funcs Eagerly inline some known functions
--enable-opt name Enable an optimization step --enable-opt name Enable an optimization step
--help Help (this text) --help Help (this text)
--include-dir dir Set an include directory search path --include-dir dir Set an include directory search path
--inline-stdfuncs Inline some standard functions
--list-opt-steps List all optimizer steps and exit --list-opt-steps List all optimizer steps and exit
--list-warnings List available warning types for -W --list-warnings List available warning types for -W
--local-strings Emit string literals immediately --local-strings Emit string literals immediately
@@ -219,11 +221,53 @@ Here is a description of all the command line options:
symbols in a special section in the object file. symbols in a special section in the object file.
<label id="option-eagerly-inline-funcs">
<tag><tt>--eagerly-inline-funcs</tt></tag>
Have the compiler eagerly inline these functions from the C library:
<itemize>
<item><tt/memcpy()/
<item><tt/memset()/
<item><tt/strcmp()/
<item><tt/strcpy()/
<item><tt/strlen()/
<item>most of the functions declared in <tt/&lt;ctype.h&gt;/
</itemize>
Note: This has two consequences:
<itemize>
<item>You may not use names of standard C functions for your own functions.
If you do that, your program is not standard-compliant anyway; but,
using <tt/--eagerly-inline-funcs/ actually will break things.
<p>
<item>The inlined string and memory functions will not handle strings or
memory areas larger than 255 bytes. Similarly, the inlined <tt/is..()/
functions will not work with values outside the char. range (such as
<tt/EOF/).
<p>
</itemize>
<tt/--eagerly-inline-funcs/ implies the <tt><ref id="option-inline-stdfuncs"
name="--inline-stdfuncs"></tt> command line option.
See also <tt><ref id="pragma-allow-eager-inline" name="#pragma&nbsp;allow-eager-inline"></tt>.
<tag><tt>-h, --help</tt></tag> <tag><tt>-h, --help</tt></tag>
Print the short option summary shown above. Print the short option summary shown above.
<label id="option-inline-stdfuncs">
<tag><tt>--inline-stdfuncs</tt></tag>
Allow the compiler to inline some standard functions from the C library like
strlen. This will not only remove the overhead for a function call, but will
make the code visible for the optimizer. See also the <tt><ref id="option-O"
name="-Os"></tt> command line option and <tt><ref id="pragma-inline-stdfuncs"
name="#pragma&nbsp;inline-stdfuncs"></tt>.
<label id="option-list-warnings"> <label id="option-list-warnings">
<tag><tt>--list-warnings</tt></tag> <tag><tt>--list-warnings</tt></tag>
@@ -392,22 +436,22 @@ Here is a description of all the command line options:
using using
<tscreen><verb> <tscreen><verb>
void f (void) void f (void)
{ {
unsigned a = 1; unsigned a = 1;
... ...
} }
</verb></tscreen> </verb></tscreen>
the variable <tt/a/ will always have the value <tt/1/ when entering the the variable <tt/a/ will always have the value <tt/1/ when entering the
function and using <tt/-Cl/, while in function and using <tt/-Cl/, while in
<tscreen><verb> <tscreen><verb>
void f (void) void f (void)
{ {
static unsigned a = 1; static unsigned a = 1;
.... ....
} }
</verb></tscreen> </verb></tscreen>
the variable <tt/a/ will have the value <tt/1/ only the first time that the the variable <tt/a/ will have the value <tt/1/ only the first time that the
@@ -444,23 +488,14 @@ Here is a description of all the command line options:
name="--register-vars">/ command line option, and the <ref name="--register-vars">/ command line option, and the <ref
id="register-vars" name="discussion of register variables"> below. id="register-vars" name="discussion of register variables"> below.
Using <tt/-Os/ will force the compiler to inline some known functions from Using <tt/-Os/ will allow the compiler to inline some standard functions
the C library like strlen. Note: This has two consequences: from the C library like strlen. This will not only remove the overhead
<p> for a function call, but will make the code visible for the optimizer.
<itemize> See also the <tt/<ref id="option-inline-stdfuncs" name="--inline-stdfuncs">/
<item>You may not use names of standard C functions in your own code. If you command line option.
do that, your program is not standard compliant anyway, but using
<tt/-Os/ will actually break things.
<p>
<item>The inlined string and memory functions will not handle strings or
memory areas larger than 255 bytes. Similarly, the inlined <tt/is..()/
functions will not work with values outside the char. range (such as
<tt/EOF/).
<p>
</itemize>
<p>
It is possible to concatenate the modifiers for <tt/-O/. For example, to It is possible to concatenate the modifiers for <tt/-O/. For example, to
enable register variables and inlining of known functions, you may use enable register variables and inlining of standard functions, you may use
<tt/-Ors/. <tt/-Ors/.
@@ -478,15 +513,15 @@ Here is a description of all the command line options:
<label id="option-W"> <label id="option-W">
<tag><tt>-W name[,name]</tt></tag> <tag><tt>-W name[,name,...]</tt></tag>
This option allows to control warnings generated by the compiler. It is This option allows to control warnings generated by the compiler. It is
followed by a comma separated list of warnings that should be enabled or followed by a comma-separated list of warnings that should be enabled or
disabled. To disable a warning, its name is prefixed by a minus sign. If disabled. To disable a warning, its name is prefixed by a minus sign. If
no such prefix exists, or the name is prefixed by a plus sign, the warning no such prefix exists, or the name is prefixed by a plus sign, the warning
is enabled. is enabled.
The following warning names are currently recognized: The following warning names currently are recognized:
<descrip> <descrip>
<tag><tt/const-comparison/</tag> <tag><tt/const-comparison/</tag>
Warn if the result of a comparison is constant. Warn if the result of a comparison is constant.
@@ -494,10 +529,13 @@ Here is a description of all the command line options:
Treat all warnings as errors. Treat all warnings as errors.
<tag><tt/no-effect/</tag> <tag><tt/no-effect/</tag>
Warn about statements that don't have an effect. Warn about statements that don't have an effect.
<tag><tt/remap-zero/</tag>
Warn about a <tt/<ref id="pragma-charmap" name="#pragma charmap()">/
that changes a character's code number from/to 0x00.
<tag><tt/struct-param/</tag> <tag><tt/struct-param/</tag>
Warn when passing structs by value. Warn when passing structs by value.
<tag><tt/unknown-pragma/</tag> <tag><tt/unknown-pragma/</tag>
Warn about known #pragmas. Warn about #pragmas that aren't recognized by cc65.
<tag><tt/unused-label/</tag> <tag><tt/unused-label/</tag>
Warn about unused labels. Warn about unused labels.
<tag><tt/unused-param/</tag> <tag><tt/unused-param/</tag>
@@ -506,15 +544,16 @@ Here is a description of all the command line options:
Warn about unused variables. Warn about unused variables.
</descrip> </descrip>
The full list of available warning names may be retrieved by using the The full list of available warning names can be retrieved by using the
option <tt><ref id="option-list-warnings" name="--list-warnings"></tt>. option <tt><ref id="option-list-warnings" name="--list-warnings"></tt>.
You may also use <tt><ref id="pragma-warn" name="#pragma&nbsp;warn"></tt> to You may use also <tt><ref id="pragma-warn" name="#pragma&nbsp;warn"></tt> to
control this setting for smaller pieces of code from within your code. control this setting, for smaller pieces of code, from within your sources.
</descrip><p> </descrip><p>
<sect>Input and output<p> <sect>Input and output<p>
The compiler will accept one C file per invocation and create a file with The compiler will accept one C file per invocation and create a file with
@@ -553,21 +592,21 @@ and the one defined by the ISO standard:
<itemize> <itemize>
<item> The datatypes "float" and "double" are not available. <item> The datatypes "float" and "double" are not available.
<p> <p>
<item> C Functions may not return structs (or unions), and structs may not <item> C Functions may not return structs (or unions), and structs may not
be passed as parameters by value. However, struct assignment *is* be passed as parameters by value. However, struct assignment *is*
possible. possible.
<p> <p>
<item> Most of the C library is available with only the fastcall calling <item> Most of the C library is available with only the fastcall calling
convention (<ref id="extension-fastcall" name="see below">). It means convention (<ref id="extension-fastcall" name="see below">). It means
that you must not mix pointers to those functions with pointers to that you must not mix pointers to those functions with pointers to
user-written, cdecl functions (the calling conventions are incompatible). user-written, cdecl functions (the calling conventions are incompatible).
<p> <p>
<item> The <tt/volatile/ keyword doesn't have an effect. This is not as bad <item> The <tt/volatile/ keyword has almost no effect. That is not as bad
as it sounds, since the 6502 has so few registers that it isn't as it sounds, since the 6502 has so few registers that it isn't
possible to keep values in registers anyway. possible to keep values in registers anyway.
<p> <p>
</itemize> </itemize>
There may be some more minor differences I'm currently not aware of. The There may be some more minor differences I'm currently not aware of. The
@@ -582,49 +621,48 @@ This cc65 version has some extensions to the ISO C standard.
<itemize> <itemize>
<item> The compiler allows to insert assembler statements into the output <item> The compiler allows to insert assembler statements into the output
file. The syntax is file. The syntax is
<tscreen><verb> <tscreen><verb>
asm (&lt;string literal&gt;[, optional parameters]) ; asm [optional volatile] (&lt;string literal&gt;[, optional parameters]) ;
</verb></tscreen> </verb></tscreen>
or or
<tscreen><verb> <tscreen><verb>
__asm__ (&lt;string literal&gt;[, optional parameters]) ; __asm__ [optional volatile] (&lt;string literal&gt;[, optional parameters]) ;
</verb></tscreen> </verb></tscreen>
The first form is in the user namespace and is disabled if the <tt/-A/ The first form is in the user namespace; and, is disabled if the <tt/-A/
switch is given. switch is given.
There is a whole section covering inline assembler statements, There is a whole section covering inline assembler statements,
<ref id="inline-asm" name="see there">. <ref id="inline-asm" name="see there">.
<p> <p>
<label id="extension-fastcall"> <label id="extension-fastcall">
<item> The normal calling convention -- for non-variadic functions -- is <item> The normal calling convention -- for non-variadic functions -- is
named "fastcall". The syntax for a function declaration that named "fastcall". The syntax for a function declaration that
<em/explicitly/ uses fastcall is <em/explicitly/ uses fastcall is
<tscreen><verb> <tscreen><verb>
&lt;return type&gt; fastcall &lt;function name&gt; (&lt;parameter list&gt;) &lt;return type&gt; fastcall &lt;function name&gt; (&lt;parameter list&gt;)
</verb></tscreen> </verb></tscreen>
or or
<tscreen><verb> <tscreen><verb>
&lt;return type&gt; __fastcall__ &lt;function name&gt; (&lt;parameter list&gt;) &lt;return type&gt; __fastcall__ &lt;function name&gt; (&lt;parameter list&gt;)
</verb></tscreen> </verb></tscreen>
An example is An example is
<tscreen><verb> <tscreen><verb>
void __fastcall__ f (unsigned char c) void __fastcall__ f (unsigned char c)
</verb></tscreen> </verb></tscreen>
The first form of the fastcall keyword is in the user namespace and can The first form of the fastcall keyword is in the user namespace and can
therefore be disabled with the <tt><ref id="option--standard" therefore be disabled with the <tt><ref id="option--standard"
name="--standard"></tt> command line option. name="--standard"></tt> command line option.
For functions that are <tt/fastcall/, the rightmost parameter is not For functions that are <tt/fastcall/, the rightmost parameter is not
pushed on the stack but left in the primary register when the function pushed on the stack but left in the primary register when the function
is called. That significantly reduces the cost of calling those functions. is called. That significantly reduces the cost of calling those functions.
<newline><newline> <p>
<p>
<item> There is another calling convention named "cdecl". Variadic functions <item> There is another calling convention named "cdecl". Variadic functions
(their prototypes have an ellipsis &lsqb;<tt/.../&rsqb;) always use that (their prototypes have an ellipsis &lsqb;<tt/.../&rsqb;) always use that
@@ -649,65 +687,72 @@ This cc65 version has some extensions to the ISO C standard.
For functions that are <tt/cdecl/, the rightmost parameter is pushed For functions that are <tt/cdecl/, the rightmost parameter is pushed
onto the stack before the function is called. That increases the cost onto the stack before the function is called. That increases the cost
of calling those functions, especially when they are called from many of calling those functions, especially when they are called from many
places.<newline><newline> places.
<p> <p>
<item> There are two pseudo variables named <tt/__AX__/ and <tt/__EAX__/. <item> There are two pseudo variables named <tt/__AX__/ and <tt/__EAX__/.
Both refer to the primary register that is used by the compiler to Both refer to the primary register that is used by the compiler to
evaluate expressions or return function results. <tt/__AX__/ is of evaluate expressions or return function results. <tt/__AX__/ is of
type <tt/unsigned int/ and <tt/__EAX__/ of type <tt/long unsigned int/ type <tt/unsigned int/ and <tt/__EAX__/ of type <tt/long unsigned int/
respectively. The pseudo variables may be used as lvalue and rvalue as respectively. The pseudo variables may be used as lvalue and rvalue as
every other variable. They are most useful together with short every other variable. They are most useful together with short
sequences of assembler code. For example, the macro sequences of assembler code. For example, the macro
<tscreen><verb> <tscreen><verb>
#define hi(x) \ #define hi(x) \
(__AX__ = (x), \ (__AX__ = (x), \
asm ("txa"), \ asm ("txa"), \
asm ("ldx #$00"), \ asm ("ldx #$00"), \
__AX__) __AX__)
</verb></tscreen> </verb></tscreen>
will give the high byte of any unsigned value. will give the high byte of any unsigned value.
<p> <p>
<item> Inside a function, the identifier <tt/__func__/ gives the name of the <item> Inside a function, the identifier <tt/__func__/ gives the name of the
current function as a string. Outside of functions, <tt/__func__/ is current function as a string. Outside of functions, <tt/__func__/ is
undefined. undefined.
Example: Example:
<tscreen><verb> <tscreen><verb>
#define PRINT_DEBUG(s) printf ("%s: %s\n", __func__, s); #define PRINT_DEBUG(s) printf ("%s: %s\n", __func__, s);
</verb></tscreen> </verb></tscreen>
The macro will print the name of the current function plus a given The macro will print the name of the current function plus a given
string. string.
<p> <p>
<item> cc65 allows the initialization of <tt/void/ variables. This may be <item> cc65 allows the initialization of <tt/void/ variables. This may be
used to create variable structures that are more compatible with used to create arbitrary structures that are more compatible with
interfaces written for assembler languages. Here is an example: interfaces written for assembler languages. Here is an example:
<tscreen><verb> <tscreen><verb>
void GCmd = { (char)3, (unsigned)0x2000, (unsigned)0x3000 }; void GCmd = { (char)3, (unsigned)0x2000, (unsigned)0x3000 };
</verb></tscreen> </verb></tscreen>
This will be translated as follows: That will be translated as follows:
<tscreen><verb> <tscreen><verb>
_GCmd: _GCmd:
.byte 3 .byte 3
.word $2000 .word $2000
.word $3000 .word $3000
</verb></tscreen> </verb></tscreen>
Since the variable is of type <tt/void/ you may not use it as is. Since the variable is of type <tt/void/, you may not use it as-is.
However, taking the address of the variable results in a <tt/void*/ However, taking the address of the variable results in a <tt/void*/
which may be passed to any function expecting a pointer. which may be passed to any function expecting a pointer. Also, the
<tt/sizeof/ operator will give the length of the initializer:
See the <url url="geos.html" name="GEOS library document"> for examples <tscreen><verb>
on how to use this feature. GLen = sizeof GCmd;
<p> </verb></tscreen>
will assign the value 5 to <tt/GLen/.
See the <url url="geos.html" name="GEOS library document"> for examples
on how to use that feature.
<p>
<item> cc65 implements flexible array struct members as defined in the C99 ISO <item> cc65 implements flexible array struct members as defined in the C99 ISO
standard. As an extension, these fields may be initialized. There are standard. As an extension, these fields may be initialized. There are
@@ -735,6 +780,7 @@ This cc65 version has some extensions to the ISO C standard.
<p> <p>
<sect>Predefined macros<p> <sect>Predefined macros<p>
The compiler defines several macros at startup: The compiler defines several macros at startup:
@@ -748,6 +794,10 @@ The compiler defines several macros at startup:
This macro is defined if the target is the enhanced Apple //e (-t apple2enh). This macro is defined if the target is the enhanced Apple //e (-t apple2enh).
<tag><tt>__ATARI2600__</tt></tag>
This macro is defined if the target is the Atari 2600 game console.
<tag><tt>__ATARI5200__</tt></tag> <tag><tt>__ATARI5200__</tt></tag>
This macro is defined if the target is the Atari 5200 game console. This macro is defined if the target is the Atari 5200 game console.
@@ -810,6 +860,11 @@ The compiler defines several macros at startup:
This macro expands to the date of translation of the preprocessing This macro expands to the date of translation of the preprocessing
translation unit in the form "Mmm dd yyyy". translation unit in the form "Mmm dd yyyy".
<tag><tt>__EAGERLY_INLINE_FUNCS__</tt></tag>
Is defined if the compiler was called with the <tt><ref id="option-eagerly-inline-funcs"
name="--eagerly-inline-funcs"></tt> command line option.
<tag><tt>__FILE__</tt></tag> <tag><tt>__FILE__</tt></tag>
This macro expands to a string containing the name of the C source file. This macro expands to a string containing the name of the C source file.
@@ -897,6 +952,7 @@ The compiler defines several macros at startup:
</descrip> </descrip>
<sect>&num;pragmas<label id="pragmas"><p> <sect>&num;pragmas<label id="pragmas"><p>
The compiler understands some pragmas that may be used to change code The compiler understands some pragmas that may be used to change code
@@ -905,6 +961,19 @@ If the first parameter is <tt/push/, the old value is saved onto a stack
before changing it. The value may later be restored by using the <tt/pop/ before changing it. The value may later be restored by using the <tt/pop/
parameter with the <tt/#pragma/. parameter with the <tt/#pragma/.
<sect1><tt>#pragma allow-eager-inline ([push,] on|off)</tt><label id="pragma-allow-eager-inline"><p>
Allow eager inlining of known functions. If the argument is "off", eager
inlining is disabled, otherwise it is enabled. Please note that (in contrast
to the <tt><ref id="option-eagerly-inline-funcs" name="--eagerly-inline-funcs"></tt>
command line option) this pragma does not imply the <tt><ref id="option-inline-stdfuncs"
name="--inline-stdfuncs"></tt> command line option. Rather it marks code to be safe for
eager inlining of known functions if inlining of standard functions is enabled.
The <tt/#pragma/ understands the push and pop parameters as explained above.
<sect1><tt>#pragma bss-name (&lsqb;push,&rsqb; &lt;name&gt;)</tt><label id="pragma-bss-name"><p> <sect1><tt>#pragma bss-name (&lsqb;push,&rsqb; &lt;name&gt;)</tt><label id="pragma-bss-name"><p>
This pragma changes the name used for the BSS segment (the BSS segment This pragma changes the name used for the BSS segment (the BSS segment
@@ -923,41 +992,45 @@ parameter with the <tt/#pragma/.
Example: Example:
<tscreen><verb> <tscreen><verb>
#pragma bss-name ("MyBSS") #pragma bss-name ("MyBSS")
</verb></tscreen> </verb></tscreen>
<sect1><tt>#pragma charmap (&lt;index&gt;, &lt;code&gt;)</tt><label id="pragma-charmap"><p> <sect1><tt>#pragma charmap (&lt;index&gt;, &lt;code&gt;)</tt><label id="pragma-charmap"><p>
Each literal string and each literal character in the source is translated Each literal string and each literal character in the source is translated
by use of a translation table. This translation table is preset when the by use of a translation table. That translation table is preset when the
compiler is started depending on the target system, for example to map compiler is started, depending on the target system; for example, to map
ISO-8859-1 characters into PETSCII if the target is a commodore machine. ISO-8859-1 characters into PETSCII if the target is a Commodore machine.
This pragma allows to change entries in the translation table, so the This pragma allows to change entries in the translation table, so the
translation for individual characters, or even the complete table may be translation for individual characters, or even the complete table may be
adjusted. adjusted. Both arguments are assumed to be unsigned characters with a valid
range of 0-255.
Both arguments are assumed to be unsigned characters with a valid range of Beware of some pitfalls:
1-255. <itemize>
<item>The character index is actually the code of the character in the
Beware of two pitfalls: C source; so, character mappings do always depend on the source
character set. That means that <tt/#pragma&nbsp;charmap()/ is not
<itemize> portable -- it depends on the build environment.
<item>The character index is actually the code of the character in the <item>While it is possible to use character literals as indices, the
C source, so character mappings do always depend on the source result may be somewhat unexpected, since character literals are
character set. This means that <tt/#pragma&nbsp;charmap/ is not themselves translated. For that reason, I would suggest to avoid
portable -- it depends on the build environment. character literals, and use numeric character codes instead.
<item>While it is possible to use character literals as indices, the <item>It is risky to change index <tt/0x00/, because string functions depend
result may be somewhat unexpected, since character literals are on it. If it is changed, then the <tt/'\0'/ at the end of string
itself translated. For this reason I would suggest to avoid literals will become non-zero. Functions that are used on those
character literals and use numeric character codes instead. literals won't stop at the end of them. cc65 will warn you if you do
</itemize> change that code number. You can turn off that <tt/remap-zero/ warning
if you are certain that you know what you are doing (see <tt/<ref
id="pragma-warn" name="#pragma&nbsp;warn()">/).
</itemize>
Example: Example:
<tscreen><verb> <tscreen><verb>
/* Use a space wherever an 'a' occurs in ISO-8859-1 source */ /* Use a space wherever an 'a' occurs in ISO-8859-1 source */
#pragma charmap (0x61, 0x20); #pragma charmap (0x61, 0x20);
</verb></tscreen> </verb></tscreen>
@@ -974,6 +1047,7 @@ parameter with the <tt/#pragma/.
The <tt/#pragma/ understands the push and pop parameters as explained above. The <tt/#pragma/ understands the push and pop parameters as explained above.
<sect1><tt>#pragma code-name ([push,] &lt;name&gt;)</tt><label id="pragma-code-name"><p> <sect1><tt>#pragma code-name ([push,] &lt;name&gt;)</tt><label id="pragma-code-name"><p>
This pragma changes the name used for the CODE segment (the CODE segment This pragma changes the name used for the CODE segment (the CODE segment
@@ -988,7 +1062,7 @@ parameter with the <tt/#pragma/.
Example: Example:
<tscreen><verb> <tscreen><verb>
#pragma code-name ("MyCODE") #pragma code-name ("MyCODE")
</verb></tscreen> </verb></tscreen>
@@ -1016,10 +1090,21 @@ parameter with the <tt/#pragma/.
Example: Example:
<tscreen><verb> <tscreen><verb>
#pragma data-name ("MyDATA") #pragma data-name ("MyDATA")
</verb></tscreen> </verb></tscreen>
<sect1><tt>#pragma inline-stdfuncs ([push,] on|off)</tt><label id="pragma-inline-stdfuncs"><p>
Allow the compiler to inline some standard functions from the C library like
strlen. If the argument is "off", inlining is disabled, otherwise it is enabled.
See also the <tt/<ref id="option-inline-stdfuncs" name="--inline-stdfuncs">/
command line option.
The <tt/#pragma/ understands the push and pop parameters as explained above.
<sect1><tt>#pragma local-strings ([push,] on|off)</tt><label id="pragma-local-strings"><p> <sect1><tt>#pragma local-strings ([push,] on|off)</tt><label id="pragma-local-strings"><p>
When "on", emit string literals to the data segment when they're encountered When "on", emit string literals to the data segment when they're encountered
@@ -1034,6 +1119,23 @@ parameter with the <tt/#pragma/.
remembered and output as a whole when translation is finished. remembered and output as a whole when translation is finished.
<sect1><tt>#pragma message (&lt;message&gt;)</tt><label id="pragma-message"><p>
This pragma is used to display informational messages at compile-time.
The message intented to be displayed must be a string literal.
Example:
<tscreen><verb>
#pragma message ("in a bottle")
</verb></tscreen>
Results in the compiler outputting the following to stderr:
<tscreen><verb>
example.c(42): Note: in a bottle
</verb></tscreen>
<sect1><tt>#pragma optimize ([push,] on|off)</tt><label id="pragma-optimize"><p> <sect1><tt>#pragma optimize ([push,] on|off)</tt><label id="pragma-optimize"><p>
Switch optimization on or off. If the argument is "off", optimization is Switch optimization on or off. If the argument is "off", optimization is
@@ -1064,7 +1166,7 @@ parameter with the <tt/#pragma/.
Example: Example:
<tscreen><verb> <tscreen><verb>
#pragma rodata-name ("MyRODATA") #pragma rodata-name ("MyRODATA")
</verb></tscreen> </verb></tscreen>
@@ -1086,9 +1188,9 @@ parameter with the <tt/#pragma/.
Example: Example:
<tscreen><verb> <tscreen><verb>
#pragma regvaraddr(on) /* Allow taking the address #pragma regvaraddr(on) /* Allow taking the address
* of register variables * of register variables
*/ */
</verb></tscreen> </verb></tscreen>
@@ -1128,14 +1230,14 @@ parameter with the <tt/#pragma/.
Switch compiler warnings on or off. "name" is the name of a warning (see the Switch compiler warnings on or off. "name" is the name of a warning (see the
<tt/<ref name="-W" id="option-W">/ compiler option for a list). The name is <tt/<ref name="-W" id="option-W">/ compiler option for a list). The name is
either followed by "pop", which restores the last pushed state, or by "on" or followed either by "pop", which restores the last pushed state, or by "on" or
"off", optionally preceeded by "push" to push the current state before "off", optionally preceeded by "push" to push the current state before
changing it. changing it.
Example: Example:
<tscreen><verb> <tscreen><verb>
/* Don't warn about the unused parameter in function func */ /* Don't warn about the unused parameter in function func */
#pragma warn (unused-param, push, off) #pragma warn (unused-param, push, off)
static int func (int unused) static int func (int unused)
{ {
return 0; return 0;
@@ -1143,6 +1245,40 @@ parameter with the <tt/#pragma/.
#pragma warn (unused-param, pop) #pragma warn (unused-param, pop)
</verb></tscreen> </verb></tscreen>
<sect1><tt>#pragma wrapped-call (push, &lt;name&gt;, &lt;identifier&gt;)</tt><label id="pragma-wrapped-call"><p>
This pragma sets a wrapper for functions, often used for trampolines.
The name is a function returning <tt/void/, and taking no parameters.
It must preserve the CPU's <tt/A/ and <tt/X/ registers if it wraps any
<tt/__fastcall__/ functions that have parameters. It must preserve
the <tt/Y/ register if it wraps any variadic functions (they have "<tt/.../"
in their prototypes).
The identifier is an 8-bit number that's set into <tt/tmp4/.
The address of a wrapped function is passed in <tt/ptr4/. The wrapper can
call that function by using "<tt/jsr callptr4/".
This feature is useful, for example, with banked memory, to switch banks
automatically to where a wrapped function resides, and then to restore the
previous bank when it returns.
The <tt/#pragma/ requires the push or pop argument as explained above.
Example:
<tscreen><verb>
/* Note that this code can be in a header. */
void mytrampoline(void); /* Doesn't corrupt __AX__ */
#pragma wrapped-call (push, mytrampoline, 5)
void somefunc1(void);
void somefunc2(int, char *);
#pragma wrapped-call (pop)
</verb></tscreen>
<sect1><tt>#pragma writable-strings ([push,] on|off)</tt><label id="pragma-writable-strings"><p> <sect1><tt>#pragma writable-strings ([push,] on|off)</tt><label id="pragma-writable-strings"><p>
Changes the storage location of string literals. For historical reasons, Changes the storage location of string literals. For historical reasons,
@@ -1167,13 +1303,12 @@ parameter with the <tt/#pragma/.
Example: Example:
<tscreen><verb> <tscreen><verb>
extern int foo; extern int foo;
#pragma zpsym ("foo"); /* foo is in the zeropage */ #pragma zpsym ("foo"); /* foo is in the zeropage */
</verb></tscreen> </verb></tscreen>
<sect>Register variables<label id="register-vars"><p> <sect>Register variables<label id="register-vars"><p>
The runtime for all supported platforms has 6 bytes of zero page space The runtime for all supported platforms has 6 bytes of zero page space
@@ -1224,39 +1359,44 @@ The compiler allows to insert assembler statements into the output file. The
syntax is syntax is
<tscreen><verb> <tscreen><verb>
asm (&lt;string literal&gt;[, optional parameters]) ; asm [optional volatile] (&lt;string literal&gt;[, optional parameters]) ;
</verb></tscreen> </verb></tscreen>
or or
<tscreen><verb> <tscreen><verb>
__asm__ (&lt;string literal&gt;[, optional parameters]) ; __asm__ [optional volatile] (&lt;string literal&gt;[, optional parameters]) ;
</verb></tscreen> </verb></tscreen>
<p> <p>
The first form is in the user namespace and is disabled by <tt><ref The first form is in the user namespace; and, is disabled by <tt><ref
id="option--standard" name="--standard"></tt> if the argument is not <tt/cc65/. id="option--standard" name="--standard"></tt> if the argument is not <tt/cc65/.
The asm statement may be used inside a function and on global file level. An The <tt/asm/ statement can be used only inside a function. Please note that
inline assembler statement is a primary expression, so it may also be used as the result of an inline assembler expression is always of type <tt/void/.
part of an expression. Please note however that the result of an expression
containing just an inline assembler statement is always of type <tt/void/.
The contents of the string literal are preparsed by the compiler and inserted The contents of the string literal are preparsed by the compiler; and, inserted
into the generated assembly output, so that the can be further processed by into the generated assembly output, so that it can be processed further by
the backend and especially the optimizer. For this reason, the compiler does the backend -- and, especially the optimizer. For that reason, the compiler does
only allow regular 6502 opcodes to be used with the inline assembler. Pseudo allow only regular 6502 opcodes to be used with the inline assembler. Pseudo
instructions (like <tt/.import/, <tt/.byte/ and so on) are <em/not/ allowed, instructions (like <tt/.import/, <tt/.byte/, and so on) are <em/not/ allowed,
even if the ca65 assembler (which is used to translate the generated assembler even if the ca65 assembler (which is used to translate the generated assembler
code) would accept them. The builtin inline assembler is not a replacement for code) would accept them. The built-in inline assembler is not a replacement for
the full blown macro assembler which comes with the compiler. the full-blown macro assembler which comes with the compiler.
Note: Inline assembler statements are subject to all optimizations done by the Note: Inline assembler statements are subject to all optimizations done by the
compiler. There is currently no way to protect an inline assembler statement compiler. There currently is no way to protect an inline assembler statement
from being moved or removed completely by the optimizer. If in doubt, check -- alone -- from being moved or removed completely by the optimizer. If in
the generated assembler output, or disable optimizations. doubt, check the generated assembler output; or, disable optimizations (for
that function).
As a shortcut, you can put the <tt/volatile/ qualifier in your <tt/asm/
statements. It will disable optimization for the functions in which those
<tt/asm volatile/ statements sit. The effect is the same as though you put
<tt/#pragma optimize(push, off)/ above those functions, and <tt/#pragma
optimize(pop)/ below those functions.
The string literal may contain format specifiers from the following list. For The string literal may contain format specifiers from the following list. For
each format specifier, an argument is expected which is inserted instead of each format specifier, an argument is expected which is inserted instead of
the format specifier before passing the assembly code line to the backend. the format specifier, before passing the assembly code line to the backend.
<itemize> <itemize>
<item><tt/%b/ - Numerical 8-bit value <item><tt/%b/ - Numerical 8-bit value
@@ -1269,33 +1409,33 @@ the format specifier before passing the assembly code line to the backend.
<item><tt/%%/ - The % sign itself <item><tt/%%/ - The % sign itself
</itemize><p> </itemize><p>
Using these format specifiers, you can access C <tt/#defines/, variables or Using those format specifiers, you can access C <tt/#defines/, variables, or
similar stuff from the inline assembler. For example, to load the value of similar stuff from the inline assembler. For example, to load the value of
a C <tt/#define/ into the Y register, one would use a C <tt/#define/ into the Y index register, one would use
<tscreen><verb> <tscreen><verb>
#define OFFS 23 #define OFFS 23
__asm__ ("ldy #%b", OFFS); __asm__ ("ldy #%b", OFFS);
</verb></tscreen> </verb></tscreen>
Or, to access a struct member of a static variable: Or, to access a struct member of a static variable:
<tscreen><verb> <tscreen><verb>
typedef struct { typedef struct {
unsigned char x; unsigned char x;
unsigned char y; unsigned char y;
unsigned char color; unsigned char color;
} pixel_t; } pixel_t;
static pixel_t pixel; static pixel_t pixel;
__asm__ ("ldy #%b", offsetof(pixel_t, color)); __asm__ ("ldy #%b", offsetof(pixel_t, color));
__asm__ ("lda %v,y", pixel); __asm__ ("lda %v,y", pixel);
</verb></tscreen> </verb></tscreen>
<p> <p>
The next example shows how to use global variables to exchange data between C The next example shows how to use global variables to exchange data between C
an assembler and how to handle assembler jumps: and assembler; and, how to handle assembler jumps:
<tscreen><verb> <tscreen><verb>
unsigned char globalSubA, globalSubB, globalSubResult; static unsigned char globalSubA, globalSubB, globalSubResult;
/* return a-b, return 255 if b>a */ /* return a-b, return 255 if b>a */
unsigned char sub (unsigned char a, unsigned char b) unsigned char sub (unsigned char a, unsigned char b)
@@ -1314,19 +1454,19 @@ an assembler and how to handle assembler jumps:
</verb></tscreen> </verb></tscreen>
<p> <p>
Arrays can also be accessed: Arrays also can be accessed:
<tscreen><verb> <tscreen><verb>
unsigned char globalSquareTable[] = { static const unsigned char globalSquareTable[] = {
0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 0, 1, 4, 9, 16, 25, 36, 49, 64, 81,
100, 121, 144, 169, 196, 225 100, 121, 144, 169, 196, 225
}; };
unsigned char globalSquareA, globalSquareResult; static unsigned char globalSquareA, globalSquareResult;
/* return a*a for a<16, else 255 */ /* return a*a for a<16, else 255 */
unsigned char square (unsigned char a) unsigned char square (unsigned char a)
{ {
if (a>15){ if (a > 15) {
return 255; return 255;
} }
globalSquareA = a; globalSquareA = a;
@@ -1339,28 +1479,30 @@ Arrays can also be accessed:
<p> <p>
Note: Do not embed the assembler labels that are used as names of global Note: Do not embed the assembler labels that are used as names of global
variables or functions into your asm statements. Code like this variables or functions into your <tt/asm/ statements. Code such as this:
<tscreen><verb> <tscreen><verb>
int foo; int foo;
int bar () { return 1; } int bar (void) { return 1; }
__asm__ ("lda _foo"); /* DON'T DO THAT! */ ...
__asm__ ("lda _foo"); /* DON'T DO THAT! */
... ...
__asm__ ("jsr _bar"); /* DON'T DO THAT EITHER! */ __asm__ ("jsr _bar"); /* DON'T DO THAT EITHER! */
</verb></tscreen> </verb></tscreen>
<p> <p>
may stop working if the way, the compiler generates these names is changed in might stop working if the way that the compiler generates those names is changed in
a future version. Instead use the format specifiers from the table above: a future version. Instead, use the format specifiers from the table above:
<tscreen><verb> <tscreen><verb>
__asm__ ("lda %v", foo); /* OK */ __asm__ ("lda %v", foo); /* OK */
... ...
__asm__ ("jsr %v", bar); /* OK */ __asm__ ("jsr %v", bar); /* OK */
</verb></tscreen> </verb></tscreen>
<p> <p>
<sect>Implementation-defined behavior<p> <sect>Implementation-defined behavior<p>
This section describes the behavior of cc65 when the standard describes the This section describes the behavior of cc65 when the standard describes the
@@ -1423,15 +1565,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <item> The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@@ -1,12 +1,12 @@
<!doctype linuxdoc system> <!-- -*- text-mode -*- --> <!doctype linuxdoc system> <!-- -*- text-mode -*- -->
<article> <article>
<title>chrcvt Users Guide <title>chrcvt65 Users Guide
<author><url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal"> <author><url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">
<date>2013-02-10 <date>2013-02-10
<abstract> <abstract>
chrcvt is the vector font converter. It is able to convert a foreign font into chrcvt65 is the vector font converter. It is able to convert a foreign font into
the native format. the native format.
</abstract> </abstract>
@@ -18,7 +18,7 @@ the native format.
<sect>Overview<p> <sect>Overview<p>
chrcvt is a vector font converter. It is able to convert a "BGI Stroked chrcvt65 is a vector font converter. It is able to convert a "BGI Stroked
Font" to a compact TGI native vector font. See the function <url Font" to a compact TGI native vector font. See the function <url
url="funcref.html#tgi_load_vectorfont" name="tgi_load_vectorfont"> for usage. url="funcref.html#tgi_load_vectorfont" name="tgi_load_vectorfont"> for usage.
@@ -26,7 +26,7 @@ url="funcref.html#tgi_load_vectorfont" name="tgi_load_vectorfont"> for usage.
<sect>Usage<p> <sect>Usage<p>
The chrcvt utility converts the font of one Borland file to its cc65 equivalent. The chrcvt65 utility converts the font of one Borland file to its cc65 equivalent.
<sect1>Command line option overview<p> <sect1>Command line option overview<p>
@@ -35,7 +35,7 @@ The program may be called as follows:
<tscreen><verb> <tscreen><verb>
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Usage: chrcvt [options] file [options] [file] Usage: chrcvt65 [options] file [options] [file]
Short options: Short options:
-h Help (this text) -h Help (this text)
-v Be more verbose -v Be more verbose
@@ -80,7 +80,7 @@ in TCH format to a new file.
Example output for the command Example output for the command
<tscreen><verb> <tscreen><verb>
chrcvt --verbose LITT.CHR chrcvt65 --verbose LITT.CHR
</verb></tscreen> </verb></tscreen>
<tscreen><verb> <tscreen><verb>
BGI Stroked Font V1.1 - Aug 12, 1991 BGI Stroked Font V1.1 - Aug 12, 1991
@@ -91,7 +91,7 @@ Copyright (c) 1987,1988 Borland International
<sect>Copyright<p> <sect>Copyright<p>
chrcvt is (C) Copyright 2009, Ullrich von Bassewitz. For usage of the chrcvt65 is (C) Copyright 2009, Ullrich von Bassewitz. For usage of the
binaries and/or sources the following conditions apply: binaries and/or sources the following conditions apply:
This software is provided 'as-is', without any expressed or implied This software is provided 'as-is', without any expressed or implied

View File

@@ -2,8 +2,9 @@
<article> <article>
<title>cl65 Users Guide <title>cl65 Users Guide
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
<date>01.08.2000, 27.11.2000, 02.10.2001 <url url="mailto:greg.king5@verizon.net" name="Greg King">
<date>2017-05-24
<abstract> <abstract>
cl65 is the compile &amp; link utility for cc65, the 6502 C compiler. It was cl65 is the compile &amp; link utility for cc65, the 6502 C compiler. It was
@@ -50,18 +51,20 @@ Short options:
-C name Use linker config file -C name Use linker config file
-Cl Make local variables static -Cl Make local variables static
-D sym[=defn] Define a preprocessor symbol -D sym[=defn] Define a preprocessor symbol
-E Stop after the preprocessing stage
-I dir Set a compiler include directory path -I dir Set a compiler include directory path
-L path Specify a library search path -L path Specify a library search path
-Ln name Create a VICE label file -Ln name Create a VICE label file
-O Optimize code -O Optimize code
-Oi Optimize code, inline functions -Oi Optimize code, inline more code
-Or Optimize code, honour the register keyword -Or Optimize code, honour the register keyword
-Os Optimize code, inline known C funtions -Os Optimize code, inline standard funtions
-S Compile but don't assemble and link -S Compile but don't assemble and link
-T Include source as comment -T Include source as comment
-V Print the version number -V Print the version number
-W name[,...] Supress compiler warnings -W name[,...] Supress compiler warnings
-Wa options Pass options to the assembler -Wa options Pass options to the assembler
-Wc options Pass options to the compiler
-Wl options Pass options to the linker -Wl options Pass options to the linker
Long options: Long options:
@@ -103,6 +106,7 @@ Long options:
--o65-model model Override the o65 model --o65-model model Override the o65 model
--obj file Link this object file --obj file Link this object file
--obj-path path Specify an object file search path --obj-path path Specify an object file search path
--print-target-path Print the target file path
--register-space b Set space available for register variables --register-space b Set space available for register variables
--register-vars Enable register variables --register-vars Enable register variables
--rodata-name seg Set the name of the RODATA segment --rodata-name seg Set the name of the RODATA segment
@@ -118,78 +122,99 @@ Long options:
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
</verb></tscreen> </verb></tscreen>
Most of the options have the same meaning than the corresponding compiler, Most of the options have the same meanings as the corresponding compiler,
assembler or linker option. See the documentation for these tools for an assembler, and linker options. See the documentation for those tools for an
explanation. If an option is available for more than one of the tools, it explanation. If an option is available for more than one of the tools, it
is set for all tools, where it is available. One example for this is <tt/-v/: is set for all tools where it is available. One example for that is <tt/-v/:
The compiler, the assembler and the linker are all called with the <tt/-v/ The compiler, the assembler, and the linker are all called with the <tt/-v/
switch. switch.
There are a few remaining options that control the behaviour of cl65: There are a few remaining options that control the behaviour of cl65:
<descrip> <descrip>
<tag><tt>-E</tt></tag>
This option is passed to the cc65 compiler; and, it forces cl65 to stop
before the assembly step. That means that C-level preprocessor directives
are obeyed; and, macroes are expanded. But, the C source isn't compiled.
If the <tt/-o/ option isn't used, then the C code results are written into
files with a ".i" suffix on their base names. Assembler files, object
files, and libraries given on the command line are ignored.
<tag><tt>-S</tt></tag> <tag><tt>-S</tt></tag>
This option forces cl65 to stop after the assembly step. This means that This option forces cl65 to stop before the assembly step. That means that
C files are translated into assembler files, but nothing more is done. C files are translated into assembler files; but, nothing more is done.
Assembler files, object files and libraries given on the command line Assembler files, object files, and libraries given on the command line
are ignored. are ignored.
<tag><tt>-c</tt></tag> <tag><tt>-c</tt></tag>
This options forces cl65 to stop after the assembly step. This means This option forces cl65 to stop after the assembly step. That means
that C and assembler files given on the command line are translated into that C and assembler files given on the command line are translated into
object files, but there is no link step, and object files and libraries object files; but, there is no link step. Object files and libraries
given on the command line are ignored. given on the command line are ignored.
<tag><tt>-o name</tt></tag> <tag><tt>-o name</tt></tag>
The -o option is used for the target name in the final step. This causes The -o option is used for the target name in the final step. That causes
problems, if the linker will not be called, and there are several input problems if the linker will not be called, and there are several input
files on the command line. In this case, the name given with -o will be files on the command line. In that case, the name given with -o will be
used for all of them, which makes the option pretty useless. You used for all of them, which makes the option pretty useless. You
shouldn't use -o when more than one output file is created. shouldn't use <tt/-o/ when more than one output file is created.
<tag><tt>--print-target-path</tt></tag>
This option prints the absolute path of the target file directory, and exits
then. It is supposed to be used with shell backquotes or the GNU make shell
function. That way, you can write build scripts or Makefiles accessing target
files without any assumption about the cc65 installation path.
<tag><tt>-t sys, --target sys</tt></tag> <tag><tt>-t sys, --target sys</tt></tag>
The default for this option is different from the compiler and linker in the The default for this option is different from the compiler and linker, in the
case that the option is missing: While the other tools (compiler, assembler case that the option is missing: While the other tools (compiler, assembler,
and linker) will use the "none" system settings by default, cl65 will use and linker) will use the "none" system settings by default, cl65 will use
the C64 as a target system by default. This was chosen since most people "c64" as a target system by default. That was chosen because most people
seem to use cc65 to develop for the C64. seem to use cc65 to develop for the C64.
<tag><tt>-Wa options, --asm-args options</tt></tag> <tag><tt>-Wa options, --asm-args options</tt></tag>
Pass options directly to the assembler. This may be used to pass options Pass options directly to the assembler. This may be used to pass options
that aren't directly supported by cl65. Several options may be separated by that aren't directly supported by cl65. Several options may be separated by
commas, the commas are replaced by spaces when passing them to the commas; the commas are replaced by spaces when passing them to the
assembler. Beware: Passing arguments directly to the assembler may interfere assembler. Beware: Passing arguments directly to the assembler might interfere
with some of the defaults, because cl65 doesn't parse the options passed. So with some of the defaults because cl65 doesn't parse the options passed. So,
if cl65 supports an option by itself, do not pass this option to the if cl65 supports an option by itself, do not pass that option to the
assembler by means of the <tt/-Wa/ switch. assembler by means of the <tt/-Wa/ switch.
<tag><tt>-Wc options, --cc-args options</tt></tag> <tag><tt>-Wc options, --cc-args options</tt></tag>
Pass options directly to the compiler. This may be used to pass options Pass options directly to the compiler. This may be used to pass options
that aren't directly supported by cl65. Several options may be separated by that aren't directly supported by cl65. Several options may be separated by
commas, the commas are replaced by spaces when passing them to the commas; the commas are replaced by spaces when passing them to the
compiler. Beware: Passing arguments directly to the compiler may interfere compiler. Beware: Passing arguments directly to the compiler might interfere
with some of the defaults, because cl65 doesn't parse the options passed. So with some of the defaults because cl65 doesn't parse the options passed. So,
if cl65 supports an option by itself, do not pass this option to the if cl65 supports an option by itself, do not pass that option to the
compiler by means of the <tt/-Wc/ switch. compiler by means of the <tt/-Wc/ switch.
<tag><tt>-Wl options, --ld-args options</tt></tag> <tag><tt>-Wl options, --ld-args options</tt></tag>
Pass options directly to the linker. This may be used to pass options that Pass options directly to the linker. This may be used to pass options that
aren't directly supported by cl65. Several options may be separated by aren't directly supported by cl65. Several options may be separated by
commas, the commas are replaced by spaces when passing them to the linker. commas; the commas are replaced by spaces when passing them to the linker.
Beware: Passing arguments directly to the linker may interfere with some of Beware: Passing arguments directly to the linker might interfere with some of
the defaults, because cl65 doesn't parse the options passed. So if cl65 the defaults because cl65 doesn't parse the options passed. So, if cl65
supports an option by itself, do not pass this option to the linker by means supports an option by itself, do not pass that option to the linker by means
of the <tt/-Wl/ switch. of the <tt/-Wl/ switch.
</descrip> </descrip>
@@ -198,7 +223,7 @@ There are a few remaining options that control the behaviour of cl65:
<sect>More usage<p> <sect>More usage<p>
Since cl65 was created to simplify the use of the cc65 development Because cl65 was created to simplify the use of the cc65 development
package, it tries to be smart about several things. package, it tries to be smart about several things.
<itemize> <itemize>
@@ -206,15 +231,14 @@ package, it tries to be smart about several things.
<item> If you don't give a target system on the command line, cl65 <item> If you don't give a target system on the command line, cl65
defaults to the C64. defaults to the C64.
<item> When linking, cl65 will supply the names of the startup file and <item> When linking, cl65 will supply the name of the library file for
library for the target system to the linker, so you don't have to do the target system to the linker; so, you don't have to do that.
that.
<item> If the final step is the linker, and the name of the output file was <item> If the final step is the linker, and the name of the output file was
not explicitly given, cl65 will use the name of the first input file not explicitly given, cl65 will use the name of the first input file
without the extension, provided that the name of this file has an without the extension, provided that the name of that file has an
extension. So you don't need to name the executable name in most extension. So, you don't need to give the executable name in most
cases, just give the name of your "main" file as first input file. cases; just give the name of your "main" file as the first input file.
</itemize> </itemize>
The command line is parsed from left to right, and the actual processing tool The command line is parsed from left to right, and the actual processing tool
@@ -235,7 +259,7 @@ The type of an input file is derived from its extension:
<itemize> <itemize>
<item>C files: <tt/.c/ <item>C files: <tt/.c/
<item>Assembler files: <tt/.s/, <tt/.asm/, <tt/.a65/ <item>Assembler files: <tt/.s/, <tt/.asm/, <tt/.a65/
<item>Object files: <tt/.o/ <tt/.obj/ <item>Object files: <tt/.o/, <tt/.obj/
<item>Libraries: <tt/.a/, <tt/.lib/ <item>Libraries: <tt/.a/, <tt/.lib/
<item>GEOS resource files: <tt/.grc/ <item>GEOS resource files: <tt/.grc/
<item>o65 files: <tt/.o65/, <tt/.emd/, <tt/.joy/, <tt/.tgi/ <item>o65 files: <tt/.o65/, <tt/.emd/, <tt/.joy/, <tt/.tgi/
@@ -304,4 +328,3 @@ freely, subject to the following restrictions:
</article> </article>

177
doc/creativision.sgml Normal file
View File

@@ -0,0 +1,177 @@
<!doctype linuxdoc system>
<article>
<title>VTech Creativision (aka Funvision) specific information for cc65
<author><url url="mailto:polluks+cc65@sdf.lonestar.org" name="Stefan A. Haubenthal">
<date>2016-04-14
<abstract>
An overview over the Creativision runtime system as it is implemented for the
cc65 C compiler.
</abstract>
<!-- Table of contents -->
<toc>
<!-- Begin the document -->
<sect>Overview<p>
This file contains an overview of the Creativision runtime system as it comes
with the cc65 C compiler. It describes the memory layout, Creativision specific header
files, available drivers, and any pitfalls specific to that platform.
Please note that Creativision specific functions are just mentioned here, they are
described in detail in the separate <url url="funcref.html" name="function
reference">. Even functions marked as "platform dependent" may be available on
more than one platform. Please see the function reference for more information.
<sect>Binary format<p>
The standard binary output format generated by the linker for the Creativision target
is a 4 kbyte machine language program. It is of course possible to change
this behaviour by using one of the different linker configs.
<sect>Memory layout<p>
cc65 generated programs with the default setup run with the I/O area enabled,
which gives a usable memory range of &dollar;B000 - &dollar;BEFF.
More ROM may need additional bankswitching code.
Special locations:
<descrip>
<tag/Text screen/
The text screen is located at VRAM &dollar;1000.
<tag/Stack/
The C runtime stack is located at &dollar;3FF and growing downwards.
<tag/Heap/
The C heap is located at the end of the program and grows towards the C
runtime stack.
</descrip><p>
<sect>Platform specific header files<p>
Programs containing Creativision specific code may use the <tt/creativision.h/ header file.
<sect1>Creativision specific functions<p>
<itemize>
<item>bios_playsound
<item>psg_delay
<item>psg_outb
<item>psg_silence
</itemize>
<!--<sect1>Hardware access<p>
The following pseudo variables declared in the <tt/creativision.inc/ include file do
allow access to hardware located in the address space.
<descrip>
<tag><tt/VDP/</tag>
The <tt/VDP/ defines allow access to the video chip.
</descrip><p>
<descrip>
<tag><tt/PIA/</tag>
The <tt/PIA/ defines allow access to the I/O chip.
</descrip><p>-->
<sect>Loadable drivers<p>
<sect1>Graphics drivers<p>
No graphics drivers are currently available for the Creativision.
<sect1>Extended memory drivers<p>
No extended memory drivers are currently available for the Creativision.
<sect1>Joystick drivers<p>
<descrip>
<tag><tt/creativision-stdjoy.joy (creativisionstd_joy)/</tag>
A joystick driver for the standard joystick is available.
</descrip><p>
<sect1>Mouse drivers<p>
No mouse drivers are currently available for the Creativision.
<sect1>RS232 device drivers<p>
No communication port drivers are currently available for the Creativision.
<sect>Limitations<p>
<sect1>Disk I/O<p>
The existing library for the Creativision doesn't implement C file
I/O. There are even no hacks for the <tt/read()/ and <tt/write()/ routines.
To be more concrete, this limitation means that you cannot use any of the
following functions (and a few others):
<itemize>
<item>fclose
<item>fopen
<item>fread
<item>fprintf
<item>fputc
<item>fscanf
<item>fwrite
<item>...
</itemize>
<sect>Other hints<p>
<sect>License<p>
This software is provided 'as-is', without any expressed or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
<enum>
<item> The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source
distribution.
</enum>
</article>

View File

@@ -78,15 +78,15 @@ vectors at the proper memory locations. The segment definition is:
<tscreen><code> <tscreen><code>
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp, define = yes; ZEROPAGE: load = ZP, type = zp, define = yes;
DATA: load = ROM, type = rw, define = yes, run = RAM; DATA: load = ROM, type = rw, define = yes, run = RAM;
BSS: load = RAM, type = bss, define = yes; BSS: load = RAM, type = bss, define = yes;
HEAP: load = RAM, type = bss, optional = yes; HEAP: load = RAM, type = bss, optional = yes;
STARTUP: load = ROM, type = ro; STARTUP: load = ROM, type = ro;
INIT: load = ROM, type = ro, optional = yes; ONCE: load = ROM, type = ro, optional = yes;
CODE: load = ROM, type = ro; CODE: load = ROM, type = ro;
RODATA: load = ROM, type = ro; RODATA: load = ROM, type = ro;
VECTORS: load = ROM, type = ro, start = $FFFA; VECTORS: load = ROM, type = ro, start = $FFFA;
} }
</code></tscreen> </code></tscreen>
@@ -97,7 +97,7 @@ The meaning of each of these segments is as follows.
<p><tt> BSS: </tt>Uninitialized data stored in RAM (used for variable storage) <p><tt> BSS: </tt>Uninitialized data stored in RAM (used for variable storage)
<p><tt> HEAP: </tt>Uninitialized C-level heap storage in RAM, optional <p><tt> HEAP: </tt>Uninitialized C-level heap storage in RAM, optional
<p><tt> STARTUP: </tt>The program initialization code, stored in ROM <p><tt> STARTUP: </tt>The program initialization code, stored in ROM
<p><tt> INIT: </tt>The code needed to initialize the system, stored in ROM <p><tt> ONCE: </tt>The code run once to initialize the system, stored in ROM
<p><tt> CODE: </tt>The program code, stored in ROM <p><tt> CODE: </tt>The program code, stored in ROM
<p><tt> RODATA: </tt>Initialized data that cannot be modified by the program, stored in ROM <p><tt> RODATA: </tt>Initialized data that cannot be modified by the program, stored in ROM
<p><tt> VECTORS: </tt>The interrupt vector table, stored in ROM at location $FFFA <p><tt> VECTORS: </tt>The interrupt vector table, stored in ROM at location $FFFA

View File

@@ -114,10 +114,12 @@ Here is a description of all the command line options:
<item>65sc02 <item>65sc02
<item>65c02 <item>65c02
<item>huc6280 <item>huc6280
<item>4510
</itemize> </itemize>
6502x is for the NMOS 6502 with unofficial opcodes. huc6280 is the CPU of 6502x is for the NMOS 6502 with unofficial opcodes. huc6280 is the CPU of
the PC engine. Support for the 65816 currently is not available. the PC engine. 4510 is the CPU of the Commodore C65. Support for the 65816
currently is not available.
<label id="option--formfeeds"> <label id="option--formfeeds">
@@ -239,6 +241,11 @@ disassembler may be told to recognize either the 65SC02 or 65C02 CPUs. The
latter understands the same opcodes as the former, plus 16 additional bit latter understands the same opcodes as the former, plus 16 additional bit
manipulation and bit test-and-branch commands. manipulation and bit test-and-branch commands.
When disassembling 4510 code, due to handling of 16-bit wide branches, da65
can produce output that can not be re-assembled, when one or more of those
branches point outside of the disassembled memory. This can happen when text
or binary data is processed.
While there is some code for the 65816 in the sources, it is currently While there is some code for the 65816 in the sources, it is currently
unsupported. unsupported.

View File

@@ -3,7 +3,7 @@
<article> <article>
<title>cc65 function reference <title>cc65 function reference
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz"> <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2015-07-21 <date>2016-08-07
<abstract> <abstract>
cc65 is a C compiler for 6502 based systems. This function reference describes cc65 is a C compiler for 6502 based systems. This function reference describes
@@ -98,6 +98,7 @@ function.
<!-- <item><ref id="_getcolor" name="_getcolor"> --> <!-- <item><ref id="_getcolor" name="_getcolor"> -->
<!-- <item><ref id="_getdefdev" name="_getdefdev"> --> <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
<!-- <item><ref id="_graphics" name="_graphics"> --> <!-- <item><ref id="_graphics" name="_graphics"> -->
<item><ref id="_is_cmdline_dos" name="_is_cmdline_dos">
<!-- <item><ref id="_rest_vecs" name="_rest_vecs"> --> <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
<!-- <item><ref id="_save_vecs" name="_save_vecs"> --> <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
<!-- <item><ref id="_scroll" name="_scroll"> --> <!-- <item><ref id="_scroll" name="_scroll"> -->
@@ -168,8 +169,11 @@ function.
<item><ref id="cbm_k_open" name="cbm_k_open"> <item><ref id="cbm_k_open" name="cbm_k_open">
<item><ref id="cbm_k_readst" name="cbm_k_readst"> <item><ref id="cbm_k_readst" name="cbm_k_readst">
<item><ref id="cbm_k_save" name="cbm_k_save"> <item><ref id="cbm_k_save" name="cbm_k_save">
<item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
<item><ref id="cbm_k_setlfs" name="cbm_k_setlfs"> <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
<item><ref id="cbm_k_setnam" name="cbm_k_setnam"> <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
<item><ref id="cbm_k_talk" name="cbm_k_talk">
<item><ref id="cbm_k_udtim" name="cbm_k_udtim">
<item><ref id="cbm_k_unlsn" name="cbm_k_unlsn"> <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
<!-- <item><ref id="cbm_load" name="cbm_load"> --> <!-- <item><ref id="cbm_load" name="cbm_load"> -->
<!-- <item><ref id="cbm_open" name="cbm_open"> --> <!-- <item><ref id="cbm_open" name="cbm_open"> -->
@@ -209,7 +213,7 @@ function.
<sect1><tt/cc65.h/<label id="cc65.h"><p> <sect1><tt/cc65.h/<label id="cc65.h"><p>
<!-- <itemize> --> <itemize>
<!-- <item><ref id="cc65_cos" name="cc65_cos"> --> <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
<!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> --> <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
<!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> --> <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
@@ -219,7 +223,8 @@ function.
<!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> --> <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
<!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> --> <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
<!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> --> <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
<!-- </itemize> --> <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
</itemize>
(incomplete) (incomplete)
@@ -346,6 +351,16 @@ function.
</itemize> </itemize>
<sect1><tt/gamate.h/<label id="gamate.h"><p>
<!-- <itemize> -->
<!-- <item><ref id="get_tv" name="get_tv"> -->
<!-- <item><ref id="waitvblank" name="waitvblank"> -->
<!-- </itemize> -->
(incomplete)
<sect1><tt/geos.h/<label id="geos.h"><p> <sect1><tt/geos.h/<label id="geos.h"><p>
(incomplete) (incomplete)
@@ -386,6 +401,13 @@ function.
(incomplete) (incomplete)
<sect1><tt/lz4.h/<label id="lz4.h"><p>
<itemize>
<item><ref id="decompress_lz4" name="decompress_lz4">
</itemize>
<sect1><tt/modload.h/<label id="modload.h"><p> <sect1><tt/modload.h/<label id="modload.h"><p>
<itemize> <itemize>
@@ -418,7 +440,7 @@ function.
<!-- <itemize> --> <!-- <itemize> -->
<!-- <item><ref id="get_tv" name="get_tv"> --> <!-- <item><ref id="get_tv" name="get_tv"> -->
<!-- <item><ref id="waitvblank" name="waitvblank"> --> <!-- <item><ref id="waitvsync" name="waitvsync"> -->
<!-- </itemize> --> <!-- </itemize> -->
(incomplete) (incomplete)
@@ -432,6 +454,16 @@ url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">
It does not declare any functions. It does not declare any functions.
<sect1><tt/pce.h/<label id="pce.h"><p>
<!-- <itemize> -->
<!-- <item><ref id="get_tv" name="get_tv"> -->
<!-- <item><ref id="waitvblank" name="waitvblank"> -->
<!-- </itemize> -->
(incomplete)
<sect1><tt/peekpoke.h/<label id="peekpoke.h"><p> <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
<itemize> <itemize>
@@ -442,6 +474,16 @@ It does not declare any functions.
</itemize> </itemize>
<sect1><tt/pen.h/<label id="pen.h"><p>
<!-- <itemize> -->
<!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
<!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
<!-- </itemize> -->
(incomplete)
<sect1><tt/pet.h/<label id="pet.h"><p> <sect1><tt/pet.h/<label id="pet.h"><p>
(incomplete) (incomplete)
@@ -942,6 +984,20 @@ id="malloc" name="malloc"> may still return <tt/NULL/.
</quote> </quote>
<sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
<quote>
<descrip>
<tag/Function/Determines whether the underlying DOS supports command line arguments.
<tag/Header/<tt/<ref id="atari.h" name="atari.h">/
<tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
<tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
It returns 1 if it does.
<tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
</descrip>
</quote>
<sect1>_poserror<label id="_poserror"><p> <sect1>_poserror<label id="_poserror"><p>
<quote> <quote>
@@ -1977,6 +2033,31 @@ only be used in presence of a prototype.
</quote> </quote>
<sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
<quote>
<descrip>
<tag/Function/Scan the keyboard matrix.
<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
<tag/Declaration/<tt/void cbm_k_scnkey (void);/
<tag/Description/This function looks at the switches in the keyboard, to see
if any of them are being pressed. If they are, then code numbers for them are
stored in RAM. Other functions use those numbers to input text. Normally,
the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
function, in order to provide input from the keyboard.
<tag/Availability/cc65
<tag/See also/
<ref id="cbm_k_getin" name="cbm_k_getin">,
<ref id="cbm_k_udtim" name="cbm_k_udtim">,
<ref id="cgetc" name="cgetc">,
<!-- <ref id="getc" name="getc"> -->
<!-- <ref id="getchar" name="getchar"> -->
<tag/Example/None.
</descrip>
</quote>
<sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p> <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
<quote> <quote>
@@ -2042,6 +2123,27 @@ only be used in presence of a prototype.
</quote> </quote>
<sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
<quote>
<descrip>
<tag/Function/Update the Jiffy clock.
<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
<tag/Declaration/<tt/void cbm_k_udtim (void);/
<tag/Description/This function adds one count to the Jiffy clock. That clock
counts sixtieths of a second. It is used by the library's <tt/clock()/
function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
then that ISR must call this function, in order to keep the clock valid.
<tag/Availability/cc65
<tag/See also/
<ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
<ref id="clock" name="clock">
<tag/Example/None.
</descrip>
</quote>
<sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p> <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
<quote> <quote>
@@ -2185,15 +2287,18 @@ only be used in presence of a prototype.
<tag/Header/<tt/<ref id="conio.h" name="conio.h">/ <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
<tag/Declaration/<tt/char cgetc (void);/ <tag/Declaration/<tt/char cgetc (void);/
<tag/Description/The function reads a character from the keyboard. If there is <tag/Description/The function reads a character from the keyboard. If there is
no character available, <tt/cgetc/ waits until the user presses a key. If the no character available, <tt/cgetc()/ waits until the user presses a key. If the
cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
displayed while waiting. displayed while waiting.
<tag/Notes/<itemize> <tag/Notes/<itemize>
<item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
from this buffer and wait only if the buffer is empty. from that buffer; and, wait only if the buffer is empty.
<item>The keyboard must be scanned periodically, in order for this function to
see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
</itemize> </itemize>
<tag/Availability/cc65 <tag/Availability/cc65
<tag/See also/ <tag/See also/
<ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
<ref id="cursor" name="cursor">, <ref id="cursor" name="cursor">,
<ref id="kbhit" name="kbhit"> <ref id="kbhit" name="kbhit">
<tag/Example/None. <tag/Example/None.
@@ -2283,16 +2388,19 @@ used in presence of a prototype.
<tag/Header/<tt/<ref id="time.h" name="time.h">/ <tag/Header/<tt/<ref id="time.h" name="time.h">/
<tag/Declaration/<tt/clock_t clock (void);/ <tag/Declaration/<tt/clock_t clock (void);/
<tag/Description/The <tt/clock/ function returns an approximaton of processor <tag/Description/The <tt/clock/ function returns an approximaton of processor
time used by the program. The time is returned in implementation defined time used by the program. The time is returned in implementation-defined
units. It can be converted to seconds by dividing by the value of the macro units. It can be converted to seconds by dividing by the value of the macro
<tt/CLOCKS_PER_SEC/. <tt/CLOCKS_PER_SEC/.
<tag/Notes/<itemize> <tag/Notes/<itemize>
<item>Since the machines, cc65 generated programs run on, cannot run multiple <item>Since the machines that cc65-generated programs run on cannot run multiple
processes, the function will actually return the time since some processes, the function actually will return the time since some
implementation defined point in the past. implementation-defined point in the past.
<item>The Jiffy clock must be "running", in order for this function to return
changing values. (See the description of <tt/cbm_k_udtim()/.)
</itemize> </itemize>
<tag/Availability/ISO 9899 <tag/Availability/ISO 9899
<tag/See also/ <tag/See also/
<ref id="cbm_k_udtim" name="cbm_k_udtim">,
<ref id="time" name="time"> <ref id="time" name="time">
<tag/Example/None. <tag/Example/None.
</descrip> </descrip>
@@ -2598,6 +2706,23 @@ used in presence of a prototype.
</quote> </quote>
<sect1>decompress_lz4<label id="decompress_lz4"><p>
<quote>
<descrip>
<tag/Function/Uncompress a LZ4-compressed buffer.
<tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
<tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
<tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
<tag/Notes/<itemize>
<item>Use LZ4_compress_HC with compression level 16 for best compression.
</itemize>
<tag/Availability/cc65
<tag/Example/None.
</descrip>
</quote>
<sect1>div<label id="div"><p> <sect1>div<label id="div"><p>
<quote> <quote>
@@ -2619,6 +2744,40 @@ ldiv
</quote> </quote>
<sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
<quote>
<descrip>
<tag/Function/Determines whether the screen is going to be cleared after program exit.
<tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
<tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
<tag/Description/The function returns zero if the screen won't be cleared immediately after
program termination. It returns a non-zero value if it will.
<tag/Notes/<itemize>
<item>Some systems, maybe depending on configuration, immediately clear the screen
after a program exits. Therefore it might be difficult to read
the last messages printed by the program prior to its exit. This function can be used
to decide if a delay or wait for a key press should be executed when then program
exits.
</itemize>
<tag/Availability/cc65
<tag/Example/<verb>
/* Hello World */
#include <stdio.h>
#include <unistd.h>
#include <cc65.h>
int main(void)
{
printf("Hello World\n");
if (doesclrscrafterexit())
sleep(5);
return 0;
}
</verb>
</descrip>
</quote>
<sect1>em_commit<label id="em_commit"><p> <sect1>em_commit<label id="em_commit"><p>
<quote> <quote>
@@ -3642,7 +3801,7 @@ fastcall function, so it may only be used in presence of a prototype.
<quote> <quote>
<descrip> <descrip>
<tag/Function/Check if a given character is a a white-space character. <tag/Function/Check if a given character is a white-space character.
<tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/ <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
<tag/Declaration/<tt/int __fastcall__ isspace (int c);/ <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
<tag/Description/The function returns a non zero value if the given argument <tag/Description/The function returns a non zero value if the given argument

View File

@@ -3,7 +3,7 @@
<article> <article>
<title>cc65 Documentation Overview <title>cc65 Documentation Overview
<author><url url="http://cc65.github.io/doc"> <author><url url="http://cc65.github.io/doc">
<date> <date>2017-02-15
<sect>Program documentation<p> <sect>Program documentation<p>
@@ -18,7 +18,7 @@
<tag><htmlurl url="cc65.html" name="cc65.html"></tag> <tag><htmlurl url="cc65.html" name="cc65.html"></tag>
Describes the cc65 C compiler. Describes the cc65 C compiler.
<tag><htmlurl url="chrcvt.html" name="chrcvt.html"></tag> <tag><htmlurl url="chrcvt65.html" name="chrcvt65.html"></tag>
Describes the vector font converter. Describes the vector font converter.
<tag><htmlurl url="cl65.html" name="cl65.html"></tag> <tag><htmlurl url="cl65.html" name="cl65.html"></tag>
@@ -31,7 +31,7 @@
Describes the da65 6502/65C02 disassembler. Describes the da65 6502/65C02 disassembler.
<tag><htmlurl url="grc65.html" name="grc65.html"></tag> <tag><htmlurl url="grc65.html" name="grc65.html"></tag>
Describes the GEOS resource compiler (grc65). Describes the GEOS resource compiler.
<tag><htmlurl url="ld65.html" name="ld65.html"></tag> <tag><htmlurl url="ld65.html" name="ld65.html"></tag>
Describes the ld65 linker. Describes the ld65 linker.
@@ -59,6 +59,9 @@
<tag><htmlurl url="coding.html" name="coding.html"></tag> <tag><htmlurl url="coding.html" name="coding.html"></tag>
Contains hints on creating the most effective code with cc65. Contains hints on creating the most effective code with cc65.
<tag><htmlurl url="cc65-intern.html" name="cc65-intern.html"></tag>
Describes internal details of cc65, such as calling conventions.
<tag><htmlurl url="using-make.html" name="using-make.html"></tag> <tag><htmlurl url="using-make.html" name="using-make.html"></tag>
Build programs, using the GNU Make utility. Build programs, using the GNU Make utility.
@@ -113,6 +116,9 @@
<tag><htmlurl url="atari.html" name="atari.html"></tag> <tag><htmlurl url="atari.html" name="atari.html"></tag>
Topics specific to the Atari 8-bit machines. Topics specific to the Atari 8-bit machines.
<tag><htmlurl url="atari2600.html" name="atari2600.html"></tag>
Topics specific to the Atari 2600 Game Console.
<tag><htmlurl url="atari5200.html" name="atari5200.html"></tag> <tag><htmlurl url="atari5200.html" name="atari5200.html"></tag>
Topics specific to the Atari 5200 Game Console. Topics specific to the Atari 5200 Game Console.
@@ -134,6 +140,12 @@
<tag><htmlurl url="cbm610.html" name="cbm610.html"></tag> <tag><htmlurl url="cbm610.html" name="cbm610.html"></tag>
Topics specific to the Commodore 610. Topics specific to the Commodore 610.
<tag><htmlurl url="creativision.html" name="creativision.html"></tag>
Topics specific to the Creativision Console.
<tag><htmlurl url="gamate.html" name="gamate.html"></tag>
Topics specific to the Bit Corporation Gamate Console.
<tag><htmlurl url="lynx.html" name="lynx.html"></tag> <tag><htmlurl url="lynx.html" name="lynx.html"></tag>
Topics specific to the Atari Lynx Game Console. Topics specific to the Atari Lynx Game Console.
@@ -146,9 +158,6 @@
<tag><htmlurl url="pce.html" name="pce.html"></tag> <tag><htmlurl url="pce.html" name="pce.html"></tag>
Topics specific to NEC PC-Engine (TurboGrafx) Console. Topics specific to NEC PC-Engine (TurboGrafx) Console.
<tag><htmlurl url="gamate.html" name="gamate.html"></tag>
Topics specific to Bit Corporation Gamate Console.
<tag><htmlurl url="pet.html" name="pet.html"></tag> <tag><htmlurl url="pet.html" name="pet.html"></tag>
Topics specific to the Commodore PET machines. Topics specific to the Commodore PET machines.
@@ -158,6 +167,9 @@
<tag><htmlurl url="supervision.html" name="supervision.html"></tag> <tag><htmlurl url="supervision.html" name="supervision.html"></tag>
Topics specific to the Watara Supervision Console. Topics specific to the Watara Supervision Console.
<tag><htmlurl url="telestrat.html" name="telestrat.html"></tag>
Topics specific to the Oric Telestrat.
<tag><htmlurl url="vic20.html" name="vic20.html"></tag> <tag><htmlurl url="vic20.html" name="vic20.html"></tag>
Topics specific to the Commodore VIC20. Topics specific to the Commodore VIC20.

View File

@@ -335,6 +335,35 @@ your harddrive directly.
to the DOS menu. Your C program should wait for a keypress if you want to see to the DOS menu. Your C program should wait for a keypress if you want to see
any output. any output.
<sect2>Stella<p>
Available at <url
url="http://stella.sourceforge.net">:
Stella is a multi-platform Atari 2600 VCS emulator. The latest version
is available on the emulator's website. It is also available through
the package manager of most Linux distributions (Fedora, Ubuntu, ..).
Compile the Atari 2600 sample with
<tscreen><verb>
make SYS=atari2600 samples
</verb></tscreen>
Then execute it with
<tscreen><verb>
stella samples/atari2600hello
</verb></tscreen>
<sect2>Harmony Cartridge<p>
Available at <url
url="http://harmony.atariage.com/Site/Harmony.html">:
The Harmony Cartridge allows running any Atari 2600 binary on real
hardware. The binary must be copied on an SD card, to be inserted in
the Harmony Cartridge. It can then be inserted on an Atari 2600
console, and run any binary on the SD card.
<sect1>Atmos <sect1>Atmos

View File

@@ -156,6 +156,7 @@ Here is a description of all of the command-line options:
<item>module <item>module
<item>apple2 <item>apple2
<item>apple2enh <item>apple2enh
<item>atari2600
<item>atari <item>atari
<item>atarixl <item>atarixl
<item>atmos <item>atmos
@@ -246,10 +247,11 @@ Here is a description of all of the command-line options:
<tag><tt>-Ln</tt></tag> <tag><tt>-Ln</tt></tag>
This option allows you to create a file that contains all global labels and This option allows you to create a file that contains all global labels and
may be loaded into the VICE emulator using the <tt/ll/ (load label) command. You may be loaded into the VICE emulator using the <tt/ll/ (load label) command
or into the Oricutron emulator using the <tt/sl/ (symbols load) command. You
may use this to debug your code with VICE. Note: Older versions had some may use this to debug your code with VICE. Note: Older versions had some
bugs in the label code. If you have problems, please get the latest <url bugs in the label code. If you have problems, please get the latest <url
url="http://vice-emu.sourceforge.net/" name="VICE"> version. url="http://vice-emu.sourceforge.net" name="VICE"> version.
<label id="option-S"> <label id="option-S">
@@ -1032,11 +1034,11 @@ The builtin config files do contain segments that have a special meaning for
the compiler and the libraries that come with it. If you replace the builtin the compiler and the libraries that come with it. If you replace the builtin
config files, you will need the following information. config files, you will need the following information.
<sect1>INIT<p> <sect1>ONCE<p>
The INIT segment is used for initialization code that may be reused once The ONCE segment is used for initialization code run only once before
execution reaches main() - provided that the program runs in RAM. You execution reaches main() - provided that the program runs in RAM. You
may for example add the INIT segment to the heap in really memory may for example add the ONCE segment to the heap in really memory
constrained systems. constrained systems.
<sect1>LOWCODE<p> <sect1>LOWCODE<p>

View File

@@ -69,8 +69,8 @@ Programs containing NES specific code may use the <tt/nes.h/ header file.
<sect1>NES specific functions<p> <sect1>NES specific functions<p>
<itemize> <itemize>
<item>waitvblank - wait until the start of vblank <item>waitvsync - wait until the start of the next frame</item>
<item>get_tv <item>get_tv</item>
</itemize> </itemize>

View File

@@ -5,7 +5,7 @@
<title>PC-Engine (TurboGrafx) System specific information for cc65 <title>PC-Engine (TurboGrafx) System specific information for cc65
<author> <author>
<url url="mailto:groepaz@gmx.net" name="Groepaz/Hitmen"> <url url="mailto:groepaz@gmx.net" name="Groepaz/Hitmen">
<date>2015-07-14 <date>2016-09-29
<abstract> <abstract>
An overview over the PCE runtime system as it is implemented for the An overview over the PCE runtime system as it is implemented for the
@@ -77,7 +77,7 @@ Programs containing PCE specific code may use the <tt/pce.h/ header file.
<sect1>PCE specific functions<p> <sect1>PCE specific functions<p>
<itemize> <itemize>
<item>waitvblank</item> <item>waitvsync</item>
<item>get_tv (since all PCE systems are NTSC, this always returns TV_NTSC)</item> <item>get_tv (since all PCE systems are NTSC, this always returns TV_NTSC)</item>
</itemize> </itemize>
@@ -179,7 +179,7 @@ some useful resources on PCE coding:
<itemize> <itemize>
<item><url url="http://blog.blockos.org/?tag=pc-engine"> <item><url url="http://blog.blockos.org/?tag=pc-engine">
<item><url url="http://pcedev.blockos.org/viewforum.php?f=5"> <item><url url="http://pcedev.blockos.org/viewforum.php?f=5">
<item><url url="http://www.romhacking.net/?page=documents&amp;category=&amp;platform=4&amp:game=&amp;author=&amp;perpage=20&amp;level=&amp;title=&amp;desc=&amp;docsearch=Go"> <item><url url="http://www.romhacking.net/?page=documents&amp;platform=4">
<item><url url="http://archaicpixels.com/Main_Page"> <item><url url="http://archaicpixels.com/Main_Page">
<item><url url="http://www.magicengine.com/mkit/doc.html"> <item><url url="http://www.magicengine.com/mkit/doc.html">

View File

@@ -155,8 +155,9 @@ The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/pet-stdjo
<tag><tt/pet-ptvjoy.joy (pet_ptvjoy_joy)/</tag> <tag><tt/pet-ptvjoy.joy (pet_ptvjoy_joy)/</tag>
Driver for the Protovision 4-player adapter contributed by Groepaz. See Driver for the Protovision 4-player adapter contributed by Groepaz. See
<url url="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and <url url="http://www.protovision-online.de/hardw/4_player.php?language=en"
building instructions. Up to two joysticks are supported. name="Protovision shop"> for prices and building instructions. Up to two
joysticks are supported.
<tag><tt/pet-stdjoy.joy (pet_stdjoy_joy)/</tag> <tag><tt/pet-stdjoy.joy (pet_stdjoy_joy)/</tag>
Driver for the standard PET userport joystick. Driver for the standard PET userport joystick.

View File

@@ -4,7 +4,7 @@
<title>sim65 Users Guide <title>sim65 Users Guide
<author><url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal"> <author><url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">
<date>2016-01-05 <date>2016-07-05
<abstract> <abstract>
sim65 is a simulator for 6502 and 65C02 CPUs. It allows to test target sim65 is a simulator for 6502 and 65C02 CPUs. It allows to test target
@@ -31,12 +31,14 @@ The simulator is called as follows:
Usage: sim65 [options] file [arguments] Usage: sim65 [options] file [arguments]
Short options: Short options:
-h Help (this text) -h Help (this text)
-c Print amount of executed CPU cycles
-v Increase verbosity -v Increase verbosity
-V Print the simulator version number -V Print the simulator version number
-x <num> Exit simulator after <num> cycles -x <num> Exit simulator after <num> cycles
Long options: Long options:
--help Help (this text) --help Help (this text)
--cycles Print amount of executed CPU cycles
--verbose Increase verbosity --verbose Increase verbosity
--version Print the simulator version number --version Print the simulator version number
</verb></tscreen> </verb></tscreen>
@@ -53,6 +55,13 @@ Here is a description of all the command line options:
Print the short option summary shown above. Print the short option summary shown above.
<tag><tt>-c, --cycles</tt></tag>
Print the number of executed CPU cycles when the program terminates.
The cycles for the final "<tt>jmp exit</tt>" are not included in this
count.
<tag><tt>-v, --verbose</tt></tag> <tag><tt>-v, --verbose</tt></tag>
Increase the simulator verbosity. Increase the simulator verbosity.

View File

@@ -49,6 +49,7 @@ Short options:
Long options: Long options:
--convert-to fmt[,attrlist] Convert into target format --convert-to fmt[,attrlist] Convert into target format
--dump-palette Dump palette as table
--help Help (this text) --help Help (this text)
--list-conversions List all possible conversions --list-conversions List all possible conversions
--pop Restore the original loaded image --pop Restore the original loaded image
@@ -76,6 +77,12 @@ attribute lists see <ref id="attr-lists" name="below">.
see section <ref id="conversions" name="Conversions">. see section <ref id="conversions" name="Conversions">.
<label id="option--dump-palette">
<tag><tt>--dump-palette</tt></tag>
Dump palette as table.
<label id="option--help"> <label id="option--help">
<tag><tt>-h, --help</tt></tag> <tag><tt>-h, --help</tt></tag>

View File

@@ -66,7 +66,7 @@ Programs containing Supervision specific code may use the <tt/supervision.h/ hea
<sect1>Supervision specific functions<p> <sect1>Supervision specific functions<p>
<itemize> <itemize>
<item>waitvblank <item>waitvsync</item>
</itemize> </itemize>

193
doc/telestrat.sgml Normal file
View File

@@ -0,0 +1,193 @@
<!doctype linuxdoc system>
<article>
<title>Oric Telestrat-specific information for cc65
<author>
<url url="mailto:jede@oric.org" name="Jede">
<date>2017-01-22
<abstract>
An overview over the Telestrat (<url name="Telemon 3.0"
url="http://orix.oric.org">) runtime system as it is implemented for the
cc65 C compiler.
</abstract>
<!-- Table of contents -->
<toc>
<!-- Begin the document -->
<sect>Overview<p>
This file contains an overview of the Telestrat runtime system as it comes with the
cc65 C compiler. It describes the memory layout, Telestrat-specific header files,
available drivers, and any pitfalls specific to that platform.
Please note that Telestrat-specific functions are just mentioned here, they are
described in detail in the separate <url url="funcref.html" name="function
reference">. Even functions marked as "platform dependent" may be available on
more than one platform. Please see the function reference for more
information.
<sect>Binary format<p>
The standard binary output format generated the linker for the Telestrat
target is a machine language program with a 20 bytes header described <url
name="here" url="http://orix.oric.org/doku.php?id=orix:header">
This header is used for Telemon 3.0.
Anyway, for Telemon 2.4, there is no file management, there is no TAPE routine in Telemon, there is no way to load a binary easily.
Stratsed (the Telestrat operating system) handles files management. Stratsed is loaded to memory from floppy disk.
There is no tool to insert a binary in a Stratsed floppy disk.
The only way to load a binary (for Telemon 2.4) is to:
<itemize>
<item>remove the 20 bytes header
<item>download <url name="osdk" url="http://osdk.defence-force.org/index?page=download">
<item>use Floppybuilder in OSDK to insert the binary with the tool (please read FloppyBuilder manual to insert your binary, and to start microdisc boot sector when Telestrat starts)
</itemize>
Please note also, that the binary converted into TAP file, will not produce
a right stratsed file when tap2dsk and old2mfm are used. You will be in the
case that Telestrat/Stratsed crashed when you do "DIR" command.
If you know the Stratsed disk format, please contact the author of this doc.
<sect>Memory layout<p>
In the standard setup, cc65-generated programs use the memory from
&dollar;0801 to &dollar;9800; so, nearly 37K of memory (including the stack) is
available. ROM calls are possible without further precautions.
Special locations:
<descrip>
<tag/Stack/
The C runtime stack is located at &dollar;97FF (or &dollar;B3FF), and grows
downwards.
<tag/Heap/
The C heap is located at the end of the program, and grows towards the C
runtime stack.
</descrip><p>
<sect>Platform-specific header files<p>
Programs containing Telestrat-specific code may use the <tt/telestrat.h/ header file.
<sect1>Telestrat-specific functions<p>
The functions listed below are special for the Telestrat. See the <url
url="funcref.html" name="function reference"> for declaration and usage.
<itemize>
<item>explode
<item>ping
<item>shoot
<item>zap
<item>oups
</itemize>
<sect1>Hardware access<p>
The following pseudo variables declared in the <tt/telestrat.h/ header file do allow
access to hardware located in the address space. Some variables are
structures; accessing the struct fields will access the chip registers.
<descrip>
<tag><tt/VIA/</tag>
Access to the VIA (Versatile Interface Adapter) chip is available via the
<tt/VIA/ variable. The structure behind this variable is explained in <tt/_6522.h/.
</descrip><p>
<sect>Loadable drivers<p>
<sect1>Extended memory drivers<p>
No extended memory drivers are currently available for the Telestrat.
<sect1>Joystick drivers<p>
<descrip>
telemon 2.4 & 3.0 manages joysticks but it had been handled yet.
</descrip>
<sect1>Mouse drivers<p>
<descrip>
Telestrat manages also mouse, but it had been no handled yet in this version.
</descrip>
<sect1>RS232 device drivers<p>
<descrip>
Telestrat has a RS232 port, but it's not used
</descrip>
<sect>Limitations<label id="limitations"><p>
<sect1>Disk I/O<p>
Telemon 3.0 handles fopen, fread, fclose primitives. It means that this
function will crash the Telestrat because Telemon 2.4 does not have these
primitives. By the way, Telemon 3.0 uses an extension "ch376 card" which
handles sdcard and FAT 32 usb key. In the next version of Telemon, FT DOS,
Sedoric, Stratsed will be handled in these 3 primitives (fopen, fread,
fclose).
<itemize>
<item>fclose
<item>fopen
<item>fread
</itemize>
<sect>Other hints<p>
<sect>License<p>
This software is provided 'as-is', without any expressed or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
<enum>
<item> The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source
distribution.
</enum>
</article>

Some files were not shown because too many files have changed in this diff Show More