User Tools

Site Tools


base:runasmfrombasic

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
base:runasmfrombasic [2017-07-28 12:26] – Simple stub. pararaumbase:runasmfrombasic [2017-07-28 12:44] – Using 57/58 from zeropage pararaum
Line 48: Line 48:
 As can be easily seen the SYS to address 2064 starts the code at $0810. As can be easily seen the SYS to address 2064 starts the code at $0810.
  
 +==== Fancier ways to call the Assembler code ====
  
 +This is the canonical way to call an Assembler code. Usually you precalculate the entry or you have to be very careful when changing the basic stub. Another nice way to call the assembler code is the following stub:
 +
 +  .word $0801
 +  * = $0801
 + 
 +  basic: .(
 +  .word end_of_basic
 +  .word main
 +  .byte $9e,$20,$c2
 +  .asc "(57)",$aa,"256",$ac,$c2,"(58)"
 +  end_of_basic:
 +  .byte 0,0,0
 +  .)
 +  
 +  main: lda #$0d
 +  sta $d020
 +      rts
 +
 +This code uses the zeropage locations $39/$3A which contain the current line number in the basic program, see [[https://www.c64-wiki.com/wiki/zeropage|zeropage description]]. The line number was selected to be the entry of the main routine.
base/runasmfrombasic.txt · Last modified: 2017-07-28 12:53 by pararaum