mirror of
https://github.com/cc65/cc65.git
synced 2025-08-08 06:25:17 +00:00
atarixl target: add support for interruptors, adapt TGI drivers
This commit is contained in:
@@ -1003,15 +1003,20 @@ CASETV = $E440 ;cassette handler vector table
|
|||||||
DISKIV = $E450 ;vector to initialize DIO
|
DISKIV = $E450 ;vector to initialize DIO
|
||||||
DSKINV = $E453 ;vector to DIO
|
DSKINV = $E453 ;vector to DIO
|
||||||
.if .defined(__ATARIXL__)
|
.if .defined(__ATARIXL__)
|
||||||
CIOV = $C0
|
.ifndef SHRAM_HANDLERS
|
||||||
SIOV = $C3
|
.import CIO_handler, SIO_handler, SETVBV_handler
|
||||||
|
.endif
|
||||||
|
.define CIOV CIO_handler
|
||||||
|
.define SIOV SIO_handler
|
||||||
|
.define SETVBV SETVBV_handler
|
||||||
CIOV_org = $E456 ;vector to CIO
|
CIOV_org = $E456 ;vector to CIO
|
||||||
SIOV_org = $E459 ;vector to SIO
|
SIOV_org = $E459 ;vector to SIO
|
||||||
|
SETVBV_org = $E45C ;vector to set VBLANK parameters
|
||||||
.else
|
.else
|
||||||
CIOV = $E456 ;vector to CIO
|
CIOV = $E456 ;vector to CIO
|
||||||
SIOV = $E459 ;vector to SIO
|
SIOV = $E459 ;vector to SIO
|
||||||
.endif
|
|
||||||
SETVBV = $E45C ;vector to set VBLANK parameters
|
SETVBV = $E45C ;vector to set VBLANK parameters
|
||||||
|
.endif
|
||||||
SYSVBV = $E45F ;vector to process immediate VBLANK
|
SYSVBV = $E45F ;vector to process immediate VBLANK
|
||||||
XITVBV = $E462 ;vector to process deferred VBLANK
|
XITVBV = $E462 ;vector to process deferred VBLANK
|
||||||
SIOINV = $E465 ;vector to initialize SIO
|
SIOINV = $E465 ;vector to initialize SIO
|
||||||
|
@@ -39,7 +39,19 @@ doneirq:
|
|||||||
|
|
||||||
IRQStub:
|
IRQStub:
|
||||||
cld ; Just to be sure
|
cld ; Just to be sure
|
||||||
|
.if .defined(__ATARIXL__)
|
||||||
|
pha
|
||||||
|
lda PORTB
|
||||||
|
pha
|
||||||
|
and #$fe
|
||||||
|
sta PORTB ; disable ROM @@@ TODO: update CHARGEN
|
||||||
|
.endif
|
||||||
jsr callirq ; Call the functions
|
jsr callirq ; Call the functions
|
||||||
|
.if .defined(__ATARIXL__)
|
||||||
|
pla
|
||||||
|
sta PORTB
|
||||||
|
pla
|
||||||
|
.endif
|
||||||
jmp IRQInd ; Jump to the saved IRQ vector
|
jmp IRQInd ; Jump to the saved IRQ vector
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
|
@@ -7,4 +7,9 @@
|
|||||||
|
|
||||||
em_libref := _exit
|
em_libref := _exit
|
||||||
joy_libref := _exit
|
joy_libref := _exit
|
||||||
|
.if .defined(__ATARIXL__)
|
||||||
|
.import CIO_handler
|
||||||
|
tgi_libref := CIO_handler
|
||||||
|
.else
|
||||||
tgi_libref := _exit
|
tgi_libref := _exit
|
||||||
|
.endif
|
||||||
|
@@ -8,6 +8,7 @@ DEBUG = 1
|
|||||||
|
|
||||||
.if .defined(__ATARIXL__)
|
.if .defined(__ATARIXL__)
|
||||||
|
|
||||||
|
SHRAM_HANDLERS = 1
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
.include "save_area.inc"
|
.include "save_area.inc"
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
@@ -15,8 +16,12 @@ DEBUG = 1
|
|||||||
|
|
||||||
.export sram_init
|
.export sram_init
|
||||||
.export KEYBDV_wrapper
|
.export KEYBDV_wrapper
|
||||||
|
.export CIO_handler
|
||||||
|
.export SIO_handler
|
||||||
|
.export SETVBV_handler
|
||||||
|
|
||||||
BUFSZ = 256 ; bounce buffer size
|
BUFSZ = 128 ; bounce buffer size
|
||||||
|
BUFSZ_SIO = 256
|
||||||
|
|
||||||
.macro disable_rom
|
.macro disable_rom
|
||||||
lda PORTB
|
lda PORTB
|
||||||
@@ -65,20 +70,6 @@ sram_init:
|
|||||||
lda #>my_NMI_han
|
lda #>my_NMI_han
|
||||||
sta $fffb
|
sta $fffb
|
||||||
|
|
||||||
; setup pointers to CIOV and SIOV wrappers
|
|
||||||
lda #$4C ; JMP opcode
|
|
||||||
sta CIOV
|
|
||||||
lda #<my_CIOV
|
|
||||||
sta CIOV+1
|
|
||||||
lda #>my_CIOV
|
|
||||||
sta CIOV+2
|
|
||||||
lda #$4C ; JMP opcode
|
|
||||||
sta SIOV
|
|
||||||
lda #<my_SIOV
|
|
||||||
sta SIOV+1
|
|
||||||
lda #>my_SIOV
|
|
||||||
sta SIOV+2
|
|
||||||
|
|
||||||
; enable interrupts
|
; enable interrupts
|
||||||
lda #$40
|
lda #$40
|
||||||
sta NMIEN
|
sta NMIEN
|
||||||
@@ -94,7 +85,7 @@ zpptr1: .res 2
|
|||||||
.segment "LOWBUFS"
|
.segment "LOWBUFS"
|
||||||
|
|
||||||
; bounce buffers for CIO and SIO calls
|
; bounce buffers for CIO and SIO calls
|
||||||
bounce_buffer: .res BUFSZ
|
bounce_buffer: .res BUFSZ_SIO
|
||||||
|
|
||||||
|
|
||||||
.segment "LOWCODE"
|
.segment "LOWCODE"
|
||||||
@@ -240,7 +231,7 @@ CIOV_call:
|
|||||||
;
|
;
|
||||||
; FIXME: Currently only the requests used by the runtime lib are handled.
|
; FIXME: Currently only the requests used by the runtime lib are handled.
|
||||||
|
|
||||||
my_CIOV:
|
CIO_handler:
|
||||||
|
|
||||||
; @@@ TODO: check X for valid IOCB index ((X < $80) and ((X & $F) == 0))
|
; @@@ TODO: check X for valid IOCB index ((X < $80) and ((X & $F) == 0))
|
||||||
|
|
||||||
@@ -707,7 +698,7 @@ setup_zpptr1:
|
|||||||
; These are the only functions used by the runtime library currently.
|
; These are the only functions used by the runtime library currently.
|
||||||
; For other function we return NVALID status code.
|
; For other function we return NVALID status code.
|
||||||
|
|
||||||
my_SIOV:
|
SIO_handler:
|
||||||
lda DCOMND ; get command
|
lda DCOMND ; get command
|
||||||
cmp #SIO_STAT
|
cmp #SIO_STAT
|
||||||
beq SIO_stat
|
beq SIO_stat
|
||||||
@@ -839,9 +830,9 @@ sio_write_copy:
|
|||||||
; CF - 0/1 for larger/not larger
|
; CF - 0/1 for larger/not larger
|
||||||
cmp_sio_len_bnc_bufsz:
|
cmp_sio_len_bnc_bufsz:
|
||||||
sec
|
sec
|
||||||
lda #<BUFSZ
|
lda #<BUFSZ_SIO
|
||||||
sbc DBYTLO
|
sbc DBYTLO
|
||||||
lda #>BUFSZ
|
lda #>BUFSZ_SIO
|
||||||
sbc DBYTHI
|
sbc DBYTHI
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@@ -888,6 +879,24 @@ kret: pha
|
|||||||
pla
|
pla
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
;---------------------------------------------------------
|
||||||
|
|
||||||
|
SETVBV_handler:
|
||||||
|
|
||||||
|
pha
|
||||||
|
lda PORTB
|
||||||
|
sta cur_SETVBV_PORTB
|
||||||
|
enable_rom
|
||||||
|
pla
|
||||||
|
jsr SETVBV_org
|
||||||
|
php
|
||||||
|
pha
|
||||||
|
lda cur_SETVBV_PORTB
|
||||||
|
sta PORTB
|
||||||
|
pla
|
||||||
|
plp
|
||||||
|
rts
|
||||||
|
|
||||||
CIO_a: .res 1
|
CIO_a: .res 1
|
||||||
CIO_x: .res 1
|
CIO_x: .res 1
|
||||||
CIO_y: .res 1
|
CIO_y: .res 1
|
||||||
@@ -895,6 +904,7 @@ CIO_p: .res 1
|
|||||||
cur_CIOV_PORTB: .res 1
|
cur_CIOV_PORTB: .res 1
|
||||||
cur_SIOV_PORTB: .res 1
|
cur_SIOV_PORTB: .res 1
|
||||||
cur_KEYBDV_PORTB: .res 1
|
cur_KEYBDV_PORTB: .res 1
|
||||||
|
cur_SETVBV_PORTB: .res 1
|
||||||
orig_ptr: .res 2
|
orig_ptr: .res 2
|
||||||
orig_len: .res 2
|
orig_len: .res 2
|
||||||
req_len: .res 2
|
req_len: .res 2
|
||||||
|
@@ -97,13 +97,20 @@ sramprep:
|
|||||||
|
|
||||||
ldx lowadr
|
ldx lowadr
|
||||||
stx MEMTOP
|
stx MEMTOP
|
||||||
stx APPMHI
|
|
||||||
lda lowadr+1
|
lda lowadr+1
|
||||||
sta MEMTOP+1
|
sta MEMTOP+1
|
||||||
sta APPMHI+1
|
|
||||||
lda lodadr+1
|
lda lodadr+1
|
||||||
sta RAMTOP
|
sta RAMTOP
|
||||||
|
|
||||||
|
; set APPMHI to MEMLO (+ 1 for sanity)
|
||||||
|
lda MEMLO
|
||||||
|
clc
|
||||||
|
adc #1
|
||||||
|
sta APPMHI
|
||||||
|
lda MEMLO+1
|
||||||
|
adc #0
|
||||||
|
sta APPMHI+1
|
||||||
|
|
||||||
|
|
||||||
; ... issue a GRAPHICS 0 call (copied'n'pasted from TGI drivers)
|
; ... issue a GRAPHICS 0 call (copied'n'pasted from TGI drivers)
|
||||||
|
|
||||||
|
@@ -4,6 +4,12 @@
|
|||||||
|
|
||||||
.macpack longbranch
|
.macpack longbranch
|
||||||
|
|
||||||
|
.if .defined(__ATARIXL__)
|
||||||
|
CIO_vec := my_CIOV
|
||||||
|
.else
|
||||||
|
CIO_vec := CIOV
|
||||||
|
.endif
|
||||||
|
|
||||||
; ******************************************************************************
|
; ******************************************************************************
|
||||||
|
|
||||||
; ----------------------------------------------------------------------
|
; ----------------------------------------------------------------------
|
||||||
@@ -18,7 +24,7 @@
|
|||||||
|
|
||||||
.byte $74, $67, $69 ; "tgi"
|
.byte $74, $67, $69 ; "tgi"
|
||||||
.byte TGI_API_VERSION ; TGI API version number
|
.byte TGI_API_VERSION ; TGI API version number
|
||||||
.addr $0000 ; Library reference
|
libref: .addr $0000 ; Library reference
|
||||||
.word x_res ; X resolution
|
.word x_res ; X resolution
|
||||||
.word y_res ; Y resolution
|
.word y_res ; Y resolution
|
||||||
.byte colors ; Number of drawing colors
|
.byte colors ; Number of drawing colors
|
||||||
@@ -111,6 +117,10 @@
|
|||||||
text_dir:
|
text_dir:
|
||||||
.byte 0 ; Text direction,
|
.byte 0 ; Text direction,
|
||||||
|
|
||||||
|
.if .defined(__ATARIXL__)
|
||||||
|
my_CIOV:
|
||||||
|
.byte $4C, 0, 0
|
||||||
|
.endif
|
||||||
.code
|
.code
|
||||||
|
|
||||||
; ******************************************************************************
|
; ******************************************************************************
|
||||||
@@ -161,6 +171,17 @@ screen_device_length := * - screen_device
|
|||||||
|
|
||||||
stx mask
|
stx mask
|
||||||
|
|
||||||
|
.if .defined(__ATARIXL__)
|
||||||
|
|
||||||
|
; setup pointer to CIO
|
||||||
|
|
||||||
|
lda libref
|
||||||
|
sta my_CIOV+1
|
||||||
|
lda libref+1
|
||||||
|
sta my_CIOV+2
|
||||||
|
.endif
|
||||||
|
|
||||||
|
|
||||||
; Find a free IOCB
|
; Find a free IOCB
|
||||||
lda #$70
|
lda #$70
|
||||||
search: tax
|
search: tax
|
||||||
@@ -202,7 +223,7 @@ switch: lda #OPEN
|
|||||||
sta ICBLL,x
|
sta ICBLL,x
|
||||||
lda #>screen_device_length
|
lda #>screen_device_length
|
||||||
sta ICBLH,x
|
sta ICBLH,x
|
||||||
jsr CIOV
|
jsr CIO_vec
|
||||||
|
|
||||||
.if ::pages = 2
|
.if ::pages = 2
|
||||||
; Reserve 8K of high memory
|
; Reserve 8K of high memory
|
||||||
@@ -212,7 +233,7 @@ switch: lda #OPEN
|
|||||||
; Close and reopen graphics
|
; Close and reopen graphics
|
||||||
lda #CLOSE
|
lda #CLOSE
|
||||||
sta ICCOM,x
|
sta ICCOM,x
|
||||||
jsr CIOV
|
jsr CIO_vec
|
||||||
; Reopen graphics
|
; Reopen graphics
|
||||||
lda #OPEN
|
lda #OPEN
|
||||||
sta ICCOM,x
|
sta ICCOM,x
|
||||||
@@ -228,7 +249,7 @@ switch: lda #OPEN
|
|||||||
sta ICBLL,x
|
sta ICBLL,x
|
||||||
lda #>screen_device_length
|
lda #>screen_device_length
|
||||||
sta ICBLH,x
|
sta ICBLH,x
|
||||||
jsr CIOV
|
jsr CIO_vec
|
||||||
; Save screen pointers
|
; Save screen pointers
|
||||||
lda SAVMSC + 1
|
lda SAVMSC + 1
|
||||||
sta p0scr
|
sta p0scr
|
||||||
@@ -271,7 +292,7 @@ exit: sta error
|
|||||||
; Close the S: device
|
; Close the S: device
|
||||||
lda #CLOSE
|
lda #CLOSE
|
||||||
sta ICCOM,x
|
sta ICCOM,x
|
||||||
jsr CIOV
|
jsr CIO_vec
|
||||||
|
|
||||||
; Reopen it in Graphics 0
|
; Reopen it in Graphics 0
|
||||||
lda #OPEN
|
lda #OPEN
|
||||||
@@ -288,12 +309,12 @@ exit: sta error
|
|||||||
sta ICBLL,x
|
sta ICBLL,x
|
||||||
lda #>screen_device_length
|
lda #>screen_device_length
|
||||||
sta ICBLH,x
|
sta ICBLH,x
|
||||||
jsr CIOV
|
jsr CIO_vec
|
||||||
|
|
||||||
; Now close it again; we don't need it anymore :)
|
; Now close it again; we don't need it anymore :)
|
||||||
lda #CLOSE
|
lda #CLOSE
|
||||||
sta ICCOM,x
|
sta ICCOM,x
|
||||||
jmp CIOV
|
jmp CIO_vec
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
; ******************************************************************************
|
; ******************************************************************************
|
||||||
@@ -640,7 +661,7 @@ done10:
|
|||||||
.endif
|
.endif
|
||||||
|
|
||||||
sta ATACHR
|
sta ATACHR
|
||||||
jmp CIOV
|
jmp CIO_vec
|
||||||
|
|
||||||
.else ; USE_CIO_LINE
|
.else ; USE_CIO_LINE
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user