[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Access other cards/JSRs/data from CP/M and the Applicard



Hello, I searched a bit and have been unable to find a definitive
answer.  With the Microsoft Softcard and clones I can access 6502
routines and exchange data.  This is well documented in the Microsoft
Softcard documentation.  So far I have been unable to find the same
for the Applicard.

For example if I want to read the time from my Thunderclock plus card
I can do the following with a MS Softcard/clone:

Aztec C for CP/M:

#asm
tcp_asm_
                        ;6502 LDA #$A3 ; '#' or '>' + 128
    lxi     h,2         ;first arg 2 + sp
    dad     sp          ;add stack pointer to HL
    mov     a,m         ;move HL to A
    aci     128         ;set MSB high (it is an Apple thing)
    sta     0f045h      ;load 6502 A (Z80 location 0x0F045) with Z80 A
                        ;6502 JSR $C70B ;write # to set 'numeric
                        ;read mode'
    lxi     h,0c70bh    ;load thunder clock plus (TCP) write entry
                        ;point in HL
    shld    0f3d0h      ;load HL (TCP write entry point) into location
                        ;0F3D0 for 6502 sub call
    lhld    0f3deh      ;load softcard address (0F3DE) in HL
    mov     m,a         ;write anything to (HL = 0F3DE) to trigger
6502
                        ;call to C70B
                        ;6502 JSR $C708 ;load time into buffer $200
    lxi     h,0c708h    ;same as above to read using C708 (not B)
    shld    0f3d0h
    lhld    0f3deh
    mov     m,a
    ret
#endasm

#define APPLE_REG_A 0xF045
#define TCP_WRITE   0xC70B
#define TCP_READ    0xC708
#define SOFTCARD    0xF3DE
#define APPLE_SUB   0xF3D0

tcp_c(c)
char c;
{
    *((char *)APPLE_REG_A) = c + 128;   /* store # or > into 6502 REG
A */
    *((int *)APPLE_SUB) = TCP_WRITE;    /* store TCP write address to
exec with write to SOFTCARD */
    *((int *)*((int *)SOFTCARD)) = 0;   /* write to SOFTWARE address
JSR TCP WRITE */
    *((int *)APPLE_SUB) = TCP_READ;     /* store TCP write address to
exec with write to SOFTCARD */
    *((int *)*((int *)SOFTCARD)) = 0;   /* write to SOFTWARE address
JSR TCP READ */
}

I can then call tcp_c('#') or tcp_asm('#') to have the time loaded
into $200, where I can then read from CP/M $F200.

How can I do the same with the Applicard?

Thanks.