mirror of
https://github.com/cc65/cc65.git
synced 2025-04-12 00:37:12 +00:00
Fix RANGE ERROR STOPPED AT 8214
On a 48k Apple II, the BLTU2 call throws an error, even when there is nothing to copy in the LC segment. Add an alternative LC copy, based on memcpy, to an extra file that the user can link in as with iobuf-0800. This memcpy-based version allows our programs to run on Integer ROM apple2. It costs 21 bytes in binary size, plus memcpy (60 bytes in binary size + RAM use) if it wasn't already linked in.
This commit is contained in:
parent
02470a2343
commit
020fe4028a
@ -10,6 +10,7 @@
|
||||
|
||||
.import initlib, _exit
|
||||
.import zerobss, callmain
|
||||
.import bltu2
|
||||
.import __ONCE_LOAD__, __ONCE_SIZE__ ; Linker generated
|
||||
.import __LC_START__, __LC_LAST__ ; Linker generated
|
||||
|
||||
@ -93,6 +94,7 @@ basic: lda HIMEM
|
||||
; Call the module constructors.
|
||||
jsr initlib
|
||||
|
||||
; Copy the LC segment to its destination
|
||||
; Switch in LC bank 2 for W/O.
|
||||
bit $C081
|
||||
bit $C081
|
||||
@ -120,7 +122,7 @@ basic: lda HIMEM
|
||||
|
||||
; Call into Applesoft Block Transfer Up -- which handles zero-
|
||||
; sized blocks well -- to move the content of the LC memory area.
|
||||
jsr $D39A ; BLTU2
|
||||
jsr bltu2 ; BLTU2
|
||||
|
||||
; Switch in LC bank 2 for R/O and return.
|
||||
bit $C080
|
||||
|
33
libsrc/apple2/extra/lc-copy-memcpy.s
Normal file
33
libsrc/apple2/extra/lc-copy-memcpy.s
Normal file
@ -0,0 +1,33 @@
|
||||
;
|
||||
; Colin Leroy-Mira, 06.03.2025
|
||||
;
|
||||
; Copy the LC segment from the end of the binary to the Language Card
|
||||
; using _memcpy. This allows running apple2 programs on the original
|
||||
; Integer ROM Apple ][.
|
||||
;
|
||||
|
||||
.export bltu2
|
||||
|
||||
.import _memcpy, pushax
|
||||
.import __ONCE_LOAD__, __ONCE_SIZE__ ; Linker generated
|
||||
.import __LC_START__, __LC_LAST__ ; Linker generated
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
bltu2:
|
||||
; Get the destination start address.
|
||||
lda #<__LC_START__
|
||||
ldx #>__LC_START__
|
||||
jsr pushax
|
||||
|
||||
; Get the source start address.
|
||||
lda #<(__ONCE_LOAD__ + __ONCE_SIZE__)
|
||||
ldx #>(__ONCE_LOAD__ + __ONCE_SIZE__)
|
||||
jsr pushax
|
||||
|
||||
; Set the length
|
||||
lda #<(__LC_LAST__ - __LC_START__)
|
||||
ldx #>(__LC_LAST__ - __LC_START__)
|
||||
|
||||
; And do the copy
|
||||
jmp _memcpy
|
9
libsrc/apple2/lc-copy-applesoft.s
Normal file
9
libsrc/apple2/lc-copy-applesoft.s
Normal file
@ -0,0 +1,9 @@
|
||||
;
|
||||
; Oliver Schmidt, 15.09.2009
|
||||
;
|
||||
; Copy the LC segment from the end of the binary to the Language Card
|
||||
; using AppleSoft's BLTU2 routine.
|
||||
;
|
||||
.export bltu2
|
||||
|
||||
bltu2 := $D39A
|
Loading…
x
Reference in New Issue
Block a user