Moved common symbol names out of sources, and into a global include file.

This commit is contained in:
Greg King
2013-07-16 00:30:56 -04:00
parent c9c66dcfdd
commit 641a609cf3
6 changed files with 105 additions and 92 deletions

View File

@@ -1,32 +1,81 @@
; ;
; Oric atmos zeropage and ROM definitions ; Oric Atmos definitions
; BASIC 1.1 addresses
; ;
; ---------------------------------------------------------------------------
; Constants
FNAME_LEN = 16 ; maximum length of file-name
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
; Zero page ; Zero page
BASIC_BUF := $35
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
; Low memory ; Low memory
CAPSLOCK := $20C CAPSLOCK := $20C
PATTERN := $213
IRQVec := $245 IRQVec := $245
CURS_Y := $268 CURS_Y := $268
CURS_X := $269 CURS_X := $269
STATUS := $26A STATUS := $26A
TIMER3 := $276 TIMER3 := $276
CFOUND_NAME := $293
KEYBUF := $2DF KEYBUF := $2DF
PARAM1 := $2E1 ; & $2E2
PARAM2 := $2E3 ; & $2E4
PARAM3 := $2E5 ; & $2E6
; ---------------------------------------------------------------------------
; 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
; 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 ; ROM entries
TEXT := $EC21
HIRES := $EC33
CURSET := $F0C8
CURMOV := $F0FD
DRAW := $F110
CHAR := $F12D
POINT := $F1C8
PAPER := $F204
INK := $F210
PRINT := $F77C PRINT := $F77C
; ---------------------------------------------------------------------------
; I/O
SCREEN := $BB80

View File

@@ -1,14 +1,15 @@
; ;
; P.A.S.E. joystick driver for the Atmos ; P.A.S.E. joystick driver for the Atmos
; May be used multiple times when linked to the statically application. ; Can be used multiple times when statically linked to the application.
; ;
; Stefan Haubenthal, 2009-12-21 ; 2002-12-20, Based on Ullrich von Bassewitz's code.
; Based on Ullrich von Bassewitz, 2002-12-20 ; 2009-12-21, Stefan Haubenthal
; 2013-07-15, Greg King
; ;
.include "joy-kernel.inc" .include "joy-kernel.inc"
.include "joy-error.inc" .include "joy-error.inc"
; .include "atmos.inc" .include "atmos.inc"
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
@@ -49,10 +50,6 @@
JOY_COUNT = 2 ; Number of joysticks we support JOY_COUNT = 2 ; Number of joysticks we support
PRA = $0301
DDRA = $0303
PRA2 = $030F
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Data. ; Data.
@@ -99,24 +96,24 @@ COUNT:
READ: READ:
tay tay
lda PRA lda VIA::PRA
pha pha
lda DDRA lda VIA::DDRA
pha pha
lda #%11000000 lda #%11000000
sta DDRA sta VIA::DDRA
lda #%10000000 lda #%10000000
sta PRA2 sta VIA::PRA2
lda PRA2 lda VIA::PRA2
sta temp1 sta temp1
lda #%01000000 lda #%01000000
sta PRA2 sta VIA::PRA2
lda PRA lda VIA::PRA
sta temp2 sta temp2
pla pla
sta DDRA sta VIA::DDRA
pla pla
sta PRA2 sta VIA::PRA2
ldx #0 ldx #0
tya tya

View File

@@ -1,19 +1,19 @@
; ;
; Ullrich von Bassewitz, 2003-03-07 ; 2003-03-07, Ullrich von Bassewitz
; Stefan Haubenthal, 2011-01-28 ; 2011-01-28, Stefan Haubenthal
; 2013-07-15, Greg King
; ;
; Setup arguments for main ; Setup arguments for main
; ;
.constructor initmainargs, 24 .constructor initmainargs, 24
.import __argc, __argv .import __argc, __argv
.include "atmos.inc"
.macpack generic .macpack generic
MAXARGS = 10 ; Maximum number of arguments allowed MAXARGS = 10 ; Maximum number of arguments allowed
REM = $9d ; BASIC token-code REM = $9d ; BASIC token-code
NAME_LEN = 16 ; maximum length of command-name
BASIC_BUF = $35
FNAM = $293
;--------------------------------------------------------------------------- ;---------------------------------------------------------------------------
@@ -29,8 +29,8 @@ FNAM = $293
; Because the buffer, that we're copying into, was zeroed out, ; Because the buffer, that we're copying into, was zeroed out,
; we don't need to add a NUL character. ; we don't need to add a NUL character.
; ;
ldy #NAME_LEN - 1 ; limit the length ldy #FNAME_LEN - 1 ; limit the length
L0: lda FNAM,y L0: lda CFOUND_NAME,y
sta name,y sta name,y
dey dey
bpl L0 bpl L0
@@ -114,7 +114,7 @@ done: lda #<argv
; ;
.bss .bss
term: .res 1 term: .res 1
name: .res NAME_LEN + 1 name: .res FNAME_LEN + 1
.data .data
argv: .addr name argv: .addr name

View File

@@ -2,7 +2,8 @@
; Serial driver for the Telestrat integrated serial controller and the ; Serial driver for the Telestrat integrated serial controller and the
; Atmos with a serial add-on. ; Atmos with a serial add-on.
; ;
; Stefan Haubenthal, 2012-03-05 ; 2012-03-05, Stefan Haubenthal
; 2013-07-15, Greg King
; ;
; The driver is based on the cc65 rs232 module, which in turn is based on ; The driver is based on the cc65 rs232 module, which in turn is based on
; Craig Bruce device driver for the Switftlink/Turbo-232. ; Craig Bruce device driver for the Switftlink/Turbo-232.
@@ -25,6 +26,7 @@
.include "zeropage.inc" .include "zeropage.inc"
.include "ser-kernel.inc" .include "ser-kernel.inc"
.include "ser-error.inc" .include "ser-error.inc"
.include "atmos.inc"
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Header. Includes jump table ; Header. Includes jump table
@@ -45,19 +47,10 @@
.addr CLOSE .addr CLOSE
.addr GET .addr GET
.addr PUT .addr PUT
.addr STATUS .addr SER_STATUS
.addr IOCTL .addr IOCTL
.addr IRQ .addr IRQ
;----------------------------------------------------------------------------
; I/O definitions
ACIA = $031C
ACIA_DATA = ACIA+0 ; Data register
ACIA_STATUS = ACIA+1 ; Status register
ACIA_CMD = ACIA+2 ; Command register
ACIA_CTRL = ACIA+3 ; Control register
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; Global variables ; Global variables
@@ -142,7 +135,7 @@ CLOSE:
; Deactivate DTR and disable 6551 interrupts ; Deactivate DTR and disable 6551 interrupts
lda #%00001010 lda #%00001010
sta ACIA_CMD,x sta ACIA::CMD,x
; Done, return an error code ; Done, return an error code
: lda #<SER_ERR_OK : lda #<SER_ERR_OK
@@ -194,10 +187,10 @@ OPEN:
lda StopTable,y lda StopTable,y
ora tmp1 ora tmp1
ora #%00010000 ; Receiver clock source = baudrate ora #%00010000 ; Receiver clock source = baudrate
sta ACIA_CTRL sta ACIA::CTRL
; Set the value for the command register. We remember the base value ; Set the value for the command register. We remember the base value
; in RtsOff, since we will have to manipulate ACIA_CMD often. ; in RtsOff, since we will have to manipulate ACIA::CMD often.
ldy #SER_PARAMS::PARITY ; Parity ldy #SER_PARAMS::PARITY ; Parity
lda (ptr1),y lda (ptr1),y
tay tay
@@ -205,7 +198,7 @@ OPEN:
ora #%00000001 ; DTR active ora #%00000001 ; DTR active
sta RtsOff sta RtsOff
ora #%00001000 ; Enable receive interrupts ora #%00001000 ; Enable receive interrupts
sta ACIA_CMD sta ACIA::CMD
; Done ; Done
stx Index ; Mark port as open stx Index ; Mark port as open
@@ -252,7 +245,7 @@ GET:
sta Stopped sta Stopped
lda RtsOff lda RtsOff
ora #%00001000 ora #%00001000
sta ACIA_CMD sta ACIA::CMD
; Get byte from buffer ; Get byte from buffer
: ldy RecvHead ; (41) : ldy RecvHead ; (41)
@@ -296,11 +289,11 @@ PUT:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; STATUS: Return the status in the variable pointed to by ptr1. ; SER_STATUS: Return the status in the variable pointed to by ptr1.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
STATUS: SER_STATUS:
lda ACIA_STATUS lda ACIA::STATUS
ldx #$00 ldx #$00
sta (ptr1,x) sta (ptr1,x)
txa ; SER_ERR_OK txa ; SER_ERR_OK
@@ -325,10 +318,10 @@ IOCTL:
IRQ: IRQ:
ldx Index ; Check for open port ldx Index ; Check for open port
beq Done beq Done
lda ACIA_STATUS,x ; Check ACIA status for receive interrupt lda ACIA::STATUS,x ; Check ACIA status for receive interrupt
and #$08 and #$08
beq Done ; Jump if no ACIA interrupt beq Done ; Jump if no ACIA interrupt
lda ACIA_DATA,x ; Get byte from ACIA lda ACIA::DATA,x ; Get byte from ACIA
ldy RecvFreeCnt ; Check if we have free space left ldy RecvFreeCnt ; Check if we have free space left
beq Flow ; Jump if no space in receive buffer beq Flow ; Jump if no space in receive buffer
ldy RecvTail ; Load buffer pointer ldy RecvTail ; Load buffer pointer
@@ -342,7 +335,7 @@ IRQ:
; Assert flow control if buffer space too low ; Assert flow control if buffer space too low
Flow: lda RtsOff Flow: lda RtsOff
sta ACIA_CMD,x sta ACIA::CMD,x
sta Stopped sta Stopped
sec ; Interrupt handled sec ; Interrupt handled
Done: rts Done: rts
@@ -361,7 +354,7 @@ Again: lda SendFreeCnt
bne Quit ; Bail out bne Quit ; Bail out
; Check that ACIA is ready to send ; Check that ACIA is ready to send
lda ACIA_STATUS lda ACIA::STATUS
and #$10 and #$10
bne Send bne Send
bit tmp1 ; Keep trying if must try hard bit tmp1 ; Keep trying if must try hard
@@ -371,7 +364,7 @@ Quit: rts
; Send byte and try again ; Send byte and try again
Send: ldy SendHead Send: ldy SendHead
lda SendBuf,y lda SendBuf,y
sta ACIA_DATA sta ACIA::DATA
inc SendHead inc SendHead
inc SendFreeCnt inc SendFreeCnt
jmp Again jmp Again

View File

@@ -2,7 +2,7 @@
; Graphics driver for the 228x200x3 palette mode on the Atmos ; Graphics driver for the 228x200x3 palette mode on the Atmos
; ;
; Stefan Haubenthal <polluks@sdf.lonestar.org> ; Stefan Haubenthal <polluks@sdf.lonestar.org>
; 2012-08-11, Greg King <greg.king5@verizon.net> ; 2013-07-15, Greg King <gregdk@users.sf.net>
; ;
.include "zeropage.inc" .include "zeropage.inc"
@@ -79,21 +79,7 @@ ERROR: .res 1 ; Error code
MODE: .res 1 ; Graphics mode MODE: .res 1 ; Graphics mode
PALETTE: .res 2 PALETTE: .res 2
; Constants and table ; Constant table
; BASIC 1.1 addresses
PATTERN := $213
PARAM1 := $2E1 ; & $2E2
PARAM2 := $2E3 ; & $2E4
PARAM3 := $2E5 ; & $2E6
TEXT := $EC21
HIRES := $EC33
CURSET := $F0C8
CURMOV := $F0FD
DRAW := $F110
CHAR := $F12D
POINT := $F1C8
PAPER := $F204
INK := $F210
.rodata .rodata

View File

@@ -2,7 +2,7 @@
; Graphics driver for the 240x200x2 monochrome mode on the Atmos ; Graphics driver for the 240x200x2 monochrome mode on the Atmos
; ;
; Stefan Haubenthal <polluks@sdf.lonestar.org> ; Stefan Haubenthal <polluks@sdf.lonestar.org>
; 2012-08-11, Greg King <greg.king5@verizon.net> ; 2013-07-15, Greg King <gregdk@users.sf.net>
; ;
.include "zeropage.inc" .include "zeropage.inc"
@@ -66,10 +66,10 @@ YSIZE = 8 ; System font height
; Variables mapped to the zero page segment variables. Some of these are ; Variables mapped to the zero page segment variables. Some of these are
; used for passing parameters to the driver. ; used for passing parameters to the driver.
X1 = ptr1 X1 := ptr1
Y1 = ptr2 Y1 := ptr2
X2 = ptr3 X2 := ptr3
Y2 = ptr4 Y2 := ptr4
; Absolute variables used in the code ; Absolute variables used in the code
@@ -78,19 +78,7 @@ Y2 = ptr4
ERROR: .res 1 ; Error code ERROR: .res 1 ; Error code
MODE: .res 1 ; Graphics mode MODE: .res 1 ; Graphics mode
; Constants and tables ; Constant table
PARAM1 = $2E1
PARAM2 = $2E3
PARAM3 = $2E5
TEXT = $EC21
HIRES = $EC33
CURSET = $F0C8
CURMOV = $F0FD
DRAW = $F110
CHAR = $F12D
POINT = $F1C8
PAPER = $F204
INK = $F210
.rodata .rodata
@@ -152,7 +140,7 @@ INIT:
; Must set an error code: NO ; Must set an error code: NO
; ;
DONE = TEXT DONE := TEXT
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; GETERROR: Return the error code in A and clear it. ; GETERROR: Return the error code in A and clear it.
@@ -181,7 +169,7 @@ CONTROL:
; Must set an error code: NO ; Must set an error code: NO
; ;
CLEAR = HIRES CLEAR := HIRES
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n). ; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n).