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


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

PLASMA/Acme oddity

Newsgroups comp.sys.apple2.programmer
Date 2016-04-06 11:28 -0700
Message-ID <6f438e11-3d4b-413c-afe1-e199203ba480@googlegroups.com> (permalink)
Subject PLASMA/Acme oddity
From mike.finger@gmail.com

Show all headers | View raw


I have a question related to PLASMA and, by extension, the ACME assembler. 

The issue I'm running into is that I have some inline assembly in a function in PLASMA that is using labels. 

I trying to put in the No-Slot Clock time routines I borrowed from the ADTPro source.  I converted it to work with ACME, but it seems to be computing absolute label offsets based on the passed in program counter and not by location within the assembly code. 

Here is an example (PLASMA): 
asm _gettime 
L0260   lda #$00 
        sta L02DE 
        lda #$03 
L0267   ora #$C0 
        sta L031F 
L026C   sta L0322 
        sta L0331 
        sta L033F 
        lda #$03 
        sta L02DF 
        one L0292 
... 
L02DE   brk 
L02DF   brk 
L02E0   brk 

When I compile it and load it up in PLASMA, I have the PLASMA code print out the address of _gettime, which spits out $4047 as the address of _gettime 

Looking at the in memory code I see this: 
4047-   A9 00           LDA   #$00 
4049-   8D B2 10        STA   $10B2 
404C-   A9 03           LDA   #$03 
4067-   09 C0           ORA   #$C0 
4069-   8D F3 10        STA   $10F3 
406C-   8D F6 10        STA   $10F6 
406F-   8D 05 11        STA   $1105 
4072-   8D 13 11        STA   $1113 
4075-   A9 03           LDA   #$03 
4077-   8D B3 10        STA   $10B3 
407A-   D0 16           BNE   $4079 


The STA on 4049 should be $40C5 but it's $10B2, same with the other absolute address labels. 407A is correct, but that is a relative address. 

It looks like offset that are too large for a relative offset are based on the current value of the PC. 

I can get the offsets to be right if I run ACME with --setpc 16401 but then the execution crashes even before outputting the address value.  Which I'd expect since I'm sure It messes up the entry point. 

The loaded code runs correct (well, doesn't crash) if I do it from the monitor after it crashes: 

*4047g 
* 

Has anyone run into this?  Am I doing something wrong? 

FWIW, I did originally load code found in here for NSC time byte for byte (via memcpy) to $260 and it runs fine, except PLASMA uses the zero page for things so we end up walking on each other.   

Thanks for any help!

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


Thread

PLASMA/Acme oddity mike.finger@gmail.com - 2016-04-06 11:28 -0700
  Re: PLASMA/Acme oddity David Schmenk <dschmenk@gmail.com> - 2016-04-07 08:42 -0700
    Re: PLASMA/Acme oddity David Schmenk <dschmenk@gmail.com> - 2016-04-07 08:51 -0700
      Re: PLASMA/Acme oddity Michael Finger <mike.finger@gmail.com> - 2016-04-07 09:29 -0700
        Re: PLASMA/Acme oddity David Schmenk <dschmenk@gmail.com> - 2016-04-07 11:17 -0700
          Re: PLASMA/Acme oddity Michael Finger <mike.finger@gmail.com> - 2016-04-08 11:13 -0700
            Re: PLASMA/Acme oddity Michael Finger <mike.finger@gmail.com> - 2016-04-08 11:14 -0700
            Re: PLASMA/Acme oddity David Schmenk <dschmenk@gmail.com> - 2016-04-08 13:19 -0700
              Re: PLASMA/Acme oddity Michael Finger <mike.finger@gmail.com> - 2016-04-08 21:45 -0700
                Re: PLASMA/Acme oddity David Schmenk <dschmenk@gmail.com> - 2016-04-09 08:56 -0700
                Re: PLASMA/Acme oddity David Schmenk <dschmenk@gmail.com> - 2016-04-09 09:14 -0700
                Re: PLASMA/Acme oddity Michael Finger <mike.finger@gmail.com> - 2016-04-09 11:52 -0700
                Re: PLASMA/Acme oddity D Finnigan <dog_cow@macgui.com> - 2016-04-09 20:09 +0000
                Re: PLASMA/Acme oddity Michael Finger <mike.finger@gmail.com> - 2016-04-11 08:42 -0700

csiph-web