Jump to content

x16tial

Members
  • Posts

    145
  • Joined

  • Last visited

  • Days Won

    1

Community Answers

  1. x16tial's post in Where is a good location to put assembly programs? was marked as the answer   
    If you don't enter any BASIC lines (with a line number) or any immediate statements that use any kind of variables, you technically can use anywhere from $0400 to $9eff. Of course be sure to save your ML program first, if you're ever in doubt.
    But, if you do want to create an ML program that can be loaded and run as if it were a BASIC program, below are the bytes you need.  Saving is a different matter, you'll need to save from $0801 to wherever your ML ends. If you use BASIC's SAVE command, it would just save the stub and leave your ML code behind.
    Here are those bytes:
    0801: 0b 08 01 00 9e 32 30 36 31 00 00 00
    080d: (where your program starts)
    What are these bytes doing?  They're "grouped" like this:  (0b 08)  (01 00)  (9e)  (32 30 36 31)  (00)  (00 00)
    0b 08 is the link to the next BASIC line at $080b.  This actually points to the 2nd set of 00's at the end of the line above, they are the link to the *next* BASIC line, and since they are 0, BASIC knows this is the end of the program (end of the stub).
    01 00 is the line number, you can change these to whatever you like.  ff 00 would be line 255.  00 01 would be line 256 etc. (little-endian)
    9e is the BASIC token for SYS
    32 30 36 31 are the hex ASCII codes for 2061 which is decimal for $080d (the rightmost digits happen to be the decimal digits)
    00 is the BASIC end of line marker
    00 00 as already mentioned is the null link marking the end of the BASIC program
    Thus the BASIC stub will SYS2061 your program that begins immediately following the three 00's, at $080d
×
×
  • Create New...

Important Information

Please review our Terms of Use