Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #842

Re: DOS 3.3 RWTS - C65 library function - please help

From "Bill Buckels" <bbuckels@mts.net>
Newsgroups comp.sys.apple2.programmer
Subject Re: DOS 3.3 RWTS - C65 library function - please help
Date 2013-08-30 13:19 -0500
Organization Aioe.org NNTP Server
Message-ID <kvqnn2$12h$1@speranza.aioe.org> (permalink)
References <kvqju7$lph$1@speranza.aioe.org> <kvqk7e$mmq$1@speranza.aioe.org> <kvqkp2$o9f$1@speranza.aioe.org>

Show all headers | View raw


"Bill Buckels" <bbuckels@mts.net> wrote:

>I will provide one more zero page layout ...which shows the differences 
>between the old version's equates and the new version's equates more 
>precisely.

Thank you for taking time to look at this. I have many other similarly 
complex issues that I have been working through, and in the end the problem 
becomes simple and obvious generally with a simple solution. But in the 
meanwhile I always wish I had more sets of eyes...

Like many C compilers that interface with assembly including Microsoft 
Compilers and the Windows API which uses PASCAL calling convention, the 
Aztec C65 compiler passes its parameters on a stack but using the C calling 
convention (in forward order)... pascal is backwards to c.

The rwts function takes integer length arguments so it is not hard to 
calculate the offsets of each parameter passed to the assembly module. The 8 
bit architecture of the 6502 makes it difficult to pass values in integers. 
I realize that I can optimize this module further by using 1 byte parameters 
from C. This is one of the reasons that Aztec C is less efficient than CC65 
which uses 1 byte when Aztec C65 uses two.

But it would take me a lifetime to optimize Aztec C65's runtime libraries 
by myself. So CC65 wins in that area.

The stack in Aztec C65 is on zero page. The 6502 series of compilers 
including the C64 and Atari compilers all use zero page which different 
offsets but the same regs. While the culprit may be on Zero Page for this 
problem, it is not obvious to me.

Annotated Zero Page listing between versions... the old and the new...

Thanks for your help. This is driving me bananas and my knowledge is very 
limited on 6502 code, DOS 3.3, and the Apple II in general compared to the 
experts here (I mean that sincerely) so I look forward to your comments:

 * Comparison to ZPAGE.H From Aztec C 3.2b
* Copyright (C) Bill Buckels 2013. All Rights Reserved.
*

*
* The following EQU's are stored directly in the .A65 source.
*
* Comments for porting DOS 3.3 A65 routines from Aztec C65 3.2b.
*

* missing - STK EQU $00 ; 8 byte stack area (same offset as VAL)
VAL EQU 0 ; same (from blockmv.a65) = STK - 8 byte stack area
SP EQU 2 ; same (from blockmv.a65)
AFRAME EQU 4 ; same (from OV65.A65)
FRAME EQU 4 ; same (from blockmv.a65)
LFRAME  EQU 6 ; same (from OV65.A65)
PC EQU 6 ; same (from blockmv.a65)

* missing - TREGS EQU $08 ; 24 byte tmp register area (same offset as R0)
R0 EQU 8 ; same (from blockmv.a65) = TREGS - 4 byte tmp register area
R1 EQU 12 ; same (from blockmv.a65)
R2 EQU 16 ; same (from blockmv.a65)
* missing - R3 EQU TREGS+12 (same offset as ACC)
* missing - R4 EQU TREGS+16 (same offset as SEC)

ACC EQU 20 ; different (from blockmv.a65) = R3 3.2b
SEC EQU 22 ; different (from blockmv.a65) = R4 3.2b

* different ACC EQU TREGS+20 = ACC+8 (to allow R3 and R4 in 3.2b)
* different SEC EQU TREGS+22 = SEC+8 (to allow R3 and R4 in 3.2b)

REGS EQU $80 ; same (from OV65.A65) 16 byte user register area

* missing - TMP EQU $40 ;4 byte zero page temporary area


Back to comp.sys.apple2.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

DOS 3.3 RWTS - C65 library function - please help "Bill Buckels" <bbuckels@mts.net> - 2013-08-30 12:14 -0500
  Re: DOS 3.3 RWTS - C65 library function - please help "Bill Buckels" <bbuckels@mts.net> - 2013-08-30 12:19 -0500
    Re: DOS 3.3 RWTS - C65 library function - please help "Bill Buckels" <bbuckels@mts.net> - 2013-08-30 12:28 -0500
      Re: DOS 3.3 RWTS - C65 library function - please help "Bill Buckels" <bbuckels@mts.net> - 2013-08-30 13:19 -0500
  Re: DOS 3.3 RWTS - C65 library function - please help Antoine Vignau <antoine.vignau@laposte.net> - 2013-08-30 12:35 -0700
    Re: DOS 3.3 RWTS - C65 library function - please help "Bill Buckels" <bbuckels@mts.net> - 2013-08-30 17:07 -0500
  Re: DOS 3.3 RWTS - C65 library function - please help "Bill Buckels" <bbuckels@mts.net> - 2013-08-30 22:16 -0500

csiph-web