Hi! I am working on my AuxMemApple library for the Apple2/cc65. It is a memory extender that allows the usage of aux memory from cc65 programs. I believe it's better than cc65's em libraries because it provides a way to access any byte or word in aux memory and string and memory functions that mirror the standard memory and string functions. The library works so far. Right now, I need to provide a way to reconnect the RAM drive at the end of the program, some demo programs and to write the manual. Then, the first beta should be ready to upload.
Anonymous
User login
Please support the defense of Ukraine.
Direct or via Unclutter App
Active forum topics
Recent content
Navigation
No Ads.
No Trackers.
No Social Media.
All Content Locally Hosted.
Built on Free Software.
We have complied with zero government requests for information.
I spent the past hour trying to get an Apple2enh port of my MadLib program to compile. The latest error was a Memory Area Not Found error from the linker on the "HIGHCODE" segment. I used the grepWIn utility to search for the name. I didn't find it. :( I'm using a custom config and a recent version of cc65. Following are the config file:
------------------------------
# Configuration for ProDOS 8 system programs (allowing for 3KB in LC)
SYMBOLS { __EXEHDR__: type = import; __FILETYPE__: type = weak, value = $00FF; # ProDOS file type __STACKSIZE__: type = weak, value = $0800; # 2k stack __LCADDR__: type = weak, value = $D400; # Behind quit code __LCSIZE__: type = weak, value = $0C00; # Rest of bank two __PRODOS_NUMFILES__: value = 4, type = weak; # max. # files open at a time}MEMORY { ZP: file = "", define = yes, start = $0080, size = $0080;#ProDOS's file buffers, large enough for four files. PDIO: start = $1000, size = $1000, define = yes; HEADER: file = %O, start = $2000 - $003A, size = $003A; MAIN: file = %O, define = yes, start = $2000, size = $BF00 - $2000; BSS: file = "", start = __ONCE_RUN__, size = $BF00 - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__;#Keyboard buffer and BASIC's ML buffer. Probably not used by most cc65 programs. KEYBUF: file = "keyb", start = $0200, size = $0200, define = yes;#Unused memory between the screen buffer and the beginning of the#file buffers. LOWBUF: file = "lowmem", start = $0800, size = $0800, define = yes; AUXMEM: file = "auxro", define = yes, start = $0800, size = $B800;}SEGMENTS { ZEROPAGE: load = ZP, type = zp; EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro; LOWCODE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro; RODATA: load = MAIN, type = ro; DATA: load = MAIN, type = rw; INIT: load = MAIN, type = rw; ONCE: load = MAIN, type = ro, define = yes; LC: load = MAIN, run = LC, type = ro, optional = yes; BSS: load = BSS, type = bss, define = yes; KEYBRO: load = KEYBUF, type = ro, define = yes, optional = yes; KEYBRW: load = KEYBUF, type = rw, define = yes, optional = yes; KEYBBSS: load = KEYBUF, type = bss, define = yes, optional = yes; LOWCO: load = LOWBUF, type = ro, define = yes, optional = yes; LOWRO: load = LOWBUF, type = ro, define = yes, optional = yes; LOWRW: load = LOWBUF, type = rw, define = yes, optional = yes; LOWBSS: load = LOWBUF, type = bss, define = yes, optional = yes; AUXRO: load = AUXMEM, type = ro, define = yes, optional = yes; AUXRW: load = AUXMEM, type = rw, define = yes, optional = yes; AUXBSS: load = AUXMEM, type = bss, define = yes, optional = yes;}FEATURES { CONDES: type = constructor, label = __CONSTRUCTOR_TABLE__, count = __CONSTRUCTOR_COUNT__, segment = ONCE; CONDES: type = destructor, label = __DESTRUCTOR_TABLE__, count = __DESTRUCTOR_COUNT__, segment = RODATA; CONDES: type = interruptor, label = __INTERRUPTOR_TABLE__, count = __INTERRUPTOR_COUNT__, segment = RODATA, import = __CALLIRQ__;}-----------------------
and the build batch file:
-----------------------
@echo off
::You may need to change the path in the folowing line:cl65 -t apple2enh -C apple2enh-system_aux_prodosi.cfg -Ors -o madlib.system main.c altinput.c getmod.c writestory.c stories.c loadmain.c print.s printi.s zeropage_vars.s rand.s strlen2.s auxmemapple.lib prodosi.lib a2simpio.lib
java -jar g:\quick\ac.jar -d madlib.dsk madlib.system java -jar g:\quick\ac.jar -as madlib.dsk madlib.system SYS < madlib.systemjava -jar g:\quick\ac.jar -d madlib.dsk auxro java -jar g:\quick\ac.jar -p madlib.dsk auxro BIN < auxrojava -jar g:\quick\ac.jar -d madlib.dsk lowmemjava -jar g:\quick\ac.jar -p madlib.dsk lowmem BIN < lowmempause--------------------------
BTW, sorry I couldn't supply them as attachments: I don't see the option in the reply page. :(
Never mind: I found the error: I neglected to update the library file. It seems to work now. :)
I've done a lot of debugging and found the cause of one of the errors in the demo: the first executable line in the main() function is a call to my A2SimpleIO library's prints() function. When I replace it with puts(), it works. Otherwise, the code I added to the stub-loading code that displays the filename returns garbage. I fixed the prints() function's declaration to __cdecl__ and get different garbage. So, the prints() function is causing the problem. I'm wondering if it's a disagreement in the stack offset. I can simply leave it as puts() but really want to use A2SimpleIO. The version of A2SimpleIO online is utdated, so I will attach the code for prints() here:
---------------------
;Print a string of no more than 256 bytes using the kernal.;As the routine is __fastcall__, the pointer already is in .X.A..proc _prints sta ptr1 ;Store pointer. stx ptr1+1 ldy #0 ;Start at offset 0.@a: lda (ptr1),y ;Load current char. beq @exit ;Exit if null/EOS. ;phy jsr _printc ;Print. ;ply iny ;Advance until end of 256 bytes. bne @a@exit: rts.endproc
;Address of kernal output routine for direct calls. The character is;already in .A._printc:;=COUT ;pha ;lda #$FF ;sta $32 ;plaBIT $C082 ora #$80 jsr COUT bit $C080 rts
--------------------
I am able to get around the bug. I just have to warn users to not use A2SimpleIO functions before loading a stub into low memory via my Cubbyhole technique, that's all.
I solved the bug: I forgot to initialize Aux memory. I needed to disable the RAM drive to make Aux RAM usable. :)