
 1000  *SAVE S.CALL.UTIL
 1010   
 1020  * 6/13/85 dcj
 1030   
 1040  * CALL 768{,pc=word,a=byte,x=byte,y=byte,p=byte}
 1050   
 1060  *--------------------------------
 1070   
 1080         .OR $300
 1090         .TF CU
 1100   
 1110  EQ.TOK .EQ $D0      Applesoft '=' token
 1120   
 1130  CHRGET .EQ $B1 -$C8 advance TXTPTR & fetch chr
 1140  CHRGOT .EQ $B7      just fetch chr
 1150   
 1160  FRMNUM .EQ $DD67    evaluate FP expression (FAC)
 1170  SYNCHR .EQ $DEC0    require chr in Acc syntax @ TXTPTR
 1180  SYNERR .EQ $DEC9    syntax error
 1190  GETBYT .EQ $E6F8    evaluate 8 bits @ TXTPTR (X-reg)
 1200  GETADR .EQ $E752    convert FAC to 16 bits in Acc & Y-reg (hi/lo)
 1210   
 1220  *--------------------------------
 1230   
 1240  CALL.UTIL
 1250   
 1260         JSR CHRGOT   get chr after call adr expression
 1270         CMP #','     comma indicates more stuff follows
 1280         BEQ .1       =>go continue parsing
 1290         LDA P.SAV    load registers
 1300         PHA           (P-reg via stack)
 1310         LDA ACC.SAV
 1320         LDX X.SAV
 1330         LDY Y.SAV
 1340         PLP
 1350         JMP (PC.SAV) go 4 it!
 1360   
 1370  * we got something to parse
 1380   
 1390  .1     JSR CHRGET   get chr after comma
 1400         CMP #'A'     (as in 'Acc')
 1410         BEQ .2       =>go get '=' & byte for Acc
 1420         CMP #'X'     (as in 'X-reg')
 1430         BEQ .3       =>go get '=' & byte for X-reg
 1440         CMP #'Y'     (as in 'Y-reg')
 1450         BEQ .4       =>go get '=' & byte for Y-reg
 1460         CMP #'P'     (as in P-reg or Program Counter)
 1470         BEQ .5       =>go get '=' or 'C='...
 1480         JMP SYNERR   razz
 1490   
 1500  * pickup Acc byte
 1510   
 1520  .2     JSR .7       require '=' (@ next) & fetch byte exp
 1530         STX ACC.SAV  stuff it
 1540         BVC CALL.UTIL ...always
 1550   
 1560  * pickup X-reg byte
 1570   
 1580  .3     JSR .7       require '=' (@ next) & fetch byte exp
 1590         STX X.SAV    stuff it
 1600         BVC CALL.UTIL ...always
 1610   
 1620  * pickup Y-reg byte
 1630   
 1640  .4     JSR .7       require '=' (@ next) & fetch byte exp
 1650         STX Y.SAV    stuff it
 1660         BVC CALL.UTIL ...always
 1670   
 1680  * Finish parsing 'P=' or 'PC='
 1690   
 1700  .5     JSR CHRGET   advance to next chr position & fetch it
 1710         CMP #'C'     (as in 'Program Counter')
 1720         BEQ .6       =>go get '=' & 16 bits for PC
 1730   
 1740  * pickup P-reg byte
 1750   
 1760         JSR .10      require '=' @ current chr position
 1770         JSR .8       fetch byte expression
 1780         STX P.SAV    stuff it
 1790         BVC CALL.UTIL ...always
 1800   
 1810  * pickup PC word
 1820   
 1830  .6     JSR .9       require '=' @ next chr position
 1840         JSR FRMNUM   fletch FP expression
 1850         JSR GETADR   convert FP expression to Acc & Y-reg (hi/lo)
 1860         STY PC.SAV   stuff 'em
 1870         STA PC.SAV+1
 1880         JMP CALL.UTIL no flag known...
 1890   
 1900  .7     JSR .9       require '=' @ next chr position
 1910   
 1920  .8     JSR GETBYT   fetch byte expression (2 X-reg)
 1930         CLV          to force branch
 1940         RTS
 1950   
 1960  .9     JSR CHRGET   1st advance to next chr position
 1970   
 1980  .10    LDA #EQ.TOK  require '=' before register expressions
 1990         JMP SYNCHR    (SYNTAX ERROR IF '=' NOT FOUND)
 2000   
 2010  *--------------------------------
 2020   
 2030  ACC.SAV    .DA #$00
 2040  X.SAV      .DA #$00
 2050  Y.SAV      .DA #$00
 2060  P.SAV      .DA #$04
 2070  PC.SAV     .DA $0000
 2080   
 2090  *--------------------------------

