Merge branch 'master' of https://github.com/jedeoric/cc65
This commit is contained in:
commit
aaf8863de5
267 changed files with 9426 additions and 5145 deletions
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
* text=auto
|
|
@ -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="
|
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -1,4 +1,4 @@
|
||||||
.PHONY: all mostlyclean clean install zip avail unavail bin lib doc samples
|
.PHONY: all mostlyclean clean install zip avail unavail bin lib doc html info samples
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ avail unavail bin:
|
||||||
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:
|
samples:
|
||||||
|
|
|
@ -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
|
|
||||||
|
|
|
@ -38,6 +38,10 @@ INIT_STATUS := $A04 ; Flags: Reset/Restore initiation status
|
||||||
FKEY_LEN := $1000 ; Function key lengths
|
FKEY_LEN := $1000 ; Function key lengths
|
||||||
FKEY_TEXT := $100A ; Function key texts
|
FKEY_TEXT := $100A ; Function key texts
|
||||||
|
|
||||||
|
KBDREPEAT := $28a
|
||||||
|
KBDREPEATRATE := $28b
|
||||||
|
KBDREPEATDELAY := $28c
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; Kernal routines
|
; Kernal routines
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,9 @@ CHARCOLOR := $286
|
||||||
CURS_COLOR := $287 ; Color under the cursor
|
CURS_COLOR := $287 ; Color under the cursor
|
||||||
PALFLAG := $2A6 ; $01 = PAL, $00 = NTSC
|
PALFLAG := $2A6 ; $01 = PAL, $00 = NTSC
|
||||||
|
|
||||||
|
KBDREPEAT := $28a
|
||||||
|
KBDREPEATRATE := $28b
|
||||||
|
KBDREPEATDELAY := $28c
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; Kernal routines
|
; Kernal routines
|
||||||
|
|
|
@ -10,10 +10,10 @@ CURSOR_X = $3C
|
||||||
CURSOR_Y = $3D
|
CURSOR_Y = $3D
|
||||||
|
|
||||||
;** VDP
|
;** VDP
|
||||||
VDP_CONTROL_W = $3001
|
|
||||||
VDP_DATA_W = $3000
|
|
||||||
VDP_STATUS_R = $2001
|
|
||||||
VDP_DATA_R = $2000
|
VDP_DATA_R = $2000
|
||||||
|
VDP_STATUS_R = $2001
|
||||||
|
VDP_DATA_W = $3000
|
||||||
|
VDP_CONTROL_W = $3001
|
||||||
|
|
||||||
;** PIA
|
;** PIA
|
||||||
PIA0_DATA = $1000
|
PIA0_DATA = $1000
|
||||||
|
@ -36,7 +36,26 @@ ZP_JOY1_DIR = $13
|
||||||
ZP_JOY0_BUTTONS = $16
|
ZP_JOY0_BUTTONS = $16
|
||||||
ZP_JOY1_BUTTONS = $17
|
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
|
||||||
BIOS_IRQ1_ADDR = $FF3F
|
BIOS_IRQ1_ADDR = $FF3F
|
||||||
BIOS_IRQ2_ADDR = $FF52
|
BIOS_IRQ2_ADDR = $FF52
|
||||||
BIOS_NMI_RESET_ADDR = $F808
|
BIOS_NMI_RESET_ADDR = $F808
|
||||||
|
BIOS_WRITE_VDP_REG = $FE1F
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
ID .byte 3 ; $6A, $6F, $79 ("joy")
|
ID .byte 3 ; $6A, $6F, $79 ("joy")
|
||||||
VERSION .byte 1 ; Interface version
|
VERSION .byte 1 ; Interface version
|
||||||
LIBREF .addr ; Library reference
|
LIBREF .addr ; Library reference
|
||||||
MASKS .byte 8 ; Joystick state mask array
|
|
||||||
JUMPTAB .struct
|
JUMPTAB .struct
|
||||||
INSTALL .addr ; INSTALL routine
|
INSTALL .addr ; INSTALL routine
|
||||||
UNINSTALL .addr ; UNINSTALL routine
|
UNINSTALL .addr ; UNINSTALL routine
|
||||||
|
|
1018
asminc/opcodes.inc
1018
asminc/opcodes.inc
File diff suppressed because it is too large
Load diff
|
@ -26,11 +26,22 @@ SCR_LINELEN := $D5 ; Screen line length
|
||||||
CURS_Y := $D8 ; Cursor row
|
CURS_Y := $D8 ; Cursor row
|
||||||
FNADR := $DA ; Pointer to file name
|
FNADR := $DA ; Pointer to file name
|
||||||
|
|
||||||
|
; 80-Column CBMs
|
||||||
|
KBDREPEAT80 := $E4
|
||||||
|
KBDRPTRATE80 := $E5
|
||||||
|
KBDRPTDELAY80 := $E6
|
||||||
|
|
||||||
BASIC_BUF := $200 ; Location of command-line
|
BASIC_BUF := $200 ; Location of command-line
|
||||||
BASIC_BUF_LEN = 81 ; Maximum length of command-line
|
BASIC_BUF_LEN = 81 ; Maximum length of command-line
|
||||||
|
|
||||||
KEY_BUF := $26F ; Keyboard buffer
|
KEY_BUF := $26F ; Keyboard buffer
|
||||||
|
|
||||||
|
; 40-Column PETs/CBMs
|
||||||
|
KBDRPTDELAY40 := $3E9
|
||||||
|
KBDRPTRATE40 := $3EA
|
||||||
|
KBDREPEAT40 := $3EE
|
||||||
|
KBDREPEAT40B := $3F8
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; PET ROM type detection
|
; PET ROM type detection
|
||||||
|
|
||||||
|
@ -55,5 +66,3 @@ VIA_PRB := $E840
|
||||||
VIA_PRA := $E841
|
VIA_PRA := $E841
|
||||||
VIA_DDRB := $E842
|
VIA_DDRB := $E842
|
||||||
VIA_DDRA := $E843
|
VIA_DDRA := $E843
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,10 @@ FKEY_COUNT := $55D ; Characters for function key
|
||||||
FKEY_SPACE := $55F ; Function key definitions
|
FKEY_SPACE := $55F ; Function key definitions
|
||||||
FKEY_ORIG := $F3D2 ; Original definitions
|
FKEY_ORIG := $F3D2 ; Original definitions
|
||||||
|
|
||||||
|
KBDREPEAT := $540
|
||||||
|
KBDREPEATRATE := $541
|
||||||
|
KBDREPEATDELAY := $542
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; Kernal routines
|
; Kernal routines
|
||||||
|
|
||||||
|
|
534
asminc/smc.inc
534
asminc/smc.inc
|
@ -1,267 +1,267 @@
|
||||||
; smc.mac
|
; smc.mac
|
||||||
; ca65 Macro-Pack for Self Modifying Code (SMC)
|
; ca65 Macro-Pack for Self Modifying Code (SMC)
|
||||||
;
|
;
|
||||||
; (c) Christian Krüger, latest change: 17-Jul-2016
|
; (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
|
||||||
; arising from the use of this software.
|
; arising from the use of this software.
|
||||||
;
|
;
|
||||||
; Permission is granted to anyone to use this software for any purpose,
|
; Permission is granted to anyone to use this software for any purpose,
|
||||||
; including commercial applications, and to alter it and redistribute it
|
; including commercial applications, and to alter it and redistribute it
|
||||||
; freely, subject to the following restrictions:
|
; freely, subject to the following restrictions:
|
||||||
;
|
;
|
||||||
; 1. The origin of this software must not be misrepresented; you must not
|
; 1. 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.
|
||||||
; 2. Altered source versions must be plainly marked as such, and must not
|
; 2. 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.
|
||||||
; 3. This notice may not be removed or altered from any source
|
; 3. This notice may not be removed or altered from any source
|
||||||
; distribution.
|
; distribution.
|
||||||
;
|
;
|
||||||
|
|
||||||
.define _SMCDesignator .mid(0, .tcount(label) - 1, label) .ident(.concat(.string(.right(1, label)), "_SMC"))
|
.define _SMCDesignator .mid(0, .tcount(label) - 1, label) .ident(.concat(.string(.right(1, label)), "_SMC"))
|
||||||
.define _SMCAlias .mid(0, .tcount(alias) - 1, alias) .ident(.concat(.string(.right(1, alias)), "_SMC"))
|
.define _SMCAlias .mid(0, .tcount(alias) - 1, alias) .ident(.concat(.string(.right(1, alias)), "_SMC"))
|
||||||
.define SMC_AbsAdr $FADE
|
.define SMC_AbsAdr $FADE
|
||||||
.define SMC_ZpAdr $00
|
.define SMC_ZpAdr $00
|
||||||
.define SMC_Opcode nop
|
.define SMC_Opcode nop
|
||||||
.define SMC_Value $42
|
.define SMC_Value $42
|
||||||
|
|
||||||
.macro SMC_OperateOnValue opcode, label
|
.macro SMC_OperateOnValue opcode, label
|
||||||
opcode _SMCDesignator+1
|
opcode _SMCDesignator+1
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro SMC_OperateOnLowByte opcode, label
|
.macro SMC_OperateOnLowByte opcode, label
|
||||||
SMC_OperateOnValue opcode, label
|
SMC_OperateOnValue opcode, label
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro SMC_OperateOnHighByte opcode, label
|
.macro SMC_OperateOnHighByte opcode, label
|
||||||
opcode _SMCDesignator + 2
|
opcode _SMCDesignator + 2
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro SMC_Import alias
|
.macro SMC_Import alias
|
||||||
.import _SMCAlias
|
.import _SMCAlias
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro SMC_Export alias, label
|
.macro SMC_Export alias, label
|
||||||
.export _SMCAlias := _SMCDesignator
|
.export _SMCAlias := _SMCDesignator
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro SMC label, statement
|
.macro SMC label, statement
|
||||||
_SMCDesignator: statement
|
_SMCDesignator: statement
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro SMC_TransferOpcode label, opcode, register
|
.macro SMC_TransferOpcode label, opcode, register
|
||||||
.if .paramcount = 2 .or .match ({register}, a) .or .match ({register}, )
|
.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)
|
||||||
ldx #opcode
|
ldx #opcode
|
||||||
stx _SMCDesignator
|
stx _SMCDesignator
|
||||||
.elseif .match ({register}, y)
|
.elseif .match ({register}, y)
|
||||||
ldy #opcode
|
ldy #opcode
|
||||||
sty _SMCDesignator
|
sty _SMCDesignator
|
||||||
.else
|
.else
|
||||||
.error "Invalid usage of macro 'SMC_TransferOpcode'"
|
.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) .or .match ({register}, )
|
.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
|
.else
|
||||||
.error "Invalid usage of macro 'SMC_LoadOpcode'"
|
.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) .or .match ({register}, )
|
.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
|
.else
|
||||||
.error "Invalid usage of macro 'SMC_StoreOpcode'"
|
.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) .or .match ({register}, )
|
.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
|
.else
|
||||||
.error "Invalid usage of macro 'SMC_ChangeBranch'"
|
.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) .or .match ({register}, )
|
.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)
|
||||||
ldx value
|
ldx value
|
||||||
stx _SMCDesignator+1
|
stx _SMCDesignator+1
|
||||||
.elseif .match ({register}, y)
|
.elseif .match ({register}, y)
|
||||||
ldy value
|
ldy value
|
||||||
sty _SMCDesignator+1
|
sty _SMCDesignator+1
|
||||||
.else
|
.else
|
||||||
.error "Invalid usage of macro 'SMC_TransferValue'"
|
.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) .or .match ({register}, )
|
.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
|
.else
|
||||||
.error "Invalid usage of macro 'SMC_LoadValue'"
|
.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) .or .match ({register}, )
|
.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
|
.else
|
||||||
.error "Invalid usage of macro 'SMC_StoreValue'"
|
.error "Invalid usage of macro 'SMC_StoreValue'"
|
||||||
.endif
|
.endif
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
|
||||||
.macro SMC_TransferLowByte label, value, register
|
.macro SMC_TransferLowByte label, value, register
|
||||||
SMC_TransferValue label, value, register
|
SMC_TransferValue label, value, register
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro SMC_LoadLowByte label, register
|
.macro SMC_LoadLowByte label, register
|
||||||
SMC_LoadValue label, register
|
SMC_LoadValue label, register
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro SMC_StoreLowByte label, register
|
.macro SMC_StoreLowByte label, register
|
||||||
SMC_StoreValue label, register
|
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) .or .match ({register}, )
|
.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)
|
||||||
ldx value
|
ldx value
|
||||||
stx _SMCDesignator+2
|
stx _SMCDesignator+2
|
||||||
.elseif .match ({register}, y)
|
.elseif .match ({register}, y)
|
||||||
ldy value
|
ldy value
|
||||||
sty _SMCDesignator+2
|
sty _SMCDesignator+2
|
||||||
.else
|
.else
|
||||||
.error "Invalid usage of macro 'SMC_TransferHighByte'"
|
.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) .or .match ({register}, )
|
.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
|
.else
|
||||||
.error "Invalid usage of macro 'SMC_LoadHighByte'"
|
.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) .or .match ({register}, )
|
.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
|
.else
|
||||||
.error "Invalid usage of macro 'SMC_StoreHighByte'"
|
.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) .or .match ({register}, )
|
.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}))
|
||||||
sta _SMCDesignator+1
|
sta _SMCDesignator+1
|
||||||
lda #>(.right (.tcount ({address})-1, {address}))
|
lda #>(.right (.tcount ({address})-1, {address}))
|
||||||
sta _SMCDesignator+2
|
sta _SMCDesignator+2
|
||||||
.else
|
.else
|
||||||
; assume absolute or zero page
|
; assume absolute or zero page
|
||||||
lda address
|
lda address
|
||||||
sta _SMCDesignator+1
|
sta _SMCDesignator+1
|
||||||
lda 1+(address)
|
lda 1+(address)
|
||||||
sta _SMCDesignator+2
|
sta _SMCDesignator+2
|
||||||
.endif
|
.endif
|
||||||
.elseif .match ((register), x)
|
.elseif .match ((register), x)
|
||||||
.if (.match (.left (1, {address}), #))
|
.if (.match (.left (1, {address}), #))
|
||||||
; immediate mode
|
; immediate mode
|
||||||
ldx #<(.right (.tcount ({address})-1, {address}))
|
ldx #<(.right (.tcount ({address})-1, {address}))
|
||||||
stx _SMCDesignator+1
|
stx _SMCDesignator+1
|
||||||
ldx #>(.right (.tcount ({address})-1, {address}))
|
ldx #>(.right (.tcount ({address})-1, {address}))
|
||||||
stx _SMCDesignator+2
|
stx _SMCDesignator+2
|
||||||
.else
|
.else
|
||||||
; assume absolute or zero page
|
; assume absolute or zero page
|
||||||
ldx address
|
ldx address
|
||||||
stx _SMCDesignator+1
|
stx _SMCDesignator+1
|
||||||
ldx 1+(address)
|
ldx 1+(address)
|
||||||
stx _SMCDesignator+2
|
stx _SMCDesignator+2
|
||||||
.endif
|
.endif
|
||||||
.elseif .match ((register), y)
|
.elseif .match ((register), y)
|
||||||
.if (.match (.left (1, {address}), #))
|
.if (.match (.left (1, {address}), #))
|
||||||
; immediate mode
|
; immediate mode
|
||||||
ldy #<(.right (.tcount ({address})-1, {address}))
|
ldy #<(.right (.tcount ({address})-1, {address}))
|
||||||
sty _SMCDesignator+1
|
sty _SMCDesignator+1
|
||||||
ldy #>(.right (.tcount ({address})-1, {address}))
|
ldy #>(.right (.tcount ({address})-1, {address}))
|
||||||
sty _SMCDesignator+2
|
sty _SMCDesignator+2
|
||||||
.else
|
.else
|
||||||
; assume absolute or zero page
|
; assume absolute or zero page
|
||||||
ldy address
|
ldy address
|
||||||
sty _SMCDesignator+1
|
sty _SMCDesignator+1
|
||||||
ldy 1+(address)
|
ldy 1+(address)
|
||||||
sty _SMCDesignator+2
|
sty _SMCDesignator+2
|
||||||
.endif
|
.endif
|
||||||
.else
|
.else
|
||||||
.error "Invalid usage of macro 'SMC_TransferAddressSingle'"
|
.error "Invalid usage of macro 'SMC_TransferAddressSingle'"
|
||||||
.endif
|
.endif
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro SMC_TransferAddress label, address
|
.macro SMC_TransferAddress label, address
|
||||||
.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}))
|
||||||
sta _SMCDesignator+1
|
sta _SMCDesignator+1
|
||||||
ldx #>(.right (.tcount ({address})-1, {address}))
|
ldx #>(.right (.tcount ({address})-1, {address}))
|
||||||
stx _SMCDesignator+2
|
stx _SMCDesignator+2
|
||||||
.else
|
.else
|
||||||
; assume absolute or zero page
|
; assume absolute or zero page
|
||||||
lda {address}
|
lda {address}
|
||||||
sta _SMCDesignator+1
|
sta _SMCDesignator+1
|
||||||
ldx 1+{address}
|
ldx 1+{address}
|
||||||
stx _SMCDesignator)+2
|
stx _SMCDesignator)+2
|
||||||
.endif
|
.endif
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
.macro SMC_StoreAddress label
|
.macro SMC_StoreAddress label
|
||||||
sta _SMCDesignator+1
|
sta _SMCDesignator+1
|
||||||
stx _SMCDesignator+2
|
stx _SMCDesignator+2
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
|
@ -31,6 +31,9 @@ BASIC_BUF_LEN = 89 ; Maximum length of command-line
|
||||||
CHARCOLOR := $286
|
CHARCOLOR := $286
|
||||||
CURS_COLOR := $287 ; Color under the cursor
|
CURS_COLOR := $287 ; Color under the cursor
|
||||||
|
|
||||||
|
KBDREPEAT := $28a
|
||||||
|
KBDREPEATRATE := $28b
|
||||||
|
KBDREPEATDELAY := $28c
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; Screen size
|
; Screen size
|
||||||
|
|
|
@ -4,7 +4,7 @@ SYMBOLS {
|
||||||
MEMORY {
|
MEMORY {
|
||||||
ZP: file = "", define = yes, start = $0020, size = $00E0;
|
ZP: file = "", define = yes, start = $0020, size = $00E0;
|
||||||
RAM: file = "", define = yes, start = $01FA, size = $0206;
|
RAM: file = "", define = yes, start = $01FA, size = $0206;
|
||||||
ROM: file = %O, define = yes, start = $B000, size = $1000;
|
ROM: file = %O, define = yes, start = $B000, size = $1000, fill = yes, fillval = $FF;
|
||||||
}
|
}
|
||||||
SEGMENTS {
|
SEGMENTS {
|
||||||
ZEROPAGE: load = ZP, type = zp;
|
ZEROPAGE: load = ZP, type = zp;
|
||||||
|
|
|
@ -3,7 +3,7 @@ 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;
|
||||||
MAIN: file = %O, define = yes, start = $0200, size = $FDF0 - __STACKSIZE__;
|
MAIN: file = %O, define = yes, start = $0200, size = $FDF0 - __STACKSIZE__;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ 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;
|
||||||
MAIN: file = %O, define = yes, start = $0200, size = $FDF0 - __STACKSIZE__;
|
MAIN: file = %O, define = yes, start = $0200, size = $FDF0 - __STACKSIZE__;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@ 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
|
||||||
|
|
||||||
ifdef CMD_EXE
|
ifdef CMD_EXE
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ clean:
|
||||||
$(RM) -r ../html ../info
|
$(RM) -r ../html ../info
|
||||||
|
|
||||||
install:
|
install:
|
||||||
$(if $(prefix),,$(error variable `prefix' must be set))
|
$(if $(PREFIX),,$(error variable `PREFIX' must be set))
|
||||||
ifeq ($(wildcard ../html),../html)
|
ifeq ($(wildcard ../html),../html)
|
||||||
$(INSTALL) -d $(DESTDIR)$(htmldir)
|
$(INSTALL) -d $(DESTDIR)$(htmldir)
|
||||||
$(INSTALL) -m0644 ../html/*.* $(DESTDIR)$(htmldir)
|
$(INSTALL) -m0644 ../html/*.* $(DESTDIR)$(htmldir)
|
||||||
|
|
105
doc/apple2.sgml
105
doc/apple2.sgml
|
@ -435,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>
|
||||||
|
@ -511,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>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <apple2.h>
|
||||||
|
|
||||||
|
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>
|
||||||
|
|
||||||
|
|
|
@ -436,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>
|
||||||
|
@ -517,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>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <apple2.h>
|
||||||
|
|
||||||
|
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>
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1636,7 +1636,7 @@ either a string or an expression.
|
||||||
|
|
||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
; Reserve space for the larger of two data blocks
|
; Reserve space for the larger of two data blocks
|
||||||
savearea: .max (.sizeof (foo), .sizeof (bar))
|
savearea: .res .max (.sizeof (foo), .sizeof (bar))
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
See: <tt><ref id=".MIN" name=".MIN"></tt>
|
See: <tt><ref id=".MIN" name=".MIN"></tt>
|
||||||
|
@ -1695,8 +1695,8 @@ either a string or an expression.
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
; Reserve space for some data, but 256 bytes minimum
|
; Reserve space for some data, but 256 bytes maximum
|
||||||
savearea: .min (.sizeof (foo), 256)
|
savearea: .res .min (.sizeof (foo), 256)
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
See: <tt><ref id=".MAX" name=".MAX"></tt>
|
See: <tt><ref id=".MAX" name=".MAX"></tt>
|
||||||
|
@ -4305,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
|
||||||
|
@ -4337,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>
|
||||||
|
|
|
@ -67,7 +67,7 @@ Special locations:
|
||||||
|
|
||||||
<descrip>
|
<descrip>
|
||||||
<tag/Stack/
|
<tag/Stack/
|
||||||
The C runtime stack is located at $FF81, and grows downwards.
|
The C runtime stack is located at $FEC2, and grows downwards.
|
||||||
|
|
||||||
<tag/Heap/
|
<tag/Heap/
|
||||||
The C heap is located at the end of the program, and grows towards the C
|
The C heap is located at the end of the program, and grows towards the C
|
||||||
|
|
394
doc/cc65.sgml
394
doc/cc65.sgml
|
@ -4,7 +4,7 @@
|
||||||
<title>cc65 Users Guide
|
<title>cc65 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:gregdk@users.sf.net" name="Greg King">
|
<url url="mailto:gregdk@users.sf.net" name="Greg King">
|
||||||
<date>2016-06-11
|
<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
|
||||||
|
@ -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/<ctype.h>/
|
||||||
|
</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 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 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/.
|
||||||
|
|
||||||
|
|
||||||
|
@ -518,6 +553,7 @@ Here is a description of all the command line options:
|
||||||
</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
|
||||||
|
@ -556,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 has almost no effect. That 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
|
||||||
|
@ -585,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 [optional volatile] (<string literal>[, optional parameters]) ;
|
asm [optional volatile] (<string literal>[, optional parameters]) ;
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
or
|
or
|
||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
__asm__ [optional volatile] (<string literal>[, optional parameters]) ;
|
__asm__ [optional volatile] (<string literal>[, 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>
|
||||||
<return type> fastcall <function name> (<parameter list>)
|
<return type> fastcall <function name> (<parameter list>)
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
or
|
or
|
||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
<return type> __fastcall__ <function name> (<parameter list>)
|
<return type> __fastcall__ <function name> (<parameter list>)
|
||||||
</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 [<tt/.../]) always use that
|
(their prototypes have an ellipsis [<tt/.../]) always use that
|
||||||
|
@ -652,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
|
||||||
|
@ -818,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.
|
||||||
|
@ -905,6 +952,7 @@ The compiler defines several macros at startup:
|
||||||
</descrip>
|
</descrip>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<sect>#pragmas<label id="pragmas"><p>
|
<sect>#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
|
||||||
|
@ -913,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 ([push,] <name>)</tt><label id="pragma-bss-name"><p>
|
<sect1><tt>#pragma bss-name ([push,] <name>)</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
|
||||||
|
@ -931,7 +992,7 @@ parameter with the <tt/#pragma/.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
#pragma bss-name ("MyBSS")
|
#pragma bss-name ("MyBSS")
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
|
|
||||||
|
@ -986,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,] <name>)</tt><label id="pragma-code-name"><p>
|
<sect1><tt>#pragma code-name ([push,] <name>)</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
|
||||||
|
@ -1000,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>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1028,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
|
||||||
|
@ -1046,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 (<message>)</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
|
||||||
|
@ -1076,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>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1098,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>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1147,7 +1237,7 @@ parameter with the <tt/#pragma/.
|
||||||
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;
|
||||||
|
@ -1156,6 +1246,39 @@ parameter with the <tt/#pragma/.
|
||||||
</verb></tscreen>
|
</verb></tscreen>
|
||||||
|
|
||||||
|
|
||||||
|
<sect1><tt>#pragma wrapped-call (push, <name>, <identifier>)</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,
|
||||||
|
@ -1180,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
|
||||||
|
@ -1269,7 +1391,7 @@ that function).
|
||||||
As a shortcut, you can put the <tt/volatile/ qualifier in your <tt/asm/
|
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
|
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/asm volatile/ statements sit. The effect is the same as though you put
|
||||||
</#pragma optimize(push, off)/ above those functions, and </#pragma
|
<tt/#pragma optimize(push, off)/ above those functions, and <tt/#pragma
|
||||||
optimize(pop)/ below those functions.
|
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
|
||||||
|
@ -1443,14 +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>
|
||||||
|
|
|
@ -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-10-16
|
||||||
|
|
||||||
<abstract>
|
<abstract>
|
||||||
cl65 is the compile & link utility for cc65, the 6502 C compiler. It was
|
cl65 is the compile & link utility for cc65, the 6502 C compiler. It was
|
||||||
|
@ -50,13 +51,14 @@ 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
|
||||||
|
@ -67,6 +69,7 @@ Short options:
|
||||||
|
|
||||||
Long options:
|
Long options:
|
||||||
--add-source Include source as comment
|
--add-source Include source as comment
|
||||||
|
--all-cdecl Make functions default to __cdecl__
|
||||||
--asm-args options Pass options to the assembler
|
--asm-args options Pass options to the assembler
|
||||||
--asm-define sym[=v] Define an assembler symbol
|
--asm-define sym[=v] Define an assembler symbol
|
||||||
--asm-include-dir dir Set an assembler include directory
|
--asm-include-dir dir Set an assembler include directory
|
||||||
|
@ -120,56 +123,66 @@ 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>
|
<tag><tt>--print-target-path</tt></tag>
|
||||||
|
|
||||||
This option prints the absolute path of the target file directory and exits
|
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
|
then. It is supposed to be used with shell backquotes or the GNU make shell
|
||||||
function. This way you can write build scripts or Makefiles accessing target
|
function. That way, you can write build scripts or Makefiles accessing target
|
||||||
files without any assumption about the cc65 installation path.
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,10 +190,10 @@ There are a few remaining options that control the behaviour of cl65:
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
|
||||||
|
@ -188,10 +201,10 @@ There are a few remaining options that control the behaviour of cl65:
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
|
||||||
|
@ -199,10 +212,10 @@ There are a few remaining options that control the behaviour of cl65:
|
||||||
|
|
||||||
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>
|
||||||
|
@ -211,7 +224,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>
|
||||||
|
@ -219,15 +232,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
|
||||||
|
@ -248,7 +260,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/
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
|
|
||||||
<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">,<newline>
|
||||||
<date>2016-08-07
|
<url url="mailto:greg.king5@verizon.net" name="Greg King">
|
||||||
|
<date>2017-09-02
|
||||||
|
|
||||||
<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
|
||||||
|
@ -183,6 +184,7 @@ function.
|
||||||
<!-- <item><ref id="cbm_save" name="cbm_save"> -->
|
<!-- <item><ref id="cbm_save" name="cbm_save"> -->
|
||||||
<!-- <item><ref id="cbm_write" name="cbm_write"> -->
|
<!-- <item><ref id="cbm_write" name="cbm_write"> -->
|
||||||
<!-- <item><ref id="get_tv" name="get_tv"> -->
|
<!-- <item><ref id="get_tv" name="get_tv"> -->
|
||||||
|
<item><ref id="kbrepeat" name="kbrepeat">
|
||||||
</itemize>
|
</itemize>
|
||||||
|
|
||||||
(incomplete)
|
(incomplete)
|
||||||
|
@ -398,6 +400,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>
|
||||||
|
@ -430,7 +439,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)
|
||||||
|
@ -2632,6 +2641,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>
|
||||||
|
@ -3710,7 +3736,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
|
||||||
|
@ -4017,6 +4043,28 @@ do), the function is rather useless.
|
||||||
</quote>
|
</quote>
|
||||||
|
|
||||||
|
|
||||||
|
<sect1>kbrepeat<label id="kbrepeat"><p>
|
||||||
|
|
||||||
|
<quote>
|
||||||
|
<descrip>
|
||||||
|
<tag/Function/Set the keyboard repeat mode.
|
||||||
|
<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
|
||||||
|
<tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
|
||||||
|
<tag/Description/This function changes which keys have automatic repeat when
|
||||||
|
being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
|
||||||
|
(repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
|
||||||
|
keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
|
||||||
|
it can be restored later.
|
||||||
|
<tag/Notes/<itemize>
|
||||||
|
<item>The function is available only as a fastcall function; so, it may be used
|
||||||
|
only in the presence of a prototype.
|
||||||
|
</itemize>
|
||||||
|
<tag/Availability/cc65
|
||||||
|
<tag/Example/None.
|
||||||
|
</descrip>
|
||||||
|
</quote>
|
||||||
|
|
||||||
|
|
||||||
<sect1>labs<label id="labs"><p>
|
<sect1>labs<label id="labs"><p>
|
||||||
|
|
||||||
<quote>
|
<quote>
|
||||||
|
|
|
@ -247,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">
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,15 @@
|
||||||
|
|
||||||
<title>Oric Telestrat-specific information for cc65
|
<title>Oric Telestrat-specific information for cc65
|
||||||
<author>
|
<author>
|
||||||
<url url="mailto:jede@oric.org" name="Jede">,<newline>
|
<url url="mailto:jede@oric.org" name="Jede">
|
||||||
|
|
||||||
<date>2017-01-22
|
<date>2017-01-22
|
||||||
|
|
||||||
<abstract>
|
<abstract>
|
||||||
|
|
||||||
An overview over the Telestrat (Telemon 2.4 & Telemon 3.x : http://orix.oric.org) runtime system as it is implemented for the cc65 C
|
An overview over the Telestrat (Telemon 2.4 & Telemon 3.x : http://orix.oric.org) runtime system as it is implemented for the cc65 C
|
||||||
compiler.)
|
compiler.)
|
||||||
|
|
||||||
</abstract>
|
</abstract>
|
||||||
|
|
||||||
<!-- Table of contents -->
|
<!-- Table of contents -->
|
||||||
|
@ -32,25 +34,28 @@ information.
|
||||||
|
|
||||||
<sect>Binary format<p>
|
<sect>Binary format<p>
|
||||||
|
|
||||||
The standard binary output format generated the linker for the Telestrat target
|
The standard binary output format generated the linker for the Telestrat
|
||||||
is a machine language program with a 20 bytes header described here : http://orix.oric.org/doku.php?id=orix:header
|
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.
|
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.
|
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.
|
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.
|
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 :
|
The only way to load a binary (for Telemon 2.4) is to:
|
||||||
<itemize>
|
<itemize>
|
||||||
<item>remove the 20 bytes header
|
<item>remove the 20 bytes header
|
||||||
<item>download osdk : http://osdk.defence-force.org/index?page=download
|
<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)
|
<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>
|
</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.
|
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.
|
If you know the Stratsed disk format, please contact the author of this doc.
|
||||||
|
|
||||||
|
@ -79,7 +84,7 @@ Special locations:
|
||||||
|
|
||||||
<sect>Platform-specific header files<p>
|
<sect>Platform-specific header files<p>
|
||||||
|
|
||||||
Programs containing Telestrat -specific code may use the <tt/telestrat.h/ header file.
|
Programs containing Telestrat-specific code may use the <tt/telestrat.h/ header file.
|
||||||
|
|
||||||
|
|
||||||
<sect1>Telestrat-specific functions<p>
|
<sect1>Telestrat-specific functions<p>
|
||||||
|
@ -162,8 +167,12 @@ Telestrat has a RS232 port, but it's not usable in cc65.
|
||||||
|
|
||||||
<sect1>Disk I/O<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.
|
Telemon 3.0 handles fopen, fread, fclose primitives. It means that this
|
||||||
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).
|
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>
|
<itemize>
|
||||||
<item>fclose
|
<item>fclose
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
|
|
||||||
<title>Commodore VIC20 (aka VC20) specific information for cc65
|
<title>Commodore VIC20 (aka VC20 aka VIC1001) specific information for cc65
|
||||||
<author>
|
<author>
|
||||||
<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
|
<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
|
||||||
<url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">
|
<url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">
|
||||||
<date>2014-04-12
|
<date>2017-05-18
|
||||||
|
|
||||||
<abstract>
|
<abstract>
|
||||||
An overview over the VIC20 runtime system as it is implemented for the cc65 C
|
An overview over the VIC20 runtime system as it is implemented for the cc65 C
|
||||||
|
@ -182,13 +182,14 @@ No VIC1011 drivers are currently available for the VIC20.
|
||||||
<sect>Limitations<p>
|
<sect>Limitations<p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<sect>Other hints<p>
|
|
||||||
|
|
||||||
|
|
||||||
<sect1>Escape code<p>
|
<sect1>Escape code<p>
|
||||||
|
|
||||||
For an Esc, press CTRL and the <tt/[/ key.
|
The CTRL key cannot be used to type most control characters,
|
||||||
|
entering an Esc is not possible.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<sect>Other hints<p>
|
||||||
|
|
||||||
|
|
||||||
<sect1>Passing arguments to the program<p>
|
<sect1>Passing arguments to the program<p>
|
||||||
|
@ -219,8 +220,7 @@ The program return code (low byte) is passed back to BASIC by use of the
|
||||||
|
|
||||||
<sect1>Using extended memory<p>
|
<sect1>Using extended memory<p>
|
||||||
|
|
||||||
The extended memory at $A000 may be added to the heap by using the following
|
BLK5 memory may be added to the heap by using the following code:
|
||||||
code:
|
|
||||||
|
|
||||||
<tscreen><verb>
|
<tscreen><verb>
|
||||||
/* Check for the existence of RAM */
|
/* Check for the existence of RAM */
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <apple2_filetype.h>
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Data */
|
/* Data */
|
||||||
|
@ -90,6 +91,14 @@
|
||||||
#define CH_RTEE '+'
|
#define CH_RTEE '+'
|
||||||
#define CH_CROSS '+'
|
#define CH_CROSS '+'
|
||||||
|
|
||||||
|
/* Masks for joy_read */
|
||||||
|
#define JOY_UP_MASK 0x10
|
||||||
|
#define JOY_DOWN_MASK 0x20
|
||||||
|
#define JOY_LEFT_MASK 0x04
|
||||||
|
#define JOY_RIGHT_MASK 0x08
|
||||||
|
#define JOY_BTN_1_MASK 0x40
|
||||||
|
#define JOY_BTN_2_MASK 0x80
|
||||||
|
|
||||||
/* Return codes for get_ostype */
|
/* Return codes for get_ostype */
|
||||||
#define APPLE_UNKNOWN 0x00
|
#define APPLE_UNKNOWN 0x00
|
||||||
#define APPLE_II 0x10 /* Apple ][ */
|
#define APPLE_II 0x10 /* Apple ][ */
|
||||||
|
@ -136,11 +145,9 @@ extern unsigned char _dos_type;
|
||||||
|
|
||||||
|
|
||||||
/* The file stream implementation and the POSIX I/O functions will use the
|
/* The file stream implementation and the POSIX I/O functions will use the
|
||||||
** following variables to determine the file type, aux type and creation time
|
** following struct to set the date and time stamp on files. This specificially
|
||||||
** stamp to use.
|
** applies to the open and fopen functions.
|
||||||
*/
|
*/
|
||||||
extern unsigned char _filetype; /* Default: 6 */
|
|
||||||
extern unsigned int _auxtype; /* Default: 0 */
|
|
||||||
extern struct {
|
extern struct {
|
||||||
struct {
|
struct {
|
||||||
unsigned day :5;
|
unsigned day :5;
|
||||||
|
|
322
include/apple2_filetype.h
Normal file
322
include/apple2_filetype.h
Normal file
|
@ -0,0 +1,322 @@
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* apple2_filetype.h */
|
||||||
|
/* */
|
||||||
|
/* Apple ][ file type definitions */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* (C) 2017 Bill Chatfield, <bill_chatfield@yahoo.com> */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* 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: */
|
||||||
|
/* */
|
||||||
|
/* 1. 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. */
|
||||||
|
/* 2. Altered source versions must be plainly marked as such, and must not */
|
||||||
|
/* be misrepresented as being the original software. */
|
||||||
|
/* 3. This notice may not be removed or altered from any source */
|
||||||
|
/* distribution. */
|
||||||
|
/* */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _APPLE2_FILETYPE_H
|
||||||
|
#define _APPLE2_FILETYPE_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Check for errors */
|
||||||
|
#if !defined(__APPLE2__)
|
||||||
|
# error This module may only be used when compiling for the Apple ][!
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Data */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ProDOS general file types */
|
||||||
|
#define PRODOS_T_UNK 0x00 /* Unknown */
|
||||||
|
#define PRODOS_T_BAD 0x01 /* Bad blocks */
|
||||||
|
#define PRODOS_T_PCD 0x02 /* Pascal code */
|
||||||
|
#define PRODOS_T_PTX 0x03 /* Pascal text */
|
||||||
|
#define PRODOS_T_TXT 0x04 /* ASCII text */
|
||||||
|
#define PRODOS_T_PDA 0x05 /* Pascal data */
|
||||||
|
#define PRODOS_T_BIN 0x06 /* Binary */
|
||||||
|
#define PRODOS_T_FNT 0x07 /* Apple III font */
|
||||||
|
#define PRODOS_T_FOT 0x08 /* Hi-res, dbl hi-res graphics */
|
||||||
|
#define PRODOS_T_BA3 0x09 /* Apple III BASIC program */
|
||||||
|
#define PRODOS_T_DA3 0x09 /* Apple III BASIC data */
|
||||||
|
#define PRODOS_T_WPF 0x0A /* Generic word processing */
|
||||||
|
#define PRODOS_T_SOS 0x0B /* SOS system */
|
||||||
|
#define PRODOS_T_DIR 0x0F /* ProDOS directory */
|
||||||
|
|
||||||
|
/* ProDOS productivity file types */
|
||||||
|
#define PRODOS_T_RPD 0x10 /* RPS data */
|
||||||
|
#define PRODOS_T_RPI 0x11 /* RPS index */
|
||||||
|
#define PRODOS_T_AFD 0x12 /* AppleFile discard */
|
||||||
|
#define PRODOS_T_AFM 0x13 /* AppleFile model */
|
||||||
|
#define PRODOS_T_AFR 0x14 /* AppleFile report */
|
||||||
|
#define PRODOS_T_SCL 0x15 /* Screen library */
|
||||||
|
#define PRODOS_T_PFS 0x16 /* PFS document */
|
||||||
|
#define PRODOS_T_ADB 0x19 /* AppleWorks database */
|
||||||
|
#define PRODOS_T_AWP 0x1A /* AppleWorks word processing */
|
||||||
|
#define PRODOS_T_ASP 0x1B /* AppleWorks spreadsheet */
|
||||||
|
|
||||||
|
/* ProDOS code file types */
|
||||||
|
#define PRODOS_T_TDM 0x20 /* Desktop Manager */
|
||||||
|
#define PRODOS_T_IPS 0x21 /* Instant Pascal source */
|
||||||
|
#define PRODOS_T_UPV 0x22 /* USCD Pascal volume */
|
||||||
|
#define PRODOS_T_3SD 0x29 /* SOS directory */
|
||||||
|
#define PRODOS_T_8SC 0x2A /* Source code */
|
||||||
|
#define PRODOS_T_8OB 0x2B /* Object code */
|
||||||
|
#define PRODOS_T_8IC 0x2C /* Interpreted code */
|
||||||
|
#define PRODOS_T_8LD 0x2D /* Language data */
|
||||||
|
#define PRODOS_T_P8C 0x2E /* ProDOS 8 code module */
|
||||||
|
|
||||||
|
/* ProDOS miscellaneous file types */
|
||||||
|
#define PRODOS_T_OCR 0x41 /* Optical char recognition */
|
||||||
|
#define PRODOS_T_FTD 0x42 /* File type definitions */
|
||||||
|
|
||||||
|
/* ProDOS Apple IIgs general file types */
|
||||||
|
#define PRODOS_T_GWP 0x50 /* Apple IIgs word processing */
|
||||||
|
#define PRODOS_T_GSS 0x51 /* Apple IIgs spreadsheet */
|
||||||
|
#define PRODOS_T_GDB 0x52 /* Apple IIgs database */
|
||||||
|
#define PRODOS_T_DRW 0x53 /* Object oriented graphics */
|
||||||
|
#define PRODOS_T_GDP 0x54 /* Apple IIgs desktop publish */
|
||||||
|
#define PRODOS_T_HMD 0x55 /* HyperMedia */
|
||||||
|
#define PRODOS_T_EDU 0x56 /* Educational program data */
|
||||||
|
#define PRODOS_T_STN 0x57 /* Stationary */
|
||||||
|
#define PRODOS_T_HLP 0x58 /* Help */
|
||||||
|
#define PRODOS_T_COM 0x59 /* Communications */
|
||||||
|
#define PRODOS_T_CFG 0x5A /* Configuration */
|
||||||
|
#define PRODOS_T_ANM 0x5B /* Animation */
|
||||||
|
#define PRODOS_T_MUM 0x5C /* Multimedia */
|
||||||
|
#define PRODOS_T_ENT 0x5D /* Entertainment */
|
||||||
|
#define PRODOS_T_DVU 0x5E /* Development utility */
|
||||||
|
|
||||||
|
/* ProDOS PC Transporter file types */
|
||||||
|
#define PRODOS_T_PRE 0x60 /* PC pre-boot */
|
||||||
|
#define PRODOS_T_BIO 0x6B /* PC BIOS */
|
||||||
|
#define PRODOS_T_NCF 0x66 /* ProDOS File Nav command file */
|
||||||
|
#define PRODOS_T_DVR 0x6D /* PC driver */
|
||||||
|
#define PRODOS_T_PRE2 0x6E /* PC pre-boot */
|
||||||
|
#define PRODOS_T_HDV 0x6F /* PC hard disk image */
|
||||||
|
|
||||||
|
/* ProDOS Kreative Software file types */
|
||||||
|
#define PRODOS_T_SN2 0x70 /* Sabine's Notebook 2.0 */
|
||||||
|
#define PRODOS_T_KMT 0x71
|
||||||
|
#define PRODOS_T_DSR 0x72
|
||||||
|
#define PRODOS_T_BAN 0x73
|
||||||
|
#define PRODOS_T_CG7 0x74
|
||||||
|
#define PRODOS_T_TNJ 0x75
|
||||||
|
#define PRODOS_T_SA7 0x76
|
||||||
|
#define PRODOS_T_KES 0x77
|
||||||
|
#define PRODOS_T_JAP 0x78
|
||||||
|
#define PRODOS_T_CSL 0x79
|
||||||
|
#define PRODOS_T_TME 0x7A
|
||||||
|
#define PRODOS_T_TLB 0x7B
|
||||||
|
#define PRODOS_T_MR7 0x7C
|
||||||
|
#define PRODOS_T_MLR 0x7D /* Mika City */
|
||||||
|
#define PRODOS_T_MMM 0x7E
|
||||||
|
#define PRODOS_T_JCP 0x7F
|
||||||
|
|
||||||
|
/* ProDOS GEOS file types */
|
||||||
|
#define PRODOS_T_GES 0x80 /* GEOS system file */
|
||||||
|
#define PRODOS_T_GEA 0x81 /* GEOS desk accessory */
|
||||||
|
#define PRODOS_T_GEO 0x82 /* GEOS application */
|
||||||
|
#define PRODOS_T_GED 0x83 /* GEOS document */
|
||||||
|
#define PRODOS_T_GEF 0x84 /* GEOS font */
|
||||||
|
#define PRODOS_T_GEP 0x85 /* GEOS printer driver */
|
||||||
|
#define PRODOS_T_GEI 0x86 /* GEOS input driver */
|
||||||
|
#define PRODOS_T_GEX 0x87 /* GEOS auxiliary driver */
|
||||||
|
#define PRODOS_T_GEV 0x89 /* GEOS swap file */
|
||||||
|
#define PRODOS_T_GEC 0x8B /* GEOS clock driver */
|
||||||
|
#define PRODOS_T_GEK 0x8C /* GEOS interface card driver */
|
||||||
|
#define PRODOS_T_GEW 0x8D /* GEOS formatting data */
|
||||||
|
|
||||||
|
/* ProDOS Apple IIgs BASIC file types */
|
||||||
|
#define PRODOS_T_WP 0xA0 /* WordPerfect */
|
||||||
|
#define PRODOS_T_GSB 0xAB /* Apple IIgs BASIC program */
|
||||||
|
#define PRODOS_T_TDF 0xAB /* Apple IIgs BASIC TDF */
|
||||||
|
#define PRODOS_T_BDF 0xAB /* Apple IIgs BASIC data */
|
||||||
|
|
||||||
|
/* ProDOS Apple IIgs system file types */
|
||||||
|
#define PRODOS_T_SRC 0xB0 /* Apple IIgs source code */
|
||||||
|
#define PRODOS_T_OBJ 0xB1 /* Apple IIgs object code */
|
||||||
|
#define PRODOS_T_LIB 0xB2 /* Apple IIgs library */
|
||||||
|
#define PRODOS_T_S16 0xB3 /* Apple IIgs application pgm */
|
||||||
|
#define PRODOS_T_RTL 0xB4 /* Apple IIgs runtime library */
|
||||||
|
#define PRODOS_T_EXE 0xB5 /* Apple IIgs shell script */
|
||||||
|
#define PRODOS_T_PIF 0xB6 /* Apple IIgs permanent init */
|
||||||
|
#define PRODOS_T_TIF 0xB7 /* Apple IIgs temporary init */
|
||||||
|
#define PRODOS_T_NDA 0xB8 /* Apple IIgs new desk accesry */
|
||||||
|
#define PRODOS_T_CDA 0xB9 /* Apple IIgs classic desk aces */
|
||||||
|
#define PRODOS_T_TOL 0xBA /* Apple IIgs tool */
|
||||||
|
#define PRODOS_T_DRV 0xBB /* Apple IIgs device driver */
|
||||||
|
#define PRODOS_T_LDF 0xBC /* Apple IIgs generic load file */
|
||||||
|
#define PRODOS_T_FST 0xBD /* Apple IIgs file sys translat */
|
||||||
|
#define PRODOS_T_DOC 0xBF /* Apple IIgs document */
|
||||||
|
|
||||||
|
/* ProDOS graphics file types */
|
||||||
|
#define PRODOS_T_PNT 0xC0 /* Apple IIgs packed sup hi-res */
|
||||||
|
#define PRODOS_T_PIC 0xC1 /* Apple IIgs super hi-res */
|
||||||
|
#define PRODOS_T_ANI 0xC2 /* PaintWorks animation */
|
||||||
|
#define PRODOS_T_PAL 0xC3 /* PaintWorks palette */
|
||||||
|
#define PRODOS_T_OOG 0xC5 /* Object-oriented graphics */
|
||||||
|
#define PRODOS_T_SCR 0xC6 /* Script */
|
||||||
|
#define PRODOS_T_CDV 0xC7 /* Apple IIgs control panel */
|
||||||
|
#define PRODOS_T_FON 0xC8 /* Apple IIgs font */
|
||||||
|
#define PRODOS_T_FND 0xC9 /* Apple IIgs Finder data */
|
||||||
|
#define PRODOS_T_ICN 0xCA /* Apple IIgs icon */
|
||||||
|
|
||||||
|
/* ProDOS audio file types */
|
||||||
|
#define PRODOS_T_MUS 0xD5 /* Music */
|
||||||
|
#define PRODOS_T_INS 0xD6 /* Instrument */
|
||||||
|
#define PRODOS_T_MID 0xD7 /* MIDI */
|
||||||
|
#define PRODOS_T_SND 0xD8 /* Apple IIgs audio */
|
||||||
|
#define PRODOS_T_DBM 0xDB /* DB master document */
|
||||||
|
|
||||||
|
/* ProDOS miscellaneous file types */
|
||||||
|
#define PRODOS_T_LBR 0xE0 /* Archive */
|
||||||
|
#define PRODOS_T_ATK 0xE2 /* AppleTalk data */
|
||||||
|
#define PRODOS_T_R16 0xEE /* EDASM 816 relocatable code */
|
||||||
|
#define PRODOS_T_PAR 0xEF /* Pascal area */
|
||||||
|
|
||||||
|
/* ProDOS system file types */
|
||||||
|
#define PRODOS_T_CMD 0xF0 /* ProDOS command file */
|
||||||
|
#define PRODOS_T_OVL 0xF1 /* User defined 1 */
|
||||||
|
#define PRODOS_T_UD2 0xF2 /* User defined 2 */
|
||||||
|
#define PRODOS_T_UD3 0xF3 /* User defined 3 */
|
||||||
|
#define PRODOS_T_UD4 0xF4 /* User defined 4 */
|
||||||
|
#define PRODOS_T_BAT 0xF5 /* User defined 5 */
|
||||||
|
#define PRODOS_T_UD6 0xF6 /* User defined 6 */
|
||||||
|
#define PRODOS_T_UD7 0xF7 /* User defined 7 */
|
||||||
|
#define PRODOS_T_PRG 0xF8 /* User defined 8 */
|
||||||
|
#define PRODOS_T_P16 0xF9 /* ProDOS-16 system file */
|
||||||
|
#define PRODOS_T_INT 0xFA /* Integer BASIC program */
|
||||||
|
#define PRODOS_T_IVR 0xFB /* Integer BASIC variables */
|
||||||
|
#define PRODOS_T_BAS 0xFC /* Applesoft BASIC program */
|
||||||
|
#define PRODOS_T_VAR 0xFD /* Applesoft BASIC variables */
|
||||||
|
#define PRODOS_T_REL 0xFE /* EDASM relocatable code */
|
||||||
|
#define PRODOS_T_SYS 0xFF /* ProDOS-8 system file */
|
||||||
|
|
||||||
|
/* The auxiliary type of a text file specifies its record length.
|
||||||
|
** A record length of 0 indicates a sequential text file, which is
|
||||||
|
** equivalent to text files of other operating systems like MacOS
|
||||||
|
** or Windows, except that lines are delimited by carriage returns
|
||||||
|
** only. An auxiliary type value greater than 0 for a text file,
|
||||||
|
** which is the record length, indicates a random access text file
|
||||||
|
** with fixed-length lines.
|
||||||
|
*/
|
||||||
|
#define PRODOS_AUX_T_TXT_SEQ 0x0000 /* Sequential text */
|
||||||
|
|
||||||
|
/* 8IC auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_8IC_APEX_PGM 0x8003 /* Apex program */
|
||||||
|
|
||||||
|
/* GWP auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_GWP_TEACH 0x5445 /* Teach */
|
||||||
|
#define PRODOS_AUX_T_GWP_DELUXEWRITE 0x8001 /* DeluxeWrite */
|
||||||
|
#define PRODOS_AUX_T_GWP_APPLEWORKS_GS 0x8010 /* AppleWorks GS */
|
||||||
|
|
||||||
|
/* GSS auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_GSS_APPLEWORKS_GS 0x8010 /* AppleWorks GS */
|
||||||
|
|
||||||
|
/* GDB auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_GDB_APPLEWORKS_GS 0x8010 /* AppleWorks GS DB */
|
||||||
|
#define PRODOS_AUX_T_GDB_AWGS_TMPL 0x8011 /* AWGS template */
|
||||||
|
#define PRODOS_AUX_T_GDB_GSAS 0x8013
|
||||||
|
|
||||||
|
/* DRW auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_DRW_OO_GRAPHICS 0x8013 /* AWGS O-O graphics */
|
||||||
|
|
||||||
|
/* GDP auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_GDP_GRAPHICWRITER 0x8002 /* A2gs GraphicWriter */
|
||||||
|
#define PRODOS_AUX_T_GDP_APPLEWORKS_GS 0x8010 /* A2gs AWGS */
|
||||||
|
|
||||||
|
/* HMD auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_HMD_HYPERCARD_GS 0x0001 /* HyperCard GS */
|
||||||
|
#define PRODOS_AUX_T_HMD_TUTOR_TECH 0x8001 /* Tutor-Tech */
|
||||||
|
#define PRODOS_AUX_T_HMD_HYPERSTUDIO 0x8002 /* HyperStudio */
|
||||||
|
#define PRODOS_AUX_T_HMD_NEXUS 0x8003 /* Nexus */
|
||||||
|
|
||||||
|
/* COM auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_COM_APPLEWORKS_GS 0x8003 /* AppleWorks GS */
|
||||||
|
|
||||||
|
/* MLR auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_MLR_SCRIPT 0x005C /* Mika City script */
|
||||||
|
#define PRODOS_AUX_T_MLR_COLOR_TABLE 0xC7AB /* Mika City color table */
|
||||||
|
#define PRODOS_AUX_T_MLR_CHARACTER_DEF 0xCDEF /* Mika City character def */
|
||||||
|
|
||||||
|
/* LDF auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_LDF_NIFTY_LIST_MOD 0x4001 /* Nifty list module */
|
||||||
|
#define PRODOS_AUX_T_LDF_SUPER_INFO_MOD 0x4002 /* Super info module */
|
||||||
|
#define PRODOS_AUX_T_LDF_TWILIGHT_MOD 0x4004 /* Twilight module */
|
||||||
|
#define PRODOS_AUX_T_LDF_MARINETTI_LLM 0x4004 /* Marinetti link layer mod */
|
||||||
|
|
||||||
|
/* PNT auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_PNT_PK_SUPER_HIRES 0x0001 /* Packed super hi-res */
|
||||||
|
#define PRODOS_AUX_T_PNT_APPLE_PREF 0x0002 /* Apple preferred format */
|
||||||
|
#define PRODOS_AUX_T_PNT_PK_QUICKDRAWII 0x0003 /* Packed QuickDraw II */
|
||||||
|
|
||||||
|
/* PIC auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_PIC_QUICKDRAW 0x0001 /* QuickDraw image */
|
||||||
|
#define PRODOS_AUX_T_PIC_SHIRES_3200 0x0002 /* Super hi-res 3200 */
|
||||||
|
|
||||||
|
/* FON auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_FON_QUICKDRAW_BIT 0x0000 /* QuickDraw bitmap font */
|
||||||
|
#define PRODOS_AUX_T_FON_POINTLESS_TT 0x0001 /* Pointless TrueType font */
|
||||||
|
|
||||||
|
/* SND auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_SND_AIFF 0x0000 /* AIFF */
|
||||||
|
#define PRODOS_AUX_T_SND_AIFF_C 0x0001 /* AIFF-C */
|
||||||
|
#define PRODOS_AUX_T_SND_ASIF_INSTR 0x0002 /* ASIF instrument */
|
||||||
|
#define PRODOS_AUX_T_SND_SOUND_RSRC 0x0003 /* Sound resource */
|
||||||
|
#define PRODOS_AUX_T_SND_MIDI_SYNTH_WAV 0x0004 /* MIDI synth wave */
|
||||||
|
#define PRODOS_AUX_T_SND_HYPERSTUDIO 0x8001 /* HyperStudio sound */
|
||||||
|
|
||||||
|
/* LBR auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_LBR_ALU 0x0000 /* ALU */
|
||||||
|
#define PRODOS_AUX_T_LBR_APPLE_SINGLE 0x0001 /* AppleSingle */
|
||||||
|
#define PRODOS_AUX_T_LBR_APPLEDBL_HDR 0x0002 /* AppleDouble header */
|
||||||
|
#define PRODOS_AUX_T_LBR_APPLEDBL_DATA 0x0003 /* AppleDouble data */
|
||||||
|
#define PRODOS_AUX_T_LBR_BINARY_II 0x8000 /* Binary II */
|
||||||
|
#define PRODOS_AUX_T_LBR_APPLELINK_ACU 0x8001 /* AppleLink ACU */
|
||||||
|
#define PRODOS_AUX_T_LBR_SHRINKIT 0x8002 /* ShrinkIt */
|
||||||
|
|
||||||
|
/* LBR auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_ATK_EASYMNT_ALIAS 0x0000 /* EasyMount alias */
|
||||||
|
|
||||||
|
/* BAS auxiliary types */
|
||||||
|
#define PRODOS_AUX_T_BAS_PGM_LOAD_ADDR 0x0801 /* Applesoft pgm load addr */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Variables */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* The file stream implementation and the POSIX I/O functions will use the
|
||||||
|
** following variables to determine the file type and auxiliary type to use.
|
||||||
|
** This applies specifically to the fopen and open functions.
|
||||||
|
*/
|
||||||
|
extern unsigned char _filetype; /* Default: PRODOS_T_BIN */
|
||||||
|
extern unsigned int _auxtype; /* Default: 0 */
|
||||||
|
|
||||||
|
/* End of apple2_filetype.h */
|
||||||
|
#endif
|
|
@ -149,6 +149,16 @@
|
||||||
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
|
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
|
||||||
#define TGI_COLOR_GRAY3 COLOR_GRAY3
|
#define TGI_COLOR_GRAY3 COLOR_GRAY3
|
||||||
|
|
||||||
|
/* Masks for joy_read */
|
||||||
|
#define JOY_UP_MASK 0x01
|
||||||
|
#define JOY_DOWN_MASK 0x02
|
||||||
|
#define JOY_LEFT_MASK 0x04
|
||||||
|
#define JOY_RIGHT_MASK 0x08
|
||||||
|
#define JOY_BTN_1_MASK 0x10
|
||||||
|
|
||||||
|
#define JOY_FIRE_MASK JOY_BTN_1_MASK
|
||||||
|
#define JOY_FIRE(v) ((v) & JOY_FIRE_MASK)
|
||||||
|
|
||||||
/* color register functions */
|
/* color register functions */
|
||||||
extern void __fastcall__ _setcolor (unsigned char color_reg, unsigned char hue, unsigned char luminace);
|
extern void __fastcall__ _setcolor (unsigned char color_reg, unsigned char hue, unsigned char luminace);
|
||||||
extern void __fastcall__ _setcolor_low (unsigned char color_reg, unsigned char color_value);
|
extern void __fastcall__ _setcolor_low (unsigned char color_reg, unsigned char color_value);
|
||||||
|
@ -346,4 +356,4 @@ struct __iocb {
|
||||||
#define IOCB_FORMAT 0xFE /* format */
|
#define IOCB_FORMAT 0xFE /* format */
|
||||||
|
|
||||||
/* End of atari.h */
|
/* End of atari.h */
|
||||||
#endif /* #ifndef _ATARI_H */
|
#endif
|
||||||
|
|
|
@ -87,6 +87,13 @@ extern void atr5200std_joy[]; /* referred to by joy_static_stddrv[] */
|
||||||
#define COLOR_LIGHTBLUE _gtia_mkcolor(HUE_BLUE,6)
|
#define COLOR_LIGHTBLUE _gtia_mkcolor(HUE_BLUE,6)
|
||||||
#define COLOR_GRAY3 _gtia_mkcolor(HUE_GREY,5)
|
#define COLOR_GRAY3 _gtia_mkcolor(HUE_GREY,5)
|
||||||
|
|
||||||
|
/* Masks for joy_read */
|
||||||
|
#define JOY_UP_MASK 0x01
|
||||||
|
#define JOY_DOWN_MASK 0x02
|
||||||
|
#define JOY_LEFT_MASK 0x04
|
||||||
|
#define JOY_RIGHT_MASK 0x08
|
||||||
|
#define JOY_BTN_1_MASK 0x10
|
||||||
|
|
||||||
/* get_tv return values */
|
/* get_tv return values */
|
||||||
#define AT_NTSC 0
|
#define AT_NTSC 0
|
||||||
#define AT_PAL 1
|
#define AT_PAL 1
|
||||||
|
@ -104,4 +111,4 @@ extern void atr5200std_joy[]; /* referred to by joy_static_stddrv[] */
|
||||||
#define ANTIC (*(struct __antic*)0xD400)
|
#define ANTIC (*(struct __antic*)0xD400)
|
||||||
|
|
||||||
/* End of atari5200.h */
|
/* End of atari5200.h */
|
||||||
#endif /* #ifndef _ATARI5200_H */
|
#endif
|
||||||
|
|
|
@ -113,6 +113,15 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Masks for joy_read */
|
||||||
|
#define JOY_UP_MASK 0x10
|
||||||
|
#define JOY_DOWN_MASK 0x08
|
||||||
|
#define JOY_LEFT_MASK 0x01
|
||||||
|
#define JOY_RIGHT_MASK 0x02
|
||||||
|
#define JOY_BTN_1_MASK 0x20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* No support for dynamically loadable drivers */
|
/* No support for dynamically loadable drivers */
|
||||||
#define DYN_DRV 0
|
#define DYN_DRV 0
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,13 @@
|
||||||
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
|
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
|
||||||
#define TGI_COLOR_GRAY3 COLOR_GRAY3
|
#define TGI_COLOR_GRAY3 COLOR_GRAY3
|
||||||
|
|
||||||
|
/* Masks for joy_read */
|
||||||
|
#define JOY_UP_MASK 0x01
|
||||||
|
#define JOY_DOWN_MASK 0x02
|
||||||
|
#define JOY_LEFT_MASK 0x04
|
||||||
|
#define JOY_RIGHT_MASK 0x08
|
||||||
|
#define JOY_BTN_1_MASK 0x10
|
||||||
|
|
||||||
/* Video mode defines */
|
/* Video mode defines */
|
||||||
#define VIDEOMODE_40x25 0x00
|
#define VIDEOMODE_40x25 0x00
|
||||||
#define VIDEOMODE_80x25 0x80
|
#define VIDEOMODE_80x25 0x80
|
||||||
|
|
|
@ -99,6 +99,13 @@
|
||||||
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
|
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
|
||||||
#define TGI_COLOR_GRAY3 COLOR_GRAY3
|
#define TGI_COLOR_GRAY3 COLOR_GRAY3
|
||||||
|
|
||||||
|
/* Masks for joy_read */
|
||||||
|
#define JOY_UP_MASK 0x01
|
||||||
|
#define JOY_DOWN_MASK 0x02
|
||||||
|
#define JOY_LEFT_MASK 0x04
|
||||||
|
#define JOY_RIGHT_MASK 0x08
|
||||||
|
#define JOY_BTN_1_MASK 0x10
|
||||||
|
|
||||||
/* Define hardware */
|
/* Define hardware */
|
||||||
#include <_vic2.h>
|
#include <_vic2.h>
|
||||||
#define VIC (*(struct __vic2*)0xD000)
|
#define VIC (*(struct __vic2*)0xD000)
|
||||||
|
|
|
@ -75,6 +75,11 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define JOY_FIRE_MASK JOY_BTN_1_MASK
|
||||||
|
#define JOY_FIRE(v) ((v) & JOY_FIRE_MASK)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Variables */
|
/* Variables */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -153,7 +158,17 @@ struct cbm_dirent {
|
||||||
unsigned char get_tv (void);
|
unsigned char get_tv (void);
|
||||||
/* Return the video mode the machine is using. */
|
/* Return the video mode the machine is using. */
|
||||||
|
|
||||||
|
#define KBREPEAT_CURSOR 0x00
|
||||||
|
#define KBREPEAT_NONE 0x40
|
||||||
|
#define KBREPEAT_ALL 0x80
|
||||||
|
|
||||||
|
unsigned char __fastcall__ kbrepeat (unsigned char mode);
|
||||||
|
/* Changes which keys have automatic repeat. */
|
||||||
|
|
||||||
|
#if !defined(__CBM610__) && !defined(__PET__)
|
||||||
|
void waitvsync (void);
|
||||||
|
/* Wait for the start of the next frame */
|
||||||
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* CBM kernal functions */
|
/* CBM kernal functions */
|
||||||
|
|
|
@ -112,6 +112,17 @@
|
||||||
#define COLOR_LIGHTBLUE (BCOLOR_LIGHTBLUE | CATTR_LUMA7)
|
#define COLOR_LIGHTBLUE (BCOLOR_LIGHTBLUE | CATTR_LUMA7)
|
||||||
#define COLOR_GRAY3 (BCOLOR_WHITE | CATTR_LUMA5)
|
#define COLOR_GRAY3 (BCOLOR_WHITE | CATTR_LUMA5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Masks for joy_read */
|
||||||
|
#define JOY_UP_MASK 0x01
|
||||||
|
#define JOY_DOWN_MASK 0x02
|
||||||
|
#define JOY_LEFT_MASK 0x04
|
||||||
|
#define JOY_RIGHT_MASK 0x08
|
||||||
|
#define JOY_BTN_1_MASK 0x80
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Define hardware */
|
/* Define hardware */
|
||||||
#include <_ted.h>
|
#include <_ted.h>
|
||||||
#define TED (*(struct __ted*)0xFF00)
|
#define TED (*(struct __ted*)0xFF00)
|
||||||
|
|
|
@ -92,6 +92,13 @@
|
||||||
#define COLOR_LIGHTBLUE 0x0E
|
#define COLOR_LIGHTBLUE 0x0E
|
||||||
#define COLOR_GRAY3 0x0F
|
#define COLOR_GRAY3 0x0F
|
||||||
|
|
||||||
|
/* Masks for joy_read */
|
||||||
|
#define JOY_UP_MASK 0x01
|
||||||
|
#define JOY_DOWN_MASK 0x02
|
||||||
|
#define JOY_LEFT_MASK 0x04
|
||||||
|
#define JOY_RIGHT_MASK 0x08
|
||||||
|
#define JOY_BTN_1_MASK 0x10
|
||||||
|
|
||||||
/* Define hardware */
|
/* Define hardware */
|
||||||
#include <_vic2.h>
|
#include <_vic2.h>
|
||||||
#define VIC (*(struct __vic2*)0xD800)
|
#define VIC (*(struct __vic2*)0xD800)
|
||||||
|
|
|
@ -63,12 +63,16 @@
|
||||||
# include <apple2enh.h>
|
# include <apple2enh.h>
|
||||||
#elif defined(__APPLE2__)
|
#elif defined(__APPLE2__)
|
||||||
# include <apple2.h>
|
# include <apple2.h>
|
||||||
|
#elif defined(__ATARI5200__)
|
||||||
|
# include <atari5200.h>
|
||||||
#elif defined(__ATARI__)
|
#elif defined(__ATARI__)
|
||||||
# include <atari.h>
|
# include <atari.h>
|
||||||
#elif defined(__ATMOS__)
|
#elif defined(__ATMOS__)
|
||||||
# include <atmos.h>
|
# include <atmos.h>
|
||||||
#elif defined(__CBM__)
|
#elif defined(__CBM__)
|
||||||
# include <cbm.h>
|
# include <cbm.h>
|
||||||
|
#elif defined(__CREATIVISION__)
|
||||||
|
# include <creativision.h>
|
||||||
#elif defined(__GAMATE__)
|
#elif defined(__GAMATE__)
|
||||||
# include <gamate.h>
|
# include <gamate.h>
|
||||||
#elif defined(__GEOS__)
|
#elif defined(__GEOS__)
|
||||||
|
@ -225,6 +229,3 @@ void __fastcall__ cputhex16 (unsigned val);
|
||||||
|
|
||||||
/* End of conio.h */
|
/* End of conio.h */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,14 @@
|
||||||
#define CH_LLCORNER 37
|
#define CH_LLCORNER 37
|
||||||
#define CH_LRCORNER 38
|
#define CH_LRCORNER 38
|
||||||
|
|
||||||
|
/* Masks for joy_read */
|
||||||
|
#define JOY_UP_MASK 0x10
|
||||||
|
#define JOY_DOWN_MASK 0x04
|
||||||
|
#define JOY_LEFT_MASK 0x20
|
||||||
|
#define JOY_RIGHT_MASK 0x08
|
||||||
|
#define JOY_BTN_1_MASK 0x01
|
||||||
|
#define JOY_BTN_2_MASK 0x02
|
||||||
|
|
||||||
/* no support for dynamically loadable drivers */
|
/* no support for dynamically loadable drivers */
|
||||||
#define DYN_DRV 0
|
#define DYN_DRV 0
|
||||||
|
|
||||||
|
|
|
@ -89,9 +89,9 @@ unsigned char __fastcall__ toascii (unsigned char c);
|
||||||
** #undef'ing the macroes.
|
** #undef'ing the macroes.
|
||||||
** Please note that the following macroes do NOT handle EOF correctly, as
|
** Please note that the following macroes do NOT handle EOF correctly, as
|
||||||
** stated in the manual. If you need correct behaviour for EOF, don't
|
** stated in the manual. If you need correct behaviour for EOF, don't
|
||||||
** use -Os, or #undefine the following macroes.
|
** use --eagerly-inline-funcs, or #undefine the following macroes.
|
||||||
*/
|
*/
|
||||||
#ifdef __OPT_s__
|
#ifdef __EAGERLY_INLINE_FUNCS__
|
||||||
|
|
||||||
#define isalnum(c) (__AX__ = (c), \
|
#define isalnum(c) (__AX__ = (c), \
|
||||||
__asm__ ("tay"), \
|
__asm__ ("tay"), \
|
||||||
|
|
|
@ -52,6 +52,7 @@ typedef struct {
|
||||||
/* Driver header */
|
/* Driver header */
|
||||||
char id[3]; /* Contains 0x65, 0x6d, 0x64 ("emd") */
|
char id[3]; /* Contains 0x65, 0x6d, 0x64 ("emd") */
|
||||||
unsigned char version; /* Interface version */
|
unsigned char version; /* Interface version */
|
||||||
|
void* libreference; /* Library reference */
|
||||||
|
|
||||||
/* Jump vectors. Note that these are not C callable */
|
/* Jump vectors. Note that these are not C callable */
|
||||||
void* install; /* INSTALL routine */
|
void* install; /* INSTALL routine */
|
||||||
|
@ -74,6 +75,3 @@ extern em_drv_header* em_drv; /* Pointer to driver */
|
||||||
|
|
||||||
/* End of em-kernel.h */
|
/* End of em-kernel.h */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -80,17 +80,6 @@
|
||||||
bit 3:
|
bit 3:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define JOY_DATA 0x4400
|
|
||||||
|
|
||||||
#define JOY_DATA_UP 0x01
|
|
||||||
#define JOY_DATA_DOWN 0x02
|
|
||||||
#define JOY_DATA_LEFT 0x04
|
|
||||||
#define JOY_DATA_RIGHT 0x08
|
|
||||||
#define JOY_DATA_FIRE_A 0x10
|
|
||||||
#define JOY_DATA_FIRE_B 0x20
|
|
||||||
#define JOY_DATA_START 0x40
|
|
||||||
#define JOY_DATA_SELECT 0x80
|
|
||||||
|
|
||||||
/* LCD
|
/* LCD
|
||||||
|
|
||||||
resolution 160x152 in 4 greys/greens
|
resolution 160x152 in 4 greys/greens
|
||||||
|
@ -181,15 +170,31 @@
|
||||||
/* No support for dynamically loadable drivers */
|
/* No support for dynamically loadable drivers */
|
||||||
#define DYN_DRV 0
|
#define DYN_DRV 0
|
||||||
|
|
||||||
|
/* Masks for joy_read */
|
||||||
|
#define JOY_UP_MASK 0x01
|
||||||
|
#define JOY_DOWN_MASK 0x02
|
||||||
|
#define JOY_LEFT_MASK 0x04
|
||||||
|
#define JOY_RIGHT_MASK 0x08
|
||||||
|
#define JOY_BTN_1_MASK 0x10
|
||||||
|
#define JOY_BTN_2_MASK 0x20
|
||||||
|
#define JOY_BTN_3_MASK 0x40
|
||||||
|
#define JOY_BTN_4_MASK 0x80
|
||||||
|
|
||||||
|
#define JOY_BTN_A_MASK JOY_BTN_1_MASK
|
||||||
|
#define JOY_BTN_B_MASk JOY_BTN_2_MASK
|
||||||
|
#define JOY_START_MASK JOY_BTN_3_MASK
|
||||||
|
#define JOY_SELECT_MASK JOY_BTN_4_MASK
|
||||||
|
|
||||||
|
#define JOY_BTN_A(v) ((v) & JOY_BTN_A_MASK)
|
||||||
|
#define JOY_BTN_B(v) ((v) & JOY_BTN_B_MASK)
|
||||||
|
#define JOY_START(v) ((v) & JOY_START_MASK)
|
||||||
|
#define JOY_SELECT(v) ((v) & JOY_SELECT_MASK)
|
||||||
|
|
||||||
/* The addresses of the static drivers */
|
/* The addresses of the static drivers */
|
||||||
extern void gamate_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
extern void gamate_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||||
|
|
||||||
#define JOY_FIRE_B 5
|
void waitvsync (void);
|
||||||
#define JOY_START 6
|
/* Wait for start of next frame */
|
||||||
#define JOY_SELECT 7
|
|
||||||
|
|
||||||
void waitvblank (void);
|
|
||||||
/* Wait for the vertical blanking */
|
|
||||||
|
|
||||||
/* NOTE: all Gamate are "NTSC" */
|
/* NOTE: all Gamate are "NTSC" */
|
||||||
#define get_tv() TV_NTSC
|
#define get_tv() TV_NTSC
|
||||||
|
|
|
@ -133,6 +133,12 @@
|
||||||
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
|
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
|
||||||
#define TGI_COLOR_GRAY3 COLOR_GRAY3
|
#define TGI_COLOR_GRAY3 COLOR_GRAY3
|
||||||
|
|
||||||
|
#define JOY_UP_MASK 0x01
|
||||||
|
#define JOY_DOWN_MASK 0x02
|
||||||
|
#define JOY_LEFT_MASK 0x04
|
||||||
|
#define JOY_RIGHT_MASK 0x08
|
||||||
|
#define JOY_BTN_1_MASK 0x10
|
||||||
|
|
||||||
|
|
||||||
/* End of geos.h */
|
/* End of geos.h */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -52,27 +52,18 @@
|
||||||
#define JOY_ERR_NO_DEVICE 4 /* Device (hardware) not found */
|
#define JOY_ERR_NO_DEVICE 4 /* Device (hardware) not found */
|
||||||
|
|
||||||
/* Argument for the joy_read function */
|
/* Argument for the joy_read function */
|
||||||
#define JOY_1 0
|
#define JOY_1 0
|
||||||
#define JOY_2 1
|
#define JOY_2 1
|
||||||
|
|
||||||
/* The following codes are *indices* into the joy_masks array */
|
|
||||||
#define JOY_UP 0
|
|
||||||
#define JOY_DOWN 1
|
|
||||||
#define JOY_LEFT 2
|
|
||||||
#define JOY_RIGHT 3
|
|
||||||
#define JOY_FIRE 4
|
|
||||||
#define JOY_FIRE2 5 /* Second fire button if available */
|
|
||||||
|
|
||||||
/* Array of masks used to check the return value of joy_read for a state */
|
|
||||||
extern const unsigned char joy_masks[8];
|
|
||||||
|
|
||||||
/* Macros that evaluate the return code of joy_read */
|
/* Macros that evaluate the return code of joy_read */
|
||||||
#define JOY_BTN_UP(v) ((v) & joy_masks[JOY_UP])
|
#define JOY_UP(v) ((v) & JOY_UP_MASK)
|
||||||
#define JOY_BTN_DOWN(v) ((v) & joy_masks[JOY_DOWN])
|
#define JOY_DOWN(v) ((v) & JOY_DOWN_MASK)
|
||||||
#define JOY_BTN_LEFT(v) ((v) & joy_masks[JOY_LEFT])
|
#define JOY_LEFT(v) ((v) & JOY_LEFT_MASK)
|
||||||
#define JOY_BTN_RIGHT(v) ((v) & joy_masks[JOY_RIGHT])
|
#define JOY_RIGHT(v) ((v) & JOY_RIGHT_MASK)
|
||||||
#define JOY_BTN_FIRE(v) ((v) & joy_masks[JOY_FIRE])
|
#define JOY_BTN_1(v) ((v) & JOY_BTN_1_MASK) /* Universally available */
|
||||||
#define JOY_BTN_FIRE2(v) ((v) & joy_masks[JOY_FIRE2])
|
#define JOY_BTN_2(v) ((v) & JOY_BTN_2_MASK) /* Second button if available */
|
||||||
|
#define JOY_BTN_3(v) ((v) & JOY_BTN_3_MASK) /* Third button if available */
|
||||||
|
#define JOY_BTN_4(v) ((v) & JOY_BTN_4_MASK) /* Fourth button if available */
|
||||||
|
|
||||||
/* The name of the standard joystick driver for a platform */
|
/* The name of the standard joystick driver for a platform */
|
||||||
extern const char joy_stddrv[];
|
extern const char joy_stddrv[];
|
||||||
|
|
|
@ -52,9 +52,7 @@ typedef struct {
|
||||||
/* Driver header */
|
/* Driver header */
|
||||||
char id[3]; /* Contains 0x6a, 0x6f, 0x79 ("joy") */
|
char id[3]; /* Contains 0x6a, 0x6f, 0x79 ("joy") */
|
||||||
unsigned char version; /* Interface version */
|
unsigned char version; /* Interface version */
|
||||||
|
void* libreference; /* Library reference */
|
||||||
/* Bitmasks for the joystick states. See joystick.h for indices */
|
|
||||||
unsigned char masks[8];
|
|
||||||
|
|
||||||
/* Jump vectors. Note that these are not C callable */
|
/* Jump vectors. Note that these are not C callable */
|
||||||
void* install; /* INSTALL routine */
|
void* install; /* INSTALL routine */
|
||||||
|
@ -85,6 +83,3 @@ void joy_clear_ptr (void);
|
||||||
|
|
||||||
/* End of joy-kernel.h */
|
/* End of joy-kernel.h */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,20 @@
|
||||||
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
|
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
|
||||||
#define TGI_COLOR_WHITE COLOR_WHITE
|
#define TGI_COLOR_WHITE COLOR_WHITE
|
||||||
|
|
||||||
|
/* Masks for joy_read */
|
||||||
|
#define JOY_UP_MASK 0x80
|
||||||
|
#define JOY_DOWN_MASK 0x40
|
||||||
|
#define JOY_LEFT_MASK 0x20
|
||||||
|
#define JOY_RIGHT_MASK 0x10
|
||||||
|
#define JOY_BTN_1_MASK 0x01
|
||||||
|
#define JOY_BTN_2_MASK 0x02
|
||||||
|
|
||||||
|
#define JOY_BTN_A_MASK JOY_BTN_1_MASK
|
||||||
|
#define JOY_BTN_B_MASK JOY_BTN_2_MASK
|
||||||
|
|
||||||
|
#define JOY_BTN_A(v) ((v) & JOY_BTN_A_MASK)
|
||||||
|
#define JOY_BTN_B(v) ((v) & JOY_BTN_B_MASK)
|
||||||
|
|
||||||
/* No support for dynamically loadable drivers */
|
/* No support for dynamically loadable drivers */
|
||||||
#define DYN_DRV 0
|
#define DYN_DRV 0
|
||||||
|
|
||||||
|
|
43
include/lz4.h
Normal file
43
include/lz4.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* lz4.h */
|
||||||
|
/* */
|
||||||
|
/* Decompression routine for the 'lz4' format */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* (C) 2017 Mega Cat Studios */
|
||||||
|
/* */
|
||||||
|
/* 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: */
|
||||||
|
/* */
|
||||||
|
/* 1. 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. */
|
||||||
|
/* 2. Altered source versions must be plainly marked as such, and must not */
|
||||||
|
/* be misrepresented as being the original software. */
|
||||||
|
/* 3. This notice may not be removed or altered from any source */
|
||||||
|
/* distribution. */
|
||||||
|
/* */
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _LZ4_H
|
||||||
|
#define _LZ4_H
|
||||||
|
|
||||||
|
void __fastcall__ decompress_lz4 (const unsigned char* src, unsigned char* const dst,
|
||||||
|
const unsigned short uncompressed_size);
|
||||||
|
/* Decompresses the source buffer into the destination buffer.
|
||||||
|
** The size of the decompressed data must be known in advance, LZ4
|
||||||
|
** does not include any terminator in-stream.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* end of lz4.h */
|
||||||
|
#endif
|
|
@ -82,6 +82,26 @@
|
||||||
#define COLOR_LIGHTBLUE 0x0E
|
#define COLOR_LIGHTBLUE 0x0E
|
||||||
#define COLOR_GRAY3 0x0F
|
#define COLOR_GRAY3 0x0F
|
||||||
|
|
||||||
|
/* Masks for joy_read */
|
||||||
|
#define JOY_UP_MASK 0x10
|
||||||
|
#define JOY_DOWN_MASK 0x20
|
||||||
|
#define JOY_LEFT_MASK 0x40
|
||||||
|
#define JOY_RIGHT_MASK 0x80
|
||||||
|
#define JOY_BTN_1_MASK 0x01
|
||||||
|
#define JOY_BTN_2_MASK 0x02
|
||||||
|
#define JOY_BTN_3_MASK 0x04
|
||||||
|
#define JOY_BTN_4_MASK 0x08
|
||||||
|
|
||||||
|
#define JOY_BTN_A_MASK JOY_BTN_1_MASK
|
||||||
|
#define JOY_BTN_B_MASK JOY_BTN_2_MASK
|
||||||
|
#define JOY_SELECT_MASK JOY_BTN_3_MASK
|
||||||
|
#define JOY_START_MASK JOY_BTN_4_MASK
|
||||||
|
|
||||||
|
#define JOY_BTN_A(v) ((v) & JOY_BTN_A_MASK)
|
||||||
|
#define JOY_BTN_B(v) ((v) & JOY_BTN_B_MASK)
|
||||||
|
#define JOY_SELECT(v) ((v) & JOY_SELECT_MASK)
|
||||||
|
#define JOY_START(v) ((v) & JOY_START_MASK)
|
||||||
|
|
||||||
/* Return codes of get_tv */
|
/* Return codes of get_tv */
|
||||||
#define TV_NTSC 0
|
#define TV_NTSC 0
|
||||||
#define TV_PAL 1
|
#define TV_PAL 1
|
||||||
|
@ -90,16 +110,6 @@
|
||||||
/* No support for dynamically loadable drivers */
|
/* No support for dynamically loadable drivers */
|
||||||
#define DYN_DRV 0
|
#define DYN_DRV 0
|
||||||
|
|
||||||
/* The joystick keys - all keys are supported */
|
|
||||||
#define KEY_A 0x01
|
|
||||||
#define KEY_B 0x02
|
|
||||||
#define KEY_SELECT 0x04
|
|
||||||
#define KEY_START 0x08
|
|
||||||
#define KEY_UP 0x10
|
|
||||||
#define KEY_DOWN 0x20
|
|
||||||
#define KEY_LEFT 0x40
|
|
||||||
#define KEY_RIGHT 0x80
|
|
||||||
|
|
||||||
/* Define hardware */
|
/* Define hardware */
|
||||||
|
|
||||||
/* Picture Processing Unit */
|
/* Picture Processing Unit */
|
||||||
|
@ -163,8 +173,8 @@ extern void nes_64_56_2_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void waitvblank (void);
|
void waitvsync (void);
|
||||||
/* Wait for the vertical blanking */
|
/* Wait for start of the next frame */
|
||||||
|
|
||||||
unsigned char get_tv (void);
|
unsigned char get_tv (void);
|
||||||
/* Return the video mode the machine is using. */
|
/* Return the video mode the machine is using. */
|
||||||
|
|
|
@ -1,47 +1,47 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* osic1p.h */
|
/* osic1p.h */
|
||||||
/* */
|
/* */
|
||||||
/* Challenger 1P system specific definitions */
|
/* Challenger 1P system specific definitions */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2015 Stephan Muehlstrasser */
|
/* (C) 2015 Stephan Muehlstrasser */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* 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 */
|
||||||
/* arising from the use of this software. */
|
/* arising from the use of this software. */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is granted to anyone to use this software for any purpose, */
|
/* Permission is granted to anyone to use this software for any purpose, */
|
||||||
/* including commercial applications, and to alter it and redistribute it */
|
/* including commercial applications, and to alter it and redistribute it */
|
||||||
/* freely, subject to the following restrictions: */
|
/* freely, subject to the following restrictions: */
|
||||||
/* */
|
/* */
|
||||||
/* 1. The origin of this software must not be misrepresented; you must not */
|
/* 1. 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. */
|
||||||
/* 2. Altered source versions must be plainly marked as such, and must not */
|
/* 2. 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. */
|
||||||
/* 3. This notice may not be removed or altered from any source */
|
/* 3. This notice may not be removed or altered from any source */
|
||||||
/* distribution. */
|
/* distribution. */
|
||||||
/* */
|
/* */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#ifndef _OSIC1P_H
|
#ifndef _OSIC1P_H
|
||||||
#define _OSIC1P_H
|
#define _OSIC1P_H
|
||||||
|
|
||||||
/* Check for errors */
|
/* Check for errors */
|
||||||
#if !defined(__OSIC1P__)
|
#if !defined(__OSIC1P__)
|
||||||
# error "This module may only be used when compiling for the Challenger 1P!"
|
# error "This module may only be used when compiling for the Challenger 1P!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The following #defines will cause the matching functions calls in conio.h
|
/* The following #defines will cause the matching functions calls in conio.h
|
||||||
** to be overlaid by macros with the same names, saving the function call
|
** to be overlaid by macros with the same names, saving the function call
|
||||||
** overhead.
|
** overhead.
|
||||||
*/
|
*/
|
||||||
#define _textcolor(color) COLOR_WHITE
|
#define _textcolor(color) COLOR_WHITE
|
||||||
#define _bgcolor(color) COLOR_BLACK
|
#define _bgcolor(color) COLOR_BLACK
|
||||||
#define _bordercolor(color) COLOR_BLACK
|
#define _bordercolor(color) COLOR_BLACK
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,18 +73,34 @@
|
||||||
#define TV_PAL 1
|
#define TV_PAL 1
|
||||||
#define TV_OTHER 2
|
#define TV_OTHER 2
|
||||||
|
|
||||||
|
/* Masks for joy_read */
|
||||||
|
#define JOY_UP_MASK 0x10
|
||||||
|
#define JOY_DOWN_MASK 0x40
|
||||||
|
#define JOY_LEFT_MASK 0x80
|
||||||
|
#define JOY_RIGHT_MASK 0x20
|
||||||
|
#define JOY_BTN_1_MASK 0x01
|
||||||
|
#define JOY_BTN_2_MASK 0x02
|
||||||
|
#define JOY_BTN_3_MASK 0x04
|
||||||
|
#define JOY_BTN_4_MASK 0x08
|
||||||
|
|
||||||
|
#define JOY_BTN_I_MASK JOY_BTN_1_MASK
|
||||||
|
#define JOY_BTN_II_MASK JOY_BTN_2_MASK
|
||||||
|
#define JOY_SELECT_MASK JOY_BTN_3_MASK
|
||||||
|
#define JOY_RUN_MASK JOY_BTN_4_MASK
|
||||||
|
|
||||||
|
#define JOY_BTN_I(v) ((v) & JOY_BTN_I_MASK)
|
||||||
|
#define JOY_BTN_II(v) ((v) & JOY_BTN_II_MASK)
|
||||||
|
#define JOY_SELECT(v) ((v) & JOY_SELECT_MASK)
|
||||||
|
#define JOY_RUN(v) ((v) & JOY_RUN_MASK)
|
||||||
|
|
||||||
/* No support for dynamically loadable drivers */
|
/* No support for dynamically loadable drivers */
|
||||||
#define DYN_DRV 0
|
#define DYN_DRV 0
|
||||||
|
|
||||||
/* The addresses of the static drivers */
|
/* The addresses of the static drivers */
|
||||||
extern void pce_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
extern void pce_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||||
|
|
||||||
#define JOY_FIRE_B 5
|
void waitvsync (void);
|
||||||
#define JOY_SELECT 6
|
/* Wait for start of the next frame */
|
||||||
#define JOY_RUN 7
|
|
||||||
|
|
||||||
void waitvblank (void);
|
|
||||||
/* Wait for the vertical blanking */
|
|
||||||
|
|
||||||
/* NOTE: all PCE are NTSC */
|
/* NOTE: all PCE are NTSC */
|
||||||
#define get_tv() TV_NTSC
|
#define get_tv() TV_NTSC
|
||||||
|
|
|
@ -55,6 +55,13 @@
|
||||||
#define COLOR_BLACK 0x00
|
#define COLOR_BLACK 0x00
|
||||||
#define COLOR_WHITE 0x01
|
#define COLOR_WHITE 0x01
|
||||||
|
|
||||||
|
/* Masks for joy_read */
|
||||||
|
#define JOY_UP_MASK 0x01
|
||||||
|
#define JOY_DOWN_MASK 0x02
|
||||||
|
#define JOY_LEFT_MASK 0x04
|
||||||
|
#define JOY_RIGHT_MASK 0x08
|
||||||
|
#define JOY_BTN_1_MASK 0x10
|
||||||
|
|
||||||
/* Define hardware */
|
/* Define hardware */
|
||||||
#include <_pia.h>
|
#include <_pia.h>
|
||||||
#define PIA1 (*(struct __pia*)0xE810)
|
#define PIA1 (*(struct __pia*)0xE810)
|
||||||
|
|
|
@ -77,6 +77,15 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Masks for joy_read */
|
||||||
|
#define JOY_UP_MASK 0x01
|
||||||
|
#define JOY_DOWN_MASK 0x02
|
||||||
|
#define JOY_LEFT_MASK 0x04
|
||||||
|
#define JOY_RIGHT_MASK 0x08
|
||||||
|
#define JOY_BTN_1_MASK 0x10
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Define hardware */
|
/* Define hardware */
|
||||||
#include <_vic.h>
|
#include <_vic.h>
|
||||||
#define VIC (*(struct __vic*)0x9000)
|
#define VIC (*(struct __vic*)0x9000)
|
||||||
|
|
344
include/zlib.h
344
include/zlib.h
|
@ -1,172 +1,172 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* zlib.h */
|
/* zlib.h */
|
||||||
/* */
|
/* */
|
||||||
/* Decompression routines for the 'deflate' format */
|
/* Decompression routines for the 'deflate' format */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2000-2015 Piotr Fusik <fox@scene.pl> */
|
/* (C) 2000-2015 Piotr Fusik <fox@scene.pl> */
|
||||||
/* */
|
/* */
|
||||||
/* This file is based on the zlib.h from 'zlib' general purpose compression */
|
/* This file is based on the zlib.h from 'zlib' general purpose compression */
|
||||||
/* library, version 1.1.3, (C) 1995-1998 Jean-loup Gailly and Mark Adler. */
|
/* library, version 1.1.3, (C) 1995-1998 Jean-loup Gailly and Mark Adler. */
|
||||||
/* */
|
/* */
|
||||||
/* Jean-loup Gailly Mark Adler */
|
/* Jean-loup Gailly Mark Adler */
|
||||||
/* jloup@gzip.org madler@alumni.caltech.edu */
|
/* jloup@gzip.org madler@alumni.caltech.edu */
|
||||||
/* */
|
/* */
|
||||||
/* 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 */
|
||||||
/* arising from the use of this software. */
|
/* arising from the use of this software. */
|
||||||
/* */
|
/* */
|
||||||
/* Permission is granted to anyone to use this software for any purpose, */
|
/* Permission is granted to anyone to use this software for any purpose, */
|
||||||
/* including commercial applications, and to alter it and redistribute it */
|
/* including commercial applications, and to alter it and redistribute it */
|
||||||
/* freely, subject to the following restrictions: */
|
/* freely, subject to the following restrictions: */
|
||||||
/* */
|
/* */
|
||||||
/* 1. The origin of this software must not be misrepresented; you must not */
|
/* 1. 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. */
|
||||||
/* 2. Altered source versions must be plainly marked as such, and must not */
|
/* 2. 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. */
|
||||||
/* 3. This notice may not be removed or altered from any source */
|
/* 3. This notice may not be removed or altered from any source */
|
||||||
/* distribution. */
|
/* distribution. */
|
||||||
/* */
|
/* */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _ZLIB_H
|
#ifndef _ZLIB_H
|
||||||
#define _ZLIB_H
|
#define _ZLIB_H
|
||||||
|
|
||||||
#define Z_OK 0
|
#define Z_OK 0
|
||||||
#define Z_DATA_ERROR (-3)
|
#define Z_DATA_ERROR (-3)
|
||||||
/* Return codes for uncompress() */
|
/* Return codes for uncompress() */
|
||||||
|
|
||||||
#define Z_DEFLATED 8
|
#define Z_DEFLATED 8
|
||||||
/* The deflate compression method (the only one supported) */
|
/* The deflate compression method (the only one supported) */
|
||||||
|
|
||||||
#define Z_NULL 0
|
#define Z_NULL 0
|
||||||
|
|
||||||
|
|
||||||
unsigned __fastcall__ inflatemem (char* dest, const char* source);
|
unsigned __fastcall__ inflatemem (char* dest, const char* source);
|
||||||
/*
|
/*
|
||||||
Decompresses the source buffer into the destination buffer.
|
Decompresses the source buffer into the destination buffer.
|
||||||
Returns the size of the uncompressed data (number of bytes written starting
|
Returns the size of the uncompressed data (number of bytes written starting
|
||||||
from dest).
|
from dest).
|
||||||
|
|
||||||
This function expects data in the DEFLATE format, described in RFC
|
This function expects data in the DEFLATE format, described in RFC
|
||||||
(Request for Comments) 1951 in the file
|
(Request for Comments) 1951 in the file
|
||||||
ftp://ds.internic.net/rfc/rfc1951.txt.
|
ftp://ds.internic.net/rfc/rfc1951.txt.
|
||||||
|
|
||||||
This function does not exist in the original zlib. Its implementation
|
This function does not exist in the original zlib. Its implementation
|
||||||
using original zlib might be following:
|
using original zlib might be following:
|
||||||
|
|
||||||
unsigned inflatemem (char* dest, const char* source)
|
unsigned inflatemem (char* dest, const char* source)
|
||||||
{
|
{
|
||||||
z_stream stream;
|
z_stream stream;
|
||||||
|
|
||||||
stream.next_in = (Bytef*) source;
|
stream.next_in = (Bytef*) source;
|
||||||
stream.avail_in = 65535;
|
stream.avail_in = 65535;
|
||||||
|
|
||||||
stream.next_out = dest;
|
stream.next_out = dest;
|
||||||
stream.avail_out = 65535;
|
stream.avail_out = 65535;
|
||||||
|
|
||||||
stream.zalloc = (alloc_func) 0;
|
stream.zalloc = (alloc_func) 0;
|
||||||
stream.zfree = (free_func) 0;
|
stream.zfree = (free_func) 0;
|
||||||
|
|
||||||
inflateInit2(&stream, -MAX_WBITS);
|
inflateInit2(&stream, -MAX_WBITS);
|
||||||
inflate(&stream, Z_FINISH);
|
inflate(&stream, Z_FINISH);
|
||||||
inflateEnd(&stream);
|
inflateEnd(&stream);
|
||||||
|
|
||||||
return stream.total_out;
|
return stream.total_out;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
int __fastcall__ uncompress (char* dest, unsigned* destLen,
|
int __fastcall__ uncompress (char* dest, unsigned* destLen,
|
||||||
const char* source, unsigned sourceLen);
|
const char* source, unsigned sourceLen);
|
||||||
/*
|
/*
|
||||||
Original zlib description:
|
Original zlib description:
|
||||||
|
|
||||||
Decompresses the source buffer into the destination buffer. sourceLen is
|
Decompresses the source buffer into the destination buffer. sourceLen is
|
||||||
the byte length of the source buffer. Upon entry, destLen is the total
|
the byte length of the source buffer. Upon entry, destLen is the total
|
||||||
size of the destination buffer, which must be large enough to hold the
|
size of the destination buffer, which must be large enough to hold the
|
||||||
entire uncompressed data. (The size of the uncompressed data must have
|
entire uncompressed data. (The size of the uncompressed data must have
|
||||||
been saved previously by the compressor and transmitted to the decompressor
|
been saved previously by the compressor and transmitted to the decompressor
|
||||||
by some mechanism outside the scope of this compression library.)
|
by some mechanism outside the scope of this compression library.)
|
||||||
Upon exit, destLen is the actual size of the compressed buffer.
|
Upon exit, destLen is the actual size of the compressed buffer.
|
||||||
This function can be used to decompress a whole file at once if the
|
This function can be used to decompress a whole file at once if the
|
||||||
input file is mmap'ed.
|
input file is mmap'ed.
|
||||||
|
|
||||||
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
|
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
|
||||||
enough memory, Z_BUF_ERROR if there was not enough room in the output
|
enough memory, Z_BUF_ERROR if there was not enough room in the output
|
||||||
buffer, or Z_DATA_ERROR if the input data was corrupted.
|
buffer, or Z_DATA_ERROR if the input data was corrupted.
|
||||||
|
|
||||||
Implementation notes:
|
Implementation notes:
|
||||||
|
|
||||||
This function expects data in the ZLIB format, described in RFC 1950
|
This function expects data in the ZLIB format, described in RFC 1950
|
||||||
in the file ftp://ds.internic.net/rfc/rfc1950.txt. The ZLIB format is
|
in the file ftp://ds.internic.net/rfc/rfc1950.txt. The ZLIB format is
|
||||||
essentially the DEFLATE format plus a very small header and Adler-32
|
essentially the DEFLATE format plus a very small header and Adler-32
|
||||||
checksum.
|
checksum.
|
||||||
|
|
||||||
Z_MEM_ERROR and Z_BUF_ERROR are never returned in this implementation.
|
Z_MEM_ERROR and Z_BUF_ERROR are never returned in this implementation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
unsigned long __fastcall__ adler32 (unsigned long adler, const char* buf,
|
unsigned long __fastcall__ adler32 (unsigned long adler, const char* buf,
|
||||||
unsigned len);
|
unsigned len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Original zlib description:
|
Original zlib description:
|
||||||
|
|
||||||
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
|
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
|
||||||
return the updated checksum. If buf is NULL, this function returns
|
return the updated checksum. If buf is NULL, this function returns
|
||||||
the required initial value for the checksum.
|
the required initial value for the checksum.
|
||||||
An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
|
An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
|
||||||
much faster. Usage example:
|
much faster. Usage example:
|
||||||
|
|
||||||
unsigned long adler = adler32(0L, Z_NULL, 0);
|
unsigned long adler = adler32(0L, Z_NULL, 0);
|
||||||
|
|
||||||
while (read_buffer(buffer, length) != EOF) {
|
while (read_buffer(buffer, length) != EOF) {
|
||||||
adler = adler32(adler, buffer, length);
|
adler = adler32(adler, buffer, length);
|
||||||
}
|
}
|
||||||
if (adler != original_adler) error();
|
if (adler != original_adler) error();
|
||||||
|
|
||||||
Implementation notes:
|
Implementation notes:
|
||||||
|
|
||||||
This function isn't actually much faster than crc32(), but it is smaller
|
This function isn't actually much faster than crc32(), but it is smaller
|
||||||
and does not use any lookup tables.
|
and does not use any lookup tables.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
unsigned long __fastcall__ crc32 (unsigned long crc, const char* buf,
|
unsigned long __fastcall__ crc32 (unsigned long crc, const char* buf,
|
||||||
unsigned len);
|
unsigned len);
|
||||||
/*
|
/*
|
||||||
Original zlib description:
|
Original zlib description:
|
||||||
|
|
||||||
Update a running crc with the bytes buf[0..len-1] and return the updated
|
Update a running crc with the bytes buf[0..len-1] and return the updated
|
||||||
crc. If buf is NULL, this function returns the required initial value
|
crc. If buf is NULL, this function returns the required initial value
|
||||||
for the crc. Pre- and post-conditioning (one's complement) is performed
|
for the crc. Pre- and post-conditioning (one's complement) is performed
|
||||||
within this function so it shouldn't be done by the application.
|
within this function so it shouldn't be done by the application.
|
||||||
Usage example:
|
Usage example:
|
||||||
|
|
||||||
unsigned long crc = crc32(0L, Z_NULL, 0);
|
unsigned long crc = crc32(0L, Z_NULL, 0);
|
||||||
|
|
||||||
while (read_buffer(buffer, length) != EOF) {
|
while (read_buffer(buffer, length) != EOF) {
|
||||||
crc = crc32(crc, buffer, length);
|
crc = crc32(crc, buffer, length);
|
||||||
}
|
}
|
||||||
if (crc != original_crc) error();
|
if (crc != original_crc) error();
|
||||||
|
|
||||||
Implementation notes:
|
Implementation notes:
|
||||||
|
|
||||||
This function uses statically allocated 1 KB lookup table. The table is
|
This function uses statically allocated 1 KB lookup table. The table is
|
||||||
initialised before it is used for the first time (that is, if buffer is
|
initialised before it is used for the first time (that is, if buffer is
|
||||||
NULL or length is zero, then the lookup table isn't initialised).
|
NULL or length is zero, then the lookup table isn't initialised).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* end of zlib.h */
|
/* end of zlib.h */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
ifneq ($(shell echo),)
|
ifneq ($(shell echo),)
|
||||||
CMD_EXE = 1
|
CMD_EXE = 1
|
||||||
endif
|
endif
|
||||||
|
@ -15,24 +14,24 @@ CBMS = c128 \
|
||||||
GEOS = geos-apple \
|
GEOS = geos-apple \
|
||||||
geos-cbm
|
geos-cbm
|
||||||
|
|
||||||
TARGETS = apple2 \
|
TARGETS = apple2 \
|
||||||
apple2enh \
|
apple2enh \
|
||||||
atari \
|
atari \
|
||||||
atarixl \
|
atarixl \
|
||||||
atari2600 \
|
atari2600 \
|
||||||
atari5200 \
|
atari5200 \
|
||||||
atmos \
|
atmos \
|
||||||
creativision \
|
creativision \
|
||||||
$(CBMS) \
|
$(CBMS) \
|
||||||
$(GEOS) \
|
$(GEOS) \
|
||||||
gamate \
|
gamate \
|
||||||
lynx \
|
lynx \
|
||||||
nes \
|
nes \
|
||||||
osic1p \
|
osic1p \
|
||||||
pce \
|
pce \
|
||||||
sim6502 \
|
sim6502 \
|
||||||
sim65c02 \
|
sim65c02 \
|
||||||
supervision\
|
supervision \
|
||||||
telestrat
|
telestrat
|
||||||
|
|
||||||
DRVTYPES = emd \
|
DRVTYPES = emd \
|
||||||
|
@ -41,13 +40,13 @@ DRVTYPES = emd \
|
||||||
ser \
|
ser \
|
||||||
tgi
|
tgi
|
||||||
|
|
||||||
OUTPUTDIRS := lib \
|
OUTPUTDIRS := lib \
|
||||||
asminc \
|
asminc \
|
||||||
cfg \
|
cfg \
|
||||||
include \
|
include \
|
||||||
$(subst ../,,$(filter-out $(wildcard ../include/*.*),$(wildcard ../include/*)))\
|
$(subst ../,,$(filter-out $(wildcard ../include/*.*),$(wildcard ../include/*))) \
|
||||||
$(subst ../,,$(wildcard ../target/*/drv/*))\
|
$(subst ../,,$(wildcard ../target/*/drv/*)) \
|
||||||
$(subst ../,,$(wildcard ../target/*/util))\
|
$(subst ../,,$(wildcard ../target/*/util))
|
||||||
|
|
||||||
.PHONY: all mostlyclean clean install zip lib $(TARGETS)
|
.PHONY: all mostlyclean clean install zip lib $(TARGETS)
|
||||||
|
|
||||||
|
@ -73,7 +72,7 @@ endif
|
||||||
|
|
||||||
ifndef TARGET
|
ifndef TARGET
|
||||||
|
|
||||||
datadir = $(prefix)/share/cc65
|
datadir = $(PREFIX)/share/cc65
|
||||||
|
|
||||||
all lib: $(TARGETS)
|
all lib: $(TARGETS)
|
||||||
|
|
||||||
|
@ -93,7 +92,7 @@ INSTALL = install
|
||||||
|
|
||||||
define INSTALL_recipe
|
define INSTALL_recipe
|
||||||
|
|
||||||
$(if $(prefix),,$(error variable `prefix' must be set))
|
$(if $(PREFIX),,$(error variable `PREFIX' must be set))
|
||||||
$(INSTALL) -d $(DESTDIR)$(datadir)/$(dir)
|
$(INSTALL) -d $(DESTDIR)$(datadir)/$(dir)
|
||||||
$(INSTALL) -m0644 ../$(dir)/*.* $(DESTDIR)$(datadir)/$(dir)
|
$(INSTALL) -m0644 ../$(dir)/*.* $(DESTDIR)$(datadir)/$(dir)
|
||||||
|
|
||||||
|
@ -197,6 +196,7 @@ DEPS = $(OBJS:.o=.d)
|
||||||
EXTRA_SRCPAT = $(SRCDIR)/extra/%.s
|
EXTRA_SRCPAT = $(SRCDIR)/extra/%.s
|
||||||
EXTRA_OBJPAT = ../lib/$(TARGET)-%.o
|
EXTRA_OBJPAT = ../lib/$(TARGET)-%.o
|
||||||
EXTRA_OBJS := $(patsubst $(EXTRA_SRCPAT),$(EXTRA_OBJPAT),$(wildcard $(SRCDIR)/extra/*.s))
|
EXTRA_OBJS := $(patsubst $(EXTRA_SRCPAT),$(EXTRA_OBJPAT),$(wildcard $(SRCDIR)/extra/*.s))
|
||||||
|
DEPS += $(EXTRA_OBJS:../lib/%.o=../libwrk/$(TARGET)/%.d)
|
||||||
|
|
||||||
ZPOBJ = ../libwrk/$(TARGET)/zeropage.o
|
ZPOBJ = ../libwrk/$(TARGET)/zeropage.o
|
||||||
ifeq ($(TARGET),$(filter $(TARGET),$(EXTZP)))
|
ifeq ($(TARGET),$(filter $(TARGET),$(EXTZP)))
|
||||||
|
@ -280,9 +280,9 @@ endef # COMPILE_recipe
|
||||||
../libwrk/$(TARGET)/%.o: %.c | ../libwrk/$(TARGET)
|
../libwrk/$(TARGET)/%.o: %.c | ../libwrk/$(TARGET)
|
||||||
$(COMPILE_recipe)
|
$(COMPILE_recipe)
|
||||||
|
|
||||||
$(EXTRA_OBJPAT): $(EXTRA_SRCPAT) | ../lib
|
$(EXTRA_OBJPAT): $(EXTRA_SRCPAT) | ../libwrk/$(TARGET) ../lib
|
||||||
@echo $(TARGET) - $(<F)
|
@echo $(TARGET) - $(<F)
|
||||||
@$(CA65) -t $(TARGET) $(CA65FLAGS) -o $@ $<
|
@$(CA65) -t $(TARGET) $(CA65FLAGS) --create-dep $(@:../lib/%.o=../libwrk/$(TARGET)/%.d) -o $@ $<
|
||||||
|
|
||||||
../lib/$(TARGET).lib: $(OBJS) | ../lib
|
../lib/$(TARGET).lib: $(OBJS) | ../lib
|
||||||
$(AR65) a $@ $?
|
$(AR65) a $@ $?
|
||||||
|
|
|
@ -46,17 +46,6 @@ PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
||||||
; Button state masks (8 values)
|
|
||||||
|
|
||||||
.byte $10
|
|
||||||
.byte $20
|
|
||||||
.byte $04
|
|
||||||
.byte $08
|
|
||||||
.byte $40
|
|
||||||
.byte $80
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
|
|
||||||
; Jump table
|
; Jump table
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
|
@ -119,7 +108,7 @@ READJOY:
|
||||||
lda BUTN0-1,x ; Check button (1, 3)
|
lda BUTN0-1,x ; Check button (1, 3)
|
||||||
asl
|
asl
|
||||||
tya
|
tya
|
||||||
ror ; FIRE DOWN !UP RIGHT !LEFT 0 0 0
|
ror ; BTN DOWN !UP RIGHT !LEFT 0 0 0
|
||||||
|
|
||||||
; Read secondary button
|
; Read secondary button
|
||||||
tay
|
tay
|
||||||
|
@ -130,10 +119,10 @@ READJOY:
|
||||||
lda BUTN0-1,x ; Check button (2, 0)
|
lda BUTN0-1,x ; Check button (2, 0)
|
||||||
asl
|
asl
|
||||||
tya
|
tya
|
||||||
ror ; FIRE2 FIRE DOWN !UP RIGHT !LEFT 0 0
|
ror ; BTN2 BTN DOWN !UP RIGHT !LEFT 0 0
|
||||||
|
|
||||||
; Finalize
|
; Finalize
|
||||||
eor #%00010100 ; FIRE2 FIRE DOWN UP RIGHT LEFT 0 0
|
eor #%00010100 ; BTN2 BTN DOWN UP RIGHT LEFT 0 0
|
||||||
ldx #$00
|
ldx #$00
|
||||||
bit $C080 ; Switch in LC bank 2 for R/O
|
bit $C080 ; Switch in LC bank 2 for R/O
|
||||||
rts
|
rts
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
.export _cgetc,setcursor
|
.export _cgetc
|
||||||
|
.import setcursor
|
||||||
.import KEYBDV_handler
|
.import KEYBDV_handler
|
||||||
.import cursor,mul40
|
|
||||||
|
|
||||||
_cgetc:
|
_cgetc:
|
||||||
jsr setcursor
|
jsr setcursor
|
||||||
|
@ -29,43 +29,3 @@ _cgetc:
|
||||||
pha
|
pha
|
||||||
rts
|
rts
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.proc setcursor
|
|
||||||
|
|
||||||
ldy #0
|
|
||||||
lda OLDCHR
|
|
||||||
sta (OLDADR),y
|
|
||||||
|
|
||||||
lda ROWCRS
|
|
||||||
jsr mul40
|
|
||||||
clc
|
|
||||||
adc SAVMSC ; add start of screen memory
|
|
||||||
sta OLDADR
|
|
||||||
txa
|
|
||||||
adc SAVMSC+1
|
|
||||||
sta OLDADR+1
|
|
||||||
lda COLCRS
|
|
||||||
adc OLDADR
|
|
||||||
sta OLDADR
|
|
||||||
bcc nc
|
|
||||||
inc OLDADR+1
|
|
||||||
nc: lda (OLDADR),y
|
|
||||||
sta OLDCHR
|
|
||||||
|
|
||||||
ldx cursor ; current cursor setting as requested by the user
|
|
||||||
beq off
|
|
||||||
ldx #0
|
|
||||||
beq cont
|
|
||||||
|
|
||||||
off: inx
|
|
||||||
cont: stx CRSINH ; update system variable
|
|
||||||
|
|
||||||
beq turnon
|
|
||||||
and #$7f ; clear high bit / inverse flag
|
|
||||||
finish: sta (OLDADR),y ; update on-screen display
|
|
||||||
rts
|
|
||||||
|
|
||||||
turnon: ora #$80 ; set high bit / inverse flag
|
|
||||||
bne finish
|
|
||||||
|
|
||||||
.endproc
|
|
||||||
|
|
|
@ -35,17 +35,6 @@
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
||||||
; Button state masks (8 values)
|
|
||||||
|
|
||||||
.byte $02 ; JOY_UP
|
|
||||||
.byte $04 ; JOY_DOWN
|
|
||||||
.byte $08 ; JOY_LEFT
|
|
||||||
.byte $10 ; JOY_RIGHT
|
|
||||||
.byte $01 ; JOY_FIRE
|
|
||||||
.byte $00 ; JOY_FIRE2 not available
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
|
|
||||||
; Jump table.
|
; Jump table.
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
|
@ -115,10 +104,12 @@ READJOY:
|
||||||
|
|
||||||
; Read joystick
|
; Read joystick
|
||||||
|
|
||||||
lda PORTA ; get position
|
lda STRIG0 ; get button
|
||||||
and #%00001111
|
|
||||||
asl a
|
asl a
|
||||||
ora TRIG0 ; add button information
|
asl a
|
||||||
eor #%00011111
|
asl a
|
||||||
|
asl a
|
||||||
|
ora PORTA ; add position information
|
||||||
|
eor #$1F
|
||||||
ldx #0 ; fix X
|
ldx #0 ; fix X
|
||||||
rts
|
rts
|
||||||
|
|
|
@ -34,17 +34,6 @@
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
||||||
; Button state masks (8 values)
|
|
||||||
|
|
||||||
.byte $01 ; JOY_UP
|
|
||||||
.byte $02 ; JOY_DOWN
|
|
||||||
.byte $04 ; JOY_LEFT
|
|
||||||
.byte $08 ; JOY_RIGHT
|
|
||||||
.byte $10 ; JOY_FIRE
|
|
||||||
.byte $00 ; JOY_FIRE2 not available
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
|
|
||||||
; Jump table.
|
; Jump table.
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
|
|
48
libsrc/atari/setcursor.s
Normal file
48
libsrc/atari/setcursor.s
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
;
|
||||||
|
; Christian Groessler, November-2002
|
||||||
|
;
|
||||||
|
; cursor handling, internal function
|
||||||
|
|
||||||
|
.include "atari.inc"
|
||||||
|
.import cursor,mul40
|
||||||
|
.export setcursor
|
||||||
|
|
||||||
|
.proc setcursor
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
lda OLDCHR
|
||||||
|
sta (OLDADR),y
|
||||||
|
|
||||||
|
lda ROWCRS
|
||||||
|
jsr mul40
|
||||||
|
clc
|
||||||
|
adc SAVMSC ; add start of screen memory
|
||||||
|
sta OLDADR
|
||||||
|
txa
|
||||||
|
adc SAVMSC+1
|
||||||
|
sta OLDADR+1
|
||||||
|
lda COLCRS
|
||||||
|
adc OLDADR
|
||||||
|
sta OLDADR
|
||||||
|
bcc nc
|
||||||
|
inc OLDADR+1
|
||||||
|
nc: lda (OLDADR),y
|
||||||
|
sta OLDCHR
|
||||||
|
|
||||||
|
ldx cursor ; current cursor setting as requested by the user
|
||||||
|
beq off
|
||||||
|
ldx #0
|
||||||
|
beq cont
|
||||||
|
|
||||||
|
off: inx
|
||||||
|
cont: stx CRSINH ; update system variable
|
||||||
|
|
||||||
|
beq turnon
|
||||||
|
and #$7f ; clear high bit / inverse flag
|
||||||
|
finish: sta (OLDADR),y ; update on-screen display
|
||||||
|
rts
|
||||||
|
|
||||||
|
turnon: ora #$80 ; set high bit / inverse flag
|
||||||
|
bne finish
|
||||||
|
|
||||||
|
.endproc
|
|
@ -27,17 +27,6 @@
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
||||||
; Button state masks (8 values)
|
|
||||||
|
|
||||||
.byte $01 ; JOY_UP
|
|
||||||
.byte $02 ; JOY_DOWN
|
|
||||||
.byte $04 ; JOY_LEFT
|
|
||||||
.byte $08 ; JOY_RIGHT
|
|
||||||
.byte $10 ; JOY_FIRE
|
|
||||||
.byte $20 ; JOY_FIRE2
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
|
|
||||||
; Jump table.
|
; Jump table.
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
|
@ -99,7 +88,7 @@ READJOY:
|
||||||
lda #0 ; Initialize return value
|
lda #0 ; Initialize return value
|
||||||
cmp TRIG0,y
|
cmp TRIG0,y
|
||||||
bne @notrg
|
bne @notrg
|
||||||
lda #$10 ; JOY_FIRE
|
lda #$10 ; JOY_BTN
|
||||||
|
|
||||||
; Read joystick
|
; Read joystick
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 2003-04-13
|
; 2003-04-13, Ullrich von Bassewitz
|
||||||
|
; 2017-06-15, Greg King
|
||||||
;
|
;
|
||||||
; void gotoxy (unsigned char x, unsigned char y);
|
; void gotoxy (unsigned char x, unsigned char y);
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _gotoxy
|
.export gotoxy, _gotoxy
|
||||||
|
|
||||||
.import popa
|
.import popa
|
||||||
|
|
||||||
.include "atmos.inc"
|
.include "atmos.inc"
|
||||||
|
|
||||||
|
gotoxy: jsr popa ; Get Y
|
||||||
|
|
||||||
.proc _gotoxy
|
.proc _gotoxy
|
||||||
|
|
||||||
sta CURS_Y ; Set Y
|
sta CURS_Y ; Set Y
|
||||||
|
@ -17,5 +21,3 @@
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,17 +28,6 @@
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
||||||
; Button state masks (8 values)
|
|
||||||
|
|
||||||
.byte $10 ; JOY_UP
|
|
||||||
.byte $08 ; JOY_DOWN
|
|
||||||
.byte $01 ; JOY_LEFT
|
|
||||||
.byte $02 ; JOY_RIGHT
|
|
||||||
.byte $20 ; JOY_FIRE
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
|
|
||||||
; Jump table.
|
; Jump table.
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
|
|
|
@ -30,17 +30,6 @@
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
||||||
; Button state masks (8 values)
|
|
||||||
|
|
||||||
.byte $01 ; JOY_UP
|
|
||||||
.byte $02 ; JOY_DOWN
|
|
||||||
.byte $04 ; JOY_LEFT
|
|
||||||
.byte $08 ; JOY_RIGHT
|
|
||||||
.byte $10 ; JOY_FIRE
|
|
||||||
.byte $00 ; JOY_FIRE2 unavailable
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
|
|
||||||
; Jump table.
|
; Jump table.
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
|
|
|
@ -30,17 +30,6 @@
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
||||||
; Button state masks (8 values)
|
|
||||||
|
|
||||||
.byte $01 ; JOY_UP
|
|
||||||
.byte $02 ; JOY_DOWN
|
|
||||||
.byte $04 ; JOY_LEFT
|
|
||||||
.byte $08 ; JOY_RIGHT
|
|
||||||
.byte $10 ; JOY_FIRE
|
|
||||||
.byte $00 ; JOY_FIRE2 unavailable
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
|
|
||||||
; Jump table.
|
; Jump table.
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
|
@ -104,7 +93,7 @@ joy1: lda #$7F
|
||||||
sei
|
sei
|
||||||
sta CIA1_PRA
|
sta CIA1_PRA
|
||||||
lda CIA1_PRB
|
lda CIA1_PRB
|
||||||
cli
|
back: cli
|
||||||
and #$1F
|
and #$1F
|
||||||
eor #$1F
|
eor #$1F
|
||||||
rts
|
rts
|
||||||
|
@ -118,9 +107,4 @@ joy2: ldx #0
|
||||||
sta CIA1_DDRA
|
sta CIA1_DDRA
|
||||||
lda CIA1_PRA
|
lda CIA1_PRA
|
||||||
sty CIA1_DDRA
|
sty CIA1_DDRA
|
||||||
cli
|
jmp back
|
||||||
and #$1F
|
|
||||||
eor #$1F
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
14
libsrc/c128/kbrepeat.s
Normal file
14
libsrc/c128/kbrepeat.s
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
;
|
||||||
|
; unsigned char __fastcall__ kbrepeat (unsigned char mode);
|
||||||
|
;
|
||||||
|
|
||||||
|
.export _kbrepeat
|
||||||
|
|
||||||
|
.include "c128.inc"
|
||||||
|
|
||||||
|
_kbrepeat:
|
||||||
|
ldx KBDREPEAT ; get old value
|
||||||
|
sta KBDREPEAT ; store new value
|
||||||
|
txa ; return old value
|
||||||
|
ldx #0
|
||||||
|
rts
|
30
libsrc/c128/waitvsync.s
Normal file
30
libsrc/c128/waitvsync.s
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
;
|
||||||
|
; Written by Groepaz <groepaz@gmx.net>
|
||||||
|
;
|
||||||
|
; void waitvsync (void);
|
||||||
|
;
|
||||||
|
|
||||||
|
.export _waitvsync
|
||||||
|
|
||||||
|
.include "c128.inc"
|
||||||
|
|
||||||
|
_waitvsync:
|
||||||
|
|
||||||
|
bit MODE
|
||||||
|
bmi @c80
|
||||||
|
|
||||||
|
@l1:
|
||||||
|
bit VIC_CTRL1
|
||||||
|
bpl @l1
|
||||||
|
@l2:
|
||||||
|
bit VIC_CTRL1
|
||||||
|
bmi @l2
|
||||||
|
rts
|
||||||
|
|
||||||
|
@c80:
|
||||||
|
;FIXME: do we have to switch banks?
|
||||||
|
@l3:
|
||||||
|
lda VDC_INDEX
|
||||||
|
and #$20
|
||||||
|
beq @l3
|
||||||
|
rts
|
|
@ -1,376 +1,376 @@
|
||||||
;
|
;
|
||||||
; Extended memory driver for 65816 based extra RAM. Driver works without
|
; Extended memory driver for 65816 based extra RAM. Driver works without
|
||||||
; problems when statically linked.
|
; problems when statically linked.
|
||||||
;
|
;
|
||||||
; Marco van den Heuvel, 2015-12-01
|
; Marco van den Heuvel, 2015-12-01
|
||||||
;
|
;
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
|
|
||||||
.include "em-kernel.inc"
|
.include "em-kernel.inc"
|
||||||
.include "em-error.inc"
|
.include "em-error.inc"
|
||||||
|
|
||||||
|
|
||||||
.macpack generic
|
.macpack generic
|
||||||
.macpack module
|
.macpack module
|
||||||
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Header. Includes jump table
|
; Header. Includes jump table
|
||||||
|
|
||||||
module_header _c64_65816_emd
|
module_header _c64_65816_emd
|
||||||
|
|
||||||
; Driver signature
|
; Driver signature
|
||||||
|
|
||||||
.byte $65, $6d, $64 ; "emd"
|
.byte $65, $6d, $64 ; "emd"
|
||||||
.byte EMD_API_VERSION ; EM API version number
|
.byte EMD_API_VERSION ; EM API version number
|
||||||
|
|
||||||
; Library reference
|
; Library reference
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
||||||
; Jump table
|
; Jump table
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
.addr UNINSTALL
|
.addr UNINSTALL
|
||||||
.addr PAGECOUNT
|
.addr PAGECOUNT
|
||||||
.addr MAP
|
.addr MAP
|
||||||
.addr USE
|
.addr USE
|
||||||
.addr COMMIT
|
.addr COMMIT
|
||||||
.addr COPYFROM
|
.addr COPYFROM
|
||||||
.addr COPYTO
|
.addr COPYTO
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Data.
|
; Data.
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
isnotscpu: .res 1 ; SuperCPU not present
|
isnotscpu: .res 1 ; SuperCPU not present
|
||||||
curpage: .res 1 ; Current page number
|
curpage: .res 1 ; Current page number
|
||||||
curbank: .res 1 ; Current bank number (+1)
|
curbank: .res 1 ; Current bank number (+1)
|
||||||
bankcount: .res 1 ; Number of available banks (pages = banks * 256)
|
bankcount: .res 1 ; Number of available banks (pages = banks * 256)
|
||||||
window: .res 256 ; Memory "window"
|
window: .res 256 ; Memory "window"
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; INSTALL routine. Is called after the driver is loaded into memory. If
|
; INSTALL routine. Is called after the driver is loaded into memory. If
|
||||||
; possible, check if the hardware is present and determine the amount of
|
; possible, check if the hardware is present and determine the amount of
|
||||||
; memory available.
|
; memory available.
|
||||||
; Must return an EM_ERR_xx code in a/x.
|
; Must return an EM_ERR_xx code in a/x.
|
||||||
;
|
;
|
||||||
|
|
||||||
INSTALL:
|
INSTALL:
|
||||||
sei
|
sei
|
||||||
clc
|
clc
|
||||||
sed
|
sed
|
||||||
lda #$99
|
lda #$99
|
||||||
adc #$01 ; on 65C02, 65SC02, 65CE02, 65802 and 65816 sets the zero flag correctly
|
adc #$01 ; on 65C02, 65SC02, 65CE02, 65802 and 65816 sets the zero flag correctly
|
||||||
cld
|
cld
|
||||||
bne @not_present
|
bne @not_present
|
||||||
clc
|
clc
|
||||||
.P816
|
.P816
|
||||||
sep #$01 ; nop #$01 on 65C02/65SC02 and lda ($01,s),y on 65CE02
|
sep #$01 ; nop #$01 on 65C02/65SC02 and lda ($01,s),y on 65CE02
|
||||||
.P02
|
.P02
|
||||||
bcc @not_present
|
bcc @not_present
|
||||||
lda $d0bc
|
lda $d0bc
|
||||||
and #$80
|
and #$80
|
||||||
sta isnotscpu
|
sta isnotscpu
|
||||||
lda $07e8
|
lda $07e8
|
||||||
pha ; save value incase it was used somewhere else
|
pha ; save value incase it was used somewhere else
|
||||||
ldx #$ff
|
ldx #$ff
|
||||||
@fillloop: ; fill from top (bank 255) to bottom
|
@fillloop: ; fill from top (bank 255) to bottom
|
||||||
txa
|
txa
|
||||||
pha
|
pha
|
||||||
.P816
|
.P816
|
||||||
plb ; pull dbr
|
plb ; pull dbr
|
||||||
.P02
|
.P02
|
||||||
stx $07e8
|
stx $07e8
|
||||||
dex
|
dex
|
||||||
cpx #$ff
|
cpx #$ff
|
||||||
bne @fillloop
|
bne @fillloop
|
||||||
inx
|
inx
|
||||||
@compareloop: ; check from bottom to top
|
@compareloop: ; check from bottom to top
|
||||||
txa
|
txa
|
||||||
pha
|
pha
|
||||||
.P816
|
.P816
|
||||||
plb
|
plb
|
||||||
.P02
|
.P02
|
||||||
cmp $07e8
|
cmp $07e8
|
||||||
bne @found_pages
|
bne @found_pages
|
||||||
.P816
|
.P816
|
||||||
inc
|
inc
|
||||||
.P02
|
.P02
|
||||||
sta $07e8
|
sta $07e8
|
||||||
cmp $07e8
|
cmp $07e8
|
||||||
bne @found_pages
|
bne @found_pages
|
||||||
inx
|
inx
|
||||||
bne @compareloop
|
bne @compareloop
|
||||||
@found_pages:
|
@found_pages:
|
||||||
dex
|
dex
|
||||||
lda #$00
|
lda #$00
|
||||||
pha
|
pha
|
||||||
.P816
|
.P816
|
||||||
plb
|
plb
|
||||||
.P02
|
.P02
|
||||||
pla
|
pla
|
||||||
sta $07e8
|
sta $07e8
|
||||||
cli
|
cli
|
||||||
lda isnotscpu
|
lda isnotscpu
|
||||||
bne @noextradex
|
bne @noextradex
|
||||||
dex
|
dex
|
||||||
@noextradex:
|
@noextradex:
|
||||||
stx bankcount
|
stx bankcount
|
||||||
lda #<EM_ERR_OK
|
lda #<EM_ERR_OK
|
||||||
ldx #>EM_ERR_OK
|
ldx #>EM_ERR_OK
|
||||||
rts
|
rts
|
||||||
@not_present:
|
@not_present:
|
||||||
cli
|
cli
|
||||||
lda #<EM_ERR_NO_DEVICE
|
lda #<EM_ERR_NO_DEVICE
|
||||||
ldx #>EM_ERR_NO_DEVICE
|
ldx #>EM_ERR_NO_DEVICE
|
||||||
; rts ; Run into UNINSTALL instead
|
; rts ; Run into UNINSTALL instead
|
||||||
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||||
; Can do cleanup or whatever. Must not return anything.
|
; Can do cleanup or whatever. Must not return anything.
|
||||||
;
|
;
|
||||||
|
|
||||||
UNINSTALL:
|
UNINSTALL:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; PAGECOUNT: Return the total number of available pages in a/x.
|
; PAGECOUNT: Return the total number of available pages in a/x.
|
||||||
;
|
;
|
||||||
|
|
||||||
PAGECOUNT:
|
PAGECOUNT:
|
||||||
lda #$00 ; a whole bank is either usable or not
|
lda #$00 ; a whole bank is either usable or not
|
||||||
ldx bankcount
|
ldx bankcount
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; MAP: Map the page in a/x into memory and return a pointer to the page in
|
; MAP: Map the page in a/x into memory and return a pointer to the page in
|
||||||
; a/x. The contents of the currently mapped page (if any) may be discarded
|
; a/x. The contents of the currently mapped page (if any) may be discarded
|
||||||
; by the driver.
|
; by the driver.
|
||||||
;
|
;
|
||||||
|
|
||||||
MAP: sta curpage ; Remember the new page
|
MAP: sta curpage ; Remember the new page
|
||||||
stx curbank ; Remember the new bank
|
stx curbank ; Remember the new bank
|
||||||
|
|
||||||
sta ptr2+1 ; src address low
|
sta ptr2+1 ; src address low
|
||||||
lda #$00
|
lda #$00
|
||||||
sta ptr2 ; src address high
|
sta ptr2 ; src address high
|
||||||
inx
|
inx
|
||||||
ldy isnotscpu ; check if not scpu
|
ldy isnotscpu ; check if not scpu
|
||||||
bne @notscpu
|
bne @notscpu
|
||||||
inx
|
inx
|
||||||
@notscpu:
|
@notscpu:
|
||||||
stx tmp2 ; src bank
|
stx tmp2 ; src bank
|
||||||
|
|
||||||
sta tmp1 ; dst bank
|
sta tmp1 ; dst bank
|
||||||
|
|
||||||
sta ptr3+1 ; length high
|
sta ptr3+1 ; length high
|
||||||
lda #$ff
|
lda #$ff
|
||||||
sta ptr3 ; length low
|
sta ptr3 ; length low
|
||||||
|
|
||||||
lda #<window
|
lda #<window
|
||||||
sta ptr1 ; dst address low
|
sta ptr1 ; dst address low
|
||||||
ldx #>window
|
ldx #>window
|
||||||
stx ptr1+1 ; dst address high
|
stx ptr1+1 ; dst address high
|
||||||
|
|
||||||
jsr transfer
|
jsr transfer
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; USE: Tell the driver that the window is now associated with a given page.
|
; USE: Tell the driver that the window is now associated with a given page.
|
||||||
|
|
||||||
USE: sta curpage ; Remember the page
|
USE: sta curpage ; Remember the page
|
||||||
stx curbank ; Remember the bank
|
stx curbank ; Remember the bank
|
||||||
lda #<window
|
lda #<window
|
||||||
ldx #>window ; Return the window
|
ldx #>window ; Return the window
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; COMMIT: Commit changes in the memory window to extended storage.
|
; COMMIT: Commit changes in the memory window to extended storage.
|
||||||
|
|
||||||
COMMIT: lda curpage ; Get the current page
|
COMMIT: lda curpage ; Get the current page
|
||||||
sta ptr1+1 ; dst high
|
sta ptr1+1 ; dst high
|
||||||
ldx #$00
|
ldx #$00
|
||||||
stx ptr1 ; dst low
|
stx ptr1 ; dst low
|
||||||
|
|
||||||
lda #<window
|
lda #<window
|
||||||
sta ptr2 ; src low
|
sta ptr2 ; src low
|
||||||
lda #>window
|
lda #>window
|
||||||
sta ptr2+1 ; src high
|
sta ptr2+1 ; src high
|
||||||
|
|
||||||
stx ptr3+1 ; length high
|
stx ptr3+1 ; length high
|
||||||
lda #$ff
|
lda #$ff
|
||||||
sta ptr3 ; length low
|
sta ptr3 ; length low
|
||||||
|
|
||||||
stx tmp2 ; src bank
|
stx tmp2 ; src bank
|
||||||
ldy curbank ; Get the current bank
|
ldy curbank ; Get the current bank
|
||||||
iny
|
iny
|
||||||
ldx isnotscpu
|
ldx isnotscpu
|
||||||
bne @notascpu
|
bne @notascpu
|
||||||
iny
|
iny
|
||||||
@notascpu:
|
@notascpu:
|
||||||
sty tmp1 ; dst bank
|
sty tmp1 ; dst bank
|
||||||
|
|
||||||
jsr transfer
|
jsr transfer
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; COPYFROM: Copy from extended into linear memory. A pointer to a structure
|
; COPYFROM: Copy from extended into linear memory. A pointer to a structure
|
||||||
; describing the request is passed in a/x.
|
; describing the request is passed in a/x.
|
||||||
; The function must not return anything.
|
; The function must not return anything.
|
||||||
;
|
;
|
||||||
|
|
||||||
COPYFROM:
|
COPYFROM:
|
||||||
sta ptr4
|
sta ptr4
|
||||||
stx ptr4+1 ; Save the passed em_copy pointer
|
stx ptr4+1 ; Save the passed em_copy pointer
|
||||||
|
|
||||||
ldy #EM_COPY::COUNT+1 ; start at the end of the struct
|
ldy #EM_COPY::COUNT+1 ; start at the end of the struct
|
||||||
lda (ptr4),y ; get high byte of count
|
lda (ptr4),y ; get high byte of count
|
||||||
tax
|
tax
|
||||||
dey
|
dey
|
||||||
lda (ptr4),y ; get low byte of count
|
lda (ptr4),y ; get low byte of count
|
||||||
bne @nodex
|
bne @nodex
|
||||||
dex
|
dex
|
||||||
@nodex:
|
@nodex:
|
||||||
.P816
|
.P816
|
||||||
dec
|
dec
|
||||||
.P02
|
.P02
|
||||||
sta ptr3 ; length low
|
sta ptr3 ; length low
|
||||||
stx ptr3+1 ; length high
|
stx ptr3+1 ; length high
|
||||||
dey
|
dey
|
||||||
lda (ptr4),y ; get bank
|
lda (ptr4),y ; get bank
|
||||||
.P816
|
.P816
|
||||||
inc
|
inc
|
||||||
.P02
|
.P02
|
||||||
ldx isnotscpu
|
ldx isnotscpu
|
||||||
bne @notscpu64
|
bne @notscpu64
|
||||||
.P816
|
.P816
|
||||||
inc
|
inc
|
||||||
.P02
|
.P02
|
||||||
@notscpu64:
|
@notscpu64:
|
||||||
sta tmp2 ; src bank
|
sta tmp2 ; src bank
|
||||||
dey
|
dey
|
||||||
lda (ptr4),y ; get page
|
lda (ptr4),y ; get page
|
||||||
sta ptr2+1 ; src high
|
sta ptr2+1 ; src high
|
||||||
dey
|
dey
|
||||||
lda (ptr4),y ; get offset in page
|
lda (ptr4),y ; get offset in page
|
||||||
sta ptr2 ; src low
|
sta ptr2 ; src low
|
||||||
dey
|
dey
|
||||||
lda (ptr4),y ; get memory buffer high
|
lda (ptr4),y ; get memory buffer high
|
||||||
sta ptr1+1 ; dst high
|
sta ptr1+1 ; dst high
|
||||||
dey
|
dey
|
||||||
lda (ptr4),y ; get memory buffer low
|
lda (ptr4),y ; get memory buffer low
|
||||||
sta ptr1 ; dst low
|
sta ptr1 ; dst low
|
||||||
lda #$00
|
lda #$00
|
||||||
sta tmp1 ; dst bank
|
sta tmp1 ; dst bank
|
||||||
|
|
||||||
jsr transfer
|
jsr transfer
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; COPYTO: Copy from linear into extended memory. A pointer to a structure
|
; COPYTO: Copy from linear into extended memory. A pointer to a structure
|
||||||
; describing the request is passed in a/x.
|
; describing the request is passed in a/x.
|
||||||
; The function must not return anything.
|
; The function must not return anything.
|
||||||
;
|
;
|
||||||
|
|
||||||
COPYTO: sta ptr4
|
COPYTO: sta ptr4
|
||||||
stx ptr4+1 ; Save the passed em_copy pointer
|
stx ptr4+1 ; Save the passed em_copy pointer
|
||||||
|
|
||||||
ldy #EM_COPY::COUNT+1 ; start at the end of the struct
|
ldy #EM_COPY::COUNT+1 ; start at the end of the struct
|
||||||
lda (ptr4),y ; get high byte of count
|
lda (ptr4),y ; get high byte of count
|
||||||
tax
|
tax
|
||||||
dey
|
dey
|
||||||
lda (ptr4),y ; get low byte of count
|
lda (ptr4),y ; get low byte of count
|
||||||
bne @nodex2
|
bne @nodex2
|
||||||
dex
|
dex
|
||||||
@nodex2:
|
@nodex2:
|
||||||
.P816
|
.P816
|
||||||
dec
|
dec
|
||||||
.P02
|
.P02
|
||||||
sta ptr3 ; length low
|
sta ptr3 ; length low
|
||||||
txa
|
txa
|
||||||
sta ptr3+1 ; length high
|
sta ptr3+1 ; length high
|
||||||
dey
|
dey
|
||||||
lda (ptr4),y ; get bank
|
lda (ptr4),y ; get bank
|
||||||
.P816
|
.P816
|
||||||
inc
|
inc
|
||||||
.P02
|
.P02
|
||||||
ldx isnotscpu
|
ldx isnotscpu
|
||||||
bne @notascpu64
|
bne @notascpu64
|
||||||
.P816
|
.P816
|
||||||
inc
|
inc
|
||||||
.P02
|
.P02
|
||||||
@notascpu64:
|
@notascpu64:
|
||||||
sta tmp1 ; dst bank
|
sta tmp1 ; dst bank
|
||||||
dey
|
dey
|
||||||
lda (ptr4),y ; get page
|
lda (ptr4),y ; get page
|
||||||
sta ptr1+1 ; dst high
|
sta ptr1+1 ; dst high
|
||||||
dey
|
dey
|
||||||
lda (ptr4),y ; get page offset
|
lda (ptr4),y ; get page offset
|
||||||
sta ptr1 ; dst low
|
sta ptr1 ; dst low
|
||||||
dey
|
dey
|
||||||
lda (ptr4),y ; get memory buffer high
|
lda (ptr4),y ; get memory buffer high
|
||||||
sta ptr2+1 ; src low
|
sta ptr2+1 ; src low
|
||||||
dey
|
dey
|
||||||
lda (ptr4),y ; get memory buffer low
|
lda (ptr4),y ; get memory buffer low
|
||||||
sta ptr2 ; src high
|
sta ptr2 ; src high
|
||||||
lda #$00
|
lda #$00
|
||||||
sta tmp2 ; src bank
|
sta tmp2 ; src bank
|
||||||
|
|
||||||
jsr transfer
|
jsr transfer
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Helper function for moving a block, the following is used:
|
; Helper function for moving a block, the following is used:
|
||||||
; ptr1: dst
|
; ptr1: dst
|
||||||
; ptr2: src
|
; ptr2: src
|
||||||
; ptr3: length
|
; ptr3: length
|
||||||
; tmp1: dst bank
|
; tmp1: dst bank
|
||||||
; tmp2: src bank
|
; tmp2: src bank
|
||||||
|
|
||||||
transfer:
|
transfer:
|
||||||
.P816
|
.P816
|
||||||
.A8
|
.A8
|
||||||
.I8
|
.I8
|
||||||
sei
|
sei
|
||||||
pha
|
pha
|
||||||
phx
|
phx
|
||||||
phy
|
phy
|
||||||
ldx tmp1 ; load srcbank
|
ldx tmp1 ; load srcbank
|
||||||
stx @move+1 ; store srcbank in move + 1
|
stx @move+1 ; store srcbank in move + 1
|
||||||
ldy tmp2 ; load dstbank
|
ldy tmp2 ; load dstbank
|
||||||
sty @move+2 ; store dstbank in move + 2
|
sty @move+2 ; store dstbank in move + 2
|
||||||
clc ; switch to native mode
|
clc ; switch to native mode
|
||||||
xce
|
xce
|
||||||
php ; save status bits
|
php ; save status bits
|
||||||
rep #%00110000 ; set A and index to 16bit
|
rep #%00110000 ; set A and index to 16bit
|
||||||
.A16
|
.A16
|
||||||
.I16
|
.I16
|
||||||
ldy ptr1
|
ldy ptr1
|
||||||
ldx ptr2
|
ldx ptr2
|
||||||
lda ptr3
|
lda ptr3
|
||||||
@move:
|
@move:
|
||||||
mvn 0,0
|
mvn 0,0
|
||||||
plp ; restore status bits
|
plp ; restore status bits
|
||||||
.A8
|
.A8
|
||||||
.I8
|
.I8
|
||||||
lda #$00
|
lda #$00
|
||||||
pha
|
pha
|
||||||
plb ; restore dbr
|
plb ; restore dbr
|
||||||
sec
|
sec
|
||||||
xce ; switch to emul mode
|
xce ; switch to emul mode
|
||||||
ply
|
ply
|
||||||
plx
|
plx
|
||||||
pla
|
pla
|
||||||
cli
|
cli
|
||||||
rts
|
rts
|
||||||
.P02
|
.P02
|
||||||
|
|
|
@ -29,17 +29,6 @@
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
||||||
; Button state masks (8 values)
|
|
||||||
|
|
||||||
.byte $01 ; JOY_UP
|
|
||||||
.byte $02 ; JOY_DOWN
|
|
||||||
.byte $04 ; JOY_LEFT
|
|
||||||
.byte $08 ; JOY_RIGHT
|
|
||||||
.byte $10 ; JOY_FIRE
|
|
||||||
.byte $00 ; JOY_FIRE2 unavailable
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
|
|
||||||
; Jump table.
|
; Jump table.
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
|
|
|
@ -30,17 +30,6 @@
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
||||||
; Button state masks (8 values)
|
|
||||||
|
|
||||||
.byte $02 ; JOY_UP "8"
|
|
||||||
.byte $10 ; JOY_DOWN "2"
|
|
||||||
.byte $20 ; JOY_LEFT "4"
|
|
||||||
.byte $08 ; JOY_RIGHT "6"
|
|
||||||
.byte $04 ; JOY_FIRE "5" ENTER
|
|
||||||
.byte $00 ; JOY_FIRE2 unavailable
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
|
|
||||||
; Jump table.
|
; Jump table.
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
|
@ -58,6 +47,49 @@ JOY_COUNT = 1 ; Number of joysticks we support
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Data.
|
; Data.
|
||||||
|
|
||||||
|
.rodata
|
||||||
|
|
||||||
|
; <U>p '8' key
|
||||||
|
; <D>own '2' key
|
||||||
|
; <L>eft '4' key
|
||||||
|
; <R>ight '6' key
|
||||||
|
; <B>utton '5' or ENTER key
|
||||||
|
|
||||||
|
masktable:
|
||||||
|
; Input: LDRBU
|
||||||
|
; Output: BRLDU
|
||||||
|
.byte %00000000 ; $00
|
||||||
|
.byte %00000001 ; $01
|
||||||
|
.byte %00010000 ; $02
|
||||||
|
.byte %00010001 ; $03
|
||||||
|
.byte %00001000 ; $04
|
||||||
|
.byte %00001001 ; $05
|
||||||
|
.byte %00011000 ; $06
|
||||||
|
.byte %00011001 ; $07
|
||||||
|
.byte %00000010 ; $08
|
||||||
|
.byte %00000011 ; $09
|
||||||
|
.byte %00010010 ; $0A
|
||||||
|
.byte %00010011 ; $0B
|
||||||
|
.byte %00001010 ; $0C
|
||||||
|
.byte %00001011 ; $0D
|
||||||
|
.byte %00011010 ; $0E
|
||||||
|
.byte %00011011 ; $0F
|
||||||
|
.byte %00000100 ; $10
|
||||||
|
.byte %00000101 ; $11
|
||||||
|
.byte %00010100 ; $12
|
||||||
|
.byte %00010101 ; $13
|
||||||
|
.byte %00001100 ; $14
|
||||||
|
.byte %00001101 ; $15
|
||||||
|
.byte %00011100 ; $16
|
||||||
|
.byte %00011101 ; $17
|
||||||
|
.byte %00000110 ; $18
|
||||||
|
.byte %00000111 ; $19
|
||||||
|
.byte %00010110 ; $1A
|
||||||
|
.byte %00010111 ; $1B
|
||||||
|
.byte %00001110 ; $1C
|
||||||
|
.byte %00001111 ; $1D
|
||||||
|
.byte %00011110 ; $1E
|
||||||
|
.byte %00011111 ; $1F
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
|
@ -100,21 +132,23 @@ COUNT: lda #JOY_COUNT
|
||||||
;
|
;
|
||||||
|
|
||||||
READ: tax ; Clear high byte
|
READ: tax ; Clear high byte
|
||||||
lda #$FD
|
lda #$FD ; For ENTER and '6'
|
||||||
ldy #$FE
|
ldy #$FE ; For '8', '5', '2', '4'
|
||||||
sei
|
sei
|
||||||
sta VIC_KBD_128
|
sta VIC_KBD_128
|
||||||
lda CIA1_PRB
|
lda CIA1_PRB
|
||||||
and #%00110000
|
and #%00110000
|
||||||
eor #%00110000
|
eor #%00110000
|
||||||
lsr
|
lsr ; Map ENTER ...
|
||||||
lsr
|
lsr ; ... onto '5'
|
||||||
sty VIC_KBD_128
|
sty VIC_KBD_128
|
||||||
eor CIA1_PRB
|
eor CIA1_PRB
|
||||||
iny
|
iny
|
||||||
sty VIC_KBD_128 ; Reset to $FF
|
sty VIC_KBD_128 ; Reset to $FF
|
||||||
cli
|
cli
|
||||||
and #%11111110
|
and #%00111110
|
||||||
eor #%11111110
|
eor #%00111110
|
||||||
|
lsr
|
||||||
|
tay
|
||||||
|
lda masktable,y ; Convert LDRBU to BRLDU
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
|
@ -29,17 +29,6 @@
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
||||||
; Button state masks (8 values)
|
|
||||||
|
|
||||||
.byte $01 ; JOY_UP
|
|
||||||
.byte $02 ; JOY_DOWN
|
|
||||||
.byte $04 ; JOY_LEFT
|
|
||||||
.byte $08 ; JOY_RIGHT
|
|
||||||
.byte $10 ; JOY_FIRE
|
|
||||||
.byte $00 ; JOY_FIRE2 unavailable
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
|
|
||||||
; Jump table.
|
; Jump table.
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
|
@ -133,8 +122,8 @@ joy3:
|
||||||
sta CIA2_PRB ; (output one at PB7)
|
sta CIA2_PRB ; (output one at PB7)
|
||||||
|
|
||||||
lda CIA2_PRB ; cia 2 port B read/write
|
lda CIA2_PRB ; cia 2 port B read/write
|
||||||
and #$1f ; get bit 4-0 (PB4-PB0)
|
and #$1F ; get bit 4-0 (PB4-PB0)
|
||||||
eor #$1f
|
eor #$1F
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Read joystick 4
|
; Read joystick 4
|
||||||
|
@ -143,14 +132,14 @@ joy4: lda #$00 ; cia 2 port B read/write
|
||||||
sta CIA2_PRB ; (output zero at PB7)
|
sta CIA2_PRB ; (output zero at PB7)
|
||||||
|
|
||||||
lda CIA2_PRB ; cia 2 port B read/write
|
lda CIA2_PRB ; cia 2 port B read/write
|
||||||
and #$0f ; get bit 3-0 (PB3-PB0)
|
and #$0F ; get bit 3-0 (PB3-PB0)
|
||||||
sta tmp1 ; joy 4 directions
|
sta tmp1 ; joy 4 directions
|
||||||
|
|
||||||
lda CIA2_PRB ; cia 2 port B read/write
|
lda CIA2_PRB ; cia 2 port B read/write
|
||||||
and #%00100000 ; get bit 5 (PB5)
|
and #%00100000 ; get bit 5 (PB5)
|
||||||
lsr
|
lsr
|
||||||
ora tmp1
|
ora tmp1
|
||||||
eor #$1f
|
eor #$1F
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
rts
|
rts
|
||||||
|
|
|
@ -29,17 +29,6 @@
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
||||||
; Button state masks (8 values)
|
|
||||||
|
|
||||||
.byte $01 ; JOY_UP
|
|
||||||
.byte $02 ; JOY_DOWN
|
|
||||||
.byte $04 ; JOY_LEFT
|
|
||||||
.byte $08 ; JOY_RIGHT
|
|
||||||
.byte $10 ; JOY_FIRE
|
|
||||||
.byte $00 ; JOY_FIRE2 unavailable
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
|
|
||||||
; Jump table.
|
; Jump table.
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
|
|
14
libsrc/c64/kbrepeat.s
Normal file
14
libsrc/c64/kbrepeat.s
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
;
|
||||||
|
; unsigned char __fastcall__ kbrepeat (unsigned char mode);
|
||||||
|
;
|
||||||
|
|
||||||
|
.export _kbrepeat
|
||||||
|
|
||||||
|
.include "c64.inc"
|
||||||
|
|
||||||
|
_kbrepeat:
|
||||||
|
ldx KBDREPEAT ; get old value
|
||||||
|
sta KBDREPEAT ; store new value
|
||||||
|
txa ; return old value
|
||||||
|
ldx #0
|
||||||
|
rts
|
18
libsrc/c64/waitvsync.s
Normal file
18
libsrc/c64/waitvsync.s
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
;
|
||||||
|
; Written by Groepaz <groepaz@gmx.net>
|
||||||
|
;
|
||||||
|
; void waitvsync (void);
|
||||||
|
;
|
||||||
|
|
||||||
|
.export _waitvsync
|
||||||
|
|
||||||
|
.include "c64.inc"
|
||||||
|
|
||||||
|
_waitvsync:
|
||||||
|
@l1:
|
||||||
|
bit VIC_CTRL1
|
||||||
|
bpl @l1
|
||||||
|
@l2:
|
||||||
|
bit VIC_CTRL1
|
||||||
|
bmi @l2
|
||||||
|
rts
|
|
@ -30,17 +30,6 @@
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
||||||
; Button state masks (8 values)
|
|
||||||
|
|
||||||
.byte $01 ; JOY_UP
|
|
||||||
.byte $02 ; JOY_DOWN
|
|
||||||
.byte $04 ; JOY_LEFT
|
|
||||||
.byte $08 ; JOY_RIGHT
|
|
||||||
.byte $10 ; JOY_FIRE
|
|
||||||
.byte $00 ; JOY_FIRE2 unavailable
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
|
|
||||||
; Jump table.
|
; Jump table.
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
|
@ -105,7 +94,7 @@ READ: ldx #$0F ; Switch to the system bank
|
||||||
lda (cia2),y ; Read joystick inputs
|
lda (cia2),y ; Read joystick inputs
|
||||||
sta tmp1
|
sta tmp1
|
||||||
|
|
||||||
; Get the fire bits
|
; Get the push button bits
|
||||||
|
|
||||||
ldy #CIA::PRA
|
ldy #CIA::PRA
|
||||||
lda (cia2),y
|
lda (cia2),y
|
||||||
|
@ -115,12 +104,12 @@ READ: ldx #$0F ; Switch to the system bank
|
||||||
cpx #$00 ; Joystick 0?
|
cpx #$00 ; Joystick 0?
|
||||||
bne @L1 ; Jump if no
|
bne @L1 ; Jump if no
|
||||||
|
|
||||||
; Joystick 1, fire is in bit 6, direction in bit 0-3
|
; Joystick 1, push button is in bit 6, direction in bit 0-3
|
||||||
|
|
||||||
asl a
|
asl a
|
||||||
jmp @L2
|
jmp @L2
|
||||||
|
|
||||||
; Joystick 2, fire is in bit 7, direction in bit 5-7
|
; Joystick 2, push button is in bit 7, direction in bit 5-7
|
||||||
|
|
||||||
@L1: ldx #$00 ; High byte of return value
|
@L1: ldx #$00 ; High byte of return value
|
||||||
lsr tmp1
|
lsr tmp1
|
||||||
|
@ -128,9 +117,9 @@ READ: ldx #$0F ; Switch to the system bank
|
||||||
lsr tmp1
|
lsr tmp1
|
||||||
lsr tmp1
|
lsr tmp1
|
||||||
|
|
||||||
; Mask the relavant bits, get the fire bit
|
; Mask the relavant bits, get the push button bit
|
||||||
|
|
||||||
@L2: asl a ; Fire bit into carry
|
@L2: asl a ; push button bit into carry
|
||||||
lda tmp1
|
lda tmp1
|
||||||
and #$0F
|
and #$0F
|
||||||
bcc @L3
|
bcc @L3
|
||||||
|
|
28
libsrc/cbm510/waitvsync.s
Normal file
28
libsrc/cbm510/waitvsync.s
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
;
|
||||||
|
; Written by Groepaz <groepaz@gmx.net>
|
||||||
|
;
|
||||||
|
; void waitvsync (void);
|
||||||
|
;
|
||||||
|
|
||||||
|
.export _waitvsync
|
||||||
|
.import PALFLAG
|
||||||
|
.import sys_bank, restore_bank
|
||||||
|
|
||||||
|
.importzp vic
|
||||||
|
|
||||||
|
.include "cbm510.inc"
|
||||||
|
|
||||||
|
_waitvsync:
|
||||||
|
jsr sys_bank ; Switch to the system bank
|
||||||
|
sei
|
||||||
|
|
||||||
|
ldy #VIC_CTRL1
|
||||||
|
@l1:
|
||||||
|
lda (vic),y
|
||||||
|
bpl @l1
|
||||||
|
@l2:
|
||||||
|
lda (vic),y
|
||||||
|
bmi @l2
|
||||||
|
|
||||||
|
cli
|
||||||
|
jmp restore_bank
|
286
libsrc/common/lz4.s
Normal file
286
libsrc/common/lz4.s
Normal file
|
@ -0,0 +1,286 @@
|
||||||
|
;
|
||||||
|
; Lauri Kasanen, 6 Jun 2017
|
||||||
|
; (C) Mega Cat Studios
|
||||||
|
; An optimized LZ4 decompressor
|
||||||
|
;
|
||||||
|
; Almost 7 times faster, uses no RAM (vs 14 bytes BSS), and takes 1/4 the space
|
||||||
|
; vs the official C source.
|
||||||
|
;
|
||||||
|
|
||||||
|
.importzp sp, sreg, regsave, regbank
|
||||||
|
.importzp tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4
|
||||||
|
.macpack longbranch
|
||||||
|
.import memcpy_upwards,pushax,popax
|
||||||
|
.export _decompress_lz4
|
||||||
|
|
||||||
|
out = regsave
|
||||||
|
written = regsave + 2
|
||||||
|
tmp = tmp1
|
||||||
|
token = tmp2
|
||||||
|
offset = ptr3
|
||||||
|
in = sreg
|
||||||
|
outlen = ptr4
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
; void decompress_lz4 (const u8 *in, u8 * const out, const u16 outlen)
|
||||||
|
; ---------------------------------------------------------------
|
||||||
|
|
||||||
|
.segment "CODE"
|
||||||
|
|
||||||
|
.proc _decompress_lz4: near
|
||||||
|
|
||||||
|
sta outlen
|
||||||
|
stx outlen+1
|
||||||
|
|
||||||
|
jsr popax
|
||||||
|
sta out
|
||||||
|
stx out+1
|
||||||
|
|
||||||
|
jsr popax
|
||||||
|
sta in
|
||||||
|
stx in+1
|
||||||
|
|
||||||
|
;
|
||||||
|
; written = 0;
|
||||||
|
;
|
||||||
|
lda #$00
|
||||||
|
sta written
|
||||||
|
;
|
||||||
|
; while (written < outlen) {
|
||||||
|
;
|
||||||
|
jmp L0046
|
||||||
|
;
|
||||||
|
; token = *in++;
|
||||||
|
;
|
||||||
|
L0004: ldy #$00
|
||||||
|
lda (in),y
|
||||||
|
sta token
|
||||||
|
|
||||||
|
inc in
|
||||||
|
bne L000A
|
||||||
|
inc in+1
|
||||||
|
L000A:
|
||||||
|
;
|
||||||
|
; offset = token >> 4;
|
||||||
|
;
|
||||||
|
ldx #$00
|
||||||
|
lsr a
|
||||||
|
lsr a
|
||||||
|
lsr a
|
||||||
|
lsr a
|
||||||
|
sta offset
|
||||||
|
stx offset+1
|
||||||
|
;
|
||||||
|
; token &= 0xf;
|
||||||
|
; token += 4; // Minmatch
|
||||||
|
;
|
||||||
|
lda token
|
||||||
|
and #$0F
|
||||||
|
clc
|
||||||
|
adc #$04
|
||||||
|
sta token
|
||||||
|
;
|
||||||
|
; if (offset == 15) {
|
||||||
|
;
|
||||||
|
lda offset
|
||||||
|
cmp #$0F
|
||||||
|
L0013: bne L001A
|
||||||
|
;
|
||||||
|
; tmp = *in++;
|
||||||
|
;
|
||||||
|
ldy #$00
|
||||||
|
lda (in),y
|
||||||
|
sta tmp
|
||||||
|
|
||||||
|
inc in
|
||||||
|
bne L0017
|
||||||
|
inc in+1
|
||||||
|
L0017:
|
||||||
|
;
|
||||||
|
; offset += tmp;
|
||||||
|
;
|
||||||
|
clc
|
||||||
|
adc offset
|
||||||
|
sta offset
|
||||||
|
lda #$00
|
||||||
|
adc offset+1
|
||||||
|
sta offset+1
|
||||||
|
;
|
||||||
|
; if (tmp == 255)
|
||||||
|
;
|
||||||
|
lda tmp
|
||||||
|
cmp #$FF
|
||||||
|
;
|
||||||
|
; goto moreliterals;
|
||||||
|
;
|
||||||
|
jmp L0013
|
||||||
|
;
|
||||||
|
; if (offset) {
|
||||||
|
;
|
||||||
|
L001A: lda offset
|
||||||
|
ora offset+1
|
||||||
|
beq L001C
|
||||||
|
;
|
||||||
|
; memcpy(&out[written], in, offset);
|
||||||
|
;
|
||||||
|
lda out
|
||||||
|
clc
|
||||||
|
adc written
|
||||||
|
sta ptr2
|
||||||
|
lda out+1
|
||||||
|
adc written+1
|
||||||
|
tax
|
||||||
|
lda ptr2
|
||||||
|
stx ptr2+1
|
||||||
|
jsr pushax
|
||||||
|
lda in
|
||||||
|
ldx in+1
|
||||||
|
sta ptr1
|
||||||
|
stx ptr1+1
|
||||||
|
; ldy #$00 - not needed as pushax zeroes Y
|
||||||
|
jsr memcpy_upwards
|
||||||
|
;
|
||||||
|
; written += offset;
|
||||||
|
;
|
||||||
|
lda offset
|
||||||
|
clc
|
||||||
|
adc written
|
||||||
|
sta written
|
||||||
|
lda offset+1
|
||||||
|
adc written+1
|
||||||
|
sta written+1
|
||||||
|
;
|
||||||
|
; in += offset;
|
||||||
|
;
|
||||||
|
lda offset
|
||||||
|
clc
|
||||||
|
adc in
|
||||||
|
sta in
|
||||||
|
lda offset+1
|
||||||
|
adc in+1
|
||||||
|
sta in+1
|
||||||
|
;
|
||||||
|
; if (written >= outlen)
|
||||||
|
;
|
||||||
|
L001C: lda written
|
||||||
|
cmp outlen
|
||||||
|
lda written+1
|
||||||
|
sbc outlen+1
|
||||||
|
;
|
||||||
|
; return;
|
||||||
|
;
|
||||||
|
bcc L0047
|
||||||
|
rts
|
||||||
|
;
|
||||||
|
; memcpy(&offset, in, 2);
|
||||||
|
;
|
||||||
|
L0047: ldy #$00
|
||||||
|
lda (in),y
|
||||||
|
sta offset
|
||||||
|
iny
|
||||||
|
lda (in),y
|
||||||
|
sta offset+1
|
||||||
|
;
|
||||||
|
; in += 2;
|
||||||
|
;
|
||||||
|
lda #$02
|
||||||
|
clc
|
||||||
|
adc in
|
||||||
|
sta in
|
||||||
|
bcc L002F
|
||||||
|
inc in+1
|
||||||
|
;
|
||||||
|
; copysrc = out + written - offset;
|
||||||
|
;
|
||||||
|
L002F: lda out
|
||||||
|
clc
|
||||||
|
adc written
|
||||||
|
tay
|
||||||
|
lda out+1
|
||||||
|
adc written+1
|
||||||
|
tax
|
||||||
|
tya
|
||||||
|
sec
|
||||||
|
sbc offset
|
||||||
|
sta ptr1
|
||||||
|
txa
|
||||||
|
sbc offset+1
|
||||||
|
sta ptr1+1
|
||||||
|
;
|
||||||
|
; offset = token;
|
||||||
|
;
|
||||||
|
lda #$00
|
||||||
|
sta offset+1
|
||||||
|
lda token
|
||||||
|
sta offset
|
||||||
|
;
|
||||||
|
; if (token == 19) {
|
||||||
|
;
|
||||||
|
cmp #$13
|
||||||
|
L0045: bne L003C
|
||||||
|
;
|
||||||
|
; tmp = *in++;
|
||||||
|
;
|
||||||
|
ldy #$00
|
||||||
|
lda (in),y
|
||||||
|
sta tmp
|
||||||
|
|
||||||
|
inc in
|
||||||
|
bne L0039
|
||||||
|
inc in+1
|
||||||
|
L0039:
|
||||||
|
;
|
||||||
|
; offset += tmp;
|
||||||
|
;
|
||||||
|
clc
|
||||||
|
adc offset
|
||||||
|
sta offset
|
||||||
|
tya
|
||||||
|
adc offset+1
|
||||||
|
sta offset+1
|
||||||
|
;
|
||||||
|
; if (tmp == 255)
|
||||||
|
;
|
||||||
|
lda tmp
|
||||||
|
cmp #$FF
|
||||||
|
;
|
||||||
|
; goto morematches;
|
||||||
|
;
|
||||||
|
jmp L0045
|
||||||
|
;
|
||||||
|
; memcpy(&out[written], copysrc, offset);
|
||||||
|
;
|
||||||
|
L003C: lda out
|
||||||
|
clc
|
||||||
|
adc written
|
||||||
|
sta ptr2
|
||||||
|
lda out+1
|
||||||
|
adc written+1
|
||||||
|
tax
|
||||||
|
lda ptr2
|
||||||
|
stx ptr2+1
|
||||||
|
jsr pushax
|
||||||
|
jsr memcpy_upwards
|
||||||
|
;
|
||||||
|
; written += offset;
|
||||||
|
;
|
||||||
|
lda offset
|
||||||
|
clc
|
||||||
|
adc written
|
||||||
|
sta written
|
||||||
|
lda offset+1
|
||||||
|
adc written+1
|
||||||
|
L0046: sta written+1
|
||||||
|
;
|
||||||
|
; while (written < outlen) {
|
||||||
|
;
|
||||||
|
lda written
|
||||||
|
cmp outlen
|
||||||
|
lda written+1
|
||||||
|
sbc outlen+1
|
||||||
|
jcc L0004
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;
|
;
|
||||||
; 2003-08-20, Ullrich von Bassewitz
|
; 2003-08-20, Ullrich von Bassewitz
|
||||||
; 2009-09-13, Christian Krueger -- performance increase (about 20%)
|
; 2009-09-13, Christian Krueger -- performance increase (about 20%), 2013-07-25 improved unrolling
|
||||||
; 2015-10-23, Greg King
|
; 2015-10-23, Greg King
|
||||||
;
|
;
|
||||||
; void* __fastcall__ memmove (void* dest, const void* src, size_t size);
|
; void* __fastcall__ memmove (void* dest, const void* src, size_t size);
|
||||||
|
@ -61,13 +61,10 @@ PageSizeCopy: ; assert Y = 0
|
||||||
dec ptr1+1 ; adjust base...
|
dec ptr1+1 ; adjust base...
|
||||||
dec ptr2+1
|
dec ptr2+1
|
||||||
dey ; in entry case: 0 -> FF
|
dey ; in entry case: 0 -> FF
|
||||||
lda (ptr1),y ; need to copy this 'intro byte'
|
|
||||||
sta (ptr2),y ; to 'land' later on Y=0! (as a result of the '.repeat'-block!)
|
|
||||||
dey ; FF ->FE
|
|
||||||
@copyBytes:
|
@copyBytes:
|
||||||
.repeat 2 ; Unroll this a bit to make it faster...
|
.repeat 3 ; unroll this a bit to make it faster...
|
||||||
lda (ptr1),y
|
lda (ptr1),y ; important: unrolling three times gives a nice
|
||||||
sta (ptr2),y
|
sta (ptr2),y ; 255/3 = 85 loop which ends at 0
|
||||||
dey
|
dey
|
||||||
.endrepeat
|
.endrepeat
|
||||||
@copyEntry: ; in entry case: 0 -> FF
|
@copyEntry: ; in entry case: 0 -> FF
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
; Randum number generator
|
; Randum number generator
|
||||||
;
|
;
|
||||||
; Written and donated by Sidney Cadot - sidney@ch.twi.tudelft.nl
|
; Written and donated by Sidney Cadot - sidney@ch.twi.tudelft.nl
|
||||||
|
; 2016-11-07, modified by Brad Smith
|
||||||
;
|
;
|
||||||
; May be distributed with the cc65 runtime using the same license.
|
; May be distributed with the cc65 runtime using the same license.
|
||||||
;
|
;
|
||||||
|
@ -13,10 +14,14 @@
|
||||||
; Multiplier must be 1 (mod 4)
|
; Multiplier must be 1 (mod 4)
|
||||||
; Added value must be 1 (mod 2)
|
; Added value must be 1 (mod 2)
|
||||||
; This guarantees max. period (2**32)
|
; This guarantees max. period (2**32)
|
||||||
; Bits 8-22 are returned (positive 2-byte int)
|
; The lowest bits have poor entropy and
|
||||||
; where 0 is LSB, 31 is MSB.
|
; exhibit easily detectable patterns, so
|
||||||
; This is better as lower bits exhibit easily
|
; only the upper bits 16-22 and 24-31 of the
|
||||||
; detectable patterns.
|
; 4-byte state are returned.
|
||||||
|
;
|
||||||
|
; The best 8 bits, 24-31 are returned in the
|
||||||
|
; low byte A to provide the best entropy in the
|
||||||
|
; most commonly used part of the return value.
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _rand, _srand
|
.export _rand, _srand
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 31.05.1998
|
; Ullrich von Bassewitz, 31.05.1998
|
||||||
|
; Christian Krueger: 2013-Jul-24, minor optimizations
|
||||||
;
|
;
|
||||||
; char* strcat (char* dest, const char* src);
|
; char* strcat (char* dest, const char* src);
|
||||||
;
|
;
|
||||||
|
@ -7,49 +8,44 @@
|
||||||
.export _strcat
|
.export _strcat
|
||||||
.import popax
|
.import popax
|
||||||
.importzp ptr1, ptr2, tmp3
|
.importzp ptr1, ptr2, tmp3
|
||||||
|
.macpack cpu
|
||||||
|
|
||||||
_strcat:
|
_strcat:
|
||||||
sta ptr1 ; Save src
|
sta ptr1 ; Save src
|
||||||
stx ptr1+1
|
stx ptr1+1
|
||||||
jsr popax ; Get dest
|
jsr popax ; Get dest
|
||||||
sta ptr2
|
sta tmp3 ; Remember for function return
|
||||||
stx ptr2+1
|
tay
|
||||||
sta tmp3 ; Remember for function return
|
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||||
ldy #0
|
stz ptr2
|
||||||
|
.else
|
||||||
|
lda #0
|
||||||
|
sta ptr2 ; access from page start, y contains low byte
|
||||||
|
.endif
|
||||||
|
stx ptr2+1
|
||||||
|
|
||||||
; find end of dest
|
findEndOfDest:
|
||||||
|
lda (ptr2),y
|
||||||
sc1: lda (ptr2),y
|
beq endOfDestFound
|
||||||
beq sc2
|
|
||||||
iny
|
iny
|
||||||
bne sc1
|
bne findEndOfDest
|
||||||
inc ptr2+1
|
inc ptr2+1
|
||||||
bne sc1
|
bne findEndOfDest
|
||||||
|
|
||||||
; end found, get offset in y into pointer
|
endOfDestFound:
|
||||||
|
sty ptr2 ; advance pointer to last y position
|
||||||
|
ldy #0 ; reset new y-offset
|
||||||
|
|
||||||
sc2: tya
|
copyByte:
|
||||||
clc
|
lda (ptr1),y
|
||||||
adc ptr2
|
sta (ptr2),y
|
||||||
sta ptr2
|
beq done
|
||||||
bcc sc3
|
|
||||||
inc ptr2+1
|
|
||||||
|
|
||||||
; copy src
|
|
||||||
|
|
||||||
sc3: ldy #0
|
|
||||||
sc4: lda (ptr1),y
|
|
||||||
sta (ptr2),y
|
|
||||||
beq sc5
|
|
||||||
iny
|
iny
|
||||||
bne sc4
|
bne copyByte
|
||||||
inc ptr1+1
|
inc ptr1+1
|
||||||
inc ptr2+1
|
inc ptr2+1
|
||||||
bne sc4
|
bne copyByte ; like bra here
|
||||||
|
|
||||||
; done, return pointer to dest
|
; return pointer to dest
|
||||||
|
done: lda tmp3 ; X does still contain high byte
|
||||||
sc5: lda tmp3 ; X does still contain high byte
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 31.05.1998
|
; Ullrich von Bassewitz, 31.05.1998
|
||||||
|
; Christian Krueger, 2013-Aug-04, minor optimization
|
||||||
;
|
;
|
||||||
; const char* strchr (const char* s, int c);
|
; const char* strchr (const char* s, int c);
|
||||||
;
|
;
|
||||||
|
@ -7,42 +8,45 @@
|
||||||
.export _strchr
|
.export _strchr
|
||||||
.import popax
|
.import popax
|
||||||
.importzp ptr1, tmp1
|
.importzp ptr1, tmp1
|
||||||
|
.macpack cpu
|
||||||
|
|
||||||
_strchr:
|
_strchr:
|
||||||
sta tmp1 ; Save c
|
sta tmp1 ; Save c
|
||||||
jsr popax ; get s
|
jsr popax ; get s
|
||||||
sta ptr1
|
tay ; low byte of pointer to y
|
||||||
stx ptr1+1
|
stx ptr1+1
|
||||||
ldy #0
|
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||||
|
stz ptr1
|
||||||
|
.else
|
||||||
|
lda #0
|
||||||
|
sta ptr1 ; access from page start, y contains low byte
|
||||||
|
.endif
|
||||||
|
|
||||||
Loop: lda (ptr1),y ; Get next char
|
Loop: lda (ptr1),y ; Get next char
|
||||||
beq EOS ; Jump on end of string
|
beq EOS ; Jump on end of string
|
||||||
cmp tmp1 ; Found?
|
cmp tmp1 ; Found?
|
||||||
beq Found ; Jump if yes
|
beq Found ; Jump if yes
|
||||||
iny
|
iny
|
||||||
bne Loop
|
bne Loop
|
||||||
inc ptr1+1
|
inc ptr1+1
|
||||||
bne Loop ; Branch always
|
bne Loop ; Branch always
|
||||||
|
|
||||||
; End of string. Check if we're searching for the terminating zero
|
; End of string. Check if we're searching for the terminating zero
|
||||||
|
|
||||||
EOS: lda tmp1 ; Get the char we're searching for
|
EOS:
|
||||||
bne NotFound ; Jump if not searching for terminator
|
lda tmp1 ; Get the char we're searching for
|
||||||
|
bne NotFound ; Jump if not searching for terminator
|
||||||
|
|
||||||
; Found. Calculate pointer to c.
|
; Found. Set pointer to c.
|
||||||
|
|
||||||
Found: ldx ptr1+1 ; Load high byte of pointer
|
Found:
|
||||||
tya ; Low byte offset
|
ldx ptr1+1 ; Load high byte of pointer
|
||||||
clc
|
tya ; low byte is in y
|
||||||
adc ptr1
|
rts
|
||||||
bcc Found1
|
|
||||||
inx
|
|
||||||
Found1: rts
|
|
||||||
|
|
||||||
; Not found, return NULL
|
; Not found, return NULL
|
||||||
|
|
||||||
NotFound:
|
NotFound:
|
||||||
lda #0
|
lda #0
|
||||||
tax
|
tax
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
|
@ -1,54 +1,53 @@
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 11.06.1998
|
; Ullrich von Bassewitz, 11.06.1998
|
||||||
|
; Christian Krueger: 05-Aug-2013, optimization
|
||||||
;
|
;
|
||||||
; size_t strcspn (const char* s1, const char* s2);
|
; size_t strcspn (const char* s1, const char* s2);
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _strcspn
|
.export _strcspn
|
||||||
.import popax
|
.import popax, _strlen
|
||||||
.importzp ptr1, ptr2, tmp1, tmp2, tmp3
|
.importzp ptr1, ptr2, tmp1, tmp2
|
||||||
|
|
||||||
_strcspn:
|
_strcspn:
|
||||||
sta ptr2 ; Save s2
|
jsr _strlen ; get length in a/x and transfer s2 to ptr1
|
||||||
stx ptr2+1
|
; Note: It does not make sense to
|
||||||
jsr popax ; Get s1
|
; have more than 255 test chars, so
|
||||||
sta ptr1
|
; we don't support a high byte here! (ptr1+1 is
|
||||||
stx ptr1+1
|
; also unchanged in strlen then (important!))
|
||||||
ldx #0 ; low counter byte
|
; -> the original implementation also
|
||||||
stx tmp1 ; high counter byte
|
; ignored this case
|
||||||
ldy #$00
|
|
||||||
|
|
||||||
L1: lda (ptr1),y ; get next char from s1
|
sta tmp1 ; tmp1 = strlen of test chars
|
||||||
beq L6 ; jump if done
|
jsr popax ; get and save s1
|
||||||
sta tmp2 ; save char
|
sta ptr2 ; to ptr2
|
||||||
|
stx ptr2+1
|
||||||
|
ldx #0 ; low counter byte
|
||||||
|
stx tmp2 ; high counter byte
|
||||||
|
|
||||||
|
loadChar:
|
||||||
|
ldy #0
|
||||||
|
lda (ptr2),y ; get next char from s1
|
||||||
|
beq leave ; handly byte of s1
|
||||||
|
advance:
|
||||||
|
inc ptr2 ; advance string position to test
|
||||||
|
bne check
|
||||||
|
inc ptr2+1
|
||||||
|
dey ; correct next iny (faster/shorter than bne...)
|
||||||
|
|
||||||
|
checkNext:
|
||||||
iny
|
iny
|
||||||
bne L2
|
check: cpy tmp1 ; compare with length of test character string
|
||||||
inc ptr1+1
|
beq endOfTestChars
|
||||||
L2: sty tmp3 ; save index into s1
|
cmp (ptr1),y ; found matching char?
|
||||||
|
bne checkNext
|
||||||
|
|
||||||
ldy #0 ; get index into s2
|
leave: txa ; restore position of finding
|
||||||
L3: lda (ptr2),y ;
|
ldx tmp2 ; and return
|
||||||
beq L4 ; jump if done
|
|
||||||
cmp tmp2
|
|
||||||
beq L6
|
|
||||||
iny
|
|
||||||
bne L3
|
|
||||||
|
|
||||||
; The character was not found in s2. Increment the counter and start over
|
|
||||||
|
|
||||||
L4: ldy tmp3 ; reload index
|
|
||||||
inx
|
|
||||||
bne L1
|
|
||||||
inc tmp1
|
|
||||||
bne L1
|
|
||||||
|
|
||||||
; The character was found, or we reached the end of s1. Return count of
|
|
||||||
; characters
|
|
||||||
|
|
||||||
L6: txa ; get low counter byte
|
|
||||||
ldx tmp1 ; get high counter byte
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
endOfTestChars:
|
||||||
|
inx
|
||||||
|
bne loadChar
|
||||||
|
inc tmp2
|
||||||
|
bne loadChar ; like bra...
|
||||||
|
|
|
@ -53,11 +53,11 @@
|
||||||
size_t __fastcall__ strftime (char* buf, size_t bufsize, const char* format,
|
size_t __fastcall__ strftime (char* buf, size_t bufsize, const char* format,
|
||||||
const struct tm* tm)
|
const struct tm* tm)
|
||||||
{
|
{
|
||||||
static const char* days[7] = {
|
static const char* const days[7] = {
|
||||||
"Sunday", "Monday", "Tuesday", "Wednesday",
|
"Sunday", "Monday", "Tuesday", "Wednesday",
|
||||||
"Thursday", "Friday", "Saturday"
|
"Thursday", "Friday", "Saturday"
|
||||||
};
|
};
|
||||||
static const char* months[12] = {
|
static const char* const months[12] = {
|
||||||
"January", "February", "March", "April", "May", "June",
|
"January", "February", "March", "April", "May", "June",
|
||||||
"July", "August", "September", "October", "November", "December"
|
"July", "August", "September", "October", "November", "December"
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 31.05.1998
|
; Ullrich von Bassewitz, 31.05.1998
|
||||||
;
|
;
|
||||||
|
; Note: strspn & strcspn call internally this function and rely on
|
||||||
|
; the usage of only ptr1 here! Keep in mind when appling changes
|
||||||
|
; and check the other implementations too!
|
||||||
|
;
|
||||||
; int strlen (const char* s);
|
; int strlen (const char* s);
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -23,4 +27,3 @@ L1: lda (ptr1),y
|
||||||
|
|
||||||
L9: tya ; get low byte of counter, hi's all set
|
L9: tya ; get low byte of counter, hi's all set
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 31.05.1998
|
; Ullrich von Bassewitz, 31.05.1998
|
||||||
|
; Christian Krueger: 12-Aug-2013, minor optimizations
|
||||||
;
|
;
|
||||||
; char* strncat (char* dest, const char* src, size_t n);
|
; char* strncat (char* dest, const char* src, size_t n);
|
||||||
;
|
;
|
||||||
|
@ -7,66 +8,66 @@
|
||||||
.export _strncat
|
.export _strncat
|
||||||
.import popax
|
.import popax
|
||||||
.importzp ptr1, ptr2, ptr3, tmp1, tmp2
|
.importzp ptr1, ptr2, ptr3, tmp1, tmp2
|
||||||
|
.macpack cpu
|
||||||
|
|
||||||
_strncat:
|
_strncat:
|
||||||
eor #$FF ; one's complement to count upwards
|
eor #$FF ; one's complement to count upwards
|
||||||
sta tmp1
|
sta tmp1
|
||||||
txa
|
txa
|
||||||
eor #$FF
|
eor #$FF
|
||||||
sta tmp2
|
sta tmp2
|
||||||
jsr popax ; get src
|
|
||||||
sta ptr1
|
jsr popax ; get src
|
||||||
stx ptr1+1
|
sta ptr1
|
||||||
jsr popax ; get dest
|
stx ptr1+1
|
||||||
sta ptr2
|
|
||||||
stx ptr2+1
|
jsr popax ; get dest
|
||||||
sta ptr3 ; remember for function return
|
sta ptr3 ; remember for function return
|
||||||
stx ptr3+1
|
stx ptr3+1
|
||||||
ldy #0
|
stx ptr2+1
|
||||||
|
tay ; low byte as offset in Y
|
||||||
|
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||||
|
stz ptr2
|
||||||
|
.else
|
||||||
|
ldx #0
|
||||||
|
stx ptr2 ; destination on page boundary
|
||||||
|
.endif
|
||||||
|
|
||||||
; find end of dest
|
; find end of dest
|
||||||
|
|
||||||
L1: lda (ptr2),y
|
L1: lda (ptr2),y
|
||||||
beq L2
|
beq L2
|
||||||
iny
|
iny
|
||||||
bne L1
|
bne L1
|
||||||
inc ptr2+1
|
inc ptr2+1
|
||||||
bne L1
|
bne L1
|
||||||
|
|
||||||
; end found, get offset in y into pointer
|
; end found, apply offset to dest ptr and reset y
|
||||||
|
L2: sty ptr2
|
||||||
L2: tya
|
|
||||||
clc
|
|
||||||
adc ptr2
|
|
||||||
sta ptr2
|
|
||||||
bcc L3
|
|
||||||
inc ptr2+1
|
|
||||||
|
|
||||||
; copy src. We've put the ones complement of the count into the counter, so
|
; copy src. We've put the ones complement of the count into the counter, so
|
||||||
; we'll increment the counter on top of the loop
|
; we'll increment the counter on top of the loop
|
||||||
|
|
||||||
L3: ldy #0
|
L3: ldy #0
|
||||||
ldx tmp1 ; low counter byte
|
ldx tmp1 ; low counter byte
|
||||||
|
|
||||||
L4: inx
|
L4: inx
|
||||||
bne L5
|
bne L5
|
||||||
inc tmp2
|
inc tmp2
|
||||||
beq L6 ; jump if done
|
beq L6 ; jump if done
|
||||||
L5: lda (ptr1),y
|
L5: lda (ptr1),y
|
||||||
sta (ptr2),y
|
sta (ptr2),y
|
||||||
beq L7
|
beq L7
|
||||||
iny
|
iny
|
||||||
bne L4
|
bne L4
|
||||||
inc ptr1+1
|
inc ptr1+1
|
||||||
inc ptr2+1
|
inc ptr2+1
|
||||||
bne L4
|
bne L4
|
||||||
|
|
||||||
; done, set the trailing zero and return pointer to dest
|
; done, set the trailing zero and return pointer to dest
|
||||||
|
|
||||||
L6: lda #0
|
L6: lda #0
|
||||||
sta (ptr2),y
|
sta (ptr2),y
|
||||||
L7: lda ptr3
|
L7: lda ptr3
|
||||||
ldx ptr3+1
|
ldx ptr3+1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,47 +1,41 @@
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 31.05.1998
|
; Ullrich von Bassewitz, 31.05.1998
|
||||||
|
; Christian Krueger: 2013-Aug-01, optimization
|
||||||
;
|
;
|
||||||
; char* strrchr (const char* s, int c);
|
; char* strrchr (const char* s, int c);
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _strrchr
|
.export _strrchr
|
||||||
.import popax
|
.import popax
|
||||||
.importzp ptr1, ptr2, tmp1
|
.importzp ptr1, tmp1, tmp2
|
||||||
|
|
||||||
_strrchr:
|
_strrchr:
|
||||||
sta tmp1 ; Save c
|
sta tmp1 ; Save c
|
||||||
jsr popax ; get s
|
jsr popax ; get s
|
||||||
sta ptr1
|
tay ; low byte to y
|
||||||
stx ptr1+1
|
stx ptr1+1
|
||||||
lda #0 ; function result = NULL
|
ldx #0 ; default function result is NULL, X is high byte...
|
||||||
sta ptr2
|
stx tmp2 ; tmp2 is low-byte
|
||||||
sta ptr2+1
|
stx ptr1 ; low-byte of source string is in Y, so clear real one...
|
||||||
tay
|
|
||||||
|
testChar:
|
||||||
|
lda (ptr1),y ; get char
|
||||||
|
beq finished ; jump if end of string
|
||||||
|
cmp tmp1 ; found?
|
||||||
|
bne nextChar ; jump if no
|
||||||
|
|
||||||
L1: lda (ptr1),y ; get next char
|
charFound:
|
||||||
beq L3 ; jump if end of string
|
sty tmp2 ; y has low byte of location, save it
|
||||||
cmp tmp1 ; found?
|
ldx ptr1+1 ; x holds high-byte of result
|
||||||
bne L2 ; jump if no
|
|
||||||
|
|
||||||
; Remember a pointer to the character
|
nextChar:
|
||||||
|
iny
|
||||||
|
bne testChar
|
||||||
|
inc ptr1+1
|
||||||
|
bne testChar ; here like bra...
|
||||||
|
|
||||||
tya
|
; return the pointer to the last occurrence
|
||||||
clc
|
|
||||||
adc ptr1
|
|
||||||
sta ptr2
|
|
||||||
lda ptr1+1
|
|
||||||
adc #$00
|
|
||||||
sta ptr2+1
|
|
||||||
|
|
||||||
; Next char
|
finished:
|
||||||
|
lda tmp2 ; high byte in X is already correct...
|
||||||
L2: iny
|
|
||||||
bne L1
|
|
||||||
inc ptr1+1
|
|
||||||
bne L1 ; jump always
|
|
||||||
|
|
||||||
; Return the pointer to the last occurrence
|
|
||||||
|
|
||||||
L3: lda ptr2
|
|
||||||
ldx ptr2+1
|
|
||||||
rts
|
rts
|
||||||
|
|
|
@ -1,56 +1,53 @@
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 11.06.1998
|
; Ullrich von Bassewitz, 11.06.1998
|
||||||
|
; Christian Krueger: 08-Aug-2013, optimization
|
||||||
;
|
;
|
||||||
; size_t strspn (const char* s1, const char* s2);
|
; size_t strspn (const char* s1, const char* s2);
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _strspn
|
.export _strspn
|
||||||
.import popax
|
.import popax, _strlen
|
||||||
.importzp ptr1, ptr2, tmp1, tmp2, tmp3
|
.importzp ptr1, ptr2, tmp1, tmp2
|
||||||
|
|
||||||
_strspn:
|
_strspn:
|
||||||
sta ptr2 ; Save s2
|
jsr _strlen ; get length in a/x and transfer s2 to ptr1
|
||||||
stx ptr2+1
|
; Note: It does not make sense to
|
||||||
jsr popax ; get s1
|
; have more than 255 test chars, so
|
||||||
sta ptr1
|
; we don't support a high byte here! (ptr1+1 is
|
||||||
stx ptr1+1
|
; also unchanged in strlen then (important!))
|
||||||
ldx #0 ; low counter byte
|
; -> the original implementation also
|
||||||
stx tmp1 ; high counter byte
|
; ignored this case
|
||||||
ldy #$00
|
|
||||||
|
|
||||||
L1: lda (ptr1),y ; get next char from s1
|
sta tmp1 ; tmp1 = strlen of test chars
|
||||||
beq L6 ; jump if done
|
jsr popax ; get and save s1
|
||||||
sta tmp2 ; save char
|
sta ptr2 ; to ptr2
|
||||||
|
stx ptr2+1
|
||||||
|
ldx #0 ; low counter byte
|
||||||
|
stx tmp2 ; high counter byte
|
||||||
|
|
||||||
|
loadChar:
|
||||||
|
ldy #0
|
||||||
|
lda (ptr2),y ; get next char from s1
|
||||||
|
beq leave ; handly byte of s1
|
||||||
|
advance:
|
||||||
|
inc ptr2 ; advance string position to test
|
||||||
|
bne check
|
||||||
|
inc ptr2+1
|
||||||
|
dey ; correct next iny (faster/shorter than bne...)
|
||||||
|
|
||||||
|
checkNext:
|
||||||
iny
|
iny
|
||||||
bne L2
|
check: cpy tmp1 ; compare with length of test character string
|
||||||
inc ptr1+1
|
beq leave
|
||||||
L2: sty tmp3 ; save index into s1
|
cmp (ptr1),y ; found matching char?
|
||||||
|
bne checkNext
|
||||||
|
|
||||||
ldy #0 ; get index into s2
|
foundTestChar:
|
||||||
L3: lda (ptr2),y ;
|
|
||||||
beq L6 ; jump if done
|
|
||||||
cmp tmp2
|
|
||||||
beq L4
|
|
||||||
iny
|
|
||||||
bne L3
|
|
||||||
|
|
||||||
; The character was found in s2. Increment the counter and start over
|
|
||||||
|
|
||||||
L4: ldy tmp3 ; reload index
|
|
||||||
inx
|
inx
|
||||||
bne L1
|
bne loadChar
|
||||||
inc tmp1
|
inc tmp2
|
||||||
bne L1
|
bne loadChar ; like bra...
|
||||||
|
|
||||||
; The character was not found, or we reached the end of s1. Return count of
|
leave: txa ; restore position of finding
|
||||||
; characters
|
ldx tmp2 ; and return
|
||||||
|
|
||||||
L6: txa ; get low counter byte
|
|
||||||
ldx tmp1 ; get high counter byte
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 06.08.1998
|
; Ullrich von Bassewitz, 06.08.1998
|
||||||
;
|
;
|
||||||
; void cputsxy (unsigned char x, unsigned char y, char* s);
|
; void cputsxy (unsigned char x, unsigned char y, const char* s);
|
||||||
; void cputs (char* s);
|
; void cputs (const char* s);
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _cputsxy, _cputs
|
.export _cputsxy, _cputs
|
||||||
|
|
|
@ -18,7 +18,7 @@ _clrscr:
|
||||||
lda #$50 ; VRAM offset high ($10 OR $40)
|
lda #$50 ; VRAM offset high ($10 OR $40)
|
||||||
sta VDP_CONTROL_W
|
sta VDP_CONTROL_W
|
||||||
|
|
||||||
lda #$C0 ; Space from ROM setup
|
lda #$40 ; Space char from ROM setup
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
ldy #3
|
ldy #3
|
||||||
|
@ -34,8 +34,8 @@ L1: sta VDP_DATA_W
|
||||||
lda #0
|
lda #0
|
||||||
sta CURSOR_X
|
sta CURSOR_X
|
||||||
sta CURSOR_Y
|
sta CURSOR_Y
|
||||||
sta <SCREEN_PTR
|
sta SCREEN_PTR
|
||||||
lda #$10
|
lda #$10
|
||||||
sta >SCREEN_PTR
|
sta SCREEN_PTR+1
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
|
@ -96,8 +96,8 @@ BAD_CHAR:
|
||||||
jmp plot
|
jmp plot
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Initialize the conio subsystem. Code goes into the INIT segment, which may
|
; Initialize the conio subsystem. "INIT" segment is nothing special on the
|
||||||
; be reused after startup.
|
; Creativision, it is part of the "ROM" memory.
|
||||||
|
|
||||||
.segment "INIT"
|
.segment "INIT"
|
||||||
|
|
||||||
|
@ -122,4 +122,4 @@ LL: lda boxchars,x
|
||||||
bne LL
|
bne LL
|
||||||
|
|
||||||
cli
|
cli
|
||||||
jmp plot
|
jmp plot
|
||||||
|
|
|
@ -31,9 +31,6 @@ entry:
|
||||||
ldx #<__RAM_START__ - 1
|
ldx #<__RAM_START__ - 1
|
||||||
txs
|
txs
|
||||||
|
|
||||||
; Start interrupts
|
|
||||||
cli
|
|
||||||
|
|
||||||
; Clear the BSS data
|
; Clear the BSS data
|
||||||
jsr zerobss
|
jsr zerobss
|
||||||
|
|
||||||
|
@ -49,13 +46,21 @@ entry:
|
||||||
; Call module constructors
|
; Call module constructors
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
|
; enable vertical blank interrupts in the display controller
|
||||||
|
lda #$E0 ; 16K RAM, Active Display, Mode 1, VBI enabled
|
||||||
|
ldx #$01 ; Register 1
|
||||||
|
jsr BIOS_WRITE_VDP_REG
|
||||||
|
|
||||||
|
; Start interrupts
|
||||||
|
cli
|
||||||
|
|
||||||
; Call main()
|
; Call main()
|
||||||
jsr callmain
|
jsr callmain
|
||||||
|
|
||||||
; Call module destructors. This is also the _exit entry.
|
; Call module destructors. This is also the _exit entry.
|
||||||
_exit: jsr donelib
|
_exit: jsr donelib
|
||||||
|
|
||||||
; TODO: Replace with some sort of reset
|
; A Creativision program isn't supposed to exit.
|
||||||
loop: jmp loop
|
loop: jmp loop
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
|
@ -81,7 +86,7 @@ irq2: jmp BIOS_IRQ2_ADDR
|
||||||
; VDP Setup
|
; VDP Setup
|
||||||
; This sets to Graphics Mode 1
|
; This sets to Graphics Mode 1
|
||||||
.byte $00 ; Register 0
|
.byte $00 ; Register 0
|
||||||
.byte $C0 ; Register 1 16K RAM, Active Display, Mode 1
|
.byte $C0 ; Register 1 16K RAM, Active Display, Mode 1, VBI disabled
|
||||||
.byte $04 ; Register 2 Name Table at $1000 - $12FF
|
.byte $04 ; Register 2 Name Table at $1000 - $12FF
|
||||||
.byte $60 ; Register 3 Colour Table at $1800 - $181F
|
.byte $60 ; Register 3 Colour Table at $1800 - $181F
|
||||||
.byte $00 ; Register 4 Pattern Table at $0000 - $07FF
|
.byte $00 ; Register 4 Pattern Table at $0000 - $07FF
|
||||||
|
|
|
@ -1,15 +1,19 @@
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 06.08.1998
|
; 1998-08-06, Ullrich von Bassewitz
|
||||||
|
; 2017-06-15, Greg King
|
||||||
;
|
;
|
||||||
; void gotoxy (unsigned char x, unsigned char y);
|
; void gotoxy (unsigned char x, unsigned char y);
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _gotoxy
|
.export gotoxy, _gotoxy
|
||||||
|
|
||||||
.import setcursor
|
.import setcursor
|
||||||
.import popa
|
.import popa
|
||||||
|
|
||||||
.include "creativision.inc"
|
.include "creativision.inc"
|
||||||
|
|
||||||
|
gotoxy: jsr popa ; Get Y
|
||||||
|
|
||||||
.proc _gotoxy
|
.proc _gotoxy
|
||||||
|
|
||||||
sta CURSOR_Y ; Set Y
|
sta CURSOR_Y ; Set Y
|
||||||
|
|
|
@ -1,60 +1,56 @@
|
||||||
;
|
;
|
||||||
; Standard joystick driver for the Creativision.
|
; Standard joystick driver for the Creativision.
|
||||||
;
|
;
|
||||||
; Christian Groessler, 2017-02-06
|
; Christian Groessler, 2017-03-08
|
||||||
;
|
;
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
|
|
||||||
.include "joy-kernel.inc"
|
.include "joy-kernel.inc"
|
||||||
.include "joy-error.inc"
|
.include "joy-error.inc"
|
||||||
.include "creativision.inc"
|
.include "creativision.inc"
|
||||||
|
|
||||||
.macpack module
|
.macpack module
|
||||||
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Header. Includes jump table
|
; Header. Includes jump table
|
||||||
|
|
||||||
module_header _creativisionstd_joy
|
module_header _creativisionstd_joy
|
||||||
|
|
||||||
; Driver signature
|
; Driver signature
|
||||||
|
|
||||||
.byte $6A, $6F, $79 ; "joy"
|
.byte $6A, $6F, $79 ; "joy"
|
||||||
.byte JOY_API_VERSION ; Driver API version number
|
.byte JOY_API_VERSION ; Driver API version number
|
||||||
|
|
||||||
; Library reference
|
; Library reference
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
||||||
; Button state masks (8 values)
|
|
||||||
|
|
||||||
.byte $10 ; JOY_UP
|
|
||||||
.byte $04 ; JOY_DOWN
|
|
||||||
.byte $20 ; JOY_LEFT
|
|
||||||
.byte $08 ; JOY_RIGHT
|
|
||||||
.byte $01 ; JOY_FIRE (button #1)
|
|
||||||
.byte $02 ; JOY_FIRE2 (button #2)
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
.byte $00 ; Future expansion
|
|
||||||
|
|
||||||
; Jump table.
|
; Jump table.
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
.addr UNINSTALL
|
.addr UNINSTALL
|
||||||
.addr COUNT
|
.addr COUNT
|
||||||
.addr READJOY
|
.addr READJOY
|
||||||
.addr 0 ; IRQ entry not used
|
.addr 0 ; IRQ entry not used
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Constants
|
; Constants
|
||||||
|
|
||||||
JOY_COUNT = 2 ; Number of joysticks we support
|
JOY_COUNT = 2 ; Number of joysticks we support
|
||||||
|
|
||||||
|
; Symbolic names for joystick masks (similar names like the defines in joystick.h, but not related to them)
|
||||||
|
|
||||||
|
JOY_UP = $10
|
||||||
|
JOY_DOWN = $04
|
||||||
|
JOY_LEFT = $20
|
||||||
|
JOY_RIGHT = $08
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Code
|
; Code
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; INSTALL routine. Is called after the driver is loaded into memory. If
|
; INSTALL routine. Is called after the driver is loaded into memory. If
|
||||||
|
@ -63,131 +59,180 @@ JOY_COUNT = 2 ; Number of joysticks we support
|
||||||
; Must return an JOY_ERR_xx code in a/x.
|
; Must return an JOY_ERR_xx code in a/x.
|
||||||
;
|
;
|
||||||
|
|
||||||
INSTALL:
|
INSTALL: lda #JOY_ERR_OK
|
||||||
lda #JOY_ERR_OK
|
ldx #0
|
||||||
ldx #0
|
; rts ; Fall through
|
||||||
; rts ; Fall through
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||||
; Can do cleanup or whatever. Must not return anything.
|
; Can do cleanup or whatever. Must not return anything.
|
||||||
;
|
;
|
||||||
|
|
||||||
UNINSTALL:
|
UNINSTALL: rts
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; COUNT: Return the total number of available joysticks in a/x.
|
; COUNT: Return the total number of available joysticks in a/x.
|
||||||
;
|
;
|
||||||
|
|
||||||
COUNT:
|
COUNT: lda #<JOY_COUNT
|
||||||
lda #<JOY_COUNT
|
ldx #>JOY_COUNT
|
||||||
ldx #>JOY_COUNT
|
rts
|
||||||
rts
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; READ: Read a particular joystick passed in A.
|
; READ: Read a particular joystick passed in A.
|
||||||
;
|
;
|
||||||
|
|
||||||
READJOY:
|
READJOY: and #1 ; fix joystick number
|
||||||
and #1 ; fix joystick number
|
bne READJOY_1 ; read right joystick
|
||||||
bne READJOY_1 ; read right joystick
|
|
||||||
|
|
||||||
; Read left joystick
|
; Read left joystick
|
||||||
|
|
||||||
ldx ZP_JOY0_DIR
|
ldx ZP_JOY0_DIR
|
||||||
lda ZP_JOY0_BUTTONS
|
lda ZP_JOY0_BUTTONS
|
||||||
jmp convert ; convert joystick state to sane cc65 values
|
jmp convert ; convert joystick state to cc65 values
|
||||||
|
|
||||||
; Read right joystick
|
; Read right joystick
|
||||||
|
|
||||||
READJOY_1:
|
READJOY_1: ldx ZP_JOY1_DIR
|
||||||
|
lda ZP_JOY1_BUTTONS
|
||||||
ldx ZP_JOY1_DIR
|
lsr a
|
||||||
lda ZP_JOY1_BUTTONS
|
lsr a
|
||||||
lsr a
|
;jmp convert ; convert joystick state to cc65 values
|
||||||
lsr a
|
; fall thru...
|
||||||
;jmp convert ; convert joystick state to sane cc65 values
|
|
||||||
; fall thru...
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; convert: make runtime lib compatible values
|
; convert: make runtime lib compatible values
|
||||||
; A - buttons
|
; inputs:
|
||||||
; X - direction
|
; A - buttons
|
||||||
|
; X - direction
|
||||||
;
|
;
|
||||||
|
|
||||||
convert:
|
convert:
|
||||||
ldy #0
|
|
||||||
sty retval ; initialize return value
|
|
||||||
|
|
||||||
; ------
|
; ------
|
||||||
; buttons:
|
; buttons:
|
||||||
; Port values are for the left hand joystick (right hand joystick
|
; Port values are for the left hand joystick (right hand joystick
|
||||||
; values were shifted to the right to be identical).
|
; values were shifted to the right to be identical).
|
||||||
; Why are there two bits indicating a pressed trigger?
|
; Why are there two bits indicating a pressed trigger?
|
||||||
; According to the "Second book of programs for the Dick Smith Wizard"
|
; According to the "Second book of programs for the Dick Smith Wizard"
|
||||||
; (pg. 88ff), the left hand fire button gives the value of
|
; (pg. 88ff), the left hand button gives the value of
|
||||||
; %00010001 and the right hand button gives %00100010
|
; %00010001 and the right hand button gives %00100010
|
||||||
; Why two bits? Am I missing something? Can there be cases that just
|
; Why two bits? Can there be cases that just one of those bits is set?
|
||||||
; one of those bits is set?
|
; Until these questions have been answered, we only use the lower two
|
||||||
; We just test if any of those two bits is not zero...
|
; bits and ignore the upper ones...
|
||||||
|
|
||||||
tay
|
and #%00000011 ; button status came in in A, strip high bits
|
||||||
and #%00010001
|
sta retval ; initialize 'retval' with button status
|
||||||
beq cnv_1
|
|
||||||
|
|
||||||
inc retval ; left button pressed
|
|
||||||
|
|
||||||
cnv_1: tya
|
|
||||||
and #%00100010
|
|
||||||
beq cnv_2
|
|
||||||
|
|
||||||
lda #$02
|
|
||||||
ora retval
|
|
||||||
sta retval ; right button pressed
|
|
||||||
|
|
||||||
; ------
|
; ------
|
||||||
; direction:
|
; direction:
|
||||||
cnv_2: txa
|
; CV has a 16-direction joystick
|
||||||
; tested with https://sourceforge.net/projects/creativisionemulator
|
;
|
||||||
; $49 - %01001001 - up
|
; port values: (compass points)
|
||||||
; $41 - %01000001 - down
|
; N - $49 - %01001001
|
||||||
; $4D - %01001101 - left
|
; NNE - $48 - %01001000
|
||||||
; $45 - %01000101 - right
|
; NE - $47 - %01000111
|
||||||
;
|
; ENE - $46 - %01000110
|
||||||
; are these correct? "Second book of programs for the Dick Smith Wizard" pg. 85 says something different
|
; E - $45 - %01000101
|
||||||
; ignored for now...
|
; ESE - $44 - %01000100
|
||||||
; $85 - %10000101 - up + right
|
; SE - $43 - %01000011
|
||||||
; $8D - %10001101 - down + left
|
; SSE - $42 - %01000010
|
||||||
; $89 - %10001001 - up + left
|
; S - $41 - %01000001
|
||||||
; $85 - %10000101 - down + right (emulator bug?)
|
; SSW - $40 - %01000000
|
||||||
|
; SW - $4F - %01001111
|
||||||
|
; WSW - $4E - %01001110
|
||||||
|
; W - $4D - %01001101
|
||||||
|
; WNW - $4C - %01001100
|
||||||
|
; NW - $4B - %01001011
|
||||||
|
; NNW - $4A - %01001010
|
||||||
|
; center - $00 - %00000000
|
||||||
|
;
|
||||||
|
; mapping to cc65 definitions (4-direction joystick with 8 possible directions thru combinations)
|
||||||
|
; N, E, S, W -> JOY_UP, JOY_RIGHT, JOY_DOWN, JOY_LEFT
|
||||||
|
; NE, SE, SW, NW -> (JOY_UP | JOY_RIGHT), (JOY_DOWN | JOY_RIGHT), (JOY_DOWN | JOY_LEFT), (JOY_UP | JOY_LEFT)
|
||||||
|
; NNE, ENE, ESE, SSE, SSW, WSW, WNW, NNW:
|
||||||
|
; toggle between straight and diagonal direction for every call, e.g.
|
||||||
|
; NNE:
|
||||||
|
; call to READJOY: return JOY_UP | JOY_RIGHT
|
||||||
|
; call to READJOY: return JOY_UP
|
||||||
|
; call to READJOY: return JOY_UP | JOY_RIGHT
|
||||||
|
; call to READJOY: return JOY_UP
|
||||||
|
; call to READJOY: return JOY_UP | JOY_RIGHT
|
||||||
|
; etc...
|
||||||
|
|
||||||
bit testbit ; bit #0 set?
|
txa ; move direction status into A
|
||||||
beq done ; no, no direction
|
beq done ; center position (no bits are set), nothing to do
|
||||||
|
|
||||||
and #%00001100 ; mask out other bits
|
and #$0F ; get rid of the "$40" bit
|
||||||
lsr a
|
bit bit0 ; is it a "three letter" direction (NNE, ENE, etc.)?
|
||||||
lsr a
|
beq special ; yes (bit #0 is zero)
|
||||||
tax
|
|
||||||
lda #%00000100 ; init bitmask
|
|
||||||
loop: dex
|
|
||||||
bmi done2
|
|
||||||
asl a
|
|
||||||
bne loop
|
|
||||||
|
|
||||||
done2: ora retval
|
lsr a ; create index into table
|
||||||
rts
|
tax
|
||||||
|
lda dirtable,x
|
||||||
|
done: ora retval ; include "button" bits
|
||||||
|
ldx #0
|
||||||
|
rts
|
||||||
|
|
||||||
done: lda retval
|
; NNE, ENE, ESE, SSE, SSW, WSW, WNW, NNW
|
||||||
rts
|
|
||||||
|
special: lsr a
|
||||||
|
tax
|
||||||
|
|
||||||
|
lda toggler ; toggle the toggler
|
||||||
|
eor #$01
|
||||||
|
sta toggler
|
||||||
|
bne spec_1 ; toggler is 1, use spectable_1 entry
|
||||||
|
|
||||||
|
lda spectable_0,x ; toggler is 0, use spectable_0 entry
|
||||||
|
bne done ; jump always
|
||||||
|
|
||||||
|
spec_1: lda spectable_1,x
|
||||||
|
bne done ; jump always
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
.data
|
.rodata
|
||||||
testbit:.byte $01
|
|
||||||
|
; a mapping table of "port values" to "cc65 values"
|
||||||
|
; port value had been shifted one bit to the right (range 0..7)
|
||||||
|
dirtable: .byte JOY_DOWN ; S
|
||||||
|
.byte JOY_DOWN | JOY_RIGHT ; SE
|
||||||
|
.byte JOY_RIGHT ; E
|
||||||
|
.byte JOY_UP | JOY_RIGHT ; NE
|
||||||
|
.byte JOY_UP ; N
|
||||||
|
.byte JOY_UP | JOY_LEFT ; NW
|
||||||
|
.byte JOY_LEFT ; W
|
||||||
|
.byte JOY_DOWN | JOY_LEFT ; SW
|
||||||
|
|
||||||
|
; two "special" mapping tables for three-letter directions (NNE, etc.)
|
||||||
|
spectable_0: .byte JOY_DOWN ; SSW
|
||||||
|
.byte JOY_DOWN ; SSE
|
||||||
|
.byte JOY_RIGHT ; ESE
|
||||||
|
.byte JOY_RIGHT ; ENE
|
||||||
|
.byte JOY_RIGHT ; NNE
|
||||||
|
.byte JOY_UP ; NNW
|
||||||
|
.byte JOY_LEFT ; WNW
|
||||||
|
.byte JOY_LEFT ; WSW
|
||||||
|
|
||||||
|
spectable_1: .byte JOY_DOWN | JOY_LEFT ; SSW
|
||||||
|
.byte JOY_DOWN | JOY_RIGHT ; SSE
|
||||||
|
.byte JOY_DOWN | JOY_RIGHT ; ESE
|
||||||
|
.byte JOY_UP | JOY_RIGHT ; ENE
|
||||||
|
.byte JOY_UP | JOY_RIGHT ; NNE
|
||||||
|
.byte JOY_UP | JOY_LEFT ; NNW
|
||||||
|
.byte JOY_UP | JOY_LEFT ; WNW
|
||||||
|
.byte JOY_DOWN | JOY_LEFT ; WSW
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
.bss
|
bit0: .byte $01
|
||||||
retval: .res 0
|
|
||||||
|
; ------------------------------------------------------------------------
|
||||||
|
;
|
||||||
|
.bss
|
||||||
|
toggler: .res 1
|
||||||
|
retval: .res 1
|
||||||
|
|
||||||
|
.end
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
;
|
|
||||||
; Ullrich von Bassewitz, 2003-03-07
|
|
||||||
;
|
|
||||||
; Setup arguments for main
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
.constructor initmainargs, 24
|
|
||||||
.import __argc, __argv
|
|
||||||
|
|
||||||
|
|
||||||
;---------------------------------------------------------------------------
|
|
||||||
; Get possible command-line arguments. Goes into the special INIT segment,
|
|
||||||
; which may be reused after the startup code is run
|
|
||||||
|
|
||||||
.segment "INIT"
|
|
||||||
|
|
||||||
.proc initmainargs
|
|
||||||
|
|
||||||
rts
|
|
||||||
|
|
||||||
.endproc
|
|
|
@ -32,7 +32,7 @@ static char DumpHandler (void);
|
||||||
static char HelpHandler (void);
|
static char HelpHandler (void);
|
||||||
|
|
||||||
/* Forwards for other functions */
|
/* Forwards for other functions */
|
||||||
static void DisplayPrompt (char* s);
|
static void DisplayPrompt (const char* s);
|
||||||
static void SingleStep (char StepInto);
|
static void SingleStep (char StepInto);
|
||||||
static void RedrawStatic (char Frame);
|
static void RedrawStatic (char Frame);
|
||||||
static void Redraw (char Frame);
|
static void Redraw (char Frame);
|
||||||
|
@ -166,7 +166,7 @@ extern unsigned DbgHI; /* High 16 bit of primary reg */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned char x;
|
unsigned char x;
|
||||||
unsigned char y;
|
unsigned char y;
|
||||||
char* text;
|
const char* text;
|
||||||
} TextDesc;
|
} TextDesc;
|
||||||
|
|
||||||
/* Window descriptor */
|
/* Window descriptor */
|
||||||
|
@ -181,13 +181,13 @@ typedef struct {
|
||||||
unsigned char fd_visible; /* Is the window currently visible? */
|
unsigned char fd_visible; /* Is the window currently visible? */
|
||||||
char (*fd_func) (void); /* Handler function */
|
char (*fd_func) (void); /* Handler function */
|
||||||
unsigned char fd_textcount; /* Number of text lines to print */
|
unsigned char fd_textcount; /* Number of text lines to print */
|
||||||
TextDesc* fd_text; /* Static text in the window */
|
const TextDesc* fd_text; /* Static text in the window */
|
||||||
} FrameDesc;
|
} FrameDesc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Texts for the windows */
|
/* Texts for the windows */
|
||||||
static TextDesc RegText [] = {
|
static const TextDesc RegText [] = {
|
||||||
{ 1, 0, "PC" },
|
{ 1, 0, "PC" },
|
||||||
{ 1, 1, "SR" },
|
{ 1, 1, "SR" },
|
||||||
{ 1, 2, "A" },
|
{ 1, 2, "A" },
|
||||||
|
@ -197,7 +197,7 @@ static TextDesc RegText [] = {
|
||||||
{ 1, 6, "CS" },
|
{ 1, 6, "CS" },
|
||||||
{ 1, 7, "HI" }
|
{ 1, 7, "HI" }
|
||||||
};
|
};
|
||||||
static TextDesc HelpText [] = {
|
static const TextDesc HelpText [] = {
|
||||||
{ 1, 0, "F1, ? Help" },
|
{ 1, 0, "F1, ? Help" },
|
||||||
{ 1, 1, "F2, t Toggle breakpoint" },
|
{ 1, 1, "F2, t Toggle breakpoint" },
|
||||||
{ 1, 2, "F3, u Run until subroutine returns" },
|
{ 1, 2, "F3, u Run until subroutine returns" },
|
||||||
|
@ -220,7 +220,7 @@ static TextDesc HelpText [] = {
|
||||||
|
|
||||||
|
|
||||||
/* Window data */
|
/* Window data */
|
||||||
static FrameDesc AsmFrame = {
|
static const FrameDesc AsmFrame = {
|
||||||
CH_ULCORNER, CH_TTEE, CH_LTEE, CH_CROSS,
|
CH_ULCORNER, CH_TTEE, CH_LTEE, CH_CROSS,
|
||||||
0, 0, MAX_X - 10, 15,
|
0, 0, MAX_X - 10, 15,
|
||||||
MAX_X - 11, 14,
|
MAX_X - 11, 14,
|
||||||
|
@ -228,7 +228,7 @@ static FrameDesc AsmFrame = {
|
||||||
AsmHandler,
|
AsmHandler,
|
||||||
0, 0
|
0, 0
|
||||||
};
|
};
|
||||||
static FrameDesc RegFrame = {
|
static const FrameDesc RegFrame = {
|
||||||
CH_TTEE, CH_URCORNER, CH_LTEE, CH_RTEE,
|
CH_TTEE, CH_URCORNER, CH_LTEE, CH_RTEE,
|
||||||
MAX_X - 10, 0, MAX_X - 1, 9,
|
MAX_X - 10, 0, MAX_X - 1, 9,
|
||||||
8, 8,
|
8, 8,
|
||||||
|
@ -236,7 +236,7 @@ static FrameDesc RegFrame = {
|
||||||
RegHandler,
|
RegHandler,
|
||||||
sizeof (RegText) / sizeof (RegText [0]), RegText
|
sizeof (RegText) / sizeof (RegText [0]), RegText
|
||||||
};
|
};
|
||||||
static FrameDesc StackFrame = {
|
static const FrameDesc StackFrame = {
|
||||||
CH_LTEE, CH_RTEE, CH_CROSS, CH_RTEE,
|
CH_LTEE, CH_RTEE, CH_CROSS, CH_RTEE,
|
||||||
MAX_X - 10, 9, MAX_X - 1, 15,
|
MAX_X - 10, 9, MAX_X - 1, 15,
|
||||||
8, 5,
|
8, 5,
|
||||||
|
@ -244,7 +244,7 @@ static FrameDesc StackFrame = {
|
||||||
StackHandler,
|
StackHandler,
|
||||||
0, 0
|
0, 0
|
||||||
};
|
};
|
||||||
static FrameDesc CStackFrame = {
|
static const FrameDesc CStackFrame = {
|
||||||
CH_CROSS, CH_RTEE, CH_BTEE, CH_LRCORNER,
|
CH_CROSS, CH_RTEE, CH_BTEE, CH_LRCORNER,
|
||||||
MAX_X - 10, 15, MAX_X - 1, MAX_Y - 1,
|
MAX_X - 10, 15, MAX_X - 1, MAX_Y - 1,
|
||||||
8, MAX_Y - 17,
|
8, MAX_Y - 17,
|
||||||
|
@ -252,7 +252,7 @@ static FrameDesc CStackFrame = {
|
||||||
CStackHandler,
|
CStackHandler,
|
||||||
0, 0
|
0, 0
|
||||||
};
|
};
|
||||||
static FrameDesc DumpFrame = {
|
static const FrameDesc DumpFrame = {
|
||||||
CH_LTEE, CH_CROSS, CH_LLCORNER, CH_BTEE,
|
CH_LTEE, CH_CROSS, CH_LLCORNER, CH_BTEE,
|
||||||
0, 15, MAX_X - 10, MAX_Y-1,
|
0, 15, MAX_X - 10, MAX_Y-1,
|
||||||
MAX_X - 11, MAX_Y - 17,
|
MAX_X - 11, MAX_Y - 17,
|
||||||
|
@ -260,7 +260,7 @@ static FrameDesc DumpFrame = {
|
||||||
DumpHandler,
|
DumpHandler,
|
||||||
0, 0
|
0, 0
|
||||||
};
|
};
|
||||||
static FrameDesc HelpFrame = {
|
static const FrameDesc HelpFrame = {
|
||||||
CH_ULCORNER, CH_URCORNER, CH_LLCORNER, CH_LRCORNER,
|
CH_ULCORNER, CH_URCORNER, CH_LLCORNER, CH_LRCORNER,
|
||||||
0, 0, MAX_X - 1, MAX_Y-1,
|
0, 0, MAX_X - 1, MAX_Y-1,
|
||||||
MAX_X - 2, MAX_Y - 2,
|
MAX_X - 2, MAX_Y - 2,
|
||||||
|
@ -268,7 +268,7 @@ static FrameDesc HelpFrame = {
|
||||||
HelpHandler,
|
HelpHandler,
|
||||||
sizeof (HelpText) / sizeof (HelpText [0]), HelpText
|
sizeof (HelpText) / sizeof (HelpText [0]), HelpText
|
||||||
};
|
};
|
||||||
static FrameDesc* Frames [] = {
|
static const FrameDesc* const Frames [] = {
|
||||||
&AsmFrame,
|
&AsmFrame,
|
||||||
&RegFrame,
|
&RegFrame,
|
||||||
&StackFrame,
|
&StackFrame,
|
||||||
|
@ -297,7 +297,7 @@ static unsigned char StackAddr; /* Start address of output */
|
||||||
|
|
||||||
|
|
||||||
/* Prompt line data */
|
/* Prompt line data */
|
||||||
static char* ActivePrompt = 0; /* Last prompt line displayed */
|
static const char* ActivePrompt = 0; /* Last prompt line displayed */
|
||||||
static char PromptColor; /* Color behind prompt */
|
static char PromptColor; /* Color behind prompt */
|
||||||
static char PromptLength; /* Length of current prompt string */
|
static char PromptLength; /* Length of current prompt string */
|
||||||
|
|
||||||
|
@ -346,10 +346,10 @@ BreakPoint* DbgIsBreak (unsigned Addr);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void DrawFrame (register FrameDesc* F, char Active)
|
static void DrawFrame (register const FrameDesc* F, char Active)
|
||||||
/* Draw one window frame */
|
/* Draw one window frame */
|
||||||
{
|
{
|
||||||
TextDesc* T;
|
const TextDesc* T;
|
||||||
unsigned char Count;
|
unsigned char Count;
|
||||||
unsigned char tl, tr, bl, br;
|
unsigned char tl, tr, bl, br;
|
||||||
unsigned char x1, y1, width;
|
unsigned char x1, y1, width;
|
||||||
|
@ -410,7 +410,7 @@ static void DrawFrames (void)
|
||||||
/* Draw all frames */
|
/* Draw all frames */
|
||||||
{
|
{
|
||||||
unsigned char I;
|
unsigned char I;
|
||||||
FrameDesc* F;
|
const FrameDesc* F;
|
||||||
|
|
||||||
/* Build the frame layout of the screen */
|
/* Build the frame layout of the screen */
|
||||||
for (I = 0; I < sizeof (Frames) / sizeof (Frames [0]); ++I) {
|
for (I = 0; I < sizeof (Frames) / sizeof (Frames [0]); ++I) {
|
||||||
|
@ -427,7 +427,7 @@ static void ActivateFrame (int Num, unsigned char Clear)
|
||||||
/* Activate a new frame, deactivate the old one */
|
/* Activate a new frame, deactivate the old one */
|
||||||
{
|
{
|
||||||
unsigned char y;
|
unsigned char y;
|
||||||
register FrameDesc* F;
|
register const FrameDesc* F;
|
||||||
|
|
||||||
if (ActiveFrame != Num) {
|
if (ActiveFrame != Num) {
|
||||||
|
|
||||||
|
@ -462,7 +462,7 @@ static void ActivateFrame (int Num, unsigned char Clear)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void DisplayPrompt (char* s)
|
static void DisplayPrompt (const char* s)
|
||||||
/* Display a prompt */
|
/* Display a prompt */
|
||||||
{
|
{
|
||||||
unsigned char OldColor;
|
unsigned char OldColor;
|
||||||
|
@ -626,11 +626,11 @@ static char InputHex (char* Prompt, unsigned* Val)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void ErrorPrompt (char* Msg)
|
static void ErrorPrompt (const char* Msg)
|
||||||
/* Display an error message and wait for a key */
|
/* Display an error message and wait for a key */
|
||||||
{
|
{
|
||||||
/* Save the current prompt */
|
/* Save the current prompt */
|
||||||
char* OldPrompt = ActivePrompt;
|
const char* OldPrompt = ActivePrompt;
|
||||||
|
|
||||||
/* Display the new one */
|
/* Display the new one */
|
||||||
DisplayPrompt (Msg);
|
DisplayPrompt (Msg);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
.include "extzp.inc"
|
.include "extzp.inc"
|
||||||
|
|
||||||
gotoxy:
|
gotoxy:
|
||||||
jsr popa ; Get X
|
jsr popa ; Get Y
|
||||||
|
|
||||||
_gotoxy:
|
_gotoxy:
|
||||||
sta CURS_Y ; Set Y
|
sta CURS_Y ; Set Y
|
||||||
|
@ -20,6 +20,4 @@ _gotoxy:
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
; force the init constructor to be imported
|
; force the init constructor to be imported
|
||||||
|
|
||||||
.import initconio
|
.forceimport initconio
|
||||||
conio_init = initconio
|
|
||||||
|
|
||||||
|
|
|
@ -24,17 +24,6 @@
|
||||||
|
|
||||||
.addr $0000
|
.addr $0000
|
||||||
|
|
||||||
; Button state masks (8 values)
|
|
||||||
|
|
||||||
.byte $01 ; JOY_UP
|
|
||||||
.byte $02 ; JOY_DOWN
|
|
||||||
.byte $04 ; JOY_LEFT
|
|
||||||
.byte $08 ; JOY_RIGHT
|
|
||||||
.byte $10 ; JOY_FIRE_A
|
|
||||||
.byte $20 ; JOY_FIRE_B
|
|
||||||
.byte $80 ; JOY_SELECT
|
|
||||||
.byte $40 ; JOY_START
|
|
||||||
|
|
||||||
; Jump table.
|
; Jump table.
|
||||||
|
|
||||||
.addr INSTALL
|
.addr INSTALL
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue