It is currently Mon Oct 20, 2014 6:21 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 141 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Author Message
PostPosted: Thu Oct 09, 2008 11:32 pm 
Offline
User avatar
 Profile

Joined: Fri Apr 25, 2008 7:55 pm
Posts: 147
Hello again - Just had a read and a play and I think I (we?) have a problem :?

It's the OS that sets and supports the BRK vector and by default this points to a handler in BASIC which prints the 'error' message. After some pointer stashing, the BRK is first offered round any paged roms with service call $06 and then finally, I assume if not claimed, the code indirects to the contents of $202/203 which point to a routine in the BASIC rom - $B402 in BASIC II.
Since I am intending to temporarily switch BASIC out whilst these utility routines are serviced (which is what I did for Kohen's multi-message utility), I think things will fall apart if the BRK error handler is used from within SWR. For the message utility, I used a simple OSASCI loop to print the messages and hence avoided this problem.

Therefore, this direction routine will either have to live in ram or will have to be rewritten to include it's own string print routine :(

Kohen - to avoid rewriting Francis' elegant routine, could it not live in ram since there is quite a lot of free space knocking around in low memory such as where I located the message print call routine or at $B00 etc. :?:

Martin


Top
 
PostPosted: Fri Oct 10, 2008 12:08 am 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Hi Martin,

The original code for the directions was never mine. I just expanded on the example Koen posted.

I am still (re)learning my BBC assembly skills in a lot of areas and I wasn't sure how the BRK,&FF,<string>,0 technique worked (I naively assumed that this was a Quillism). I could rewrite the code to use OSASCI instead.

Kind regards,

Francis.


Top
 
PostPosted: Fri Oct 10, 2008 12:52 am 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
MartinB wrote:
I've been keeping an eye on developments and you (Francis) are doing a stirling job :D

Thanks! :D

Developing the routines for Koen have been a good opportunity for me to practice my 6502 skills.

Kind regards,

Francis.


Top
 
PostPosted: Fri Oct 10, 2008 10:41 am 
Offline
User avatar
 Profile

Joined: Fri Apr 25, 2008 7:55 pm
Posts: 147
Hi Francis.

'Quillism' - love that :lol:

Actually, that's an interesting point because Quill could indeed hijack the vector at $202/203 and use it's own print routine but I don't know if that's the case or not. I did give these things some thought a while ago but in the end took the safety first lazy good-for-nothing cowards way out and included my own message print code.

All things considered, I think I would be happier if you could re-work the code to include it's own print routine - assuming of course that you have the time and inclination!

Rather than dump it back on you, I could get serious - build all these routines into a pucker service rom with star commands and then include code to claim the BRK call and implement an error message handler as per BASIC but it would all get extremely time consuming and somewhat over-elaborate. The message print utility (already complete) just uses one 16k bank of SWR as a text storage area and I was only going to use the second SWR bank as extended memory to host these (your :) ) new routines with a call selector in normal ram.

So, if you have the time, do you fancy re-working it? I'm embroiled in several hardware projects (as always) so I was hoping to keep my adventuring exploits to a minimum if possible.

Martin


Top
 
PostPosted: Fri Oct 10, 2008 12:06 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Hi Martin,

I should be able to rewrite the code to include it's own print routine, but it will be next week before I can do anything with it.

Kind regards,

Francis.


Top
 
PostPosted: Fri Oct 10, 2008 8:30 pm 
Offline
 Profile

Joined: Mon Jul 07, 2008 6:58 pm
Posts: 64
Wwow!!!
Lots of BRK and routine words :lol: :lol:

Some of the I understand, but Martin if you have used the code from the forum page, you indeed get an error with quil.
I missed a line in that code, and also I had to insert the tape numbers (mentioned in the code) to make the routine work.
After these corrections all worked well with Quil.
The corrections are :
Code:
 
50 .START:LDA &350A:STA &70:LDA &350B:STA &71:LDX #0
95 EQUB 255:EQUB 13:EQUS "Visible exits : ":EQUB 13:EQUB 0

Rewriting the utils is not my first choice. That would be Fransis to decide.
I don't know how much memory is left to put software.
But what I do know, is that the possibility should stay open for me to load an run and use *commands within Quill.
The free space suggested by Quill is : &70 - &8F and &B00 - &CFF

So if both utils from Fransis and the call Util from Martin to display the SWR messages fit within these memory locations, it would be great!

Am I saying useful things between the BRK's? :?

Cheers

Koen


Top
 
PostPosted: Fri Oct 10, 2008 9:18 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Does the corrected routine work when relocated to sideway RAM though?

If it does then great, if not I'll rewrite it.

Kind regards,

Francis


Top
 
PostPosted: Fri Oct 10, 2008 9:31 pm 
Offline
 Profile

Joined: Mon Jul 07, 2008 6:58 pm
Posts: 64
Hey your home computer works again. (or still at work?)

Martin can answer this. Don't know if he tested it with Quill.
If it is easy to convert, Martin, we can test it. Just send me a disk image or code so I'll test it. (together with a small utill to be placed in B00 or other free space that Quill can call, which on its turn calls the routine in SWR)

Cheers

Koen


Top
 
PostPosted: Fri Oct 10, 2008 9:39 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
At least one of my home computers was always working, but I have 5 in bits at the moment making access to my working ones awkward.

Kind regards,

Francis


Top
 
PostPosted: Fri Oct 10, 2008 10:16 pm 
Offline
User avatar
 Profile

Joined: Fri Apr 25, 2008 7:55 pm
Posts: 147
Sorry Koen, didn't mean to cut you out of the discussion - seems the engineers were making plans without talking to the project manager! It's my fault though, I was leading the polite and helpful Francis astray :oops:

No, not tried anything yet - I was just looking at the code and making assumptions but I am sure the routine will fail when run in SWR unless Quill handles BRK triggered error message printing as per BASIC. However, I will provide you with the relocated code (unchanged) and a caller so you can try it first before we make any decisions. Haven't got time just now though, busy weekend, so I will do it as soon as possible.

Martin


Top
 
PostPosted: Sat Oct 11, 2008 7:43 am 
Offline
 Profile

Joined: Mon Jul 07, 2008 6:58 pm
Posts: 64
Hey Martin,

MartinB wrote:
Sorry Koen, didn't mean to cut you out of the discussion - seems the engineers were making plans without talking to the project manager! It's my fault though, I was leading the polite and helpful Francis astray :oops:

Don't worry about that.
Didn't had any feeling of any kind of cutting off.
Just had a laugh with myself, about all those BRK and other machine code talk I did partly understand.
So no problem at all. ;)

I'll see when you have something ready.

Cheers

Koen


Top
 
PostPosted: Mon Oct 13, 2008 1:32 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Hi Koen,

Updated code using OSASCI instead of the BRKs

Code:
   10FOR N%=0 TO 3 STEP 3
   20P%=&B00
   30[
   40OPT N%
   50.START:LDA &350A:STA &70:LDA &350B:STA &71:LDX #0
   60.START1:CPX &502:BEQ START2:LDY #0:LDA(&70),Y
   70CLC:ADC &70:STA &70:LDA &71:ADC #0:STA &71:INX:JMP START1
   80.START2:LDY #0:.S2_LOOP:LDA S2_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S2_LOOP
   90LDY #1:STY &72
  100.START3:LDY &72:LDA (&70),Y:CMP #255:BNE START0
  110JSR &FFE7:JSR &FFE7:RTS
  120.START0:CMP #0:BNE START5:.S0_LOOP:LDA S0_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S0_LOOP
  130.START4:INC &72:INC &72:JMP START3
  140.START5:CMP #1:BNE START6:.S5_LOOP:LDA S5_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S5_LOOP
  150JMP START4
  160.START6:CMP #2:BNE START7:.S6_LOOP:LDA S6_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S6_LOOP
  170JMP START4
  180.START7:CMP #3:BNE START8:.S7_LOOP:LDA S7_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S7_LOOP
  190JMP START4
  200.START8:CMP #4:BNE START9:.S8_LOOP:LDA S8_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S8_LOOP
  210JMP START4
  220.START9:CMP #5:BNE START10:.S9_LOOP:LDA S9_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S9_LOOP
  230JMP START4
  240.START13:CMP #11:BNE START4:.S13_LOOP:LDA S13_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S13_LOOP
  250JMP START4
  260.START10:CMP #8:BNE START11:.S10_LOOP:LDA S10_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S10_LOOP
  270JMP START4
  280.START11:CMP #9:BNE START12:.S11_LOOP:LDA S11_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S11_LOOP
  290JMP START4
  300.START12:CMP #10:BNE START13:.S12_LOOP:LDA S12_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S12_LOOP
  310JMP START4
  320.S0_TEXT:EQUS "North, ":EQUB 0
  330.S2_TEXT:EQUS "Visible exits : ":EQUB 0
  340.S5_TEXT:EQUS "South, ":EQUB 0
  350.S6_TEXT:EQUS "East, ":EQUB 0
  360.S7_TEXT:EQUS "West, ":EQUB 0
  370.S8_TEXT:EQUS "Up, ":EQUB 0
  380.S9_TEXT:EQUS "Down, ":EQUB 0
  390.S10_TEXT:EQUS "NorthEast, ":EQUB 0
  400.S11_TEXT:EQUS "NorthWest, ":EQUB 0
  410.S12_TEXT:EQUS "SouthEast, ":EQUB 0
  420.S13_TEXT:EQUS "SouthWest, ":EQUB 0
  430]
  440NEXT
  450PRINT"LSB=";START MOD 256
  460PRINT"MSB=";START DIV 256


Try that and let me know if it works.

Kind regards,

Francis.


Top
 
PostPosted: Mon Oct 13, 2008 1:54 pm 
Offline
 Profile

Joined: Mon Jul 07, 2008 6:58 pm
Posts: 64
Hi Francis,

Well have to disapoint you. In a way it works, but not in the right way.
The screenshot shows the possible exits at 'undefined location'.
The exits are : nw,n,ne,w,e,sw,s,se (programmed in that order)

Hope you can do something with it.

maybe these hints from the manual helps :
Quote:
The program reveals several points that the user should note:

1) Locations &70-&8F are available to the user,
2) The Quill interpreter is restarted by RTS, and
3) Messages can be sent using BRK, followed by a 255, the message, and a 0.


Cheers

Koen


Attachments:
Picture 1.png [14.9 KiB]
Downloaded 163 times
Top
 
PostPosted: Mon Oct 13, 2008 2:28 pm 
Offline
User avatar
 Profile

Joined: Fri Apr 25, 2008 7:55 pm
Posts: 147
I was hoping to get the relocated version done today or tomorrow so it's always possible that might yet work but I'm still dubious - I know that the Quill manual suggests that the BRK,<err_num>,<text>,0 can be used but they may still be assuming that BASIC will be present (and paged in) on the end user's machine.

Reference your OSASCI version Francis, and just at a glance, I think the forward truncated messages are because Y hasn't been initialised to zero before you start your printing loops. Where you begin each loop with LDA_Sn_TEXT,Y the Y register contains an earlier value from the initial code and hence will skip the first n characters of each message.

Martin


Top
 
PostPosted: Mon Oct 13, 2008 3:03 pm 
Offline
 Profile

Joined: Mon Jul 07, 2008 6:58 pm
Posts: 64
Hi Both,

In the picture you also see 'Up' mentioned.
And this is not programmed in Quill.
Donno where that would come from.

Cheers

Koen


Top
 
PostPosted: Mon Oct 13, 2008 3:25 pm 
Offline
User avatar
 Profile

Joined: Fri Apr 25, 2008 7:55 pm
Posts: 147
Hi Koen.

Francis has coded an 'Up' in his table of directions - is that what you're asking?

Also, can you clarify some of your flag use for me...

I think you are saying that for my message selector I need to first check the contents of location $50A, let's call this result P, and then I will find the actual message number to be printed in location ($500+P) :?:

For this new range of utils to go in SWR, how many utils are there and can you specify one or maybe two flags for me to use in order to activate the correct routine :?:

Thanks,

Martin


Top
 
PostPosted: Mon Oct 13, 2008 3:41 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Hi Koen/Martin,

Yes, I've forgotten to reset the Y register to zero before printing the text (part of the problem of trying to rush this during my tea and lunch breaks at work).

Updated code:

Code:
   10FOR N%=0 TO 3 STEP 3
   20P%=&B00
   30[
   40OPT N%
   50.START:LDA &350A:STA &70:LDA &350B:STA &71:LDX #0
   60.START1:CPX &502:BEQ START2:LDY #0:LDA(&70),Y
   70CLC:ADC &70:STA &70:LDA &71:ADC #0:STA &71:INX:JMP START1
   80.START2:LDY #0:.S2_LOOP:LDA S2_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S2_LOOP
   90LDY #1:STY &72
  100.START3:LDY &72:LDA (&70),Y:CMP #255:BNE START0
  110JSR &FFE7:JSR &FFE7:RTS
  120.START0:CMP #0:BNE START5:LDY #0:.S0_LOOP:LDA S0_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S0_LOOP
  130.START4:INC &72:INC &72:JMP START3
  140.START5:CMP #1:BNE START6:LDY #0:.S5_LOOP:LDA S5_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S5_LOOP
  150JMP START4
  160.START6:CMP #2:BNE START7:LDY #0:.S6_LOOP:LDA S6_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S6_LOOP
  170JMP START4
  180.START7:CMP #3:BNE START8:LDY #0:.S7_LOOP:LDA S7_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S7_LOOP
  190JMP START4
  200.START8:CMP #4:BNE START9:LDY #0:.S8_LOOP:LDA S8_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S8_LOOP
  210JMP START4
  220.START9:CMP #5:BNE START10:LDY #0:.S9_LOOP:LDA S9_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S9_LOOP
  230JMP START4
  240.START13:CMP #11:BNE START4:LDY #0:.S13_LOOP:LDA S13_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S13_LOOP
  250JMP START4
  260.START10:CMP #8:BNE START11:LDY #0:.S10_LOOP:LDA S10_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S10_LOOP
  270JMP START4
  280.START11:CMP #9:BNE START12:LDY #0:.S11_LOOP:LDA S11_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S11_LOOP
  290JMP START4
  300.START12:CMP #10:BNE START13:LDY #0:.S12_LOOP:LDA S12_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S12_LOOP
  310JMP START4
  320.S0_TEXT:EQUS "North, ":EQUB 0
  330.S2_TEXT:EQUS "Visible exits : ":EQUB 0
  340.S5_TEXT:EQUS "South, ":EQUB 0
  350.S6_TEXT:EQUS "East, ":EQUB 0
  360.S7_TEXT:EQUS "West, ":EQUB 0
  370.S8_TEXT:EQUS "Up, ":EQUB 0
  380.S9_TEXT:EQUS "Down, ":EQUB 0
  390.S10_TEXT:EQUS "NorthEast, ":EQUB 0
  400.S11_TEXT:EQUS "NorthWest, ":EQUB 0
  410.S12_TEXT:EQUS "SouthEast, ":EQUB 0
  420.S13_TEXT:EQUS "SouthWest, ":EQUB 0
  430]
  440NEXT
  450PRINT"LSB=";START MOD 256
  460PRINT"MSB=";START DIV 256


If that still doesn't work, try this one:

Code:
   10FOR N%=0 TO 3 STEP 3
   20P%=&B00
   30[
   40OPT N%
   50.START:LDA &350A:STA &70:LDA &350B:STA &71:LDX #0
   60.START1:CPX &502:BEQ START2:LDY #0:LDA(&70),Y
   70CLC:ADC &70:STA &70:LDA &71:ADC #0:STA &71:INX:JMP START1
   80.START2:LDY #0:.S2_LOOP:LDA S2_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S2_LOOP
   90LDY #1:STY &72
  100.START3:LDY &72:LDA (&70),Y:CMP #255:BNE START0
  110JSR &FFE7:JSR &FFE7:RTS
  120.START0:CMP #0:BNE START5:LDY #0:.S0_LOOP:LDA S0_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S0_LOOP
  130.START4:INC &72:INC &72:JMP START3
  140.START5:CMP #1:BNE START6:LDY #0:.S5_LOOP:LDA S5_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S5_LOOP
  150JMP START4
  160.START6:CMP #2:BNE START7:LDY #0:.S6_LOOP:LDA S6_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S6_LOOP
  170JMP START4
  180.START7:CMP #3:BNE START8:LDY #0:.S7_LOOP:LDA S7_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S7_LOOP
  190JMP START4
  200.START8:CMP #4:BNE START9:LDY #0:.S8_LOOP:LDA S8_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S8_LOOP
  210JMP START4
  220.START9:CMP #5:BNE START10:LDY #0:.S9_LOOP:LDA S9_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S9_LOOP
  230JMP START4
  240.START13:CMP #11:BNE START4:LDY #0:.S13_LOOP:LDA S13_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S13_LOOP
  250JMP START4
  260.START10:CMP #8:BNE START11:LDY #0:.S10_LOOP:LDA S10_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S10_LOOP
  270JMP START4
  280.START11:CMP #9:BNE START12:LDY #0:.S11_LOOP:LDA S11_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S11_LOOP
  290JMP START4
  300.START12:CMP #10:BNE START13:LDY #0:.S12_LOOP:LDA S12_TEXT,Y:JSR &FFE3:INY:CMP #0:BNE S12_LOOP
  310JMP START4
  320.S0_TEXT:EQUB 255:EQUS "North, ":EQUB 0
  330.S2_TEXT:EQUB 255:EQUS "Visible exits : ":EQUB 0
  340.S5_TEXT:EQUB 255:EQUS "South, ":EQUB 0
  350.S6_TEXT:EQUB 255:EQUS "East, ":EQUB 0
  360.S7_TEXT:EQUB 255:EQUS "West, ":EQUB 0
  370.S8_TEXT:EQUB 255:EQUS "Up, ":EQUB 0
  380.S9_TEXT:EQUB 255:EQUS "Down, ":EQUB 0
  390.S10_TEXT:EQUB 255:EQUS "NorthEast, ":EQUB 0
  400.S11_TEXT:EQUB 255:EQUS "NorthWest, ":EQUB 0
  410.S12_TEXT:EQUB 255:EQUS "SouthEast, ":EQUB 0
  420.S13_TEXT:EQUB 255:EQUS "SouthWest, ":EQUB 0
  430]
  440NEXT
  450PRINT"LSB=";START MOD 256
  460PRINT"MSB=";START DIV 256


Kind regards,

Francis


Last edited by FrancisL on Mon Oct 13, 2008 3:45 pm, edited 1 time in total.

Top
 
PostPosted: Mon Oct 13, 2008 3:42 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Hi Koen,

The up (and down) direction were part of the original example code you posted.

Kind regards,

Francis.


Top
 
PostPosted: Mon Oct 13, 2008 4:24 pm 
Offline
 Profile

Joined: Mon Jul 07, 2008 6:58 pm
Posts: 64
Hi Francis and Martin,

Francis:
The first util works great!
The 2nd gives an extra character, white block
The up I saw was I think the Y thingy you had to change. It was displayed while not programmed in Quil. But it works fine now.
This way the util is a bit bigger than the previous version. But both work fine.

Martin:
Th &50A has a value. This could be 12.
When this number is read, message 12 from the SWR should be displayed.
So the content of &50A = SWR message number to be displayed
When you would read &50B you would get a different number. This number is related to something else in the adventure.

At the moment there are 3 utils. The 2 from Francis and the one from Martin.
To activate one of the routines I need an LSB and MSB value. So what I think is the easiest idea is. 3 little utils somewhere between &B00-&CFF (if I'm correct) and these utils just call the right SWR util.
Francis made the c0/3 colour switch. (2 utils in one) the fist had LSB=0 & MSB=11 and the 2nd had an LSB=11 & MSB=11.
Is that what you wanted to know?

It is also possible to put the c0/3 util somewhere between &B00-&CFF and the other 2 utils in SWR. To make it easier. (this because the util is so small)

Cheers

Koen


Top
 
PostPosted: Mon Oct 13, 2008 5:01 pm 
Offline
User avatar
 WWW  Profile

Joined: Wed Jan 09, 2008 10:23 am
Posts: 359
Location: Glasgow, Scotland
Hi Koen,

The white block is the character from EQUB 255. I was just covering my bases in case Quill was expecting this character for some reason.

Kind regards,

Francis


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 141 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: RichTW and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: