ASM with acme.exe compiliert. how to start please.

All aspects of programming on the Commander X16.
Post Reply
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

ASM with acme.exe compiliert. how to start please.

Post by funkheld »

Hi good afternoon.
I have this ASM program from x16-programmers.
a prg is created with acme.exe.

How do you set the start address in the asm ?

load"float.prg",8 >>>>> is ok
how do you start prg?

Thanks.

Code: Select all

!to "float.prg", cbm

*=....????  How do you set the start address for the prg?

CHROUT = $ffd2
FOUT   = $fe06
FMULTT = $fe21
FDIV   = $fe24
CONUPK = $fe5a
MOVFM  = $fe63

 lda  #4
 sta  $01         
 lda  #<flt_two
 ldy  #>flt_two
 jsr  MOVFM
 lda  #<flt_g
 ldy  #>flt_g
 jsr  FDIV        
 lda  #<flt_time
 ldy  #>flt_time
 jsr  CONUPK      
 jsr  FMULTT      
 lda  #<flt_time
 ldy  #>flt_time
 jsr  CONUPK      
 jsr  FMULTT      
 jsr  FOUT        
 ; rom bank 4 (BASIC) contains the fp routines.
 ; FACC= g/2
 ; ARG = time
 ; FACC = g/2 * time
 ; again ARG = time
 ; FACC = g/2 * time * time
 ; to string
 ; print string in AY
 sta  $02
 sty  $03
 ldy  #0
loop:
 lda  ($02),y
 beq  done
 jsr  CHROUT
 iny
 bne  loop
done:
 rts
 
flt_g:      !byte  $84, $1c, $f5, $c2, $8f  ; float 9.81 
flt_time:   !byte  $83, $20, $00, $00, $00  ; float 5.0
flt_two:    !byte  $82, $00, $00, $00, $00  ; float 2.0
User avatar
desertfish
Posts: 1123
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: ASM with acme.exe compiliert. how to start please.

Post by desertfish »

I don't know the ACME assembler dialect, but usually to set the start address you do

* = $2000

or perhaps:

.org $2000

Depending on what the assembler produces, you can then load that in Basic like so:

LOAD "FLOAT.PRG",8,1

and start it with

SYS $2000


The ",1" parameter for the LOAD command is to tell Basic to load the program not as a basic program but as a machine code program at the address it is assembled to.
There are also ways to create a "normal" basic program that you can simply LOAD and then RUN, but that requires a so called "basic stub" at the start of the program which need to start at $0801 in this case. There are many ways to do this and I don't know what would be Acme's way - maybe someone else knows this detail.
TomXP411
Posts: 1803
Joined: Tue May 19, 2020 8:49 pm

Re: ASM with acme.exe compiliert. how to start please.

Post by TomXP411 »

The Commander X16 starts is BASIC space at $801, so if your program has the usual 0 SYS 2064 BASIC stub, then you'd want to use * = $0801.

Otherwise, for small routines (less than 1 KB) I'd suggest using the Golden RAM at $400. The block at $400-$7FF is reserved for machine language routines.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: ASM with acme.exe compiliert. how to start please.

Post by funkheld »

Hello thanks .

thank you for your help.
wonderful , is ok.

greeting
Attachments
float.jpg
float.jpg (56.95 KiB) Viewed 638 times
Last edited by funkheld on Mon Feb 26, 2024 9:16 pm, edited 1 time in total.
Post Reply