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