Jump to content

Photo

RXB - Rich Extended Basic


873 replies to this topic

#776 RXB OFFLINE  

RXB

    River Patroller

  • 3,303 posts
  • Location:Vancouver, Washington, USA

Posted Thu Mar 8, 2018 2:14 AM

Well I really screwed this pooch on this one. 

Found a error in RXB 2015 that does not crash easy but could potentially create a crash.

***********************************************************
* CALL MOTION(#SPR,YSPEED,XSPEED,...)
***********************************************************
SPRMOV CALL COMB              Insure at "("
* RXB PATCH CODE *************
* SPRMV2 CALL SPNUM2          Get sprite number
SPRMV2 CALL SPGS              # or ALL or GO or STOP
SPRMV3 CALL SPMOVE            Store velocity
SPRMV4 CEQ  COMMAZ,@CHAT      Loop if more
       BS   SPRMV2
       BR   GB0F2          *  LNKRTN (>A01C)
***********************************************************

***********************************************************
* MOTION PATCH for GO and STOP
SPGS   XML  PGMCHR            ( or ,
       CEQ  ALLZ,@CHAT        ALL?
       BR   SPGS1             No.
       XML  PGMCHR            Skip ALL
       XML  PGMCHR            Skip ,
       DST  1,@FAC            First sprite
       CALL SPNUM5            Get sprite table
       CALL SPMOVE            Store velocity
       ST   28,@FAC           Last sprite
       DCLR @VAR0             Index
SPGSA  MOVE 2,V@>0780,V@>0780(@VAR0)
       DADD 4,@VAR0           Index +4
       DEC  @FAC              Sprite -1
       BR   SPGSA             Done?
       B    SPRMV4            No. (Should put SPRMV4 end routine here.)
SPGS1  CEQ  NUMBEZ,@CHAT      #?
       BR   SPGS2             No.
       CALL SPNUM6            Standard routine.
       B    SPRMV3             (Should put a RTN here.)
SPGS2  CEQ  GOZ,@CHAT         GO?
       BR   SPGS3             No.
       AND  >BF,@>83C2        GO!!!
       B    SPGS4             Done. 
SPGS3  CEQ  STOPZ,@CHAT       STOP?
       BR   ERRSYN            No
       OR   >40,@>83C2        STOP!!!
SPGS4  XML  PGMCHR            Skip GO or STOP
       B    SPRMV4                 (Should put SPRMV4 end routine here.)
***********************************************************

Using a B (branch) instead of a CALL resulted in a return never used in GPL could potentially create a crash or GPL Stack Full.

 

Replaced the B with a CALL and in next version of RXB will have this potential error repaired.


Edited by RXB, Thu Mar 8, 2018 2:18 AM.


#777 TheBF OFFLINE  

TheBF

    Dragonstomper

  • 708 posts
  • Location:The Great White North

Posted Thu Mar 8, 2018 7:51 AM

These things keep us all humble.

 

Sometimes I think about making a sign for my wall that says "Bugs-R-US"

 

It's a great BASIC just the same Rich.


  • RXB likes this

#778 Opry99er OFFLINE  

Opry99er

    Quadrunner

  • 9,797 posts
  • Location:Hustisford, WI

Posted Thu Mar 8, 2018 9:38 AM

I believe I have a legacy copy of GKXB on diskette in my boxes somewhere.... :)

Edited by Opry99er, Thu Mar 8, 2018 9:38 AM.


#779 Ed in SoDak OFFLINE  

Ed in SoDak

    Moonsweeper

  • 414 posts
  • Location:Black Hills of South Dakota

Posted Thu Mar 8, 2018 8:26 PM

Well myself I often run a line number to test a section of code, just figured others do the same thing. 

 

Especially when testing multiple versions of the same XB code.

The Timex/Sinclair 1000's BASIC allowed either RUN 1700 or GOTO 1000 on the command line. Both from a program that hadn't been run since entering it or loading.

 

Like you, I  used that a lot when writing or debugging code to skip all the intro, ect. code.

 

On the TI, I just add a GOTO NN to a program as the first or very early line to jump to where I'm currently working or testing my code. The SXB cart allows a CALL GOTO(variable) and a few other nice features. Set that up as an input in the front of the program and you could just enter the line you wish to jump to and execute from there.

 

-Ed


Edited by Ed in SoDak, Thu Mar 8, 2018 8:35 PM.


#780 RXB OFFLINE  

RXB

    River Patroller

  • 3,303 posts
  • Location:Vancouver, Washington, USA

Posted Fri Mar 9, 2018 2:42 AM

The Timex/Sinclair 1000's BASIC allowed either RUN 1700 or GOTO 1000 on the command line. Both from a program that hadn't been run since entering it or loading.

 

Like you, I  used that a lot when writing or debugging code to skip all the intro, ect. code.

 

On the TI, I just add a GOTO NN to a program as the first or very early line to jump to where I'm currently working or testing my code. The SXB cart allows a CALL GOTO(variable) and a few other nice features. Set that up as an input in the front of the program and you could just enter the line you wish to jump to and execute from there.

 

-Ed

Yea Craig Miller did not like the GOTO (line number) option as he stated it would not work in Re-sequence of line numbers.

As you have it in a variable how could you possibly adjust it up or down?

 

This is not even to mention MOVE that moves sections of lines to another line number.

Or COPY that duplicates a set of lines to another line number.

All of these were included in GKXB by Miller Graphics. (Maybe the reason.)



#781 Ed in SoDak OFFLINE  

Ed in SoDak

    Moonsweeper

  • 414 posts
  • Location:Black Hills of South Dakota

Posted Fri Mar 9, 2018 2:02 PM

Another quirk of the Timex was it didn't care if a line number existed or not. It would simply jump to the following line. That BASIC didn't have a resequence command, but you could run USR routines to add such things.

 

While SXB might support GOTO(A) I don't use it. I keep my programs mostly compatible with TIXB. In my Timer program, I did a VERSION check and branched to code appropriate for whichever cart was mounted.

 

A way to deal with losing a branch with GOTO(A) if you resequence, I kept REM statements at the front of the program noting where things took place in the code and it would be fairly easy to manually update such.

 

SXB allows selective resequencing from line XXXX to YYYY only, so you could expand tight sections or move lines back to where they were or shuffle lines around.

 

Sure, there's other and better ways, but the SXB is pretty flexible. I like elegant programs myself, but mine seldom reach that status. :)

-Ed


  • RXB likes this

#782 RXB OFFLINE  

RXB

    River Patroller

  • 3,303 posts
  • Location:Vancouver, Washington, USA

Posted Wed Mar 21, 2018 11:11 PM

Another quirk of the Timex was it didn't care if a line number existed or not. It would simply jump to the following line. That BASIC didn't have a resequence command, but you could run USR routines to add such things.

 

While SXB might support GOTO(A) I don't use it. I keep my programs mostly compatible with TIXB. In my Timer program, I did a VERSION check and branched to code appropriate for whichever cart was mounted.

 

A way to deal with losing a branch with GOTO(A) if you resequence, I kept REM statements at the front of the program noting where things took place in the code and it would be fairly easy to manually update such.

 

SXB allows selective resequencing from line XXXX to YYYY only, so you could expand tight sections or move lines back to where they were or shuffle lines around.

 

Sure, there's other and better ways, but the SXB is pretty flexible. I like elegant programs myself, but mine seldom reach that status. :)

-Ed

Just a point of fact SXB  and RXB and XB 2.7 use GKXB routines of COPY, RES, MOVE and EDIT commands.



#783 RXB OFFLINE  

RXB

    River Patroller

  • 3,303 posts
  • Location:Vancouver, Washington, USA

Posted Wed Mar 21, 2018 11:18 PM

Found another error in RXB 2015 that slipped through the cracks since RXB 2001.

 

CALL JOYST(3,X,Y) or CALL JOYST(4,X,Y) will both be accepted and should error out.

 

I used the normal CALL KEY section shared and this was missed by me previously.

 

This will be repaired in RXB 2018 with other errors I am looking for.



#784 Casey OFFLINE  

Casey

    Moonsweeper

  • 290 posts

Posted Mon Mar 26, 2018 4:42 PM

It looks like RXB works the same way as TI BASIC and TI Extended BASIC do with regard to CALL JOYST.  

 

We know that TI reserved joystick units 3 and 4 for "possible future use" like CALL KEY was on the 99/4.  Units 3 and 4 were reserved for the never release wireless controllers, right?  Is there any way to make use of them with the hardware we have?  

 

(Not saying you shouldn't change it to only allow units 1 and 2, but more just curious about the hardware we have now).



#785 RXB OFFLINE  

RXB

    River Patroller

  • 3,303 posts
  • Location:Vancouver, Washington, USA

Posted Mon Mar 26, 2018 7:31 PM

It looks like RXB works the same way as TI BASIC and TI Extended BASIC do with regard to CALL JOYST.  

 

We know that TI reserved joystick units 3 and 4 for "possible future use" like CALL KEY was on the 99/4.  Units 3 and 4 were reserved for the never release wireless controllers, right?  Is there any way to make use of them with the hardware we have?  

 

(Not saying you shouldn't change it to only allow units 1 and 2, but more just curious about the hardware we have now).

Well the same routine as used by the CALL KEY routine was used for CALL JOYST and that routine worked with 0 to 5

thus why you could do CALL JOYST(3,X,Y) or CALL JOYST(4,X,Y)

 

I am not a hardware guy but I do not think that is possible but in GPL Programming Manual (page D2) :

 

"REMOTE KEYBOARD (KEY BOARDS)

Remote handsets 3 and 4 can be mapped into a 40 key
keyboard in the same manner as handsets 1 and 2 ."
 
And a drawing of Handheld Unit 3 or 4 is shown (page D6) :
 
(It looks just like the Number Pad portion of a standard PC Keyboard.)
 
i.e.
 
 
Clear      7         8     9     Period    
Go         4         5     6      X
Set        1         2     3      No
Next      Stop    0     =      Yes
 
Key values:
 
13          7         8     9      A
12          4         5     6      8
11          1         2     3      C
10          F        0      E     Q

Edited by RXB, Mon Mar 26, 2018 7:32 PM.


#786 RXB OFFLINE  

RXB

    River Patroller

  • 3,303 posts
  • Location:Vancouver, Washington, USA

Posted Wed Mar 28, 2018 9:36 PM

Just a update on what I am working on today:

 

CALL JOYSTMOTION(keyunit,X,Y,#sprite,Row-velocity,Col-velocity,KEY) GOTO line-number

 

How does this work?

keyunit is same as XB normal CALL JOYST(keyunit,X,Y)

After that is same as XB normal CALL MOTION(#sprite,Row-velocity,Col-velocity)

So here is the kicker, it changes the Row-velocity,Col-velocity to Positive or Negative per JOYSTICK USE:

Thus Row-velocity,Col-velocity reflect choice made by the JOYSTICK direction this moves the Sprite for you.

If no JOYSTICK movement the SPRITE does not move. (Built in IF joystick THEN move sprite)

 

Ok now what about KEY?

This checks the FIRE BUTTON and saves that value for you, but also works with the GOTO line-number

If you press the FIRE BUTTON it uses the GOTO line-number, but if no FIRE BUTTON then it goes to next line.

Or if you use a :: the next XB command....

 

Here is a XB Program similar to this single RXB  line command:

100 CALL CLEAR
110 CALL SPRITE(#1,65,2,9,190,20,0)

120 CALL JOYST(1,X,Y)
130 CALL MOTION(#1,-(Y*5),(X*5))
140 CALL KEY(1,K,S)
150 IF K=18 THEN CALL BEEP

160 GOTO 120 

Lines 120 to 150 are an approximation of RXB CALL JOYSTMOTION

 

As you can see this would speed up XB programs and eliminate code that slows XB down.

 

Specfically those IF something THEN line-number



#787 senior_falcon OFFLINE  

senior_falcon

    Stargunner

  • 1,231 posts
  • Location:Lansing, NY, USA

Posted Thu Mar 29, 2018 5:58 AM

Specfically those IF something THEN line-number

 

This looks good. Of course the real speed improvement here comes from bundling the three CALLs into one. The more CALLs you can eliminate the better.   IF/THEN is way faster than doing a call and there shouldn't be a whole lot of speed increase from including that, although it might help a bit.  I am assuming the added stuff is optional - i.e. CALL JOYST(keyunit,X,Y) works normally, or CALL JOYSTMOTION(keyunit,X,Y,#sprite,Row-velocity,Col-velocity) would work without the KEY.


  • RXB likes this

#788 RXB OFFLINE  

RXB

    River Patroller

  • 3,303 posts
  • Location:Vancouver, Washington, USA

Posted Thu Mar 29, 2018 6:53 AM

No Key will still be there as it does the same thing as

CALL JOYST(keyunit,x,y) & CALL MOTION(#sprite,RV,CV) & IF joystick movement move sprite & CALL KEY(keyunit,Key,S)

 

I can set it up to not use the GOTO line-number but fail to see the reason for that?

 

I guess I could also make KEY and GOTO optional, but why make something then just not use it?

 

 

By the way when you do a CALL KEY or CALL JOYST it always scans and fills address:

>8375 Key, >8376 JOY Y and >8377 JOY X even if you do not use Key or Joystick values.

 

Why would you want to use another CALL KEY as that would be doubling what was done?


Edited by RXB, Thu Mar 29, 2018 6:58 AM.


#789 senior_falcon OFFLINE  

senior_falcon

    Stargunner

  • 1,231 posts
  • Location:Lansing, NY, USA

Posted Thu Mar 29, 2018 7:49 AM


I guess I could also make KEY and GOTO optional, but why make something then just not use it?


 

Why would you want to use another CALL KEY as that would be doubling what was done?

Suppose you only wanted info from the joysticks like munchman and had no need for CALL KEY.  If it is always included then you are including an unnecessary extra step. What about CALL JOYST(keyunit,X,Y) without the motion? Is motion optional?



#790 RXB OFFLINE  

RXB

    River Patroller

  • 3,303 posts
  • Location:Vancouver, Washington, USA

Posted Thu Mar 29, 2018 7:20 PM

Suppose you only wanted info from the joysticks like munchman and had no need for CALL KEY.  If it is always included then you are including an unnecessary extra step. What about CALL JOYST(keyunit,X,Y) without the motion? Is motion optional?

Let me explain the GPL COMMAND "SCAN"

 

When  you use SCAN it goes to the OS ROM zero and ALWAYS fills >8375, >8376, and >8377 even if you only want a key or joystick.

So the fact that it fills these ALWAYS does not cost me one single clock cycle more.

 

Now you are correct that GPL ASSIGN a value to KEY will cost me some time and address space.

So you are right I should make KEY, and GOTO Line number optional thanks for suggestion.

 

As for this question: 

"What about CALL JOYST(keyunit,X,Y) without the motion? Is motion optional?"

 

They are separate routines entirely thus share some code:

***********************************************************
*              SUBPROGRAM FOR 'KEY'
***********************************************************
KEY    CALL SPAR              GET KEY UNIT
* RXB PATCH LABEL ************
GABD1  XML  SPEED             Insure in range
       BYTE RANGE          *   of 0 - 5
       BYTE 0
       DATA 5
       CALL KEYJOY            Get variables for code and st
*                              and scan keyboard
*                             KEYJOY returns key status
       BS   KEY1B             KEY STATUS = 1
       DNEG @FAC              Assume status = -1
       CEQ  >FF,@RKEY         But correct if = 0
       BR   KEY1B
       DCLR @FAC              KEY STATUS = 0
KEY1B  XML  ASSGNV            Assign value in variable
       DST  >4001,@FAC        Re-store F.P. 1 in FAC
       CZ   @RKEY             If key-code = 0
       BS   KEY2
       CEQ  >FF,@RKEY         No key depressed,
       BS   KEY1C              key code assigned to -1
* FORMAT FOR KEYCODES ABOVE 99 ADDED FOR 99/4A HIGHEST
* KEYCODE (OTHER THAN >FF) IS >C6=198
* 5/7/81
       CHE  100,@RKEY
       BR   GAC04
       INC  @FAC
       SUB  100,@RKEY
       ST   @RKEY,@FAC2       FLOATING FORMAT (>4001__00000
       B    GAC07
GAC04  ST   @RKEY,@FAC1       FLOATING FORMAT (>40__0000000
GAC07  BR   KEY2A
KEY1C  DNEG @FAC              KEY CODE ASSIGNED TO -1
       BR   KEY2A
KEY2   DCLR @FAC              (>000000000000000)
KEY2A  XML  ASSGNV            ASSIGN VALUE TO VARIABLE
* RXB PATCH CODE *************
*      BR   LNKRTN
       RTN
***********************************************************
* RXB PATCH WAS    SUBPROGRAM FOR 'JOYSTICK'
***********************************************************
       CALL SPAR              KEY UNIT
       XML  SPEED             Insure in range
       BYTE RANGE          *   of 1 - 4
       BYTE 1
       DATA 4
       CALL KEYJOY            GET VARIABLES FOR X, Y
*                              AND SCAN KEYBOARD
       ST   @JOYY,@VAR0       JOYSTICK Y POSITION
       CALL JOYXY             -4 to +4
       DST  >4001,@FAC        Re-store F.P. 1 in FAC
       ST   @JOYX,@VAR0       JOYSTICK X POSITION
       CALL JOYXY             -4 to +4
       BR   LNKRTN
***********************************************************
* INSURE LEFT PARENTHESIS AND THEN PARSE TO A COMMA
***********************************************************
* RXB PATCH CODE
LPARR  CEQ  COMMAZ,@CHAT
       BS   CPAR
       XML  SPEED           *  Must be
       BYTE SYNCHK          *  at a
       BYTE LPARZ           *    left parenthesis
       BR   CPAR3
* RXB PATCH CODE SAVES 3 BYTES (LOL)
* CPAR   XML  SPEED
*        BYTE SYNCHK
*        BYTE COMMAZ
CPAR   CALL SPAR2           * RXB COMMA SPEED CHECKER
* RXB PATCH LABEL ***********
CPAR2  XML  PARSE             Do the parse
       BYTE COMMAZ          * Stop on a comma
* RXB PATCH CODE SAVES 3 BYTES (LOL)
*       XML  SPEED           *  Must be
*       BYTE SYNCHK          *  at a
*       BYTE COMMAZ          *    left comma
       CALL SPAR2           *  RXB COMMA SPEED CHECKER
       RTN
*****************************
CPAR3  XML  SPEED           * Similar to LPARR
       DATA COMMAZ          * Syntax check ,
       BR   CPAR2           * Parse value
***********************************************************

**********************************************************
GKEY1  DST  @ENLN,@FAC2        Get last address
       DSUB 3,@FAC2            Point to first LINE#
GKEY2  CALL GRSUB3             Read from VDP/RAM
       BYTE FAC2
       DCEQ @EEE1,@FAC         Same?
       BS   GKEY3              Yes, found line#
       DCH  @STLN,@FAC2        No line# left
       BR   ERRLNF             ERROR LINE NOT FOUND
       DSUB 4,@FAC2            Next LINE#
       BR   GKEY2              Loop
GKEY3  DST  @FAC2,@EXTRAM      Got LINE#
       DADD 4,@EXTRAM          Point to begining of line
       DINCT @EXTRAM           Point to ADDRESS
       DST  @EXTRAM,@PGMPTR    Set pointer to line to run
       DINCT @PGMPTR           Point to tokens
       CALL RETURN             Return to XB
**********************************************************
*                  SUBPROGRAM FOR 'JOYSTICK'
**********************************************************
JOYST  CALL SPAR              KEY UNIT
* RXB PATCH LABEL ************
JOYRPT XML  SPEED             Insure in range
       BYTE RANGE          *   of 1 - 4
       BYTE 1
       DATA 4
*                             GET VARIABLES FOR X, Y
*                              AND SCAN KEYBOARD
       ST   @FAC1,@VAR0       Keyboard selection
       CALL NUMVAR            Get variable for key-code
       CEQ  COMMAZ,@CHAT      If not comma - error
       BR   ERRSYN
       XML  PGMCHR            Get next character
       CALL NUMVAR            Get variable for key-status
       ST   @VAR0,@KEYBD      Keyboard selection
       MOVE 8,G@FLT1,@FAC     Set up float
       SCAN                   SCAN the keyboard
* RXB PATCH CODE SAVE KEY & JOYST
       ST   @RKEY,@FNUM       KEY VALUE
       DST  @JOYY,@VAR9       JOYY & JOYX
       CLR  @KEYBD            Clear the code(No affect on s
       ST   @JOYY,@VAR0       JOYSTICK Y POSITION
       CALL JOYXY             -4 to +4
       DST  >4001,@FAC        Re-store F.P. 1 in FAC
       ST   @JOYX,@VAR0       JOYSTICK X POSITION
       CALL JOYXY             -4 to +4
       RTN
***********************************************************
ZJOYST CALL JOYST
JOYAGN CEQ  COMMAZ,@CHAT
       BR   LNKRTN
       CALL CPAR3
       CALL JOYRPT
       BR   JOYAGN
************************************************************
* CALL JOYMOTION(keyunit,X,Y,#sprite,R-vel,C-vel,KEY,..)
************************************************************
ZJOMO  CALL JOYST          * Get Key unit, X & Y 
       CEQ  COMMAZ,@CHAT   * COMMA?
       BR   ERRSYN         * SYNTAX ERROR
       XML  PGMCHR         * Skip COMMA
       CEQ  NUMBEZ,@CHAT   * #?
       BR   ERRSYN         * SYNTAX ERROR
       CALL SPNUM3         * SPSAL=SPRITE ADDRESS  
       CALL COMMA          * Parse up to comma and skip
       CALL RANGEV         * Check if numeric and convert
*                             to integer
       ST   @FAC1,@SPTMP   * Store Y velocity
       XML  PARSE          * Get X velocity
       BYTE RPARZ          * Check for ")" or less
       CALL RANGEV         * Numeric check and convert
*                              to integer
       ST   @SPTMP,@FAC     * @FAC=Y velocity, @FAC1=X velocity
* CHECK DIRECTION OF JOYST AND SET UP FAC FOR LOADING VALUES      
       DCEQ >0000,@VAR9   * >0000 JOYST
       BR   ZJOMO1
       DCLR @FAC
ZJOMO1 DCEQ >0400,@VAR9   * UP
       BR   ZJOMO2
       CLR  @FAC1    
ZJOMO2 DCEQ >FC00,@VAR9   * DOWN
       BR   ZJOMO3
       NEG  @FAC
       CLR  @FAC1
ZJOMO3 DCEQ >00FC,@VAR9   * LEFT
       BR   ZJOMO4
       CLR  @FAC
       NEG  @FAC1
ZJOMO4 DCEQ >0004,@VAR9   * RIGHT
       BR   ZJOMO5
       CLR @FAC
ZJOMO5 DCEQ >04FC,@VAR9   * UPLEFT
       BR   ZJOMO6
       NEG  @FAC1
ZJOMO6 DCEQ >0404,@VAR9   * UPRIGHT 
       BR   ZJOMO7
ZJOMO7 DCEQ >FCFC,@VAR9   * DOWNLEFT
       BR   ZJOMO8
       NEG  @FAC
       NEG  @FAC1
ZJOMO8 DCEQ >FC04,@VAR9   * DOWNRIGHT     
       BR   ZJOMO9
       NEG  @FAC
ZJOMO9 CALL SPMOVG        * Load Sprite values, pass to XB
       CEQ  COMMAZ,@CHAT  * COMMA?
       BR   ERRSYN        * SYNTAX ERROR
       XML  PGMCHR        * Skip COMMA
       CEQ  18,@FNUM      * FIRE BUTTON?
       BR   ZJOMOA        * No
       DST  18,@FAC       * Load FIRE KEY
       XML  CIF           * Convert to floating point
       XML  ASSGNV        * Put put 18 in KEY variable
ZJOMOA CEQ  RPARZ,@CHAT   * )?
       BR   ERRSYN        * SYNTAX ERROR
       XML  PGMCHR        * Skip )
       CEQ  GOTOZ,@CHAT   * GOTO flag?
       BR   ERRSYN        * SYNTAX ERROR
       XML  PGMCHR        * Skip GOTO
       CEQ  LNZ,@CHAT     * Line# token?
       BR   ERRSYN        * SYNTAX ERROR
       XML  PGMCHR        * Skip line# token
       ST   @CHAT,@FAC    * Store high byte line#
       XML  PGMCHR        * Skip high byte line#
       ST   @CHAT,@FAC1   * Store low byte line#
       XML  PGMCHR        * Skip low byte line#
       B    GKEY1         * Find Line# and run it
**********************************************************


#791 senior_falcon OFFLINE  

senior_falcon

    Stargunner

  • 1,231 posts
  • Location:Lansing, NY, USA

Posted Thu Mar 29, 2018 9:41 PM

Sorry, I feel like a dope for asking that. I thought you had modified CALL JOYST to do all those things, when actually it is a new program CALL JOYSTMOTION. Now I see the light!



#792 Opry99er OFFLINE  

Opry99er

    Quadrunner

  • 9,797 posts
  • Location:Hustisford, WI

Posted Thu Mar 29, 2018 9:57 PM

A very interesting subprogram.  Combines many things into one simple call.  :)


  • RXB likes this

#793 RXB OFFLINE  

RXB

    River Patroller

  • 3,303 posts
  • Location:Vancouver, Washington, USA

Posted Thu Mar 29, 2018 11:54 PM

Going to make another one:

 

CALL JOYSTLOCATE(keyunit,X,Y,#sprite,Row,Column,INDEX,KEY) GOTO line-number

 

This would LOCATE a SPRITE by adding INDEX to the location like say 8 pixels to location according to JOYST

 

INDEX could be any value needed, so not smooth like motion but jumping sprite to where you want per JOYST

 

I will also make it like motion so you can eliminate KEY and GOTO line-number if you choose.

 

Of course the Row and Column will be updated when returned values go back to XB,

this would mean Row and Column are always the last location for the sprite on screen.


Edited by RXB, Thu Mar 29, 2018 11:55 PM.


#794 senior_falcon OFFLINE  

senior_falcon

    Stargunner

  • 1,231 posts
  • Location:Lansing, NY, USA

Posted Fri Mar 30, 2018 5:57 AM

CALL JOYSTMOTION(keyunit,X,Y,#sprite,Row-velocity,Col-velocity,KEY) GOTO line-number

 

I think you could make this even more versatile.  You really don't need to know what key was pressed-it will be the fire button or nothing, so get rid of the KEY. There are three possible states for the fire button: not pressed; newly pressed; and held down more than one cycle. So as an idea you might make it work this way:

10 CALL JOYSTMOTION(keyunit,X,Y,#sprite,Row-velocity,Col-velocity) 100 ELSE 200

20 !fire button not pressed

100 !fire button newly pressed

200 !fire button held down

 

Probably should make the 100 ELSE 200 optional. If the fire button is not used by the program then just go on to the next line. Also probably should make the ELSE 200 optional, same as it is when using an IF/THEN statement.



#795 Opry99er OFFLINE  

Opry99er

    Quadrunner

  • 9,797 posts
  • Location:Hustisford, WI

Posted Fri Mar 30, 2018 10:52 AM

^^likey^^

#796 RXB OFFLINE  

RXB

    River Patroller

  • 3,303 posts
  • Location:Vancouver, Washington, USA

Posted Fri Mar 30, 2018 12:14 PM

CALL JOYSTMOTION(keyunit,X,Y,#sprite,Row-velocity,Col-velocity,KEY) GOTO line-number

 

I think you could make this even more versatile.  You really don't need to know what key was pressed-it will be the fire button or nothing, so get rid of the KEY. There are three possible states for the fire button: not pressed; newly pressed; and held down more than one cycle. So as an idea you might make it work this way:

10 CALL JOYSTMOTION(keyunit,X,Y,#sprite,Row-velocity,Col-velocity) 100 ELSE 200

20 !fire button not pressed

100 !fire button newly pressed

200 !fire button held down

 

Probably should make the 100 ELSE 200 optional. If the fire button is not used by the program then just go on to the next line. Also probably should make the ELSE 200 optional, same as it is when using an IF/THEN statement.

How would I know the FIRE button has been held down?

In XB a variable saves that value so where in GPL am I going to permanently store this?

Scratch pad? (Already to cramped for space)

VDP RAM? (RXB already has just about reached any limit for those locations I am already using >3EFF that is reserved)

 

I guess KEY is not needed but the GOTO is required, but I could use the ELSE

 

CALL JOYSTMOTION(keyunit,X,Y,#sprite,Row-velocity,Col-velocity,KEY) GOTO line-number ELSE  line-number

 

If key pressed GOTO  line-number and  if key held down  ELSE  line-number if no key next line.

 

And both optional as before. Thanks I guess I could remove KEY.

But have no clue how to save KEY and where unless it is included and I checked if it was 18 previously?

 

So I guess KEY is required to be used to check if previously if KEY was pressed for held down.


Edited by RXB, Fri Mar 30, 2018 12:18 PM.


#797 senior_falcon OFFLINE  

senior_falcon

    Stargunner

  • 1,231 posts
  • Location:Lansing, NY, USA

Posted Fri Mar 30, 2018 7:27 PM

Quite simple once you know how.  Do a KSCAN.  After KSCAN >8375 has the key that was pressed, or >FF if no key was pressed. Then check the status byte at >837C.  If bit 2 is set then a new key was pressed.  If bit 2 is not set and >8375 is not >FF then the same key was held down.  Dunno how to do it in GPL, but here is one way do do it in assembly:

HXFF00 DATA >FF00

HX2000 DATA >2000

 

CB @>8375,@HXFF00 

JEQ NOKEY    

MOV @>837C,R1

COC @HX2000,R1

JNE SAMEK

JEQ NEWK

 

I am assuming that after finishing the stuff within the parentheses you then jump to the XB code directly after the parenthesis (i.e. GOTO linenumber ELSE linenumber). If so I think XB would permit more than just GOTO.  You should be able to execute  the more complicated code allowed with IF/THEN/ELSE.



#798 RXB OFFLINE  

RXB

    River Patroller

  • 3,303 posts
  • Location:Vancouver, Washington, USA

Posted Fri Mar 30, 2018 10:41 PM

Quite simple once you know how.  Do a KSCAN.  After KSCAN >8375 has the key that was pressed, or >FF if no key was pressed. Then check the status byte at >837C.  If bit 2 is set then a new key was pressed.  If bit 2 is not set and >8375 is not >FF then the same key was held down.  Dunno how to do it in GPL, but here is one way do do it in assembly:

HXFF00 DATA >FF00

HX2000 DATA >2000

 

CB @>8375,@HXFF00 

JEQ NOKEY    

MOV @>837C,R1

COC @HX2000,R1

JNE SAMEK

JEQ NEWK

 

I am assuming that after finishing the stuff within the parentheses you then jump to the XB code directly after the parenthesis (i.e. GOTO linenumber ELSE linenumber). If so I think XB would permit more than just GOTO.  You should be able to execute  the more complicated code allowed with IF/THEN/ELSE.

IF THEN ELSE are tokens but the GPL code for IF is way different then what I am doing and would require tons of code.

 

I am using the GOTO token but not the normal GPL code same with ELSE I can use the token but not the actual routines.

 

Besides if you need the KEY for additions routines how would you know if the key was pressed if you have no variable?

Also I can make it so it returns any key-pressed to the KEY thus accomplish more then one function at once.

 

Hitting a key on keyboard like SPACE or ENTER or Q or the FIRE Button, yet only the FIRE button responds to the 

GOTO line-number THEN line-number

I can think of a Flight Simulator in XB that would like that feature. Or a CAR shifting gears or Brake or Hand Brake slides...

 

Your view would turn into a major rewrite of the code for IF THEN ELSE just to make this work, much more involved then 

I want to spend time on when current code can do almost exactly the same thing without out major rewrites.



#799 RXB OFFLINE  

RXB

    River Patroller

  • 3,303 posts
  • Location:Vancouver, Washington, USA

Posted Mon Apr 2, 2018 4:40 PM

Hello well I found out what happens when you use the Ryte Data GPL Assembler and generate to many labels...it crashed!

 

I had so many labels in my source that the GPL Assembler ran out of space to make a DSR for creating a Object or LIst files.

 

Understandable I had thousands of labels and just ate up all the VDP of the 12K VDP available.

 

I want to thank Tursi for volunteering to help solve this madding problem I have had for 2 weeks.

 

Quite by accidentally was looking for errors and removed a number of duplicate labels and the GPL Assembler did not crash?

 

While looking at the VDP memory using Classic99 it looked like it just stopped generating labels so that confirmed what I suspected.



#800 RXB OFFLINE  

RXB

    River Patroller

  • 3,303 posts
  • Location:Vancouver, Washington, USA

Posted Tue Apr 10, 2018 7:14 AM

Hello 

Well major changes to RXB future updates I ran out of GROM space finally.

 

In order to fix this issue I am forced to eliminate some RXB commands:

 

CALL PROTECT(pathname,filename,flag)

 

CALL RMDIR(pathname,directory-name)

 

CALL SCSI(pathname,string-variable)

 

CALL SECTOR(pathname,read/write-flag,#sectors,sector-string)

 

Because SECTOR was for Hard Drives or Disk it was huge.

 

The only other way to get more space is to eliminate REA or move it to another GROM page, not likely.






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users