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


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

How to check for AUX RAM size within an own program

Newsgroups comp.sys.apple2.programmer
Date 2018-12-27 22:08 -0800
References <e2642e5d-48a6-4d0b-8451-4d9b41c36417@googlegroups.com>
Message-ID <7914598d-e4cd-4bd5-b60b-0007906a5dd8@googlegroups.com> (permalink)
Subject How to check for AUX RAM size within an own program
From Michael Pohoreski <michael.pohoreski@gmail.com>

Show all headers | View raw


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

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


Thread

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

csiph-web