; trapmain.asm ; ; this file contains the shell for setting up the ; stack with paramaters for running the "traparea" ; subroutine. ; first task is the general setup: ; set up the stack and init the registers. org $3000 start: lds #$2fff ;init the stack pointer ldy #0 ldx #0 ldd #0 ; Set up the stack by pushing the paramaters onto ; the stack in order, then calling the subroutine. ldaa parama psha ldaa paramb psha ldaa paramh psha pshx ; two bytes for the result jsr traparea ; when we return from the subroutine, pop off the ; result and store it in "result", then clear the ; stack. pulx stx result pula pula pula ; we're done, set up the stop bit and stop. done: tpa anda #$7f tap stop ; at this point, load the subroutine $INCLUDE 'a6q2.asm' ; here's the data area org $0000 parama db !85 paramb db !30 paramh db !16 result dw !0 ; result should be 0.5*16(85+30) ; = 8(115) ; = 184 = 0398h ; and finally set up the reset vector org $fffe reset: dw start