home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / genie-commodore-file-library / Information / PROGRAMMING.SFX / 00programming next >
Encoding:
Text File  |  1990-02-12  |  35.8 KB  |  878 lines

  1. rea 2 nor
  2. rea 4-5 nor
  3.  ************
  4. Topic 2         Wed Apr 20, 1994
  5. CBM-PRESS [Butterfield]      (Forwarded) 
  6. Sub: 128 Bank Switching                     
  7.  
  8. Details on how a programmer can make good use of the 128's memory bank
  9. switching capabilities.
  10.  
  11. 9 message(s) total.
  12.  ************
  13.  ------------
  14. Category 5,  Topic 2
  15. Message 1         Wed Apr 20, 1994
  16. CBM-PRESS [Butterfield]      (Forwarded) 
  17.  
  18. The Basic BANK command is deceptive.  On standard 128s, only FOUR bank numbers
  19. are of any value:  BANK 15 (default), Bank 14 (for looking at the character
  20. gen ROM at $D000), Bank 1 and Bank 0.
  21.   Note that the Basic command BANK does NOT set the bank; it just logs the
  22. number given and invokes a bank switch when a PEEK, POKE, or SYS is used.
  23.   Also:  a "bank" isn't exactly that; it's usually a mixture of RAM, ROM, and
  24. I/O.
  25.   The average M/L programmer, writing code into RAM bank 0, might think that
  26. BANK 0:SYS ... would be all he/she needed. WRONG.  Because BANK 0 makes the
  27. ROM disappear totally; all you have is RAM at all addresses.  (The interrupts,
  28. by the way, take care of themselves pretty well).
  29.    If the M/L program is sited below $4000, it would be much better to use
  30. BANK 15:SYS ..., since this give you a mixture of:  RAM0 at $0000-$3FFF, ROM
  31. at $4000-$BFFF and (sorry, that's ROM at $4000-CFFF and at $E000-$FFFF, and
  32. the I/O chips at $D000-$DFFF.
  33.   Great, but you can't usually site a program of any size below $4000,
  34. especially since Basic normally starts at $1C00 and may start much higher if
  35. the 128 is in graphics.
  36.   So .. instead of relying on the four BANK values, you can make up new memory
  37. mixes by storing a selected value to address $FF00.
  38.   The usual procedure is to command BANK 0:SYS ... and when your program
  39. starts running, thump a new value into $FF00 to get the Kernal ROM (and maybe
  40. I/O) back in. For Bank 0 ROM, the best value to use is $4E, which .. no, the
  41. best value is $0E, which configures you to: RAM0 at $0000 to $BFFF; ROM at
  42. $C000 to $CFFF and $E000 to $FFFF, and the I/O chips at $D000 to $DFFF.
  43.   With the $0E value, your program can use 48K of RAM and still have the
  44. Kernal and I/O chips available.
  45.   If the M/L program returns to Basic, be sure to restore the configuration to
  46. Bank0 before returning.  Do this by putting $3F into $FF00.
  47.   Next message deals with Bank 1.
  48.  ------------
  49. Category 5,  Topic 2
  50. Message 2         Wed Apr 20, 1994
  51. CBM-PRESS [Butterfield]      (Forwarded) 
  52.  
  53.   Wanna put your program into bank 1, where there's less collision with Basic
  54. stuff?  No problem.  As usual, you will command BANK 1: SYS ...   and then you
  55. have to get the ROM and I/O chips back into your configuration.
  56.   This time, it's REALLY value $4E that goes into address $FF00.  Gives you
  57. RAM1 from $0000 to $BFFF; the rest is as previously described.  When you're
  58. done, go back to "bank 1" configuration by storing $7F into $FF00.
  59.   Need to look at the character generation ROM for some reason?  Just add 1 to
  60. the values given earlier.  Thus, $0E becomes $0F and $4E becomes $4F.  And
  61. don't forget to put things back as they were.
  62.   I hope this gives further insight into the question we discussed in the
  63. conference area recently.
  64.          --Jim Butterfield
  65.  ------------
  66. Category 5,  Topic 2
  67. Message 3         Wed Apr 20, 1994
  68. GEOS-TIM                     (Forwarded) 
  69.  
  70. BTW It was a great conference.  The transcripts will be uploaded in a  couple
  71. days.  Thanks again Jim. For those folks that didn'T know, Jim Butterfield
  72. will be on GEnie through this week. If you'd like to ask a question, do so on
  73. this message thread.               :) -Tim
  74.  ------------
  75. Category 5,  Topic 2
  76. Message 4         Thu Apr 21, 1994
  77. S.EYRSE [steve]              (Forwarded) 
  78.  
  79. Jim: Thanks for starting this thread. The question I have is when the 125 is
  80. Bank switched is the area for code renumbered.  By that I mean if I switch
  81. from bank 15 to bank 0 am I still working in a $0000 to $FFFF limit computer?
  82.   Also if I did a program that started out in the normal bank 15 mode with the
  83. start at say $4200 and inside switched to Bank 0 to store material could it
  84. then start at the same $4200.  But then there would need to be a chunk of code
  85. in Bank 0 that would switch it back to 15. So is Bank switching like having a
  86. internal REU ? Which would make it much faster as switching to a bank and
  87. having a "NEW" program or part should be very fast.  My interest in this in a
  88. general way is that some have asked me to recode a 64 GEos program I did to
  89. work with the 128 and it would really helpto have some idea how the machine
  90. works.  I have a 64. If the HEX numbers all stay the same that would explain
  91. how BSW could make 128 Geos work much faster and have things like printer
  92. drivers just standing by.  The "internal" REU concept.  They had VLIR with
  93. overlays down that next step would have been a snap, If that is the way the
  94. 128 works. Thanks: Steve.
  95.  ------------
  96. Category 5,  Topic 2
  97. Message 5         Fri Apr 22, 1994
  98. CBM-ED [e.g.bell]            (Forwarded) 
  99.  
  100.  Steve:
  101.   SE> when the 125 is Bank switched is the area for code renumbered
  102.  
  103.  No.
  104.  
  105.   SE> Also if I did a program that started out in the normal bank 15
  106.   SE> mode with the start at say $4200 and inside switched to Bank 0
  107.   SE> to store material could it then start at the same $4200
  108.  
  109.  At a lower address what you are suggesting would work... lower than
  110.  $4000.  Higher than that is BASIC ROM in Bank 15, so when you called
  111.  your code at that address you would actually hit something in ROM.
  112.  If you started your code at $3f00 and switched to Bank 0 there, any
  113.  address would be available to you in bank 0 (ram-0), but you would
  114.  lose basic, the kernal, etc.
  115.  
  116.  The numbers (addresses) all stay the same when you switch configurations
  117.  though.  The only thing that changes is what the 128 can 'see' at those
  118.  addresses.  Try this from BASIC....
  119.  
  120.  bank 15:print peek(16384)
  121.  
  122.   and then
  123.  
  124.  bank 0 :print peek(16384)
  125.  
  126.  As Jim already said, it is much handier to stash #$0e into the 
  127.  MMU, which gives you ram -0 up to $BFFF, and the screen editor stuff
  128.  i/o block, and kernal above that.  Unless you need BASIC routines in your
  129.  code, it is an excellent configuration.
  130.  
  131.  I'm not really a chip person, but it helped to visualize things having
  132.  worked on the 64 under BASIC...  that was pretty much the same thing
  133.  as in the 128 as far as what is happening, at least that is how I see
  134.  it.  Do you have a copy of Mapping the 128 by Otis Cowper.  THAT is the
  135.  book to get!
  136.  
  137.  ------------
  138. Category 5,  Topic 2
  139. Message 6         Fri Apr 22, 1994
  140. C128.JBEE                    (Forwarded) 
  141.  
  142.  $FE is another good one for bank 1.
  143.  ------------
  144. Category 5,  Topic 2
  145. Message 7         Sat Apr 23, 1994
  146. CBM-PRESS [Butterfield]      (Forwarded) 
  147.  
  148. `$FE for bank 1?  I must comment on this one. Bit 7 of the MMU is not active
  149. in the 128.  Thus, storing $FE into $FF00 is the same as storing $7E. Now,
  150. what this gives you is:
  151.   RAM1 throughout, except for D000-DFFF, which will have the I/O chips.  No
  152. good for calling the Kernal, since there's no ROM there, but if you need to
  153. hit I/O directly, you could do that.
  154.   The official "BANK 1" is $7F into $FF00; that gives you RAM1 everywhere,
  155. including $D000 to $DFFF. handier if your job is handling data.
  156.   And, as I mentioned earlier, $4E will give you RAM1 from $0000 to $BFFF, ROM
  157. from $C000 to $FFFF exception for the I/O chips at $D000 etc.
  158.   I should maybe note that with ALL confiruations, addresses $0002-$03FF are
  159. always RAM0.
  160.  ------------
  161. Category 5,  Topic 2
  162. Message 8         Sat Apr 23, 1994
  163. CBM-PRESS [Butterfield]      (Forwarded) 
  164.  
  165.   In reply to a question:  at any instand, the 128 can reach  only 64K of
  166. memory.  In M/L terms, this is addresses 0000 to FFFF. So you get to various
  167. "bits" of memory by calling up the bank configuration that you want.
  168.   Now, when you go INTO a bank with SYS, to run a machine language program
  169. there, Basic logs its old bank configuration; that way, when your program says
  170. goodbye with RTS, Basic will have its ROM back in place and can continue
  171. going.
  172.   So you have to think of Basic as a separate game from the M/L program, which
  173. acquires its bank status the instant it starts running.  (If the Basic command
  174. BANK 0 *really* did the bank switch right then, Basic would crash, since the
  175. ROM which makes it run would have vanished!)
  176.   "Bank 15" specifies RAM0 at all addresses below $4000, so if you could site
  177. your M/L program entirely below that address, you could leap into the code
  178. without worrying too much about the architecture:  Kernal ROM would still be
  179. in place.
  180.   But once your code if forced above $3FFF, Basic's only option is "Bank 0" ..
  181. and that starts up the M/L program with no ROM or I/O chips in place.  That's
  182. why you have to fool around with the contents of $FF00.
  183.   This is my last day on Genie.  Good to see you all, and hope this stream
  184. helps a bit in the Banking Business.
  185.                     --Jim
  186.  ------------
  187. Category 5,  Topic 2
  188. Message 9         Sat Apr 23, 1994
  189. C128.JBEE                    (Forwarded) 
  190.  
  191.  What $FE is good for is BLOADing graphics into Bank 1 and then putting them
  192.  onto the VDC screen real fast :)
  193.  ------------
  194.  
  195. 5 | ************
  196. Topic 4         Sun May 01, 1994
  197. A.PLATT3                     (Forwarded) 
  198. Sub: Raster Register--HUH??                 
  199.  
  200. How do you use the raster?
  201.  
  202.  
  203. 3 message(s) total.
  204.  ************
  205.  ------------
  206. Category 5,  Topic 4
  207. Message 1         Sun May 01, 1994
  208. A.PLATT3                     (Forwarded) 
  209.  
  210.      I'm getting into heavy game programming for the 64 and getting nowhere
  211. with the raster register.  When I try to ise it, the computer resets, and
  212. eventually  locks up.  I manually reset the  computer, and it works fine for
  213. awhile, then locks up again.  
  214.      I thought someone might help me  with this description, so DOD DERNET,
  215. HELP ME!
  216.  ------------
  217. Category 5,  Topic 4
  218. Message 2         Wed May 04, 1994
  219. CBM-ED [e.g.bell]            (Forwarded) 
  220.  
  221.  AP:
  222.   AP> I'm getting into heavy game programming for the 64 and getting
  223.   AP> nowhere with the raster register
  224.  
  225.  I know you probably think I forgot you, but I didn't... just up to my
  226.  ears in other stuff.  I dug up an old raster routine I used in the past.
  227.  I don't remember all the whys of it cuz I haven't used it in over 5 years
  228.  but I think you should be able to figure it out....
  229.  
  230.  105 ;-----<flip the raster code on>
  231.  110 ;
  232.  115 wedgeon sei
  233.  120 lda #<raster:sta $0314
  234.  125 lda #>raster:sta $0315
  235.  130 cli
  236.  135 lda #27:sta $d011
  237.  140 lda #1:sta $d01a:sta 56334
  238.  145 rts
  239.  150 ;
  240.  155 ;-----<interrupt>
  241.  160 ;-----<status line - screen top>
  242.  165 ;
  243.  170 raster lda $d012:cmp #58:bcc !01
  244.  175 ldx #1:stx $d019
  245.  180 dex:stx $d012:jsr $ffea:jmp $ea7b
  246.  185 ;
  247.  210 !01 ldx $d6:cpx #1:bcs !03;             is cursor on line 1 or more
  248.  215 ldx #1:stx $d6:jsr $e56e;                 no - line 0 - set to line 1
  249.  220 ;
  250.  225 !03 ldy #39
  251.  230 !04 lda rasterline,y:sta 1024,y
  252.  235 lda rastercolr,y:sta 55296,y:dey:bpl !04
  253.  240 jmp $ea81
  254.  245 ;
  255.  250 ;-----<poke data>
  256.  255 ;
  257.  260 rasterline .byte "Your Data Here - Anything - 40 chars max"
  258.  265 rastercolr .byte 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
  259.  265 :          .byte 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7
  260.  270 ;
  261.  
  262.  Line 170 checks to see if the raster beam in on the correct line and
  263.  line 175 unlatches the interrupt (if I remember this stuff correctly).
  264.  Line 180 sets up for the next interrupt at the top of the screen,
  265.  updates the system clock and handles the keyboard polling by calling the
  266.  routine at the end of the IRQ..  (Yes, I know it is an undocumented 
  267.  entry... I was looking for the maximum speed possible in this routine and
  268.  willing to shave EVERY clock cycle possible)
  269.  
  270.  Line 210 checks the current cursor row.  If 0, it sets to line 1.  If
  271.  1 or greater it skips that part.
  272.  
  273.  LInes 225-240 poke the status line data into the top screen line RAM.
  274.  There are 2 separate 'exits' for a raster code since you are exiting it
  275.  twice at different points.  You don't want to perform all of the irq
  276.  functions at every interrupt... just the last one on the screen.
  277.  Remember code you want displayed on the screen must be screen code, no
  278.  petscii or it won't display correctly.  The exit in line 240 just exits
  279.  the irq by cleaning the stack... no polling of the keyboard or clock 
  280.  updates take place at that point.  O, and the $e56e in line 215 is more
  281.  cursor positioning stuff.  Let me know if you can make sense of this.
  282.  I think it is pretty straightforward.  There is no code included to turn
  283.  off the wedge, but I think you can probably handle that, right?  :)
  284.  ------------
  285. Category 5,  Topic 4
  286. Message 3         Sun May 29, 1994
  287. A.PLATT3 [Chance]            (Forwarded) 
  288.  
  289.      Hey, thanks!  I haven't taken this source and really broken it down, but
  290. I should be able to learn how to use the raster from your example. Thanks!!!
  291.  
  292.      And for those who are interested in gaming, any suggestions, including
  293. type of game, names, characters, or any game info. will be greatly considered!
  294. Mostly important to me, though, is the story line.  Any story line that can
  295. incorporated sequels will be considered the most.  
  296.  
  297. Thank you!   (Post under this response for suggestions!!)
  298.  ------------
  299.  ************
  300. Topic 5         Tue May 17, 1994
  301. D.BOBER [RENTaLASER]         (Forwarded) 
  302. Sub: BASIC 64                               
  303.  
  304. Need help with this compiler...
  305. 20 message(s) total.
  306.  ************
  307.  ------------
  308. Category 5,  Topic 5
  309. Message 1         Tue May 17, 1994
  310. D.BOBER [RENTaLASER]         (Forwarded) 
  311.  
  312.     I'm trying to compile a program with BASIC 64. My program occupies aprox.
  313. 102 Blocks. There is a 9 block font located at 51200 and a ML Routine loacated
  314. at 828. Now, I included the directive REM@ S=1024 to keep variable out of the
  315. cassette buffer. But for some reason the compiled program trashes the ML
  316. Routine. Everything located between 828-1024 is wiped out. As for the font,
  317. I'm not sure because the program crashes. But I used the "Advanced Development
  318. Features" and set the top of memory at 51100. The program uses a lot of DIM 
  319. Arrays, but nothing too large because it all works with out a problem in
  320. BASIC.
  321.  
  322. Any help would be appreciated, this is my first attempt at compiling a
  323. program, heck, it's my first useful program.
  324.  
  325. Thanks, Douglas
  326.  
  327.  
  328.  ------------
  329. Category 5,  Topic 5
  330. Message 2         Wed May 18, 1994
  331. CBM-ED [e.g.bell]            (Forwarded) 
  332.  
  333.   DB> 9 block font located at 51200 and a ML Routine loacated at 828.
  334.   DB> Now, I included the directive REM@ S=1024 to keep variable out
  335.   DB> of the cassette buffer. But for some reason the compiled
  336.   DB> program trashes the ML Routine
  337.  
  338.  Why don't you try moving your ML routine to the top of memory, above
  339.  the font.  A 9 block font is only going to be about 2048 bytes.  O,
  340.  just checked... it won't fit there, but put it below the font/screen
  341.  then, but still in page $c0.  In other words, put the ML routine at
  342.  49152.  Here is one thing you may need to consider though. I have never
  343.  used BASIC 64, but I have used BASIC 128 pretty often, and it puts the
  344.  compiled code high in memory.  The limits you are setting may be
  345.  keeping the program from getting enough memory.  Remember also that there
  346.  is a run-time package added to compiled BASIC programs that might
  347.  increase the size of the final file.  BASIC 128 offers the option of 
  348.  turning off the math processor or something like that.  Does the 64
  349.  version?  
  350.  
  351.  Anyway, try the shift of the ML.  There is 1948 bytes left below
  352.  51100, and I know the cassette buffer is only like 192 bytes, so there
  353.  is definitely room if that is the problem.  And one last thing... BASIC 128
  354.  has a menu for the advanced development features.  I use that in my 
  355.  progs for different memory specs rather than the inline directives.  I 
  356.  don't know if it matters, I just prefer it.  I then save them into an
  357.  'e' file that I load to configure things the same every time for that 
  358.  compile.  Just a thought. :)
  359.  ------------
  360. Category 5,  Topic 5
  361. Message 3         Thu May 19, 1994
  362. D.BOBER [RENTaLASER]         (Forwarded) 
  363.  
  364.     Well I changed the load address of the ML Routine to 49152 and tested the
  365. routine (I did not compile it) and the routine does not work there. I found
  366. this routine in a library book some time ago. Basically what it does is copy 
  367. the screen into memory with SYS858. Then SYS828 recalls the screen. I use this
  368. for a simple "Window" routine. Trouble is, when I relocate it, it doesn't
  369. work.
  370.  
  371. BASIC 64 does not give you the option of turning off the math processor. It
  372. does however have a menu for the advanced development features...
  373.  
  374.   A. Speedcode or Machine Language option
  375.   B. Input a Symbol table
  376.   C. Save Symbol table
  377.   D. Generates an address list
  378.   E. Change the end-of-memory address of compiled program
  379.   F. Raise or lower the start address of compiled program
  380.   G. Controls connection of the run time module
  381.   H. BASIC extensions
  382.   I. Imput no. of bytes per extended BASIC command
  383.   J. Locates the ELSE command
  384.   K. Turn off runtime error handling
  385.   L. Suppress the overlay feature
  386.   M. Send DOS commands to disk
  387.   N. Directory
  388.  
  389.  
  390. I just don't understand why BASIC 64 is clearing my routine from the cassette
  391. buffer. If I load the routine in direct mode and PRINT PEEK(828) I get
  392. somthing like 152. (That is not the actual number, I'm just using it as an
  393. example) After loading and running the compiled program. It crashes then I
  394. enter PRINT PEEK(828) again and the result is 0. In fact all the address' from
  395. 828 to 1024 are reset to 0.
  396.  
  397. :(
  398.  
  399.  ------------
  400. Category 5,  Topic 5
  401. Message 4         Fri May 20, 1994
  402. C128.JBEE                    (Forwarded) 
  403.  
  404.  From the Basic 64 manual on page 20:
  405.  
  406.  "The compiler normally places all variables in the cassette buffer for
  407.  easy access.  You can use this range for your own purposes by supplying
  408.  an address where you feel the buffer should end.  For example:
  409.  rem@ s=1024
  410.  "
  411.  
  412.  The compiler probably zeros out the cassette buffer before storing
  413.  variables there.
  414.  ------------
  415. Category 5,  Topic 5
  416. Message 5         Fri May 20, 1994
  417. CBM-ED [e.g.bell]            (Forwarded) 
  418.  
  419.  You observation leads me to ask a question.  After you used the compiler
  420.  directive to protect the cassette buffer, did you LOAD the ML routine
  421.  from disk to use it?  This may be a question that this thread already
  422.  answers, of course.  Also, you didn't say in your post whether this
  423.  did the trick.
  424.  
  425.  Send me a copy of your ML routine and I'll fix it if I can to work at
  426.  the higher address.  It can only be 192 bytes or less, right?  It has
  427.  to be very small if it was written to work in the cassette buffer.  It
  428.  is probably using the cassette buffer for its variables, ad all it has to
  429.  have done is to reassemble it for the higher address.  Upload it to me.
  430.  In the meantime, why not try this... I assume you changed the SYS calls
  431.  to address 828 to point to 49152, right?  Now, put a POKE 49152,96 at
  432.  the start of your code, then compile again to see if it crashes.  If not,
  433.  this may really be all that is required. 
  434.  ------------
  435. Category 5,  Topic 5
  436. Message 6         Fri May 20, 1994
  437. CBM-ED [e.g.bell]            (Forwarded) 
  438.  
  439.  DB:
  440.    A. Speedcode or Machine Language option
  441.  
  442.  Which are you using here.  I would recommend the Speedcode because of 
  443.  the size of the program you are starting with.
  444.  
  445.    E. Change the end-of-memory address of compiled program
  446.    F. Raise or lower the start address of compiled program
  447.  
  448.  What are these 2 for?  I would take a look at the settings here also.
  449.  Particularly 'F'.  This is where I'd adjust my program parameters, from
  450.  this menu, tho that is a personal preference.  There is a lot to 
  451.  recommend the way you are doing things too, particularly not having to
  452.  remember the settings for compiles later.
  453.  
  454.    K. Turn off runtime error handling
  455.  
  456.  Do you need this?  You might try turning it off unless you need it.  Just
  457.  to try to cut down the size of the finished program.  None of this 
  458.  is really meant to address the problem you are having.  I can understand
  459.  why what you tried does not work.  You can't just change the load address
  460.  of an ML program and have it work.  That needs tweaked.  I'm just curious
  461.  here about the features available in BASIC 64.
  462.  ------------
  463. Category 5,  Topic 5
  464. Message 7         Fri May 20, 1994
  465. D.BOBER [RENTaLASER]         (Forwarded) 
  466.  
  467. The routine is binary code, not basic data statements. Can I upload it via E-
  468. Mail or do I have to upload it to the Libs?
  469.  ------------
  470. Category 5,  Topic 5
  471. Message 8         Fri May 20, 1994
  472. D.BOBER [RENTaLASER]         (Forwarded) 
  473.  
  474.    EB> After you used the compiler directive to protect the cassette buffer,
  475. did       you LOAD the ML routine...
  476.  
  477. Yes,
  478.  
  479. 20 if a=0 then a=1:load"bank ml",8,1:rem load window routine
  480.  
  481.    EB> I assume you changed the SYS calls to address 828 to point to 49152,
  482.        right?
  483.  
  484. I just changed all the SYS828 to SYS49152 and SYS858 to SYS49182, is that what
  485. you mean?
  486.  
  487. SYS828 copies the screen. SYS858 recalls the screen.
  488.  
  489.    EB> Which are you using here. I would recommend the Speedcode because of
  490. the
  491.        size of the program you are startig with.
  492.  
  493. Yes, I'm using the speedcode option. I also used option 'E' Change the end-of-
  494. memory address of compiled program. This sets the end-of-memory for the 
  495. compiled program. This will save space for routines, fonts, ect.
  496.  
  497. I didn't raise or lower the start address of compiled program option 'F'.
  498.  
  499. Option 'K' is OFF by default.
  500.  
  501. I changed the ML Routine start address to 49152 and included the POKE 
  502. 49152,96 in the beginning of the program. The compiled program crashed and the
  503. BASIC version crashes also. It looks like the SYS49152 causes the crash in
  504. BASIC, the screen resets to start-up blue and the loaded font resets to upper-
  505. case, graphics.
  506.  
  507.  
  508.  
  509.  
  510. Grumble, grumble...
  511.  
  512. :/
  513.  ------------
  514. Category 5,  Topic 5
  515. Message 9         Sat May 21, 1994
  516. CBM-ED [e.g.bell]            (Forwarded) 
  517.  
  518.  DB:  You can upload that file however you like.  However, remember that
  519.  uploading it to my mailbox will cost you, whereas uploading it to the
  520.  library will not.   Seems like an easy choice if I had to make it!  :)
  521.  If it is only a couple hundred bytes, which I assume because you have it
  522.  in the cassette buffer, it won't take any time at all to disassemble
  523.  and reassemble in a new address.
  524.  ------------
  525. Category 5,  Topic 5
  526. Message 10        Sat May 21, 1994
  527. CBM-ED [e.g.bell]            (Forwarded) 
  528.  
  529.  DB:
  530.   DB> changed all the SYS828 to SYS49152 and SYS858 to SYS49182, is
  531.   DB> that what you mean
  532.  
  533.  Yes, that is what I meant.
  534.  
  535.   DB> option 'E' Change the end-of- memory address of compiled
  536.   DB> program. This sets the end-of-memory for the  compiled
  537.   DB> program. This will save space for routines, fonts, ect.
  538.  
  539.   DB> I didn't raise or lower the start address of compiled program
  540.   DB> option 'F'
  541.  
  542.  Did you lower the end-of-memory address from 51100 where you had it to
  543.  49151?  As for raising the start-address, if the @1024 thing does that
  544.  I guess it is probably not needed from the menu.
  545.  
  546.   DB> included the POKE  49152,96 in the beginning of the program.
  547.   DB> The compiled program crashed and the BASIC version crashes
  548.   DB> also. It looks like the SYS49152 causes the crash in BASIC
  549.  
  550.  This kind of suggests that it is really not the routine that is causing
  551.  the problem because the 96 you poked into memory is just an RTS
  552.  intruction, like a RETURN at the end of a BASIC subroutine.  If you didn't
  553.  already, set the top of program pointer to 49151 and try this experiment
  554.  again.  I know it is a PITA, but that is the kind of stuff you have to
  555.  go through to get this stuff working.  (When I say try it again, I'm 
  556.  talking about the POKE 49152,96)
  557.  
  558.  You might also try this.  Try compiling a little BASIC program that 
  559.  pokes 49152 with 96, does the screen moves, etc. and that is all.
  560.  Compile it and see if it works.  Perhaps you are trying to do something
  561.  that simply isn't going to work the way you want to do it.  If you 
  562.  eliminate everything else but this code, it can give you some very
  563.  helpful clues. 
  564.  ------------
  565. Category 5,  Topic 5
  566. Message 11        Sat May 21, 1994
  567. D.BOBER [RENTaLASER]         (Forwarded) 
  568.  
  569. Ok, I compiled this little program...
  570.  
  571. 5 rem compile test 6 poke49152,96 10 ifa=0thena=1:load"bank ml",8,1:REM ml
  572. routine at 828 20 ifb=0thenb=1:load"bank.font",8,1:REM font at 51200 30
  573. poke56578,peek(56578)or3 40 poke56576,(peek(56576)and252) 50
  574. poke53272,(peek(53272)and15) 60 poke648,192 70 poke53272,(peek53272)and240)or2
  575. 80 end
  576.  
  577. Now, after loading and running it, the screens switch and my font is now
  578. active. But when I enter sys49152, the screen resets back and the font is no
  579. longer active. Also the cursor disappears. But the computer isn't really
  580. locked up, because if I hit F1 the ACTIVITY/ACCESS leds on the RamLink light
  581. up, denoting that the directory is being read, just can't list it on the
  582. screen.
  583.  
  584. This occures to the BASIC and COMPILED version...
  585.  
  586. When compiling, I set the end-of-memory address to 49151 and this time I
  587. omitted the REM@ S=1024 directive since I don't need the cassette buffer.
  588.  
  589. Seems like all my trouble is around that ML Routine, perhaps it's time to make
  590. a big change to my program...
  591.  
  592. Douglas
  593.  
  594.  
  595.  
  596.  
  597.  ------------
  598. Category 5,  Topic 5
  599. Message 12        Sat May 21, 1994
  600. CBM-ED [e.g.bell]            (Forwarded) 
  601.  
  602.  DB:  I cleaned up your message.  When you post stuff like that ALWAYS
  603.  use *sn to send it. not *s.  That way it won't be reformatted.  Here it
  604.  is:
  605.  
  606.  5 rem compile test 
  607.  6 poke49152,96 
  608.  10 ifa=0thena=1:load"bank ml",8,1:REM ml routine at 828 
  609.  20 ifb=0thenb=1:load"bank.font",8,1:REM font at 51200 
  610.  30 poke56578,peek(56578)or3 40 poke56576,(peek(56576)and252) 
  611.  50 poke53272,(peek(53272)and15) 60 poke648,192 70
  612. poke53272,(peek53272)and240)
  613.     or 2
  614.  80 end
  615.  
  616.   DB> after loading and running it, the screens switch and my font is
  617.   DB> now active. But when I enter sys49152, the screen resets back
  618.   DB> and the font is no longer active
  619.  
  620.  Here is what you have learned from this.  The ML routine works at 828 as
  621.  it should.  I gather this from the above... and assume that the switches
  622.  are called with the routine in the cassette buffer, right.  Now here is
  623.  something else to try with what you have right now.  The way you have the
  624.  program set up, it just ENDs, meaning nothing should have changed from the
  625.  way you had it while running.  Do a PEEK at address 49152 after the 
  626.  thing stops to see what value is in there.  See if it is still 96.
  627.  
  628.  Incidentally, I just noticed something that may be causing all of this
  629.  as well... and this one is kind of my fault, tho with an explanation.
  630.  Notice that you poked 648 with the value 192.  Well, that is probably how
  631.  I originally told you to do it.  This actually explains everything.  I 
  632.  was thinking that way because the problem with the cassette buffer had not
  633.  cropped up at that time.  This poke tells the screen editor that the screen
  634.  is at 49152.  In other words, anything PRINTed is POKEd to the 1024 byte
  635.  block starting at 49152.  Here is what is probably happening, in light of
  636.  this.   The first character at this address is a space, probably, which 
  637.  is the machine language instruction to JSR, similar to a GOSUB in BASIC.
  638.  The next 2 bytes tell the computer where in memory this routine is.  Since
  639.  this is random, the address is going to be who knows where, which is why
  640.  you are getting such odd, and inconsistent, results.  Do this.  Instead of
  641.  using address 49152, try address 50176, which is after screen memory and
  642.  before the font, meaning unused.  Poke the 96 there, compile, then try
  643.  the switches (in the cassette buffer.... leave the ML there). 
  644.  
  645.  The reason you are probably getting the disappearing cursor, etc. is 
  646.  because of all the bank and pointer changes being done.
  647.  
  648.   DB> I set the end-of-memory address to 49151 and this time I
  649.   DB> omitted the REM@ S=1024 directive since I don't need the
  650.   DB> cassette buffer.
  651.  
  652.  There is something you must keep in mind when shifting ML code around in
  653.  memory.  SOMETIMES it will work, and this may be one of those cases.
  654.  However, it is also possible that the code needs variables that are 
  655.  absolute... in other words, they are in the same block of memory as the
  656.  program itself.  When you move the code, it *may* work if it doesn't
  657.  have to JMP or JSR to any internal addresses.... in other words, any 
  658.  routines of its own.  However, if it uses internal variables, these
  659.  references won't change.  What this means is that the routine may work 
  660.  wherever it is loaded, but it will play havoc with any important data 
  661.  other routines/programs have in that area.  Solution *if* this is what
  662.  is happening, is to 1] leave the routine where it is and protect it with
  663.  compiler directives, or 2] move the routine, but still protect the original
  664.  block of memory, namely, in this case, the cassette buffer, or 3] re-do
  665.  the routine to assemble at a new address.  Try the change to 50176 instead
  666.  of 49152.  I think you are going to see some further changes.
  667.  
  668.  I really think you are getting some valuable information/clues as to what
  669.  is going on from this little program.  Try the address change and get back
  670.  w/your results from that.  You may have to make some changes to your 
  671.  program... maybe not.  You're getting closer to the solution all the time
  672.  though!  :)
  673.  ------------
  674. Category 5,  Topic 5
  675. Message 13        Tue May 24, 1994
  676. D.BOBER [RENTaLASER]         (Forwarded) 
  677.  
  678.  Oh, I forgot to mention soemthing. When I first started eveloping this 
  679.  program, SYS828 would copy the screen into memory and SYS858 would recall the
  680.  screen. But when I started using my font, SYS885 would copy the screen and
  681.  SYS828 recalls the screen. I don't know why, but it works.
  682.  
  683.  Now, I changed the POKE 49152,96 to POKE 50176,96 and changed the load 
  684.  address of the ml routine, and it worked only after removing the POKE
  685. 50176,96
  686.  It worked in BASIC and Compiled. But when I made the needed changes to my
  687.  program and tried it. When my program calls SYS50206 to copy the screen to
  688.  memory, it does. But when it calls SYS50176 to recall the screen, it breaks.
  689.  Entering CONT continues the program, it also recalls the screen. But the 
  690.  compiled version doesn't work at all. It crashes like before. I used the REM@
  691.  s=1024 to keep the cassette buffer open. We're gettin closer, Just don't know
  692.  what to do.
  693.  
  694.  
  695.  ------------
  696. Category 5,  Topic 5
  697. Message 14        Tue May 24, 1994
  698. CBM-ED [e.g.bell]            (Forwarded) 
  699.  
  700. DB:
  701.  DB>  program, SYS828 would copy the screen into memory and SYS858
  702.  DB> would recall the  screen. But when I started using my font,
  703.  DB> SYS885 would copy the screen and  SYS828 recalls the screen. I
  704.  DB> don't know why, but it works
  705.  
  706. I can't explain that either.  :(
  707.  
  708.  DB> It worked in BASIC and Compiled. But when I made the needed
  709.  DB> changes to my  program and tried it. When my program calls
  710.  DB> SYS50206 to copy the screen to  memory, it does. But when it
  711.  DB> calls SYS50176 to recall the screen, it breaks
  712.  
  713. That is not all tha surprising.  It is more surprising that it works either
  714. time, actually.  Like I told you before, what is probably  needed is for that
  715. screen save routine to be rewritten to work in  page $C0-$CF.  It may also be
  716. that the save routine is saving data  into this block of memory, meaning that
  717. it is overwriting the ML which could cause what you describe.  The screen data
  718. takes 1024 bytes.  The color, depending on how it is done, may take as little
  719. as 512 bytes... but this had to come from somewhere, and it may well be from
  720. this very bock of memory.  This might complicate things too... finding enough
  721. memory to save the screen in.  The 1K can come from the normal screen area,
  722. which your routine would not be doing, and 512 other bytes would have to be
  723. found somewhere... but I think the problem sounds for all intents and purposes
  724. to be solved.  The routine must be reassembled to work... and I have to
  725. suspect from your description that it is  overwriting itself...  Upload it. 
  726. :)
  727.  ------------
  728. Category 5,  Topic 5
  729. Message 15        Wed May 25, 1994
  730. D.BOBER [RENTaLASER]         (Forwarded) 
  731.  
  732.  Ok, I'll upload it tonight.
  733.  ------------
  734. Category 5,  Topic 5
  735. Message 16        Thu May 26, 1994
  736. CBM-ED [e.g.bell]            (Forwarded) 
  737.  
  738.  DB:  I have good news for you, and some explanation as well.  First, the
  739.  reason the save/restore works in reverse when you have that hack I gave
  740.  you installed is this.  As I surmised, the routine you are  using to save
  741.  the screen data is indeed saving it to $c000.  This is almost too perfect
  742.  to ask for, because it takes data from the screen area at $0400 and saves
  743.  it in $C0 block, and vice versa to restore it. Since my code puts the
  744.  screen at $c0 block, the same code will work, but in reverse.  In other
  745.  words, you are taking from $C000 and putting to $0400 to save and vice 
  746.  versa to restore.  This was a stroke of coincidence/luck.
  747.  
  748.  Second, the routine is only saving the text portion of the screen, not
  749.  the color data, meaning that we don't need any more than just the normal
  750.  screen area... not the extra 512-1024 bytes for color storage/recovery.
  751.  
  752.  Third, I think all you will have to do to get this routine to work is
  753.  to make it load at 50176.  Then sys 50176 should recall the screen and
  754.  sys 50206 should save it.  This takes all of the ML and font, etc. out of
  755.  the live area for BASIC 64 and it shouldn't trip over itself.  Of course,
  756.  is this what you have already said does not work?  Hmmmmm!  I can't recall.
  757.  But here is what the routine you sent me looks like disassembled:
  758.  
  759.  restore   ldy #0
  760.  !01       lda $0400,y
  761.            sta $c000,y
  762.            lda $0500,y
  763.            sta $c100,y
  764.            lda $0600,y
  765.            sta $c200,y
  766.            lda $06e8,y
  767.            sta $c2e8,y
  768.            iny
  769.            bne !01
  770.            rts
  771.            ;
  772.  save      ldy #0
  773.  !01       lda $c000,y
  774.            sta $0400,y
  775.            lda $c100,y
  776.            sta $0500,y
  777.            lda $c200,y
  778.            sta $0600,y
  779.            lda $c2e8,y
  780.            sta $06e8,y
  781.            iny
  782.            bne !01
  783.            rts
  784.  
  785.  ------------
  786. Category 5,  Topic 5
  787. Message 17        Thu May 26, 1994
  788. D.BOBER [RENTaLASER]         (Forwarded) 
  789.  
  790.  UPDATE! UPDATE!
  791.  
  792.  
  793.  OK, I double checked my code, removed the REM@ S=1025 directive, and also
  794.  removed the lines that loads the FONT and ML. (I made a BASIC loader for 
  795.  those.) Then compiled the program...
  796.  
  797.  It started to work! The first SYS50206 (save screen) worked but the
  798.  SYS50176 (recall) caused a crash. (Blue screen, no cursor.) This also happens
  799.  with the BASIC version, only somewhat slower. That makes sense, the speedcode
  800.  
  801.  would be faster!
  802.  
  803.  I stated earlyer that in BASIC, I could enter CONT to continue the program,
  804.  that's not right, I can't. Something else I noticed when it crashes back
  805.  to the blue screen, there is some text on the blue screen. However, they
  806.  are in Upper-case/Graphics. Example, the top of the screen looks something
  807.  like this...
  808.  
  809.  Account   Options
  810.  ---------------------------------------------------------------------
  811.  
  812.  
  813.  
  814.  But after the crash "Account" and "Options" are in uppercase/graphics.
  815.  Seems like it jumped to the original screen (default).
  816.  
  817.  I think we're getting closer yet....
  818.  
  819.  
  820.  :)
  821.  
  822.  ------------
  823. Category 5,  Topic 5
  824. Message 18        Thu May 26, 1994
  825. D.BOBER [RENTaLASER]         (Forwarded) 
  826.  
  827.  Uh-oh!
  828.  
  829.  Ignore my last post!
  830.  
  831.  I'm Embarassed! I was pouring over my program this evening and I found it...
  832.  ...It was there...A lonely little SYS828 right in the place that caused 
  833.  the crash I posted in my last post.
  834.  
  835.  I then Re-Compiled it and it now works flawlessly!  Although, When the screen
  836.  is copied into memory (SYS50206) about 6-8 characters appear at the lower-
  837.  middle of the screen. EXAMPLE:  k<k<rp<= 
  838.  
  839.  Have no idea why, or what it is. SYS50176 removes it. Must be caused by the
  840.  compiler. I'll experiment with it.
  841.  
  842.  Thanks alot for all you're help! I really appreciate it!!!
  843.  
  844.  I have a few other things I want to add and change. After testing this
  845. program
  846.  I will upload it to GEnie. Should be about two weeks.
  847.  
  848.  Again, THANK YOU!!
  849.  
  850.  :)
  851.  
  852.  Douglas Bober
  853.  
  854.  
  855.  
  856.  ------------
  857. Category 5,  Topic 5
  858. Message 19        Fri May 27, 1994
  859. CBM-ED [e.g.bell]            (Forwarded) 
  860.  
  861.  Just give me an honorable mention in your acknowledgements.  hehehe
  862.  
  863.  The spurious characters appear when you *save* the screen?  It 
  864.  sounds like something spurious is getting into your $C000-$c7ff
  865.  screen area.  I'm glad you found the final problem though.  This
  866.  last thing you found is typical of the kinds of things programmers
  867.  run into.  :)
  868.  ------------
  869. Category 5,  Topic 5
  870. Message 20        Fri May 27, 1994
  871. D.BOBER [RENTaLASER]         (Forwarded) 
  872.  
  873.  Thank you...
  874.  
  875.  I will definitly mention you in my acknowledgements!
  876.  ------------
  877.  
  878. 5 |