Namely, I am interested in seeing what popa and popax do.
I noticed when looking at the code for some of the neslib.s (I was looking at oam_spr) routines that there are lots of calls to "jsr popa" because that call takes 4 arguments.
Typically jsr can be a bit heavy (6 cycles for JSR plus another 6 for its RTS) and I wanted to see if any of the routines could be optimized.
Code: Select all
; ; Ullrich von Bassewitz, 25.10.2000 ; ; CC65 runtime: Pop a from stack ; .export popa .importzp sp .macpack cpu .proc popa .if (.cpu .bitand ::CPU_ISET_65SC02) lda (sp) .else ldy #0 ; (2) lda (sp),y ; (7) Read byte .endif inc sp ; (12) beq @L1 ; (14) rts ; (20) @L1: inc sp+1 rts .endproc
Code: Select all
; ; Ullrich von Bassewitz, 25.10.2000 ; ; CC65 runtime: Increment the stackpointer by 2. For performance reasons, ; this modules does also contain the popax function. .export popax, incsp2 .importzp sp .macpack cpu ; Pop a/x from stack. This function will run directly into incsp2 .proc popax ldy #1 lda (sp),y ; get hi byte tax ; into x .if (.cpu .bitand ::CPU_ISET_65SC02) lda (sp) ; get lo byte .else dey lda (sp),y ; get lo byte .endif .endproc .proc incsp2 inc sp ; 5 beq @L1 ; 2 inc sp ; 5 beq @L2 ; 2 rts @L1: inc sp ; 5 @L2: inc sp+1 ; 5 rts .endproc
Code: Select all
$ ld65 --version ld65 V2.13.9 - (C) Copyright 1998-2009, Ullrich von Bassewitz $ ld65 -o main.nes crt0.o example1.o runtime.lib -C nes.cfg ld65: Error: Wrong data version in `runtime.lib
"ld65: Error: nes.cfg(82): Attribute expected"
82 is the line with "__STACKSIZE__ = $0500; # 5 pages stack"
I've never developed on the NES platform (or used the cc65 binutils) before, also I'm trying to build the examples on Ubuntu.
- Fixed some macro issues.
- Static const local data goes into RODATA, not DATA.
- Fix problem when converting function to void pointer.
- Fix register info for several runtime functions. Result was invalid code.
- Fix an error in the runtime division routine.
- Fix internal error caused by error recovery (or lack of).
- Fix invalid handling of signed int types in some cases.
- Fix and improve the code for compares.
- Disallow __asm__ on global level.
- Fix problem with access to structs returned by functions.
- Fix an internal error in the code generator.
- Fix error handling in .LEFT.
- Fix problem with .REPEAT.
- Fix problem with alignments >= 256 bytes.
- Fix some macro issues.
- Fixed problems with 80 column mode (C128 library).
- Remove final jump to RESTOR for all CBM platforms (cc65 libraries).
- Merge back Olivers C interrupt handling code (cc65 libraries).
- The LINE function mistakenly enabled the BASIC ROM (TGI driver for C64).
- Fix some issues with conio scrolling (C128 library).
- Add missing export for CBM510 platform (cbm510 library).
- Merge back POSIX directory routines for the Atari (atari library).
- Fix smbx and rmbx instructions.
- Fixed/improved several error messages (all tools).
- Several documentation changes.
- Several documentation fixes and improvements.
There is basically nothing useful in the nes/ lib source, unless you want to make a text only program maybe, and I think it's a good idea to replace crt0. Luckily all the runtime/ stuff is modularized, so stuff you don't used is not linked in anyway.
Apparently there's a few things I need from common/ so far zerobss.s and copydata.s were needed. Probably I will need to add more as I go along and I get link errors, but I think most of common/ I want to leave out. I'm keeping a list as I go. I'll release source and information once I've finished my current project, so anyone who's interested might learn from it.