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


Groups > comp.sys.apple2.programmer > #4932 > unrolled thread

How to check for AUX RAM size within an own program

Started byMarc Golombeck <marc.andre.tichy@googlemail.com>
First post2018-12-27 15:02 -0800
Last post2019-01-08 12:39 -0800
Articles 11 — 5 participants

Back to article view | Back to comp.sys.apple2.programmer


Contents

  How to check for AUX RAM size within an own program Marc Golombeck <marc.andre.tichy@googlemail.com> - 2018-12-27 15:02 -0800
    How to check for AUX RAM size within an own program Michael Pohoreski <michael.pohoreski@gmail.com> - 2018-12-27 21:05 -0800
      Re: How to check for AUX RAM size within an own program Marc Golombeck <marc.andre.tichy@googlemail.com> - 2018-12-27 23:47 -0800
        Re: How to check for AUX RAM size within an own program Brian Patrie <bpatrie@bellsouth.spamisicky.net> - 2018-12-28 03:16 -0600
          Re: How to check for AUX RAM size within an own program Marc Golombeck <marc.andre.tichy@googlemail.com> - 2018-12-28 02:43 -0800
    How to check for AUX RAM size within an own program Michael Pohoreski <michael.pohoreski@gmail.com> - 2018-12-27 22:08 -0800
      Re: How to check for AUX RAM size within an own program Brian Patrie <bpatrie@bellsouth.spamisicky.net> - 2018-12-28 03:19 -0600
        Re: How to check for AUX RAM size within an own program Michael Pohoreski <michael.pohoreski@gmail.com> - 2018-12-28 09:04 -0800
    Re: How to check for AUX RAM size within an own program James Davis <JPD.Enterprises@outlook.com> - 2018-12-28 09:27 -0800
    Re: How to check for AUX RAM size within an own program Marc Golombeck <marc.andre.tichy@googlemail.com> - 2018-12-28 13:37 -0800
    How to check for AUX RAM size within an own program gids.rs@sasktel.net - 2019-01-08 12:39 -0800

#4932 — How to check for AUX RAM size within an own program

FromMarc Golombeck <marc.andre.tichy@googlemail.com>
Date2018-12-27 15:02 -0800
SubjectHow to check for AUX RAM size within an own program
Message-ID<e2642e5d-48a6-4d0b-8451-4d9b41c36417@googlegroups.com>
I am wondering how I can check for the size of the installed AUX RAM of an Apple II. I especially want to check if an Apple //e has 128kB or 64 kB installed. My first approach is not working at all and I wanted to ask if someone in this group has a hint about how to retrieve the amount of AUX RAM installed in a machine?

[toc] | [next] | [standalone]


#4933

FromMichael Pohoreski <michael.pohoreski@gmail.com>
Date2018-12-27 21:05 -0800
Message-ID<cf02b9bc-d670-4ae3-ae86-f883f9a663ab@googlegroups.com>
In reply to#4932
You might be interested in my 6502_linux_logo which detects 128 KB, 64 KB or 48 KB.  Hints:

* Default to 128 KB
* Check the Machine ID byte; change to 64 KB as needed
* Check for a Language Card; if not present change to 48 KB 

https://github.com/Michaelangel007/6502_linux_logo/blob/master/linuxlogo.s

[toc] | [prev] | [next] | [standalone]


#4935

FromMarc Golombeck <marc.andre.tichy@googlemail.com>
Date2018-12-27 23:47 -0800
Message-ID<a275200c-9bfe-41a3-ad7c-52def303da6e@googlegroups.com>
In reply to#4933
Am Freitag, 28. Dezember 2018 06:05:05 UTC+1 schrieb Michael Pohoreski:
> You might be interested in my 6502_linux_logo which detects 128 KB, 64 KB or 48 KB.  Hints:
> 
> * Default to 128 KB
> * Check the Machine ID byte; change to 64 KB as needed
> * Check for a Language Card; if not present change to 48 KB 
> 
> https://github.com/Michaelangel007/6502_linux_logo/blob/master/linuxlogo.s

Thank you for your link to the source code. The machine byte was my first try. An enhanced //e has always 128k by default. I wanted to catch the standard //e with or without 128k memory so just checking for $FBC0 will be save for setting the value to 64k when $EA is present at that memory location but this will not catch all the guys that have installed a 64k RAM extension in their standard //e.

IO have seen that you test for language card by reading $D000. Maybe this could be changed to something similar by just reading a memory location that should be located in AUX RAM and compare it to a known value in MAIN RAM? If AUX is present the AUX-value (maybe $00 or $FF) should be different from that in MAIN (whatever value you choose, shouldn't be $00 or $FF though).

Maybe I try that approach?

[toc] | [prev] | [next] | [standalone]


#4936

FromBrian Patrie <bpatrie@bellsouth.spamisicky.net>
Date2018-12-28 03:16 -0600
Message-ID<q04pl0$1jb6$1@gioia.aioe.org>
In reply to#4935
On 28/12/2018 01.47, Marc Golombeck wrote:
 > An enhanced //e has always 128k by default.

This is not a given; it's entirely possible for a IIee to have only 64k.

[toc] | [prev] | [next] | [standalone]


#4938

FromMarc Golombeck <marc.andre.tichy@googlemail.com>
Date2018-12-28 02:43 -0800
Message-ID<f4df0875-f318-4add-a8dd-05e0cde14cfb@googlegroups.com>
In reply to#4936
Am Freitag, 28. Dezember 2018 10:16:19 UTC+1 schrieb Brian Patrie:
> On 28/12/2018 01.47, Marc Golombeck wrote:
>  > An enhanced //e has always 128k by default.
> 
> This is not a given; it's entirely possible for a IIee to have only 64k.

okay, so I need to check for 128k explicitly independent from the machine type. Will try that...

[toc] | [prev] | [next] | [standalone]


#4934

FromMichael Pohoreski <michael.pohoreski@gmail.com>
Date2018-12-27 22:08 -0800
Message-ID<7914598d-e4cd-4bd5-b60b-0007906a5dd8@googlegroups.com>
In reply to#4932
Alternatively, if you need an accurate byte count then use the soft switches
and write/read from AUX RAM.  For example, the following AuxMemSize utility
will print the number of valid pages in AUX memory ($C0 = 192 pages of
AUX RAM = 128 KB.)

How it works:

It copies $34 bytes to $0100..$0134 and checks the first byte of every
AUX page from $04 .. $BF (inclusive) updating the number of valid pages
before printing it.

Cheers,
Michael

- - - 8< - - - 

2000: A0 35 B9 0D 20 99 FF 00
2008: 88 D0 F7 4C 00 01 84 FD
2010: A9 04 85 FE 85 FF 8D 03
2018: C0 8D 05 C0 B1 FD AA 49
2020: FF 91 FD D1 FD D0 11 8A
2028: 91 FD D1 FD D0 0A E6 FF
2030: E6 FE A5 FE C9 C0 D0 E4
2038: 8D 02 C0 8D 04 C0 A5 FF
2040: 4C DA FD 

- - - 8< - - - 

; -------- Data --------

ziPage      EQU $FC
zpPage      EQU $FD
znTotal     EQU $FF 


; -------- I/O --------

Dest        EQU $0100 ; Stack!!! Anywhere < $200 is OK
RDMAINRAM   EQU $C002 ; 2=OFF, 3=ON
WRMAINRAM   EQU $C004 ; 4=MAIN, 5=AUX


; -------- ROM --------

PRBYTE      EQU $FDDA


; -------- Code --------

            ORG $2000
Main
        LDY #End-Begin
Copy
        LDA Start-1,Y
        STA Dest -1,Y
        DEY
        BNE Copy
        JMP Dest

; -------- Moved to DEST --------
Start
        ORG $0100       ; DEST
Begin        
        STY zpPage      ; y = 0
        LDA #4          ; zpPage = 0x0400
        STA zpPage+1
        STA znTotal

        STA RDMAINRAM+1 ; read aux
        STA WRMAINRAM+1 ; write aux

CheckPage
        LDA (zpPage),Y  ; mem -> a
        TAX             ; save byte
        EOR #$FF
        STA (zpPage),Y  ; a^$FF -> mem
        CMP (zpPage),Y  ; Couldn't write to page, all done
        BNE Info

        TXA
        STA (zpPage),Y  ; a -> mem
        CMP (zpPage),Y  ; Could't verify original byte, all done
        BNE Info

        INC znTotal
        INC zpPage+1
        LDA zpPage+1
        CMP #$C0
        BNE CheckPage
Info
        STA RDMAINRAM   ; read main
        STA WRMAINRAM   ; write main
        LDA znTotal
        JMP PRBYTE
End

[toc] | [prev] | [next] | [standalone]


#4937

FromBrian Patrie <bpatrie@bellsouth.spamisicky.net>
Date2018-12-28 03:19 -0600
Message-ID<q04pq8$1jb6$2@gioia.aioe.org>
In reply to#4934
On 28/12/2018 00.08, Michael Pohoreski wrote:
> the following AuxMemSize utility will print the number of valid pages
> in AUX memory ($C0 = 192 pages of AUX RAM = 128 KB.

I'm confused.  To me a page is 256 bytes, 192 of which are 48 kiB.

[toc] | [prev] | [next] | [standalone]


#4939

FromMichael Pohoreski <michael.pohoreski@gmail.com>
Date2018-12-28 09:04 -0800
Message-ID<9d190d2a-13b1-4a8e-82ab-1a161f9bff7d@googlegroups.com>
In reply to#4937
>> > in AUX memory ($C0 = 192 pages of AUX RAM = 128 KB. 
> I'm confused.  To me a page is 256 bytes, 192 of which are 48 kiB. 

Yes, a page is 256 bytes.

I omitted the details of the return value: $C0 = 192 = detected 48 KB of AUX RAM. It was implied that one had already tested for the MAIN 64 KB, thus if you saw $C0 then you could infer 128 KB total RAM.

Sorry for the confusion.

[toc] | [prev] | [next] | [standalone]


#4940

FromJames Davis <JPD.Enterprises@outlook.com>
Date2018-12-28 09:27 -0800
Message-ID<cc06e19b-e6ee-4581-a622-55ae827d5668@googlegroups.com>
In reply to#4932
On Thursday, December 27, 2018 at 3:02:06 PM UTC-8, Marc Golombeck wrote:
> I am wondering how I can check for the size of the installed AUX RAM of an Apple II. I especially want to check if an Apple //e has 128kB or 64 kB installed. My first approach is not working at all and I wanted to ask if someone in this group has a hint about how to retrieve the amount of AUX RAM installed in a machine?

You should check for more than 128 KB, too.  Some of us have very large amounts of extra memory (that maybe used to setup large RAM disk-drives).  It is handled either as (64 KB) bank-switched memory or the other way.  (But, I forgot how the other way works!  I think its called Slinky memory, or something like that.)

[toc] | [prev] | [next] | [standalone]


#4941

FromMarc Golombeck <marc.andre.tichy@googlemail.com>
Date2018-12-28 13:37 -0800
Message-ID<7bfe891d-a106-49da-89bf-a7f956d2e2e2@googlegroups.com>
In reply to#4932
Okay I solved this issue by following some idea of Michael's second solution. I am copying parts of my code into AUX RAM after startup (MockingBoard playing algorithm and some other stuff). Triggering the switches and copying can be performed on every machine without resulting in a program crash so I needed to find a way in order to test if the code has been successfully copied into AUX RAM.

The solution is reading parts of the code and compare it to the original version in MAIN RAM which is quite obvious. If the copy action to AUX MEM was successful the code pairs match.

My question was where should I put the code snippet which does the comparison of the two memory areas. The solution was given in Michael's post by the idea of putting that code snippet into the stack area ($0100-$01FF) since this part of the memory (as well as the ZP) are shared between AUX and MAIN (as long as I do not activate the AUX ZP + STACK), hence, if anything went wrong with copying my code to AUX beforehand the algorithm will not crash when issuing a STA $C003 which switches AUX MEM on and MAIN MEM off and which will terminate program execution immediately if the code in AUX MEM is not identical to MAIN MEM.

At the moment it seems that I have a solution that works and I can distinguish between different machine types, CPU types and AUX memory sizes.

A DSK-image of the demo with machine-, CPU- and RAM-detection can be found here:

http://www.golombeck.eu/fileadmin/downloads/XMAS-DEMO_2018_48k.dsk

[toc] | [prev] | [next] | [standalone]


#4949

Fromgids.rs@sasktel.net
Date2019-01-08 12:39 -0800
Message-ID<e4051630-405c-4508-ac78-355778a778e4@googlegroups.com>
In reply to#4932
If you boot into Prodos, the byte at BF98 will tell if an 80-col card is installed and also tells if machine is 48kb. 64kb or 128 kb.  Also indicates machine type: II+, IIe, IIc and Apple III emulation

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.apple2.programmer


csiph-web