1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00
This commit is contained in:
Christian Groessler 2013-09-27 22:01:54 +02:00
parent c88e0818b4
commit 39a98f250b
10 changed files with 809 additions and 809 deletions

View File

@ -33,10 +33,10 @@ MEMORY {
# "main program" load chunk
MAINHDR: file = %O, start = $0000, size = $0004;
RAM: file = %O, define = yes, start = %S +
__LOWDATA_SIZE__, size = $D000 -
__STACKSIZE__ -
%S -
__LOWDATA_SIZE__;
__LOWDATA_SIZE__, size = $D000 -
__STACKSIZE__ -
%S -
__LOWDATA_SIZE__;
# defines entry point into program
TRAILER: file = %O, start = $0000, size = $0006;

View File

@ -28,10 +28,10 @@ MEMORY {
# "main program" load chunk
MAINHDR: file = %O, start = $0000, size = $0004;
RAM: file = %O, define = yes, start = %S +
__LOWDATA_SIZE__, size = $D000 -
__STACKSIZE__ -
%S -
__LOWDATA_SIZE__;
__LOWDATA_SIZE__, size = $D000 -
__STACKSIZE__ -
%S -
__LOWDATA_SIZE__;
# defines entry point into program
TRAILER: file = %O, start = $0000, size = $0006;

View File

@ -41,7 +41,7 @@
.export _get_ostype
.include "atari.inc"
.include "romswitch.inc"
.include "romswitch.inc"
.ifdef __ATARIXL__
@ -50,8 +50,8 @@
.macro disable_rom_save_a
pha
disable_rom
pla
disable_rom
pla
.endmacro
.else ; above atarixl, below atari

View File

@ -6,8 +6,8 @@
; Christian Groessler, chris@groessler.org, 2013
;
.import SAVMSC_save
.import MEMTOP_save
.import APPMHI_save
.import RAMTOP_save
.import PORTB_save
.import SAVMSC_save
.import MEMTOP_save
.import APPMHI_save
.import RAMTOP_save
.import PORTB_save

View File

@ -8,18 +8,18 @@
.ifdef __ATARIXL__
.export SAVMSC_save
.export MEMTOP_save
.export APPMHI_save
.export RAMTOP_save
.export PORTB_save
.export SAVMSC_save
.export MEMTOP_save
.export APPMHI_save
.export RAMTOP_save
.export PORTB_save
.segment "LOWDATA"
SAVMSC_save: .res 2
MEMTOP_save: .res 2
APPMHI_save: .res 2
RAMTOP_save: .res 1
PORTB_save: .res 1
SAVMSC_save: .res 2
MEMTOP_save: .res 2
APPMHI_save: .res 2
RAMTOP_save: .res 1
PORTB_save: .res 1
.endif

View File

@ -1,6 +1,6 @@
; Name of the "screen" device
.export scrdev
.export scrdev
.rodata

File diff suppressed because it is too large Load Diff

View File

@ -90,7 +90,7 @@ sramprep:
lda lodadr+1
sta RAMTOP
; set APPMHI to MEMLO (+ 1 for sanity)
; set APPMHI to MEMLO (+ 1 for sanity)
lda MEMLO
clc
adc #1
@ -104,7 +104,7 @@ sramprep:
jsr findfreeiocb
.ifdef DEBUG ; only check in debug version, this shouldn't really happen(tm)
.ifdef DEBUG ; only check in debug version, this shouldn't really happen(tm)
beq iocbok
print_string "Internal error, no free IOCB!"
jsr delay

View File

@ -11,11 +11,11 @@
; Christian Groessler, chris@groessler.org, 2013
;
DEBUG = 1
DEBUG = 1
.ifdef __ATARIXL__
.export syschk
.export syschk
.import __SYSCHK_LOAD__
.import __STARTADDRESS__ ; needed by xlmemchk.inc
@ -24,36 +24,36 @@ DEBUG = 1
.macro print_string text
.local start, cont
jmp cont
start: .byte text, ATEOL
cont: ldx #0 ; channel 0
lda #<start
sta ICBAL,x ; address
lda #>start
sta ICBAH,x
lda #<(cont - start)
sta ICBLL,x ; length
lda #>(cont - start)
sta ICBLH,x
lda #PUTCHR
sta ICCOM,x
jsr CIOV_org
.local start, cont
jmp cont
start: .byte text, ATEOL
cont: ldx #0 ; channel 0
lda #<start
sta ICBAL,x ; address
lda #>start
sta ICBAH,x
lda #<(cont - start)
sta ICBLL,x ; length
lda #>(cont - start)
sta ICBLH,x
lda #PUTCHR
sta ICCOM,x
jsr CIOV_org
.endmacro
.macro print_string2 addr, len
ldx #0 ; channel 0
lda #<addr
sta ICBAL,x ; address
lda #>addr
sta ICBAH,x
lda #<len
sta ICBLL,x ; length
lda #>len
sta ICBLH,x
lda #PUTCHR
sta ICCOM,x
jsr CIOV_org
ldx #0 ; channel 0
lda #<addr
sta ICBAL,x ; address
lda #>addr
sta ICBAH,x
lda #<len
sta ICBLL,x ; length
lda #>len
sta ICBLH,x
lda #PUTCHR
sta ICCOM,x
jsr CIOV_org
.endmacro
@ -72,74 +72,74 @@ cont: ldx #0 ; channel 0
.segment "SYSCHK"
; no XL machine
no_xl: print_string "This program needs an XL machine."
jmp fail
no_xl: print_string "This program needs an XL machine."
jmp fail
; entry point
syschk:
lda $fcd8 ; from ostype.s
lda $fcd8 ; from ostype.s
cmp #$a2
beq no_xl
; we have an XL machine, now check memory
lda RAMSIZ
cmp #$80
bcs sys_ok
lda RAMSIZ
cmp #$80
bcs sys_ok
; not enough memory
print_string "Not enough memory."
fail: jsr delay
jmp (DOSVEC)
print_string "Not enough memory."
fail: jsr delay
jmp (DOSVEC)
sys_ok:
.include "xlmemchk.inc" ; calculate lowest address we will use when we move the screen buffer down
.include "xlmemchk.inc" ; calculate lowest address we will use when we move the screen buffer down
sec
lda MEMLO
sbc lowadr
lda MEMLO+1
sbc lowadr+1
bcc memlo_ok
sec
lda MEMLO
sbc lowadr
lda MEMLO+1
sbc lowadr+1
bcc memlo_ok
; load address was too low
print_string2 lmemerr_txt, lmemerr_txt_len
jsr delay ; long text takes longer to read, give user additional time
jmp fail
print_string2 lmemerr_txt, lmemerr_txt_len
jsr delay ; long text takes longer to read, give user additional time
jmp fail
; all is well(tm), launch the application
memlo_ok:
.ifdef DEBUG
print_string "Stage #1 OK"
jsr delay
print_string "Stage #1 OK"
jsr delay
.endif
rts
rts
lmemerr_txt:
.byte "Not enough memory to move screen", ATEOL
.byte "memory to low memory. Consider using", ATEOL
.byte "a higher load address.", ATEOL
lmemerr_txt_len = * - lmemerr_txt
.byte "Not enough memory to move screen", ATEOL
.byte "memory to low memory. Consider using", ATEOL
.byte "a higher load address.", ATEOL
lmemerr_txt_len = * - lmemerr_txt
; short delay
.proc delay
.proc delay
lda #10
l: jsr delay1
clc
sbc #0
bne l
rts
lda #10
l: jsr delay1
clc
sbc #0
bne l
rts
delay1: ldx #0
ldy #0
loop: dey
bne loop
dex
bne loop
rts
delay1: ldx #0
ldy #0
loop: dey
bne loop
dex
bne loop
rts
.endproc
@ -154,4 +154,4 @@ end:
.word INITAD+1
.word syschk
.endif ; .ifdef __ATARIXL__
.endif ; .ifdef __ATARIXL__

View File

@ -9,12 +9,12 @@
; by the screen memory afterwards.
;
; inputs:
; __STARTADDRESS__ - load address of the program
; __STARTADDRESS__ - load address of the program
; outputs:
; lodadr - (high byte only) value to
; write into RAMTOP
; lowadr - lowest address occupied by
; screen data
; lodadr - (high byte only) value to
; write into RAMTOP
; lowadr - lowest address occupied by
; screen data
;
@ -35,85 +35,85 @@
; available memory, boundary crossing cannot happen.
SCRBUFSZ = (40 * 24) ; size of mode 0 screen buffer
DLSZ = 32 ; size of mode 0 display list
SCRBUFSZ = (40 * 24) ; size of mode 0 screen buffer
DLSZ = 32 ; size of mode 0 display list
scrmemtst:
; subtract screen memory size from our load address
lda lodadr
sec
sbc #<SCRBUFSZ
sta tstadr
lda lodadr+1
sbc #>SCRBUFSZ
sta tstadr+1
lda lodadr
sec
sbc #<SCRBUFSZ
sta tstadr
lda lodadr+1
sbc #>SCRBUFSZ
sta tstadr+1
; check if a 4K boundary is crossed
lda lodadr+1
and #$f0
sta tmp
lda tstadr+1
and #$f0
cmp tmp
beq scrmemok
lda lodadr+1
and #$f0
sta tmp
lda tstadr+1
and #$f0
cmp tmp
beq scrmemok
; if lodadr is at an exact 4K boundary, it's still ok
lda lodadr+1
and #$0f
beq scrmemok
lda lodadr+1
and #$0f
beq scrmemok
; 4K boundary will be crossed, use this 4K boundary address as lodadr
al4k: lda lodadr+1
and #$f0
sta lodadr+1
bne scrmemtst
al4k: lda lodadr+1
and #$f0
sta lodadr+1
bne scrmemtst
; not reached
.ifdef DEBUG
.byte "XLMEMCHK:>"
.endif
lodadr: .word __STARTADDRESS__ & $FF00 ; our program's load address, rounded down to page boundary
tstadr: .res 2
lowadr: .res 2
tmp: .res 1
lodadr: .word __STARTADDRESS__ & $FF00 ; our program's load address, rounded down to page boundary
tstadr: .res 2
lowadr: .res 2
tmp: .res 1
; subtract display list size from calculated screen address
scrmemok:
lda tstadr
sec
sbc #<DLSZ
sta lowadr
lda tstadr+1
sbc #>DLSZ
sta lowadr+1
lda tstadr
sec
sbc #<DLSZ
sta lowadr
lda tstadr+1
sbc #>DLSZ
sta lowadr+1
.if 0 ; this cannot happen
.if 0 ; this cannot happen
; check if a 1K boundary is crossed
lda tstadr+1
and #$fc
sta tmp
lda lowadr+1
and #$fc
cmp tmp
bne al4k ; 1K boundary will be crossed, decrease lodadr
lda tstadr+1
and #$fc
sta tmp
lda lowadr+1
and #$fc
cmp tmp
bne al4k ; 1K boundary will be crossed, decrease lodadr
.endif
; address of display list is ok
; decrease lowadr by two
lda lowadr
sec
sbc #2
sta lowadr
bcs dec_cont
dec lowadr+1
lda lowadr
sec
sbc #2
sta lowadr
bcs dec_cont
dec lowadr+1
dec_cont: