qdosmsq:vectors:gtint

CA_ or SB_ GTINT/GTFP/GTSTR/GTLIN - Vectors $112/$114/$116/$118

These vectors evaluate parameters to SuperBASIC procedures and functions and put them on the maths stack.

Call ParametersReturn Parameters
D0.LUnusedD0.LError code.
D1.LUnused D1.LCorrupted.
D2.LUnused D2.LCorrupted.
D3.LUnused D3.WNumber of parameters fetched.
D4.LUnused D4.LCorrupted.
D6.LUnused D6.LCorrupted.
A0.LUnused A0.LCorrupted.
A1.LUnused A1.LUpdated pointer to maths stack
A2.LUnused A2.LCorrupted.
A3.LPointer to first parameterA3.LPreserved.
A5.LPointer to last parameterA5.LPreserved.
A6.LSuperBASIC pointer A6.LCould be changed.
ERR_BPBad parameter.
ERR_XPError in expression.
  • All registers not shown above are not used on entry and are preserved on exit.
  • The parameters are stored in the name table between (A3,A6.L) and (A5,A6.L). Thus A5.L points to the end of the last parameter.
  • The final value of the maths stack is at (A1,A6.L). The value in A1 is also set in BV_RIP(A6).
  • The four routines process the following four types of parameter:
    • GTINT - integer.
    • GTFP - floating point.
    • GTSTR - string.
    • GTLIN - long integer.
  • The maths stack is set to its initial position after procedures and after errors in functions. It is up to the programmer to tidy the maths stack after a function.

In this example we need three integer parameters followed by two long integers.

       lea       5*8(a3),a0      ; To check for 5 parameters
       cmpa.l    a0,a5
       bne       bad_parm ---->  ; There were not 5 parameters
       movea.l   a5,a4           ; Keep the pointer to the end of parameters
       lea       3*8(a3),a5      ; Arrange to input 3 parameters
       movea.w   CA_GTINT,a2
       jsr       (a2)            ; Process the parameters
       bne       bad_parm ---->  ; (No need to test D0.L)
       subq.w    #3,d3           ; Three parameters? . .
       bne       bad_parm ---->  ; . . no!
       movem.l   (a1,a6.l),d5-7  ; Extract parameters to D5 to D7
       addq.l    #6,bv_rip(a6)   ; Tidy the maths stack
       movea.l   a5,a3           ; Point to the last two parameters
       movea.l   a4,a5           ; Restore A5
       movea.w   CA_GTLIN,a2
       jsr       (a2)            ; Process the remaining 2 parameters
       bne       bad_parm ---->
       subq.w    #2,d3           ; Two parameters? . .
       bne       bad_parm ---->  ; . . no 
       addq.l    #8,bv_rip(a6)   ; Tidy the maths stack
  • qdosmsq/vectors/gtint.txt
  • Last modified: 2009/02/11 10:33
  • by george.gwilt