Merge branch 'master' into kbrepeat

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

48
asminc/apple2.mac Normal file
View File

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

View File

@@ -106,7 +106,7 @@ SIO_WRPERCOM = $4F ;write PERCOM block (XF551)
SIO_WRITE = $50 ;write sector
SIO_READ = $52 ;read sector
SIO_STAT = $53 ;get status information
SIO_VERIFY = $56 ;verify sector
SIO_VERIFY = $56 ;verify sector
SIO_WRITEV = $57 ;write sector with verify
SIO_WRITETRK = $60 ;write track (Speedy)
SIO_READTRK = $62 ;read track (Speedy)
@@ -183,6 +183,7 @@ FNTFND = 170 ;($AA) file not found
PNTINV = 171 ;($AB) point invalid
BADDSK = 173 ;($AD) bad disk
INCFMT = 176 ;($B0) DOS 3: incompatible file system
XNTBIN = 180 ;($B4) XDOS: file not binary
; DCB Device Bus Equates
@@ -689,7 +690,7 @@ CASFLG = $030F ;CASSETTE MODE WHEN SET
TIMER2 = $0310 ;2-byte final baud rate timer value
TEMP1 = $0312 ;TEMPORARY STORAGE REGISTER
;TEMP2 = $0314 ;##old## TEMPORARY STORAGE REGISTER
TEMP2 = $0313 ;##1200xl## 1-byte temporary
TEMP2 = $0313 ;##1200xl## 1-byte temporary
PTIMOT = $0314 ;##1200xl## 1-byte printer timeout
TEMP3 = $0315 ;TEMPORARY STORAGE REGISTER
SAVIO = $0316 ;SAVE SERIAL IN DATA PORT
@@ -765,7 +766,7 @@ CART = $BFFC ;##rev2## 1-byte cartridge present indicator
;0=Cart Exists
CARTFG = $BFFD ;##rev2## 1-byte cartridge flags
;D7 0=Not a Diagnostic Cart
; 1=Is a Diagnostic cart and control is
; 1=Is a Diagnostic cart and control is
; given to cart before any OS is init.
;D2 0=Init but Do not Start Cart
; 1=Init and Start Cart
@@ -889,6 +890,10 @@ SETVBV_org = $E45C ;vector to set VBLANK parameters
CIOV = $E456 ;vector to CIO
SIOV = $E459 ;vector to SIO
SETVBV = $E45C ;vector to set VBLANK parameters
; aliases in order not to have to sprinkle common code with .ifdefs
CIOV_org = CIOV
SIOV_org = SIOV
SETVBV_org = SETVBV
.endif
SYSVBV = $E45F ;vector to process immediate VBLANK
XITVBV = $E462 ;vector to process deferred VBLANK
@@ -925,7 +930,7 @@ RADON = 0 ;INDICATES RADIANS
DEGON = 6 ;INDICATES DEGREES
ASCZER = '0' ;ASCII ZERO
COLON = $3A ;ASCII COLON
COLON = $3A ;ASCII COLON
CR = $9B ;SYSTEM EOL (CARRIAGE RETURN)
;-------------------------------------------------------------------------
@@ -997,12 +1002,38 @@ diopp_size = 5 ; size of structure
; VALUES for dos_type
;-------------------------------------------------------------------------
ATARIDOS = 0
SPARTADOS = 1
OSADOS = 2 ; OS/A+
MYDOS = 3
XDOS = 4
SPARTADOS = 0
OSADOS = 1 ; OS/A+
XDOS = 2
ATARIDOS = 3
MYDOS = 4
NODOS = 255
; The DOSes with dos_type below or equal MAX_DOS_WITH_CMDLINE do support
; command line arguments.
MAX_DOS_WITH_CMDLINE = XDOS
;-------------------------------------------------------------------------
; XDOS defines (version 2.4, taken from xdos24.pdf)
;-------------------------------------------------------------------------
XOPT = $070B ; XDOS options
XCAR = $070C ; XDOS cartridge address (+ $70D)
XPAT = $086F ; XDOS bugfix and patch number
XVER = $0870 ; XDOS version number
XFILE = $087D ; XDOS filename buffer
XLINE = $0880 ; XDOS DUP input line
XGLIN = $0871 ; get line
XSKIP = $0874 ; skip parameter
.ifdef __ATARIXL__
.ifndef SHRAM_HANDLERS
.import XMOVE_handler
.endif
.define XMOVE XMOVE_handler
XMOVE_org = $0877 ; move filename
.else
XMOVE = $0877 ; move filename
.endif
XGNUM = $087A ; get number
;-------------------------------------------------------------------------
; End of atari.inc

7
asminc/atari2600.inc Normal file
View File

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

20
asminc/atari2600_riot.inc Normal file
View File

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

69
asminc/atari2600_tia.inc Normal file
View File

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

View File

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

View File

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

View File

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

61
asminc/creativision.inc Normal file
View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,245 +1,267 @@
; smc.mac
; ca65 Macro-Pack for Self Modifying Code (SMC)
;
; (c) Christian Kr<EFBFBD>ger, latest change: 09-Nov-2011
;
; 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.
;
.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 SMC_AbsAdr $FADE
.define SMC_ZpAdr $00
.define SMC_Opcode nop
.define SMC_Value $42
.macro SMC_OperateOnValue opcode, label
opcode _SMCDesignator+1
.endmacro
.macro SMC_OperateOnLowByte opcode, label
SMC_OperateOnValue opcode, label
.endmacro
.macro SMC_OperateOnHighByte opcode, label
opcode _SMCDesignator + 2
.endmacro
.macro SMC_Import alias
.import _SMCAlias
.endmacro
.macro SMC_Export alias, label
.export _SMCAlias := _SMCDesignator
.endmacro
.macro SMC label, statement
_SMCDesignator: statement
.endmacro
.macro SMC_TransferOpcode label, opcode, register
.if .paramcount = 2 .or .match ({register}, a)
lda #opcode
sta _SMCDesignator
.elseif .match ({register}, x)
ldx #opcode
stx _SMCDesignator
.elseif .match ({register}, y)
ldy #opcode
sty _SMCDesignator
.endif
.endmacro
.macro SMC_LoadOpcode label, register
.if .paramcount = 1 .or .match ({register}, a)
lda _SMCDesignator
.elseif .match ({register}, x)
ldx _SMCDesignator
.elseif .match ({register}, y)
ldy _SMCDesignator
.endif
.endmacro
.macro SMC_StoreOpcode label, register
.if .paramcount = 1 .or .match ({register}, a)
sta _SMCDesignator
.elseif .match ({register}, x)
stx _SMCDesignator
.elseif .match ({register}, y)
sty _SMCDesignator
.endif
.endmacro
.macro SMC_ChangeBranch label, destination, register
.if .paramcount = 2 .or .match ({register}, a)
lda #(destination - _SMCDesignator -2)
sta _SMCDesignator+1
.elseif .match ({register}, x)
ldx #(destination - _SMCDesignator - 2)
stx _SMCDesignator+1
.elseif .match ({register}, y)
ldy #(destination - _SMCDesignator - 2)
sty _SMCDesignator+1
.endif
.endmacro
.macro SMC_TransferValue label, value, register
.if .paramcount = 2 .or .match ({register}, a)
lda value
sta _SMCDesignator+1
.elseif .match ({register}, x)
ldx value
stx _SMCDesignator+1
.elseif .match ({register}, y)
ldy value
sty _SMCDesignator+1
.endif
.endmacro
.macro SMC_LoadValue label, register
.if .paramcount = 1 .or .match ({register}, a)
lda _SMCDesignator+1
.elseif .match ({register}, x)
ldx _SMCDesignator+1
.elseif .match ({register}, y)
ldy _SMCDesignator+1
.endif
.endmacro
.macro SMC_StoreValue label, register
.if .paramcount = 1 .or .match ({register}, a)
sta _SMCDesignator+1
.elseif .match ({register}, x)
stx _SMCDesignator+1
.elseif .match ({register}, y)
sty _SMCDesignator+1
.endif
.endmacro
.macro SMC_TransferLowByte label, value, register
SMC_TransferValue label, value, register
.endmacro
.macro SMC_LoadLowByte label, register
SMC_LoadValue label, register
.endmacro
.macro SMC_StoreLowByte label, register
SMC_StoreValue label, register
.endmacro
.macro SMC_TransferHighByte label, value, register
.if .paramcount = 2 .or .match ({register}, a)
lda value
sta _SMCDesignator+2
.elseif .match ({register}, x)
ldx value
stx _SMCDesignator+2
.elseif .match ({register}, y)
ldy value
sty _SMCDesignator+2
.endif
.endmacro
.macro SMC_LoadHighByte label, register
.if .paramcount = 1 .or .match ({register}, a)
lda _SMCDesignator+2
.elseif .match ({register}, x)
ldx _SMCDesignator+2
.elseif .match ({register}, y)
ldy _SMCDesignator+2
.endif
.endmacro
.macro SMC_StoreHighByte label, register
.if .paramcount = 1 .or .match ({register}, a)
sta _SMCDesignator+2
.elseif .match ({register}, x)
stx _SMCDesignator+2
.elseif .match ({register}, y)
sty _SMCDesignator+2
.endif
.endmacro
.macro SMC_TransferAddressSingle label, address, register
.if .paramcount = 2 .or .match ((register), a)
.if (.match (.left (1, {address}), #))
; immediate mode
lda #<(.right (.tcount ({address})-1, {address}))
sta _SMCDesignator+1
lda #>(.right (.tcount ({address})-1, {address}))
sta _SMCDesignator+2
.else
; assume absolute or zero page
lda address
sta _SMCDesignator+1
lda 1+(address)
sta _SMCDesignator+2
.endif
.elseif .match ((register), x)
.if (.match (.left (1, {address}), #))
; immediate mode
ldx #<(.right (.tcount ({address})-1, {address}))
stx _SMCDesignator+1
ldx #>(.right (.tcount ({address})-1, {address}))
stx _SMCDesignator+2
.else
; assume absolute or zero page
ldx address
stx _SMCDesignator+1
ldx 1+(address)
stx _SMCDesignator+2
.endif
.elseif .match ((register), y)
.if (.match (.left (1, {address}), #))
; immediate mode
ldy #<(.right (.tcount ({address})-1, {address}))
sty _SMCDesignator+1
ldy #>(.right (.tcount ({address})-1, {address}))
sty _SMCDesignator+2
.else
; assume absolute or zero page
ldy address
sty _SMCDesignator+1
ldy 1+(address)
sty _SMCDesignator+2
.endif
.endif
.endmacro
.macro SMC_TransferAddress label, address
.if (.match (.left (1, {address}), #))
; immediate mode
lda #<(.right (.tcount ({address})-1, {address}))
sta _SMCDesignator+1
ldx #>(.right (.tcount ({address})-1, {address}))
stx _SMCDesignator+2
.else
; assume absolute or zero page
lda {address}
sta _SMCDesignator+1
ldx 1+{address}
stx _SMCDesignator)+2
.endif
.endmacro
.macro SMC_StoreAddress label
sta _SMCDesignator+1
stx _SMCDesignator+2
.endmacro
; smc.mac
; ca65 Macro-Pack for Self Modifying Code (SMC)
;
; (c) Christian Krüger, latest change: 17-Jul-2016
;
; 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.
;
.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 SMC_AbsAdr $FADE
.define SMC_ZpAdr $00
.define SMC_Opcode nop
.define SMC_Value $42
.macro SMC_OperateOnValue opcode, label
opcode _SMCDesignator+1
.endmacro
.macro SMC_OperateOnLowByte opcode, label
SMC_OperateOnValue opcode, label
.endmacro
.macro SMC_OperateOnHighByte opcode, label
opcode _SMCDesignator + 2
.endmacro
.macro SMC_Import alias
.import _SMCAlias
.endmacro
.macro SMC_Export alias, label
.export _SMCAlias := _SMCDesignator
.endmacro
.macro SMC label, statement
_SMCDesignator: statement
.endmacro
.macro SMC_TransferOpcode label, opcode, register
.if .paramcount = 2 .or .match ({register}, a) .or .match ({register}, )
lda #opcode
sta _SMCDesignator
.elseif .match ({register}, x)
ldx #opcode
stx _SMCDesignator
.elseif .match ({register}, y)
ldy #opcode
sty _SMCDesignator
.else
.error "Invalid usage of macro 'SMC_TransferOpcode'"
.endif
.endmacro
.macro SMC_LoadOpcode label, register
.if .paramcount = 1 .or .match ({register}, a) .or .match ({register}, )
lda _SMCDesignator
.elseif .match ({register}, x)
ldx _SMCDesignator
.elseif .match ({register}, y)
ldy _SMCDesignator
.else
.error "Invalid usage of macro 'SMC_LoadOpcode'"
.endif
.endmacro
.macro SMC_StoreOpcode label, register
.if .paramcount = 1 .or .match ({register}, a) .or .match ({register}, )
sta _SMCDesignator
.elseif .match ({register}, x)
stx _SMCDesignator
.elseif .match ({register}, y)
sty _SMCDesignator
.else
.error "Invalid usage of macro 'SMC_StoreOpcode'"
.endif
.endmacro
.macro SMC_ChangeBranch label, destination, register
.if .paramcount = 2 .or .match ({register}, a) .or .match ({register}, )
lda #(<(destination - _SMCDesignator -2))
sta _SMCDesignator+1
.elseif .match ({register}, x)
ldx #(<(destination - _SMCDesignator - 2))
stx _SMCDesignator+1
.elseif .match ({register}, y)
ldy #(<(destination - _SMCDesignator - 2))
sty _SMCDesignator+1
.else
.error "Invalid usage of macro 'SMC_ChangeBranch'"
.endif
.endmacro
.macro SMC_TransferValue label, value, register
.if .paramcount = 2 .or .match ({register}, a) .or .match ({register}, )
lda value
sta _SMCDesignator+1
.elseif .match ({register}, x)
ldx value
stx _SMCDesignator+1
.elseif .match ({register}, y)
ldy value
sty _SMCDesignator+1
.else
.error "Invalid usage of macro 'SMC_TransferValue'"
.endif
.endmacro
.macro SMC_LoadValue label, register
.if .paramcount = 1 .or .match ({register}, a) .or .match ({register}, )
lda _SMCDesignator+1
.elseif .match ({register}, x)
ldx _SMCDesignator+1
.elseif .match ({register}, y)
ldy _SMCDesignator+1
.else
.error "Invalid usage of macro 'SMC_LoadValue'"
.endif
.endmacro
.macro SMC_StoreValue label, register
.if .paramcount = 1 .or .match ({register}, a) .or .match ({register}, )
sta _SMCDesignator+1
.elseif .match ({register}, x)
stx _SMCDesignator+1
.elseif .match ({register}, y)
sty _SMCDesignator+1
.else
.error "Invalid usage of macro 'SMC_StoreValue'"
.endif
.endmacro
.macro SMC_TransferLowByte label, value, register
SMC_TransferValue label, value, register
.endmacro
.macro SMC_LoadLowByte label, register
SMC_LoadValue label, register
.endmacro
.macro SMC_StoreLowByte label, register
SMC_StoreValue label, register
.endmacro
.macro SMC_TransferHighByte label, value, register
.if .paramcount = 2 .or .match ({register}, a) .or .match ({register}, )
lda value
sta _SMCDesignator+2
.elseif .match ({register}, x)
ldx value
stx _SMCDesignator+2
.elseif .match ({register}, y)
ldy value
sty _SMCDesignator+2
.else
.error "Invalid usage of macro 'SMC_TransferHighByte'"
.endif
.endmacro
.macro SMC_LoadHighByte label, register
.if .paramcount = 1 .or .match ({register}, a) .or .match ({register}, )
lda _SMCDesignator+2
.elseif .match ({register}, x)
ldx _SMCDesignator+2
.elseif .match ({register}, y)
ldy _SMCDesignator+2
.else
.error "Invalid usage of macro 'SMC_LoadHighByte'"
.endif
.endmacro
.macro SMC_StoreHighByte label, register
.if .paramcount = 1 .or .match ({register}, a) .or .match ({register}, )
sta _SMCDesignator+2
.elseif .match ({register}, x)
stx _SMCDesignator+2
.elseif .match ({register}, y)
sty _SMCDesignator+2
.else
.error "Invalid usage of macro 'SMC_StoreHighByte'"
.endif
.endmacro
.macro SMC_TransferAddressSingle label, address, register
.if .paramcount = 2 .or .match ((register), a) .or .match ({register}, )
.if (.match (.left (1, {address}), #))
; immediate mode
lda #<(.right (.tcount ({address})-1, {address}))
sta _SMCDesignator+1
lda #>(.right (.tcount ({address})-1, {address}))
sta _SMCDesignator+2
.else
; assume absolute or zero page
lda address
sta _SMCDesignator+1
lda 1+(address)
sta _SMCDesignator+2
.endif
.elseif .match ((register), x)
.if (.match (.left (1, {address}), #))
; immediate mode
ldx #<(.right (.tcount ({address})-1, {address}))
stx _SMCDesignator+1
ldx #>(.right (.tcount ({address})-1, {address}))
stx _SMCDesignator+2
.else
; assume absolute or zero page
ldx address
stx _SMCDesignator+1
ldx 1+(address)
stx _SMCDesignator+2
.endif
.elseif .match ((register), y)
.if (.match (.left (1, {address}), #))
; immediate mode
ldy #<(.right (.tcount ({address})-1, {address}))
sty _SMCDesignator+1
ldy #>(.right (.tcount ({address})-1, {address}))
sty _SMCDesignator+2
.else
; assume absolute or zero page
ldy address
sty _SMCDesignator+1
ldy 1+(address)
sty _SMCDesignator+2
.endif
.else
.error "Invalid usage of macro 'SMC_TransferAddressSingle'"
.endif
.endmacro
.macro SMC_TransferAddress label, address
.if (.match (.left (1, {address}), #))
; immediate mode
lda #<(.right (.tcount ({address})-1, {address}))
sta _SMCDesignator+1
ldx #>(.right (.tcount ({address})-1, {address}))
stx _SMCDesignator+2
.else
; assume absolute or zero page
lda {address}
sta _SMCDesignator+1
ldx 1+{address}
stx _SMCDesignator)+2
.endif
.endmacro
.macro SMC_StoreAddress label
sta _SMCDesignator+1
stx _SMCDesignator+2
.endmacro

View File

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

156
asminc/telestrat.inc Normal file
View File

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