1 comment "subroutine prologue" 2 .macro gdbasm_enter 3 ldx _.frame 4 pshx 5 sts _.frame 6 .endm 7 8 comment "subroutine epilogue" 9 .macro gdbasm_leave 10 pulx 11 stx _.frame 12 rts 13 .endm 14 15 .macro gdbasm_call subr 16 jsr \subr 17 .endm 18 19 .macro gdbasm_several_nops 20 nop 21 nop 22 nop 23 nop 24 .endm 25 26 comment "exit (0)" 27 .macro gdbasm_exit0 28 clra 29 clrb 30 wai 31 .endm 32 33 comment "crt0 startup" 34 .macro gdbasm_startup 35 .sect .data 36 .globl _.frame 37 _.frame: .word 0 38 .previous 39 lds #0x2000 40 ; the linker script maps the data section in ROM (LMA) for its initial 41 ; content and in RAM (VMA) for its runtime value. We have to do 42 ; what the default crt0 does: copy the ROM part in RAM. 43 ; (otherwise any 'globalvar' appears uninitialized) 44 ldx #__data_image 45 ldy #__data_section_start 46 bra Start_map 47 Loop: 48 ldaa 0,x 49 staa 0,y 50 inx 51 iny 52 Start_map: 53 cpx #__data_image_end 54 blo Loop 55 Done: 56 clr _.frame 57 clr _.frame+1 58 .endm 59 60 comment "Declare a data variable" 61 .purgem gdbasm_datavar 62 .macro gdbasm_datavar name value 63 .data 64 \name: 65 .word \value 66 .endm 67