mirror of
https://github.com/cc65/cc65.git
synced 2024-10-12 00:23:53 +00:00
some more changes -- atarixl target basically works now
This commit is contained in:
parent
9228b002b0
commit
8e632b2847
@ -13,8 +13,12 @@
|
|||||||
|
|
||||||
.import initlib, donelib
|
.import initlib, donelib
|
||||||
.import callmain, zerobss
|
.import callmain, zerobss
|
||||||
.import __STARTUP_LOAD__, __ZPSAVE_LOAD__
|
.import __STARTUP_LOAD__, __ZPSAVE_LOAD__, __BSS_LOAD__
|
||||||
.import __RESERVED_MEMORY__
|
.import __RESERVED_MEMORY__
|
||||||
|
.import __RAM_START__, __RAM_SIZE__
|
||||||
|
.import zpsave
|
||||||
|
.import sram_init
|
||||||
|
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
@ -32,7 +36,11 @@
|
|||||||
.endif
|
.endif
|
||||||
|
|
||||||
.word __STARTUP_LOAD__
|
.word __STARTUP_LOAD__
|
||||||
|
.if .defined(__ATARIXL__)
|
||||||
|
.word __BSS_LOAD__ - 1
|
||||||
|
.else
|
||||||
.word __ZPSAVE_LOAD__ - 1
|
.word __ZPSAVE_LOAD__ - 1
|
||||||
|
.endif
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Actual code
|
; Actual code
|
||||||
@ -46,6 +54,8 @@
|
|||||||
|
|
||||||
; Real entry point:
|
; Real entry point:
|
||||||
|
|
||||||
|
.if .not .defined(__ATARIXL__) ; already done in previous load chunk
|
||||||
|
|
||||||
; Save the zero page locations we need
|
; Save the zero page locations we need
|
||||||
|
|
||||||
ldx #zpspace-1
|
ldx #zpspace-1
|
||||||
@ -54,6 +64,12 @@ L1: lda sp,x
|
|||||||
dex
|
dex
|
||||||
bpl L1
|
bpl L1
|
||||||
|
|
||||||
|
.else
|
||||||
|
|
||||||
|
jsr sram_init
|
||||||
|
|
||||||
|
.endif
|
||||||
|
|
||||||
; Clear the BSS data
|
; Clear the BSS data
|
||||||
|
|
||||||
jsr zerobss
|
jsr zerobss
|
||||||
@ -84,16 +100,17 @@ L1: lda sp,x
|
|||||||
|
|
||||||
.else
|
.else
|
||||||
|
|
||||||
; for now... needs to use value from linker script later
|
lda #<(__RAM_START__ + __RAM_SIZE__ - 1)
|
||||||
lda MEMTOP
|
|
||||||
sta sp
|
sta sp
|
||||||
lda MEMTOP+1
|
lda #>(__RAM_START__ + __RAM_SIZE__ - 1)
|
||||||
sta sp+1
|
sta sp+1
|
||||||
|
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
; Call module constructors
|
; Call module constructors
|
||||||
|
|
||||||
|
; brk
|
||||||
|
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
; Set left margin to 0
|
; Set left margin to 0
|
||||||
@ -184,12 +201,6 @@ L2: lda zpsave,x
|
|||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
|
|
||||||
.segment "ZPSAVE"
|
|
||||||
|
|
||||||
zpsave: .res zpspace
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
|
|
||||||
spsave: .res 1
|
spsave: .res 1
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
;
|
;
|
||||||
; Tasks:
|
; Tasks:
|
||||||
; - move screen memory below load address
|
; - move screen memory below load address
|
||||||
|
; - copy ROM chargen to its new place
|
||||||
; - copy shadow RAM contents to their destination
|
; - copy shadow RAM contents to their destination
|
||||||
;
|
;
|
||||||
; Christian Groessler, chris@groessler.org, 2013
|
; Christian Groessler, chris@groessler.org, 2013
|
||||||
@ -13,8 +14,10 @@
|
|||||||
.export sramprep
|
.export sramprep
|
||||||
.import __SRPREP_LOAD__, __SRPREP_SIZE__
|
.import __SRPREP_LOAD__, __SRPREP_SIZE__
|
||||||
.import __SHADOW_RAM_LOAD__, __SHADOW_RAM_SIZE__
|
.import __SHADOW_RAM_LOAD__, __SHADOW_RAM_SIZE__
|
||||||
.import __CHARGEN_LOAD__, __CHARGEN_SIZE__
|
.import __SHADOW_RAM_RUN__
|
||||||
|
.import __CHARGEN_START__, __CHARGEN_SIZE__
|
||||||
.import __SAVEAREA_LOAD__
|
.import __SAVEAREA_LOAD__
|
||||||
|
.import zpsave
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
@ -35,7 +38,7 @@ cont: ldx #0 ; channel 0
|
|||||||
sta ICBLH,x
|
sta ICBLH,x
|
||||||
lda #PUTCHR
|
lda #PUTCHR
|
||||||
sta ICCOM,x
|
sta ICCOM,x
|
||||||
jsr CIOV
|
jsr CIOV_org
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
@ -55,6 +58,7 @@ sramprep:
|
|||||||
print_string "in sramprep"
|
print_string "in sramprep"
|
||||||
|
|
||||||
; save values of modified system variables and ports
|
; save values of modified system variables and ports
|
||||||
|
|
||||||
lda RAMTOP
|
lda RAMTOP
|
||||||
sta RAMTOP_save
|
sta RAMTOP_save
|
||||||
lda MEMTOP
|
lda MEMTOP
|
||||||
@ -67,6 +71,31 @@ sramprep:
|
|||||||
sta APPMHI_save+1
|
sta APPMHI_save+1
|
||||||
lda PORTB
|
lda PORTB
|
||||||
sta PORTB_save
|
sta PORTB_save
|
||||||
|
lda CIOV ; zero-page wrapper
|
||||||
|
sta ZP_CIOV_save
|
||||||
|
lda CIOV+1
|
||||||
|
sta ZP_CIOV_save+1
|
||||||
|
lda CIOV+2
|
||||||
|
sta ZP_CIOV_save+2
|
||||||
|
lda SIOV ; zero-page wrapper
|
||||||
|
sta ZP_SIOV_save
|
||||||
|
lda SIOV+1
|
||||||
|
sta ZP_SIOV_save+1
|
||||||
|
lda SIOV+2
|
||||||
|
sta ZP_SIOV_save+2
|
||||||
|
|
||||||
|
lda $fffe
|
||||||
|
sta IRQ_save
|
||||||
|
lda $ffff
|
||||||
|
sta IRQ_save+1
|
||||||
|
lda $fffc
|
||||||
|
sta RESET_save
|
||||||
|
lda $fffd
|
||||||
|
sta RESET_save+1
|
||||||
|
lda $fffa
|
||||||
|
sta NMI_save
|
||||||
|
lda $fffb
|
||||||
|
sta NMI_save+1
|
||||||
|
|
||||||
; disable BASIC
|
; disable BASIC
|
||||||
|
|
||||||
@ -75,7 +104,7 @@ sramprep:
|
|||||||
sta PORTB
|
sta PORTB
|
||||||
|
|
||||||
|
|
||||||
; ... change memory bla
|
; ... change system memory variables bla
|
||||||
|
|
||||||
CMPVAL = 64+255+992 ; you may ask, why these values... @@@ document
|
CMPVAL = 64+255+992 ; you may ask, why these values... @@@ document
|
||||||
|
|
||||||
@ -94,7 +123,7 @@ sys_ok: lda #<__SAVEAREA_LOAD__
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ... issue ar GRAPHICS 0 call (copied'n'pasted from TGI drivers)
|
; ... issue a GRAPHICS 0 call (copied'n'pasted from TGI drivers)
|
||||||
|
|
||||||
|
|
||||||
ldx #$50 ; take any IOCB, hopefully free (@@@ fixme)
|
ldx #$50 ; take any IOCB, hopefully free (@@@ fixme)
|
||||||
@ -114,7 +143,7 @@ sys_ok: lda #<__SAVEAREA_LOAD__
|
|||||||
sta ICBLL,x
|
sta ICBLL,x
|
||||||
lda #>screen_device_length
|
lda #>screen_device_length
|
||||||
sta ICBLH,x
|
sta ICBLH,x
|
||||||
jsr CIOV
|
jsr CIOV_org
|
||||||
bpl okoko
|
bpl okoko
|
||||||
|
|
||||||
print_string "GR 0 FAILED"
|
print_string "GR 0 FAILED"
|
||||||
@ -122,7 +151,8 @@ sys_ok: lda #<__SAVEAREA_LOAD__
|
|||||||
jsr delay
|
jsr delay
|
||||||
jsr delay
|
jsr delay
|
||||||
|
|
||||||
jmp xxx
|
jmp (DOSVEC) ; abort loading
|
||||||
|
|
||||||
|
|
||||||
okoko:
|
okoko:
|
||||||
|
|
||||||
@ -130,24 +160,147 @@ okoko:
|
|||||||
; 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
|
||||||
jsr CIOV
|
jsr CIOV_org
|
||||||
|
|
||||||
print_string "GR 0 OKOKO"
|
print_string "GR 0 OKOKO"
|
||||||
jsr delay
|
jsr delay
|
||||||
|
|
||||||
|
|
||||||
|
; Save the zero page locations we need
|
||||||
|
|
||||||
|
ldx #zpspace-1
|
||||||
|
L1: lda sp,x
|
||||||
|
sta zpsave,x
|
||||||
|
dex
|
||||||
|
bpl L1
|
||||||
|
|
||||||
|
; copy chargen to low memory
|
||||||
|
|
||||||
|
lda #>(__SRPREP_LOAD__ + __SRPREP_SIZE__)
|
||||||
|
sta ptr3+1
|
||||||
|
lda #<(__SRPREP_LOAD__ + __SRPREP_SIZE__)
|
||||||
|
sta ptr3
|
||||||
|
beq cg_addr_ok
|
||||||
|
|
||||||
xxx:
|
; page align the new chargen address
|
||||||
|
inc ptr3+1
|
||||||
|
lda #0
|
||||||
|
sta ptr3
|
||||||
|
|
||||||
|
cg_addr_ok:
|
||||||
|
lda #<DCSORG
|
||||||
|
sta ptr1
|
||||||
|
lda #>DCSORG
|
||||||
|
sta ptr1+1
|
||||||
|
lda ptr3
|
||||||
|
sta ptr2
|
||||||
|
lda ptr3+1
|
||||||
|
sta ptr2+1
|
||||||
|
lda #>__CHARGEN_SIZE__
|
||||||
|
sta tmp2
|
||||||
|
lda #<__CHARGEN_SIZE__
|
||||||
|
sta tmp2+1
|
||||||
|
jsr memcopy
|
||||||
|
|
||||||
|
; TODO: switch to this temp. chargen
|
||||||
|
|
||||||
|
; disable ROMs
|
||||||
|
sei
|
||||||
|
ldx #0
|
||||||
|
stx NMIEN ; disable NMI
|
||||||
|
lda PORTB
|
||||||
|
and #$fe
|
||||||
|
sta PORTB ; now ROM is mapped out
|
||||||
|
|
||||||
|
; copy shadow RAM contents to their destination
|
||||||
|
|
||||||
|
lda #<__SHADOW_RAM_SIZE__
|
||||||
|
bne do_copy
|
||||||
|
lda #>__SHADOW_RAM_SIZE__
|
||||||
|
beq no_copy ; we have no shadow RAM contents
|
||||||
|
|
||||||
|
; ptr1 - src; ptr2 - dest; tmp1, tmp2 - len
|
||||||
|
do_copy:lda #<__SHADOW_RAM_LOAD__
|
||||||
|
sta ptr1
|
||||||
|
lda #>__SHADOW_RAM_LOAD__
|
||||||
|
sta ptr1+1
|
||||||
|
lda #<__SHADOW_RAM_RUN__
|
||||||
|
sta ptr2
|
||||||
|
lda #>__SHADOW_RAM_RUN__
|
||||||
|
sta ptr2+1
|
||||||
|
lda #<__SHADOW_RAM_SIZE__
|
||||||
|
sta tmp1
|
||||||
|
lda #>__SHADOW_RAM_SIZE__
|
||||||
|
sta tmp2
|
||||||
|
|
||||||
|
jsr memcopy
|
||||||
|
|
||||||
|
no_copy:
|
||||||
|
|
||||||
|
; copy chargen to its new location
|
||||||
|
|
||||||
|
lda ptr3
|
||||||
|
sta ptr1
|
||||||
|
lda ptr3+1
|
||||||
|
sta ptr1+1
|
||||||
|
lda #<__CHARGEN_START__
|
||||||
|
sta ptr2
|
||||||
|
lda #>__CHARGEN_START__
|
||||||
|
sta ptr2+1
|
||||||
|
lda #>__CHARGEN_SIZE__
|
||||||
|
sta tmp2
|
||||||
|
lda #<__CHARGEN_SIZE__
|
||||||
|
sta tmp2+1
|
||||||
|
jsr memcopy
|
||||||
|
|
||||||
|
; re-enable ROM
|
||||||
|
|
||||||
|
lda PORTB
|
||||||
|
ora #1
|
||||||
|
sta PORTB
|
||||||
|
lda #$40
|
||||||
|
sta NMIEN ; enable VB again
|
||||||
|
cli ; and enable IRQs
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
; my 6502 fu is rusty, so I took a routine from the internet (http://www.obelisk.demon.co.uk/6502/algorithms.html)
|
||||||
|
|
||||||
|
; copy memory
|
||||||
|
; ptr1 - source
|
||||||
|
; ptr2 - destination
|
||||||
|
; tmp2:tmp1 - len
|
||||||
|
|
||||||
|
.proc memcopy
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
ldx tmp2
|
||||||
|
beq last
|
||||||
|
pagecp: lda (ptr1),y
|
||||||
|
sta (ptr2),y
|
||||||
|
iny
|
||||||
|
bne pagecp
|
||||||
|
inc ptr1+1
|
||||||
|
inc ptr2+1
|
||||||
|
dex
|
||||||
|
bne pagecp
|
||||||
|
last: cpy tmp1
|
||||||
|
beq done
|
||||||
|
lda (ptr1),y
|
||||||
|
sta (ptr2),y
|
||||||
|
iny
|
||||||
|
bne last
|
||||||
|
done: rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
.byte "HERE ****************** HERE ***************>>>>>>"
|
||||||
|
|
||||||
|
sramsize:
|
||||||
|
.word __SHADOW_RAM_SIZE__
|
||||||
|
|
||||||
; short delay
|
; short delay
|
||||||
.proc delay
|
.proc delay
|
||||||
|
|
||||||
@ -173,6 +326,13 @@ screen_device_length = * - screen_device
|
|||||||
|
|
||||||
.byte " ** srprep ** end-->"
|
.byte " ** srprep ** end-->"
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------
|
||||||
|
; Provide an empty SHADOW_RAM segment in order that the linker is happy
|
||||||
|
; if the user program doesn't have a SHADOW_RAM segment.
|
||||||
|
|
||||||
|
.segment "SHADOW_RAM"
|
||||||
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Chunk "trailer" - sets INITAD
|
; Chunk "trailer" - sets INITAD
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user