Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Racer

#1
Assembly / Re: Centipede BBS Source Code Help
March 10, 2011, 07:26 AM
Here is what I found out, in case anyone is interested.

The source files are in BUDDY assembler format but the files are slightly corrupted.

I have been able to retrieve at least most of the code by running the MAKE-ASCII program that comes with the Buddy Assembler to convert the files into SEQ files for use with the EBUD Assembler.

Not sure how they got corrupted.  I dont know if it happened when they were combined in LBR or what.  I do think I can rescue most if not all of the code.
#2
BDD, tried using your code as an example, but it does not mark for garbage collection and will run out of memory eventually.  The code I posted is the only one I found that does unless you have something else or I missed something which is highly possible.


#3
Here is the working source to create / read a variable in Assembly.

Thanks to Hydro for making this work!  This will now flag the variables so garbage collection will remove them and no more out of memory error.



; COMMODORE 128 STRING ROUTINES
; I DID NOT WRITE MOST OF THIS CODE. JUST COMBINED IT TO MAKE IT WORK
; THANKS TO THOSE WHO DID MOST OF THE HARD WORK
; STARTLOC + 0 WILL COPY THE CONTENTS OF DATA INTO I$
; DATA IS DEFINED AT THE END OF THIS SOURCE AND IS A NULL TERMINATED STRING
; STARTLOC + 3 WILL FIND THE STRING I$ AND PRINT ITS CONTENTS TO THE SCREEN
; THIS CODE CAN BE EASILY MODIFIED TO CHANGE WHICH VARIABLE IS IS LOOKING FOR.
; SOURCE IS IN 64TASS FORMAT - SHOULD BE EASY TO MODIFY TO YOUR FAVORITE ASSEMBLER
INDEX1 = $24    ;HEAVLY USED BASIC POINTER   
FRETOP = $35
FRESPC = $37
VARNAM = $47
VARPNT = $49
STRPNT = $52
LENGTH = $63
JSRFAR = $2CD
NEWFAR = $2A2-22
PTRGET = $7B0B
STRLIT = $869A
STREX1 = $87CA
INDFET = $FF74    ;KERNAL JUMPS
INDSTA = $FF77
*= $1300
  JMP  J1   ; WRITE CONTENTS OF DATA TO STRING
  JMP  J2   ; FIND STRING, AND PRINT ITS CONTENTS
J1   JSR  DUPFAR
  LDA  #"i"
  LDY  #$80   ; I$
  JSR  STRFIN   ; SETUP VARIABLE NAME
  JMP  STRSTR   ; STORE CONTENTS OF "DATA"
J2   LDA  #"i"
  LDY  #$80   ; I$
  JSR  STRFIN
  JSR  STRGET
  LDA  #STRPNT+1  ; ZP STARTING ADDRESS OF STRING (LO BYTE)
  STA  FETCH+1  ; UPDATE OUR FETCH ROUTINE TO FIND IT
  LDA  STRPNT   ; STRING LENGTH
  BNE  +   ; CONTINUE PRINTING IF ITS NOT 0 LENGTH
  RTS    ; IF ITS NULL, EXIT OUT
+   LDY  #0   ; PRINTS CONTENTS OF THE STRING TO THE SCREEN
-   STY  TEMPY   ; SAVE Y
  jsr  FETCH   ; GET BYTE FROM STRING
  JSR  $FFD2   ; PRINT IT
  LDY  TEMPY   ; RESTORE Y
  INY
  CPY  STRPNT   ; LENGTH OF STRING
  BCC  -   ; LOOP UNTIL END OF STRING
  RTS
TEMPY  .BYTE  0
STRGET  LDY  #2
-   LDX  #1
  LDA  #VARPNT
  JSR  INDFET
  STA  STRPNT,Y
  DEY
  BPL  -
  RTS
STRFIN  STA  VARNAM
  STY  VARNAM+1
  LDA  #$FF   ; FLAG FOR TYPE $
  STA  $0F
  LDA  #14   ; BANK 14
  LDX   #>PTRGET   
  LDY   #<PTRGET   
  JSR   CALLJSR        ; CALL PTRGET AT $7B0B
 
;SET INDEX1,A WITH DESCRIPTOR   


  LDX  VARPNT   
  LDY  VARPNT+1   
  STX  INDEX1   
  STY  INDEX1+1   
  LDA  #14
  LDX  #>STREX1
  LDY  #<STREX1
 
  JSR  CALLJSR ;NEWFAR       ;CALL STREX1     
  LDA  #INDEX1      ;POINTER   
  STA  $2B9         ;FOR INDSTA   
  LDA  6            ;REGISTER .A FROM STREX1 CALL   
  BEQ  EMPTY        ;ZERO LENGTH, NO DATA   
  TAY              ;AFTER DATA, "BACK POINTER" LOW BYTE   
  LDX  #1   
  JSR  INDSTA       ;SET LENGTH OF GARBAGE   
  INY              ;INDEX "BACK POINTER" HIGH BYTE   
  LDA  #$FF         ;FLAG AS GARBAGE   
  LDX  #1   
  JMP  INDSTA       ;SET FLAG
EMPTY   RTS

STRSTR  LDA  #<DATA
  STA  $06
  LDA  #>DATA
  STA  $08

  LDA  #14
  LDX  #>STRLIT
  LDY  #<STRLIT
  JSR  CALLJSR
 
  DEC  $18   ;CALLING FROM ÍÌ,
  DEC  $18   ;SO UNDO $,
  DEC  $18   ;DESCRIPTOR STACK
  LDA  #VARPNT  ;ADDRESS OF VARPNT
  STA  $02B9
  LDX  #1   ;MMU BANK 1 RAM
  LDY  #0
  LDA  LENGTH   ;$ LENGTH
  JSR  INDSTA
  LDX  #1
  INY
  LDA  FRETOP   ;MAKE OUR VARIABLE
  JSR  INDSTA   ;POINT TO COPIED $
  LDX  #1
  INY
  LDA  FRETOP+1
  JSR  INDSTA

  LDA   #FRETOP      ;POINTER TO NEW STRING DATA   
  STA   $02B9        ;POINTER FOR INDSTA   
  LDX   #1   
  LDY   LENGTH       ;AFTER STRING DATA   
  LDA   VARPNT       ;MAKE "BACK-POINTER" LOW   
  JSR   INDSTA       ;FOR GARBAGE COLLECTION   
  LDX   #1   
  INY     
  LDA   VARPNT+1     ;MAKE "BACK-POINTER" HIGH   
  JMP   INDSTA


FETCH  LDA  #$FF   ; ZP pointer to use THIS GETS MODIFYED ** IMPORTANT **
  LDX  #1    ; bank index 1
  JMP  $FF74   ; kernal

CALLJSR STA  $02
  STX  $03
  STY  $04
  JMP  NEWFAR
DUPFAR  LDY  #21
-  LDA  JSRFAR,Y
  STA  NEWFAR,Y
  DEY
  BPL  -
  LDA  $FF00   ; MODIFY TO RETURN TO
  STA  NEWFAR+17  ; CALLING BANK
  RTS
DATA  .BYTE  "hello world!",0


#4
Your code seems to work just fine.  Like in your demonstration, it counts down, runs garbage collection and starts all over.  GREAT JOB!

I ran it through 1 loop anyway.  Might just turn it on and let it run for awhile.  I see no reason it shouldn't keep on running.  Maybe I will throw some other variables in there from basic to make it really have lots of garbage to collect.

I have no idea how in the world you figured that out but you are my hero.  :)

I will try and clean up my code, make it look pretty, and post the complete working code on here later for any one else who might need it.
#5
Hydro!

You posted at the exact same time.  Well it appears I was on the right track.  (I think)

Its getting late here, but I can't wait to try your code.  Looks like I will have something to play with at lunch time.

I appreciate all of your effort and help.

I'd like to make website or something with just 128 code snippets and share things that may be helpful to newbies like myself.  I dont think there is one dediated to 128 code anyway.  I have some code that might be useful for other people.  I have code to save/restore variables, arrays, etc.  basically its a re-dim program.  It was used in C64 BBS's and I think I have it working on the 128.  Need some more testing.  I also have a nice working Swiftlink library (Not the one from Craig Bruce)

Just in case anyone was interested in that sort of stuff.

-Jeff
#6
Ok, I have done some playing and I will try and explain what I found out.  I made the changes to the code above and assembled.  Ran this program:


10 BANK15:FAST
20 SYS4864:PRINTI$:I$="JEFF BROWN":PRINTI$:GOTO20


After 10 minutes or so, I get an out of memory error.

So I am thinking it must be garbage collection.  I changed the code to the following:


10 BANK15:FAST
20 SYS4864:PRINT I$:I$="JEFF BROWN": PRINT I$:X=FRE(1):Y=FRE(0):PRINT X,Y:GOTO20

This should force garbage collection (It does on a C64, not 100% sure on the 128)
If you run this, you will see that when it prints X it is constantly going down.  Soon as it gets to about 0 out of memory error.

1 more change to the code:


10 BANK15:FAST
20 I$="":SYS4864:PRINT I$:I$="JEFF BROWN": PRINT I$:X=FRE(1):Y=FRE(0):PRINT X,Y:GOTO20


Now when you run it, you will see that printing x,y does not change.  Its been running for about 20 minutes and still going, which I am guessing it would run forever like that.

So is this a garbage collection issue?  Is the string not being created properly?  I am wondering if we somehow create a null string first and then create the string using the ML would the be the same as doing the I$="" and the SYS to create I$ with data stored in the ML?

I'd love to hear your thoughts.  I have learned a lot this last week or so but I still have a LONG way to go, but its fun.  :)

#7
I changed the code and I get the same thing.  It will run for about 5-10 minutes and then get an out of memory error.

Granted, this is running on Vice.  I did not try it on real hardware to be 100% sure but vice is usually pretty good.
#8
Thanks for the reply.  I will give it a shot when I get home and let you know how it goes.
#9
Here is an issue I am having.  Hope someone can help.

I modified BBD's code and just kept the parts to create a string.

I can BANK15:SYS DEC("1300"),,,,,A$

It returns "Hello World" in a$ just like it should.

Here is my problem:  Eventually I get an out of memory error.

Simple program


10 BANK15
20 SYS DEC("1300"),,,,,A$:PRINT A$: A$="HI":PRINT A$:GOTO20



As you can imagine, this prints "HELLO WORLD" and next line "HI" over and over again.  This will run for about 10-15 minutes and then will give me an out of memory error.  If I view bank 1 it seems to be filled up with HI (and I think HELLO WORLD, not at my main computer right now).  Seems that its not doing garbage collection?

I can post the ML code if needed, but seems kind of redundant since its 99% unmodifyed BBD code posted above.

Any help is appreciated.
#10
Here is some code that might be helpful to anyone wanting to access variables on the 128.  Please note.  I did not write 99% of this code.  I just arranged it so it would be easy to find.  I hope this is not out of line.

This code has 2 routines.  1st routine will create a string variable (I$) from whatever is stored in DATA (at end of source)

2nd routine will read the contents of I$ and print it to the screen.

Feel free to comment or make any changes to make this better.  I hope this helps anyone who is looking for this type of information.


; COMMODORE 128 STRING ROUTINES
; I DID NOT WRITE MOST OF THIS CODE.  JUST COMBINED IT TO MAKE IT WORK
; THANKS TO THOSE WHO DID MOST OF THE HARD WORK
; STARTLOC + 0 WILL COPY THE CONTENTS OF DATA INTO I$
; DATA IS DEFINED AT THE END OF THIS SOURCE AND IS A NULL TERMINATED STRING
; STARTLOC + 3 WILL FIND THE STRING I$ AND PRINT ITS CONTENTS TO THE SCREEN
; THIS CODE CAN BE EASILY MODIFIED TO CHANGE WHICH VARIABLE IS IS LOOKING FOR.
; SOURCE IS IN 64TASS FORMAT - SHOULD BE EASY TO MODIFY TO YOUR FAVORITE ASSEMBLER
FRETOP = $35     
FRESPC = $37
VARNAM = $47
VARPNT = $49
STRPNT = $52
LENGTH = $63
JSRFAR = $2CD
NEWFAR = $2A2-22
PTRGET = $7B0B   
STRLIT = $869A
INDFET = $FF74    ;KERNAL JUMPS
INDSTA = $FF77
*= $1300

JMP J1  ; WRITE CONTENTS OF DATA TO STRING
JMP J2  ; FIND STRING, AND PRINT ITS CONTENTS

J1 LDA #"i"
LDY #$80  ; I$
JSR STRFIN  ; SETUP VARIABLE NAME
JMP STRSTR  ; STORE CONTENTS OF "DATA"

J2 LDA #"i"
LDY #$80  ; I$
JSR STRFIN
JSR STRGET
LDA #STRPNT+1 ; ZP STARTING ADDRESS OF STRING (LO BYTE)
STA FETCH+1 ; UPDATE OUR FETCH ROUTINE TO FIND IT
LDA STRPNT  ; STRING LENGTH
BNE +  ; CONTINUE PRINTING IF ITS NOT 0 LENGTH
RTS   ; IF ITS NULL, EXIT OUT
+ LDY #0  ; PRINTS CONTENTS OF THE STRING TO THE SCREEN
- STY TEMPY  ; SAVE Y
jsr FETCH  ; GET BYTE FROM STRING
JSR $FFD2  ; PRINT IT
LDY TEMPY  ; RESTORE Y
INY
CPY STRPNT  ; LENGTH OF STRING
BCC -  ; LOOP UNTIL END OF STRING
RTS
TEMPY .BYTE 0
STRGET LDY  #2
-  LDX  #1
    LDA  #VARPNT
    JSR  INDFET
    STA  STRPNT,Y
    DEY
    BPL  -
    RTS

STRFIN PHA
TYA
PHA
    JSR  DUPFAR      ; DUP AND MOD JSRFAR
    PLA
TAY   ; Y WILL CONTAIN #$80 IF JUST SINGLE CHAR VARIABLE (A$, ETC)
PLA
    STA  VARNAM
    STY  VARNAM+1
    LDA  #$FF        ; FLAG FOR TYPE $
    STA  $0F
    LDA  #14         ; BANK 14
    STA  $02
    LDA  #>PTRGET
    STA  $03
    LDA  #<PTRGET
    STA  $04
    JMP  NEWFAR      ; CALL PTRGET AT $7B0B
STRSTR LDA  #14
    STA  $02
    LDA  #>STRLIT
    STA  $03
    LDA  #<STRLIT
    STA  $04
    LDA  #<DATA   ;ADDRESS OF OUR $
    STA  $06           ;TO BE ALLOTTED/COPIED
    LDA  #>DATA
    STA  $08
    JSR  NEWFAR      ;CALL STRLIT AT $869A
    DEC  $18         ;CALLING FROM ÍÌ,
    DEC  $18         ;SO UNDO $,
    DEC  $18         ;DESCRIPTOR STACK
    LDA  #VARPNT     ;ADDRESS OF VARPNT
    STA  $02B9
    LDX  #1          ;MMU BANK 1 RAM
    LDY  #0
    LDA  LENGTH      ;$ LENGTH
    JSR  INDSTA
    LDX  #1
    INY
    LDA  FRETOP      ;MAKE OUR VARIABLE
    JSR  INDSTA      ;POINT TO COPIED $
    LDX  #1
    INY
    LDA  FRETOP+1
    JSR  INDSTA
    LDA  #FRESPC     ;FREESPC ADDRESS WHICH
    STA  $02B9        ;POINTS TO COPIED $
    LDX  #1
    LDY  #0
    LDA  VARPNT      ;MAKE $ POINT BACK TO
    JSR  INDSTA      ;OUR VARIABLE (FOR
    LDX  #1          ;GARBAGE COLLECTION
    INY              ;PURPOSES)
    LDA  VARPNT+1
    JMP  INDSTA

FETCH LDA  #$FF   ; ZP pointer to use THIS GETS MODIFYED ** IMPORTANT **
LDX  #1   ; bank index 1
JMP  $FF74   ; kernal
DUPFAR LDY  #21
-  LDA  JSRFAR,Y
    STA  NEWFAR,Y
    DEY
    BPL  -
    LDA  $FF00       ; MODIFY TO RETURN TO
    STA  NEWFAR+17   ; CALLING BANK
    RTS

DATA .BYTE "hello world!",0

#11
As the topic says, looking for a decent 80 column capable monitor.  Like 1902, 1084, etc.

I am located in North Carolina

Hope this is the proper place to post this.  I didn't see any classified section or anything.
#12
Turns out it was a fuse in the PS.  Who would have thought. 
#13
Ok, have a USA model 128DCR.

Everything functions perfectly except neither TOD clock in the CIA chips work.  Swapped the CIA chips and same thing.

Chatted with Ray Carleson and he said that the U16 and U 30  74ls14 and 7406 are high failure items and to try replacing them.  I did and same thing.

I do not have access to an oscilliscope so I am just kind of going for parts replacement.

Any suggestions would be great.

#14
Assembly / Re: Centipede BBS Source Code Help
August 13, 2010, 12:40 PM
No, they are source code files.

There is an assembler for the C64 that works similar.  If you load in the program file without the assembler running you get a little bit of code and mostly nonsense.  My guess is that it is creating its own tokenized code and has to be running first.

Its not a ML file with a basic header, its actual source.
#15
Assembly / Centipede BBS Source Code Help
August 13, 2010, 11:33 AM
I downloaded a copy of Centipede BBS's source code available here:  http://snowpig.org/centipede/dl-centipede.htm

Anyway, they are all PRG files but they are not standard basic programs.  You can load them and list, but you will only get a couple of lines listed and some garbage.  My guess there has to be an assembler running for it to show the complete listing.  My question is, anyone have any idea what assembler that might be?
#16
Looking for a hard drive to run a BBS.

Yes, I know they are very expensive.

Let me know what you have.

I am located in North Carolina, USA