Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (777)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
  JavaGaming.org - Pastebin



Author: EgonOlsen (posted 2018-06-10 19:43:48, viewed 2124 times)

1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34   35   36   37   38   39   40   41   42   43   44   45   46   47   48   49   50   51   52   53   54   55   56   57   58   59   60   61   62   63   64   65   66   67   68   69   70   71   72   73   74   75   76   77   78   79   80   81   82   83   84   85   86   87   88   89   90   91   92   93   94   95   96   97   98   99   100   101   102   103   104   105   106   107   108   109   110   111   112   113   114   115   116   117   118   119   120   121   122   123   124   125   126   127   128   129   130   131   132   133   134   135   136   137   138   139   140   141   142   143   144   145   146   147   148   149   150   151   152   153   154   155   156   157   158   159   160   161   162   163   164   165   166   167   168   169   170   171   172   173   174   175   176   177   178   179   180   181   182   183   184   185   186   187   188   189   190   191   192   193   194   195   196   197   198   199   200   201   202   203   204   205   206   207   208   209   210   211   212   213   214   215   216   217   218   219   220   221   222   223   224   225   226   227   228   229   230   231   232   233   234   235   236   237   238   239   240   241   242   243   244   245   246   247   248   249   250   251   252   253   254   255   256   257   258   259   260   261   262   263   264   265   266   267   268   269   270   271   272   273   274   275   276   277   278   279   280   281   282   283   284   285   286   287   288   289   290   291   292   293   294   295   296   297   298   299   300   301   302   303   304   305   306   307   308   309   310   311   312   313   314   315   316   317   318   319   320   321   322   323   324   325   326   327   328   329   330   331   332   333   334   335   336   337   338   339   340   341   342   343   344   345   346   347   348   349   350   351   352   353   354   355   356   357   358   359   360   361   362   363   364   365   366   367   368   369   370   371   372   373   374   375   376   377   378   379   380   381   382   383   384   385   386   387   388   389   390   391   392   393   394   395   396   397   398   399   400   401   402   403   404   405   406   407   408   409   410   411   412   413   414   415   416   417   418   419   420   421   422   423   424   425   426   427   428   429   430   431   432   433   434   435   436   437   438   439   440   441   442   443   444   445   446   447   448   449   450   451   452   453   454   455   456   457   458   459   460   461   462   463   464   465   466   467   468   469   470   471   472   473   474   475   476   477   478   479   480   481   482   483   484   485   486   487   488   489   490   491   492   493   494   495   496   497   498   499   500   501   502   503   504   505   506   507   508   509   510   511   512   513   514   515   516   517   518   519   520   521   522   523   524   525   526   527   528   529   530   531   532   533   534   535   536   537   538   539   540   541   542   543   544   545   546   547   548   549   550   551   552   553   554   555   556   557   558   559   560   561   562   563   564   565   566   567   568   569   570   571   572   573   574   575   576   577   578   579   580   581   582   583   584   585   586   587   588   589   590   591   592   593   594   595   596   597   598   599   600   601   602   603   604   605   606   607   608   609   610   611   612   613   614   615   616   617   618   619   620   621   622   623   624   625   626   627   628   629   630   631   632   633   634   635   636   637   638   639   640   641   642   643   644   645   646   647   648   649   650   651   652   653   654   655   656   657   658   659   660   661   662   663   664   665   666   667   668   669   670   671   672   673   674   675   676   677   678   679   680   681   682   683   684   685   686   687   688   689   690   691   692   693   694   695   696   697   698   699   700   701   702   703   704   705   706   707   708   709   710   711   712   713   714   715   716   717   718   719   720   721   722   723   724   725   726   727   728   729   730   731   732   733   734   735   736   737   738   739   740   741   742   743   744   745   746   747   748   749   750   751   752   753   754   755   756   757   758   759   760   761   762   763   764   765   766   767   768   769   770   771   772   773   774   775   776   777   778   779   780   781   782   783   784   785   786   787   788   789   790   791   792   793   794   795   796   797   798   799   800   801   802   803   804   805   806   807   808   809   810   811   812   813   814   815   816   817   818   819   820   821   822   823   824   825   826   827   828   829   830   831   832   833   834   835   836   837   838   839   840   841   842   843   844   845   846   847   848   849   850   851   852   853   854   855   856   857   858   859   860   861   862   863   864   865   866   867   868   869   870   871   872   873   874   875   876   877   878   879   880   881   882   883   884   885   886   887   888   889   890   891   892   893   894   895   896   897   898   899   900   901   902   903   904   905   906   907   908   909   910   911   912   913   914   915   916   917   918   919   920   921   922   923   924   925   926   927   928   929   930   931   932   933   934   935   936   937   938   939   940   941   942   943   944   945   946   947   948   949   950   951   952   953   954   955   956   957   958   959   960   961   962   963   964   965   966   967   968   969   970   971   972   973   974   975   976   977   978   979   980   981   982   983   984   985   986   987   988   989   990   991   992   993   994   995   996   997   998   999   1000   1001   1002   1003   1004   1005   1006   1007   1008   1009   1010   1011   1012   1013   1014   1015   1016   1017   1018   1019   1020   1021   1022   1023   1024   1025   1026   1027   1028   1029   1030   1031   1032   1033   1034   1035   1036   1037   1038   1039   1040   1041   1042   1043   1044   1045   1046   1047   1048   1049   1050   1051   1052   1053   1054   1055   1056   1057   1058   1059   1060   1061   1062   1063   1064   1065   1066   1067   1068   1069   1070   1071   1072   1073   1074   1075   1076   1077   1078   1079   1080   1081   1082   1083   1084   1085   1086   1087   1088   1089   1090   1091   1092   1093   1094   1095   1096   1097   1098   1099   1100   1101   1102   1103   1104   1105   1106   1107   1108   1109   1110   1111   1112   1113   1114   1115   1116   1117   1118   1119   1120   1121   1122   1123   1124   1125   1126   1127   1128   1129   1130   1131   1132   1133   1134   1135   1136   1137   1138   1139   1140   1141   1142   1143   1144   1145   1146   1147   1148   1149   1150   1151   1152   1153   1154   1155   1156   1157   1158   1159   1160   1161   1162   1163   1164   1165   1166   1167   1168   1169   1170   1171   1172   1173   1174   1175   1176   1177   1178   1179   1180   1181   1182   1183   1184   1185   1186   1187   1188   1189   1190  
SGNFAC = $BC2B
MEMARG = $BA8C
ARGADD = $B86A
ARGAND = $AFE9
ARGDIV = $BB14
FACMUL = $BA30
FACADD = $B867
FACLOG = $B9EA
FACSQR = $BF71
FACEXP = $BFED
FACABS = $BC58
FACSIN = $E26B
FACCOS = $E264
FACTAN = $E2B4
FACATN = $E30E
FACSGN = $BC39
FACRND = $E097
FACWORD = $B7F7
FACDIV = $BB0F
BASINT = $BCCC
FACPOW = $BF7B
FACSUB = $B853
FACOR = $AFE6
FACMEM = $BBD7
ARGFAC = $BBFC
FACSTR = $BDDF
FACINT = $B1AA
RNDFAC = $BC1B
REALFAC = $BBA2
INTFAC = $B391
WRITETIS = $A9E7
GETTI = $BE68
GETTIME = $AF7E
COPYTIME = $AF87
TI2FAC = $AF84
CHROUT = $FFD2
PRINTSTRS = $AB25
VALS = $B7B5
CMPFAC = $BC5B
BYTEFAC = $B3A2
CRSRPOS = $FFF0
CRSRRIGHT = $AB3B
GETIN = $FFE4
INPUT = $A560
OPENCH = $F34A
CLOSECH = $F291
CHKIN = $FFC6
CHKOUT = $FFC9
CLRCH = $FFCC
LOADXX = $F4B8
SAVEXX = $F5FA
TWAIT = $F6ED
TMP_ZP = 105
TMP2_ZP = 107
TMP3_ZP = 34
;make sure that JUMP_TARGET's low can't be $ff
JUMP_TARGET = 69
TMP_REG=71
*=2072
TSX
STX SP_SAVE
; *** CODE ***
PROGRAMSTART:
JSR START
;
LINE_1:
;
;
LINE_5:
;
LDA #<CONST_0
LDY #>CONST_0
STA A_REG
STY A_REG+1
JSR STROUTBRK
; Optimizer rule: STROUT + LINEBRK/1
;
LINE_10:
;
;
LINE_11:
;
LDA #<CONST_1
LDY #>CONST_1
JSR REALFAC
; Optimizer rule: Direct loading of values into FAC/3
; FAC to integer in Y/A
JSR FACWORD
STY MOVBSELF1+1
STA MOVBSELF1+2
LDA #$1C
MOVBSELF1:
STA $FFFF
;
LINE_12:
;
LDY CONST_3
STY 2042
; Optimizer rule: Simple POKE/2
LDY CONST_3
STY 2043
; Optimizer rule: Simple POKE/2
LDY CONST_3
STY 2044
; Optimizer rule: Simple POKE/2
;
LINE_20:
;
LDA #<CONST_4R
LDY #>CONST_4R
JSR REALFACPUSH
; Optimizer rule: Load and PUSH combined/1
LDA #<CONST_5R
LDY #>CONST_5R
JSR REALFACPUSH
; Optimizer rule: Load and PUSH combined/1
LDA #$0
STA $61
; Optimizer rule: Direct loading of 0/2
; Optimizer rule: Avoid INTEGER->REAL conversion/3
LDY #>Y_REG
LDX #<Y_REG
JSR FACMEM
; Optimizer rule: FAC into REG?, REG? into FAC (2)/3
LDX #<VAR_N
LDY #>VAR_N
; FAC to (X/Y)
JSR FACMEM
LDA #<VAR_N
LDY #>VAR_N
STA A_REG
STY A_REG+1
LDA #<FORLOOP0
STA JUMP_TARGET
LDA #>FORLOOP0
STA JUMP_TARGET+1
JSR INITFOR
FORLOOP0:
JSR READNUMBER
LDA #<Y_REG
LDY #>Y_REG
; Real in (A/Y) to FAC
JSR REALFAC
LDX #<VAR_Q
LDY #>VAR_Q
; FAC to (X/Y)
JSR FACMEM
LDA #<VAR_N
LDY #>VAR_N
JSR REALFAC
LDA #<CONST_7
LDY #>CONST_7
JSR MEMARG
JSR ARGADD
; Optimizer rule: Highly simplified loading for calculations/7
; Optimizer rule: FAC into REG?, REG? into FAC/0
JSR PUSHREAL
LDA #<VAR_Q
LDY #>VAR_Q
STY TMP3_ZP+1
LDX #<X_REG
LDY #>X_REG
JSR COPY2_XYA
; Optimizer rule: Memory saving copy/4
; Optimizer rule: Quick copy into REG/7
JSR POPREAL
JSR FACWORD
; Optimizer rule: POP, REG0, VAR0 -> to WORD/2
STY MOVBSELF5+1
STA MOVBSELF5+2
LDA #<X_REG
LDY #>X_REG
; Real in (A/Y) to FAC
JSR REALFAC
; FAC to integer in Y/A
JSR FACWORD
MOVBSELF5:
STY $FFFF
LDA #0
STA A_REG
STA A_REG+1
JSR NEXT
; Optimizer rule: NEXT with no variable name simplified/4
LDA A_REG
BNE RBEQ_0
JMP (JUMP_TARGET)
; Optimizer rule: NEXT check simplified/4
RBEQ_0:
;
LINE_25:
;
LDA #<CONST_8
LDY #>CONST_8
JSR REALFAC
; Optimizer rule: Direct loading of values into FAC/3
; FAC to integer in Y/A
JSR FACWORD
STY MOVBSELF6+1
STA MOVBSELF6+2
LDA #$C
MOVBSELF6:
STA $FFFF
LDA #<CONST_10
LDY #>CONST_10
JSR REALFAC
; Optimizer rule: Direct loading of values into FAC/3
; FAC to integer in Y/A
JSR FACWORD
STY MOVBSELF7+1
STA MOVBSELF7+2
LDA #$C
MOVBSELF7:
STA $FFFF
;
LINE_30:
;
LDA #<CONST_11R
LDY #>CONST_11R
JSR REALFACPUSH
; Optimizer rule: Load and PUSH combined/1
LDA #<CONST_5R
LDY #>CONST_5R
JSR REALFACPUSH
; Optimizer rule: Load and PUSH combined/1
LDA #0
STA  VAR_X
STA  VAR_X+1
; Optimizer rule: Simplified setting to 0/3
LDA #<VAR_X
LDY #>VAR_X
STA A_REG
STY A_REG+1
LDA #<FORLOOP1
STA JUMP_TARGET
LDA #>FORLOOP1
STA JUMP_TARGET+1
JSR INITFOR
FORLOOP1:
;
LINE_40:
;
LDA #<CONST_12
LDY #>CONST_12
JSR REALFACPUSH
; Optimizer rule: Load and PUSH combined/1
LDA #<VAR_X
LDY #>VAR_X
STY TMP3_ZP+1
LDX #<X_REG
LDY #>X_REG
JSR COPY2_XYA
; Optimizer rule: Memory saving copy/4
; Optimizer rule: Quick copy into REG/7
JSR POPREAL
JSR FACWORD
; Optimizer rule: POP, REG0, VAR0 -> to WORD/2
STY MOVBSELF8+1
STA MOVBSELF8+2
LDA #<X_REG
LDY #>X_REG
; Real in (A/Y) to FAC
JSR REALFAC
; FAC to integer in Y/A
JSR FACWORD
MOVBSELF8:
STY $FFFF
;
LINE_48:
;
LDA #<CONST_13
LDY #>CONST_13
JSR REALFACPUSH
; Optimizer rule: Load and PUSH combined/1
LDA #<VAR_X
LDY #>VAR_X
STY TMP3_ZP+1
LDX #<X_REG
LDY #>X_REG
JSR COPY2_XYA
; Optimizer rule: Memory saving copy/4
; Optimizer rule: Quick copy into REG/7
JSR POPREAL
JSR FACWORD
; Optimizer rule: POP, REG0, VAR0 -> to WORD/2
STY MOVBSELF9+1
STA MOVBSELF9+2
LDA #<X_REG
LDY #>X_REG
; Real in (A/Y) to FAC
JSR REALFAC
; FAC to integer in Y/A
JSR FACWORD
MOVBSELF9:
STY $FFFF
;
LINE_50:
;
LDA #<CONST_14
LDY #>CONST_14
JSR REALFACPUSH
; Optimizer rule: Load and PUSH combined/1
LDA #<VAR_X
LDY #>VAR_X
STY TMP3_ZP+1
LDX #<X_REG
LDY #>X_REG
JSR COPY2_XYA
; Optimizer rule: Memory saving copy/4
; Optimizer rule: Quick copy into REG/7
JSR POPREAL
JSR FACWORD
; Optimizer rule: POP, REG0, VAR0 -> to WORD/2
STY MOVBSELF10+1
STA MOVBSELF10+2
LDA #<X_REG
LDY #>X_REG
; Real in (A/Y) to FAC
JSR REALFAC
; FAC to integer in Y/A
JSR FACWORD
MOVBSELF10:
STY $FFFF
;
LINE_58:
;
LDA #<CONST_15
LDY #>CONST_15
JSR REALFAC
; Optimizer rule: Direct loading of values into FAC/3
; FAC to integer in Y/A
JSR FACWORD
STY MOVBSELF11+1
STA MOVBSELF11+2
LDA #$64
MOVBSELF11:
STA $FFFF
;
LINE_60:
;
LDA #<VAR_X
LDY #>VAR_X
STA A_REG
STY A_REG+1
JSR NEXT
LDA A_REG
BNE RBEQ_1
JMP (JUMP_TARGET)
; Optimizer rule: NEXT check simplified/4
RBEQ_1:
;
LINE_70:
;
JMP LINE_30
;
LINE_200:
;
;
LINE_210:
;
;
LINE_220:
;
;
LINE_230:
;
;
LINE_240:
;
JSR END
RTS
; *** SUBROUTINES ***
;###################################
START      LDA #<FPSTACK
LDY #>FPSTACK
STA FPSTACKP
STY FPSTACKP+1
LDA #<FORSTACK
LDY #>FORSTACK
STA FORSTACKP
STY FORSTACKP+1
LDA #0
STA CONCATBUFP
LDA #<STRBUF
LDY #>STRBUF
STA STRBUFP
STY STRBUFP+1
STA HIGHP
STY HIGHP+1
LDA #0
STA LASTVAR
STA LASTVAR+1
JSR INITVARS
LDA #0
STA CMD_NUM
STA CHANNEL
TAY
TAX
STA $C6
JSR RESTORE
CLC
RTS
;###################################
;###################################
INITNARRAY
STA TMP_ZP
STY TMP_ZP+1
LDY #0
NINITLOOP   LDA #0
STA (TMP_ZP),Y
INC TMP_ZP
BNE NLOOPNOV
INC TMP_ZP+1
NLOOPNOV   SEC
LDA TMP2_ZP
SBC #1
STA TMP2_ZP
BCS NLOOPNOV2
DEC TMP2_ZP+1
NLOOPNOV2   LDA TMP2_ZP
BNE NINITLOOP
LDA TMP2_ZP+1
BNE NINITLOOP
RTS
;###################################
;###################################
INITSTRARRAY
STA TMP_ZP
STY TMP_ZP+1
SINITLOOP   LDY #0
LDA #<EMPTYSTR
STA (TMP_ZP),Y
LDA #>EMPTYSTR
INY
STA (TMP_ZP),Y
CLC
LDA TMP_ZP
ADC #2
STA TMP_ZP
BCC SLOOPNOV1
INC TMP_ZP+1
SLOOPNOV1   SEC
LDA TMP2_ZP
SBC #2
STA TMP2_ZP
BCS SLOOPNOV2
DEC TMP2_ZP+1
SLOOPNOV2   LDA TMP2_ZP
BNE SINITLOOP
LDA TMP2_ZP+1
BNE SINITLOOP
RTS
;###################################
;###################################
INITSPARAMS   SEC
SBC #2
STA TMP_ZP
TYA
SBC #0
STA TMP_ZP+1
LDY #0
LDA (TMP_ZP),Y
STA TMP2_ZP
INY
LDA (TMP_ZP),Y
STA TMP2_ZP+1
RTS
;##################################
;##################################
INITSTRVARS   LDA #<STRINGVARS_START      ; Reset all string variables...
LDY #>STRINGVARS_START
CMP #<STRINGVARS_END
BNE INITIT1
CPY #>STRINGVARS_END
BNE INITIT1
JMP INITSA2               ; No string variables at all
INITIT1      STA TMP_ZP
STY TMP_ZP+1
LDY #0
INITSTRLOOP   LDA #<EMPTYSTR
STA (TMP_ZP),Y
INY
LDA #>EMPTYSTR
STA (TMP_ZP),Y
DEY
LDA TMP_ZP
CLC
ADC #2
STA TMP_ZP
LDA TMP_ZP+1
ADC #0
STA TMP_ZP+1
CMP #>STRINGVARS_END
BNE INITSTRLOOP
LDA TMP_ZP
CMP #<STRINGVARS_END
BNE INITSTRLOOP
INITSA2      LDA #<STRINGARRAYS_START   ; ...and all string arrays
LDY #>STRINGARRAYS_START
CMP #<STRINGARRAYS_END
BNE ARRAYLOOP
CPY #>STRINGARRAYS_END
BNE ARRAYLOOP
RTS                     ;...no string array at all
ARRAYLOOP   CLC
ADC #3
BCC ARRAYSKIP1
INY
ARRAYSKIP1   CPY #>STRINGARRAYS_END
BCC ARRAYSKIP2
CMP #<STRINGARRAYS_END
BCS ARRAYQUIT
ARRAYSKIP2   STA TMP_REG
STY TMP_REG+1
JSR INITSPARAMS
LDA TMP_REG
LDY TMP_REG+1
JSR INITSTRARRAY
LDA TMP_ZP
LDY TMP_ZP+1
JMP ARRAYLOOP
ARRAYQUIT   RTS
;###################################
;###################################
END         RTS
;###################################
;###################################
RESTORE      LDA #<DATAS
LDY #>DATAS
STA DATASP
STY DATASP+1
RTS
;###################################
;###################################
REROUTE      LDA CMD_NUM      ; if CMD mode, enable channel output
BEQ REROUTECMD
TAX
STA CHANNEL
JMP CHKOUT
REROUTECMD   RTS
;###################################
;###################################
RESETROUTE   LDA CMD_NUM      ; if CMD mode, disable channel output
BEQ RESETROUTECMD
JMP CLRCH
RESETROUTECMD
RTS
;###################################
;###################################
STROUTBRK   JSR REROUTE
LDA A_REG
STA $22
LDA A_REG+1
STA $23
LDY #0
LDA ($22),Y
TAX
INC $22
BNE PRINTSTR2
INC $23
PRINTSTR2   JSR PRINTSTRS
LDA HIGHP         ; Update the memory pointer to the last actually assigned one
STA STRBUFP
LDA HIGHP+1
STA STRBUFP+1
LDA #0
STA CONCATBUFP   ; Reset the work buffer
LDA #$0D
JSR CHROUT
JMP RESETROUTE    ;RTS is implicit
;###################################
;###################################
INITFOR      LDA FORSTACKP
STA TMP_ZP
LDA FORSTACKP+1
STA TMP_ZP+1
LDY #0
LDA A_REG
STA (TMP_ZP),Y
INY
LDA A_REG+1
STA (TMP_ZP),Y
INY
LDA JUMP_TARGET
STA (TMP_ZP),Y
INY
LDA JUMP_TARGET+1
STA (TMP_ZP),Y
INY
STY TMP3_ZP
JSR INCTMPZP
JSR POPREAL
LDX TMP_ZP
LDY TMP_ZP+1
; FAC to (X/Y)
JSR FACMEM
JSR SGNFAC
STA TMP_FLAG
LDY #5
STY TMP3_ZP
JSR INCTMPZP
JSR POPREAL
LDX TMP_ZP
LDY TMP_ZP+1
; FAC to (X/Y)
JSR FACMEM
LDY #5
STY TMP3_ZP
JSR INCTMPZP
LDY #0
LDA TMP_FLAG
STA (TMP_ZP),Y
INY
LDA #1
STA (TMP_ZP),Y
INY
LDA #15
STA (TMP_ZP),Y
LDY #3
STY TMP3_ZP
JSR INCTMPZP
LDA TMP_ZP
STA FORSTACKP
LDA TMP_ZP+1
STA FORSTACKP+1
RTS
;###################################
;###################################
NEXT      LDA FORSTACKP
STA TMP_ZP
LDA FORSTACKP+1
STA TMP_ZP+1
SEARCHFOR   LDA TMP_ZP+1
STA TMP3_REG+1
LDA TMP_ZP
STA TMP3_REG
SEC
SBC #2
STA TMP_ZP
BCS NOPV1N1
DEC TMP_ZP+1
NOPV1N1      LDY #0
LDA (TMP_ZP),Y
BNE NOGOSUB
JMP NEXTWOFOR
NOGOSUB
INY
LDA TMP_ZP
SEC
SBC (TMP_ZP),Y
STA TMP_ZP
BCS NOPV1N2
DEC TMP_ZP+1
NOPV1N2      DEY
LDA A_REG
BEQ LOW0
CMPFOR      CMP (TMP_ZP),Y
BNE SEARCHFOR
LDA A_REG+1
INY
CMP (TMP_ZP),Y
BEQ FOUNDFOR
JMP SEARCHFOR
LOW0      LDX A_REG+1
BEQ FOUNDFOR
BNE CMPFOR
FOUNDFOR   LDA TMP_ZP
STA TMP2_REG
LDA TMP_ZP+1
STA TMP2_REG+1
VARREAL
LDY #0
STY A_REG+1 ; Has to be done anyway...so we can do it here as well
LDA (TMP_ZP),Y
TAX
INY
LDA (TMP_ZP),Y
TAY
TXA
JSR REALFAC
CALCNEXT   LDA TMP_ZP
CLC
ADC #4
STA TMP_ZP
BCC NOPV2IN
INC TMP_ZP+1
NOPV2IN      STA TMP_REG
LDY TMP_ZP+1
STY TMP_REG+1
JSR FACADD   ;M-ADD
LDA TMP2_REG
STA TMP_ZP
LDA TMP2_REG+1
STA TMP_ZP+1
STOREREAL
LDY #0
LDA (TMP_ZP),Y
TAX
INY
LDA (TMP_ZP),Y
TAY
JSR FACMEM   ;FAC TO (X/Y)
CMPFOR      LDA #5
STA TMP3_ZP
LDA TMP_REG
CLC
ADC #5
STA TMP_REG
BCC NOPV3
INC TMP_REG+1
NOPV3      LDY TMP_REG+1
JSR CMPFAC    ;CMPFAC
BEQ LOOPING
PHA
LDY #14
LDA (TMP_ZP),Y
BEQ STEPZERO
ROL
BCC STEPPOS
STEPNEG      PLA
ROL
BCC LOOPING
BCS EXITLOOP
STEPPOS      PLA
ROL
BCC EXITLOOP
LOOPING      LDA TMP3_REG
STA FORSTACKP
LDA TMP3_REG+1
STA FORSTACKP+1
LDA TMP2_REG
CLC
ADC #2
STA TMP2_REG
BCC NOPV4IN
INC TMP2_REG+1
NOPV4IN      LDY #0
STY A_REG
STA TMP_ZP
LDA TMP2_REG+1
STA TMP_ZP+1
LDA (TMP_ZP),Y
STA JUMP_TARGET
INY
LDA (TMP_ZP),Y
STA JUMP_TARGET+1
RTS
STEPZERO   PLA
JMP LOOPING
EXITLOOP   LDA TMP2_REG
STA FORSTACKP
LDA TMP2_REG+1
STA FORSTACKP+1
LDA #1
STA A_REG
RTS
;###################################
;###################################
READINIT   LDA DATASP
STA TMP3_ZP
LDA DATASP+1
STA TMP3_ZP+1
LDY #$0
LDA (TMP3_ZP),Y
INC TMP3_ZP
BNE READNOOV
INC TMP3_ZP+1
READNOOV   CMP #$FF
BNE MOREDATA
JMP OUTOFDATA
MOREDATA   RTS
;###################################
;###################################
READADDPTR   STX TMP_REG+1
LDA TMP3_ZP
CLC
ADC TMP_REG+1
STA TMP3_ZP
BCC READADDPTRX
INC TMP3_ZP+1
READADDPTRX   RTS
;###################################
;###################################
READNUMBER   JSR READINIT
MORENUMDATA CMP #$2            ; Strings are not allowed here
BNE NUMNUM
LDA (TMP3_ZP),Y      ; ...unless they are empty, which makes them count as 0
BEQ RNESTR
JMP SYNTAXERROR
RNESTR      LDA #0
LDY #0
JSR INTFAC
LDX #1
JSR READADDPTR
JMP NUMREAD
NUMNUM      CMP #$1
BEQ NUMREADREAL
CMP #$0
BEQ NUMREADINT
LDA (TMP3_ZP),Y
TAY
JSR BYTEFAC
LDX #1
JSR READADDPTR
JMP NUMREAD         ; It's a byte
NUMREADINT   LDA (TMP3_ZP),Y      ; It's an integer
STA TMP_REG
INY
LDA (TMP3_ZP),Y
LDY TMP_REG
JSR INTFAC
LDX #2
JSR READADDPTR
JMP NUMREAD
NUMREADREAL   LDA TMP3_ZP
LDY TMP3_ZP+1
JSR REALFAC
LDX #5
JSR READADDPTR
NUMREAD      JSR NEXTDATA
LDX #<Y_REG
LDY #>Y_REG
JMP FACMEM      ; ...and return
;###################################
;###################################
NEXTDATA   LDA TMP3_ZP         ; Adjust pointer to the next element
STA DATASP
LDA TMP3_ZP+1
STA DATASP+1
RTS
;###################################
;##################################
REALFACPUSH   STA TMP_ZP
STY   TMP_ZP+1
LDX FPSTACKP
LDY FPSTACKP+1
STX TMP2_ZP
STY TMP2_ZP+1
LDY #0
LDA (TMP_ZP),Y
STA (TMP2_ZP),Y
BEQ PUSHED0
INY
LDA (TMP_ZP),Y
STA (TMP2_ZP),Y
INY
LDA (TMP_ZP),Y
STA (TMP2_ZP),Y
INY
LDA (TMP_ZP),Y
STA (TMP2_ZP),Y
INY
LDA (TMP_ZP),Y
STA (TMP2_ZP),Y
PUSHED0      LDA FPSTACKP
CLC
ADC #5
STA FPSTACKP
BCC NOPVRFPXX
INC FPSTACKP+1
NOPVRFPXX   RTS
;###################################
;###################################
PUSHREAL   LDX FPSTACKP
LDY FPSTACKP+1
JSR FACMEM
LDA FPSTACKP
CLC
ADC #5
STA FPSTACKP
BCC NOPVPUR
INC FPSTACKP+1
NOPVPUR      RTS
;###################################
;###################################
POPREAL      LDA FPSTACKP
SEC
SBC #5
STA FPSTACKP
BCS NOPVPR
DEC FPSTACKP+1
NOPVPR      LDA FPSTACKP
LDY FPSTACKP+1
JMP REALFAC
;###################################
;###################################
INCTMPZP   LDA TMP_ZP
CLC
ADC TMP3_ZP
STA TMP_ZP
BCC NOPV2
INC TMP_ZP+1
NOPV2      RTS
;###################################
;###################################
COPY2_XYA   STA TMP3_ZP
COPY2_XY   STX TMP_ZP
STY TMP_ZP+1
COPY3_XY   LDY #0
LDA (TMP3_ZP),Y
STA (TMP_ZP),Y
BEQ COPIED0         ; Shortcut for 0 values...
INY
LDA (TMP3_ZP),Y
STA (TMP_ZP),Y
INY
LDA (TMP3_ZP),Y
STA (TMP_ZP),Y
INY
LDA (TMP3_ZP),Y
STA (TMP_ZP),Y
INY
LDA (TMP3_ZP),Y
STA (TMP_ZP),Y
RTS
COPIED0      INY
STA (TMP_ZP),Y
RTS
;###################################
;###################################
NEXTWOFOR   LDX #$0A
JMP $A437
;###################################
;###################################
OUTOFDATA   LDX #$0D
JMP $A437
;###################################
;###################################
SYNTAXERROR
JMP $AF08
;###################################
;###############################
INITVARS
JSR INITSTRVARS
LDA #0
STA VAR_N
STA VAR_N+1
STA VAR_Q
STA VAR_Q+1
STA VAR_X
STA VAR_X+1
RTS
;###############################
; *** SUBROUTINES END ***
SQRTTABLE
.BYTE 03 11 18 25 32 38 44 50
.BYTE 58 69 79 89 98 107 115 123
; *** CONSTANTS ***
CONSTANTS
; CONST: ${clear}
CONST_0   .BYTE 7
   .STRG "{clear}"
; CONST: #53269.0

CONST_1   .REAL 53269.0
; CONST: #28


; CONST: #13
CONST_3   .WORD 13

; CONST: #62

CONST_4R   .REAL 62.0
; CONST: #1

CONST_5R   .REAL 1.0
; CONST: #0


; CONST: #832

CONST_7   .REAL 832
; CONST: #53271.0

CONST_8   .REAL 53271.0
; CONST: #12


; CONST: #53277.0

CONST_10   .REAL 53277.0
; CONST: #200

CONST_11R   .REAL 200.0
; CONST: #53252.0

CONST_12   .REAL 53252.0
; CONST: #53256.0

CONST_13   .REAL 53256.0
; CONST: #53253.0

CONST_14   .REAL 53253.0
; CONST: #53257.0

CONST_15   .REAL 53257.0
; CONST: #100


; ******** DATA ********
DATAS
.BYTE 3
.BYTE 0
.BYTE 3
.BYTE 127
.BYTE 3
.BYTE 0
.BYTE 3
.BYTE 1
.BYTE 3
.BYTE 255
.BYTE 3
.BYTE 192
.BYTE 3
.BYTE 3
.BYTE 3
.BYTE 255
.BYTE 3
.BYTE 224
.BYTE 3
.BYTE 3
.BYTE 3
.BYTE 231
.BYTE 3
.BYTE 224
.BYTE 3
.BYTE 7
.BYTE 3
.BYTE 217
.BYTE 3
.BYTE 240
.BYTE 3
.BYTE 7
.BYTE 3
.BYTE 223
.BYTE 3
.BYTE 240
.BYTE 3
.BYTE 7
.BYTE 3
.BYTE 217
.BYTE 3
.BYTE 240
.BYTE 3
.BYTE 3
.BYTE 3
.BYTE 231
.BYTE 3
.BYTE 224
.BYTE 3
.BYTE 3
.BYTE 3
.BYTE 255
.BYTE 3
.BYTE 224
.BYTE 3
.BYTE 3
.BYTE 3
.BYTE 255
.BYTE 3
.BYTE 224
.BYTE 3
.BYTE 2
.BYTE 3
.BYTE 255
.BYTE 3
.BYTE 160
.BYTE 3
.BYTE 1
.BYTE 3
.BYTE 127
.BYTE 3
.BYTE 64
.BYTE 3
.BYTE 1
.BYTE 3
.BYTE 62
.BYTE 3
.BYTE 64
.BYTE 3
.BYTE 0
.BYTE 3
.BYTE 156
.BYTE 3
.BYTE 128
.BYTE 3
.BYTE 0
.BYTE 3
.BYTE 156
.BYTE 3
.BYTE 128
.BYTE 3
.BYTE 0
.BYTE 3
.BYTE 73
.BYTE 3
.BYTE 0
.BYTE 3
.BYTE 0
.BYTE 3
.BYTE 73
.BYTE 3
.BYTE 0
.BYTE 3
.BYTE 0
.BYTE 3
.BYTE 62
.BYTE 3
.BYTE 0
.BYTE 3
.BYTE 0
.BYTE 3
.BYTE 62
.BYTE 3
.BYTE 0
.BYTE 3
.BYTE 0
.BYTE 3
.BYTE 62
.BYTE 3
.BYTE 0
.BYTE 3
.BYTE 0
.BYTE 3
.BYTE 28
.BYTE 3
.BYTE 0
.BYTE $FF
; ******** DATA END ********
CONSTANTS_END
; *** VARIABLES ***
VARIABLES
; VAR: N
VAR_N   .REAL 0.0
; VAR: Q
VAR_Q   .REAL 0.0
; VAR: X
VAR_X   .REAL 0.0
STRINGVARS_START
; VAR: TI$
VAR_TI$ .WORD EMPTYSTR
STRINGVARS_END
STRINGARRAYS_START
STRINGARRAYS_END
VARIABLES_END
; *** INTERNAL ***
X_REG   .REAL 0.0
Y_REG   .REAL 0.0
C_REG   .REAL 0.0
D_REG   .REAL 0.0
E_REG   .REAL 0.0
F_REG   .REAL 0.0
A_REG   .WORD 0
B_REG   .WORD 0
G_REG   .WORD 0
CMD_NUM   .BYTE 0
CHANNEL   .BYTE 0
SP_SAVE   .BYTE 0
TMP2_REG   .WORD 0
TMP3_REG   .WORD 0
TMP4_REG   .WORD 0
STORE1   .WORD 0
STORE2   .WORD 0
STORE3   .WORD 0
GCSTART   .WORD 0
GCLEN   .WORD 0
GCWORK   .WORD 0
TMP_FREG   .REAL 0
TMP2_FREG   .REAL 0
TMP_FLAG   .BYTE 0
REAL_CONST_ONE   .REAL 1.0
REAL_CONST_ZERO   .REAL 0.0
REAL_CONST_MINUS_ONE   .REAL -1.0
EMPTYSTR   .BYTE 0
FPSTACKP   .WORD FPSTACK
FORSTACKP   .WORD FORSTACK
DATASP   .WORD DATAS
LASTVAR   .WORD 0
LASTVARP   .WORD 0
HIGHP   .WORD STRBUF
STRBUFP   .WORD STRBUF
ENDSTRBUF   .WORD 40960
INPUTQUEUEP   .BYTE 0
CONCATBUFP   .BYTE 0
PROGRAMEND
CONCATBUF   .ARRAY 256
INPUTQUEUE   .ARRAY $0F
FPSTACK .ARRAY 100
FORSTACK .ARRAY 340
STRBUF   .BYTE 0





Dump your java code here :



Special syntax:
  • To highlight a line (yellow background), prefix it with '@@'
  • To indicate that a line should be removed (red background), prefix it with '-'
  • To indicate that a line should be added (green background), prefix it with '+'
  • To post multiple snippets, seperate them by '~~~~'
  EOF
 
hadezbladez (276 views)
2018-11-16 13:46:03

hadezbladez (153 views)
2018-11-16 13:41:33

hadezbladez (286 views)
2018-11-16 13:35:35

hadezbladez (68 views)
2018-11-16 13:32:03

EgonOlsen (2123 views)
2018-06-10 19:43:48

EgonOlsen (2147 views)
2018-06-10 19:43:44

EgonOlsen (1360 views)
2018-06-10 19:43:20

DesertCoockie (1955 views)
2018-05-13 18:23:11

nelsongames (1598 views)
2018-04-24 18:15:36

nelsongames (2245 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!