zach@pro-pac.cts.com (Zach Taft) (10/21/88)
I'm a newcomer to programming in assembly on the //gs and I am really having some problems with some of the concepts involved in the APW/65816 programming language. One of the most difficult things has been changing concepts from absolute (//e assembly ala Merlin) to relocatable (ala APW/ORCA). Here's a couple of scenarios which fully describe what is puzzling me, and if anyone could help with some sort of understanding (in plain language preferably) I sure would appreciate it. Case No. 1 - Most of the long addressing modes in the APW compiler all have three byte operands when identifying and address to work with. This is the low byte, followed by the high byte, followed by the program bank byte. My problem comes when trying to address the problem of convert- ing my old programs to the 16-bit format (I assume) of the same opera- tion. In my old 8-bit programs I used a number of (z),y and (z,x) operations. In the APW format, I try to use these with full long addressing, but I get operation syntax errors. EX: BankZ ds 4 PushLong #0 ;space for result _Macro ;returns a long result PopLong BankZ ;store this returned addr lda [BankZ],Y ;error? lda (BankZ,x) ;comes up with wrong address in sta Wherever+1 ; the actual accumulator. And then inx ; when I try to JSL to the address inx ; it totally bombs the system out lda (BankZ,x) ; (which is why I am assuming the sta Wherever+3 ; addr is being passed incorrectly). Wherever anop jsl TheAddr ; ;the actual accumulator. Questions: Why am I getting errors with the 'lda [BankZ],Y' statement, and why does the 'lda (BankZ,X)' state- ment come up with the wrong address? Does this mean that I cannot use long directives indirectly? And while I'm at it and may have the attention of some of the APW people out there, there are a few things that I would like to ask about the data bank register (DBR) and the program bank register (PBR), and their relationship with segments and banks in memory. When the code segments (programs) that I create with APW are run from the APW shell am I to assume that the shell is loading the programs into bank $00? If not, then exactly how does the system keep track of the DBR and PBR. I have "Mastering the //gs" (M.Davis & D. Gookin) and "Exploring the Apple //gs" (B. Little), but their text must not either explain this operation fully to my understanding, or I may be missing something. Do the PBR and DBR automatically cross to the next 64K bank of memory when that point is reached? If not, what happens when I have code that is loaded into the system and crosses this boundary? Do I have to manually check the PC and see if I am near the bank boundary or what!?! Either way, do I have to change the DBR to a seperate bank that holds my data if I want to read or write to this data? Finally, can someone direct me to some text that will describe the APW segment loading concept in a bit more detail (an less encryption) than the APW manual? I just don't understand how one canmake segments load into relocatable positions, and also make them accessable to some control program that is already loaded without REwriting every single damn address reference to said code in the control program! That's all for now. I sincerely would appreciate any help in understanding the concepts behind this. Zach Taft -- UUCP: {nosc, cacilj, sdcsvax, hplabs!hp-sdd, sun.COM} ...!crash!pnet01!pro-nsfmat!pro-pac!zach ARPA: crash!pnet01!pro-nsfmat!pro-pac!zach@nosc.MIL INET: zach@pro-pac.CTS.COM - BITNET: pro-pac.UUCP!zach@PSUVAX1