basiegaxorz subroutines?
Moderator: BigEvilCorporation
-
- Very interested
- Posts: 326
- Joined: Mon Mar 12, 2007 1:53 am
- Contact:
basiegaxorz subroutines?
does this developer tool support subroutines? i need two different things running at the same time. one routing, the main routing is in a loop, while i need a sub routine keeping a steady timer...
^^ No, i hardly see the megadrive cpu doing multithreating
You may be able to use VINT code to do things while the main code is running, but it will interrupt the main code during its execution
Also, both code may not access the display part (at least, not without implementing a special mechanism), else some big issues may occur around VDP pointers
Using VINT is quite easy if you are programming in C or ASM, but i don't know if BASICegaxorg will let you do that (I think it even already use VINT code to do its own stuff).
Maybe Basicegaxorg have a command to read VTIMER (VTIMER may be a value increasing after each 1/50 or 1/60 seconds), in that case, you may use those values for your timer, staying in your main code loop
I'm sorry i cannot help more
You may be able to use VINT code to do things while the main code is running, but it will interrupt the main code during its execution
Also, both code may not access the display part (at least, not without implementing a special mechanism), else some big issues may occur around VDP pointers
Using VINT is quite easy if you are programming in C or ASM, but i don't know if BASICegaxorg will let you do that (I think it even already use VINT code to do its own stuff).
Maybe Basicegaxorg have a command to read VTIMER (VTIMER may be a value increasing after each 1/50 or 1/60 seconds), in that case, you may use those values for your timer, staying in your main code loop
I'm sorry i cannot help more
-
- Very interested
- Posts: 326
- Joined: Mon Mar 12, 2007 1:53 am
- Contact:
i don't think the intel 8086 could either, but they did have subroutines
i only need one of the routines to access the VDP anyway, one of them is just for background use..
here's my loop:
after about 60 seconds, i want the test to end at line 110... after looking over the basics help file, it doesn't look like it supports it.. but it does support ASM coding.
but im not the best at 68k assembly, i'll admit..
for example, lets say i wanted a game to only play for a minute, that same routine my work..
i only need one of the routines to access the VDP anyway, one of them is just for background use..
here's my loop:
Code: Select all
100 counter=0
105 cls
110 print "Your CPU Score: ";counter;""
120 counter=counter+1
130 goto 105
Code: Select all
Command_ASM:
Syntax: Asm "<Instruction> [operand 1], [operand 2]"
Description: Inserts assembly code directly into the assembler output of the BASIC file. The expression must be in quotes, and the expression cannot be in a variable/string.
for example, lets say i wanted a game to only play for a minute, that same routine my work..
-
- Very interested
- Posts: 2442
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
Go to programmersheaven.com, enter assembly zone, find 680x0, and grab all ASM guides there, OR I'll mail you really great ones which I got there and used to learn the language. These tuts are so good that I learned 68K ASM with just 2 days !!!
ASM is not hard, it is just tricky
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
-
- Very interested
- Posts: 326
- Joined: Mon Mar 12, 2007 1:53 am
- Contact:
-
- Very interested
- Posts: 616
- Joined: Thu Nov 30, 2006 6:30 am
I don't think subroutines are exactly what you're looking for here. A subroutine lets you make a commonly used piece of code re-usable, but it doesn't allow multiple things to occur at the same time.evildragon wrote:i don't think the intel 8086 could either, but they did have subroutines
Anyway, in most BASIC languages I've used you type GOSUB X where X is either a label or a line number to call a subroutine and then use RETURN inside the subroutine to return to the point where the subroutine was called.
There's no reason you couldn't have a multi-threading library on the Megadrive/Genesis. All you need is a CPU that supports interrupts and a timer of some sort that generates interrupts. Now the Megadrive doesn't exactly have a proper interrupt generating timer, but you could use HINTS for that purpose.Fonzie wrote:^^ No, i hardly see the megadrive cpu doing multithreating
-
- Very interested
- Posts: 326
- Joined: Mon Mar 12, 2007 1:53 am
- Contact:
it has gosub, but when i use gosub to start the timer, the "cpu counter" stops...Mask of Destiny wrote:I don't think subroutines are exactly what you're looking for here. A subroutine lets you make a commonly used piece of code re-usable, but it doesn't allow multiple things to occur at the same time.evildragon wrote:i don't think the intel 8086 could either, but they did have subroutines
Anyway, in most BASIC languages I've used you type GOSUB X where X is either a label or a line number to call a subroutine and then use RETURN inside the subroutine to return to the point where the subroutine was called.
There's no reason you couldn't have a multi-threading library on the Megadrive/Genesis. All you need is a CPU that supports interrupts and a timer of some sort that generates interrupts. Now the Megadrive doesn't exactly have a proper interrupt generating timer, but you could use HINTS for that purpose.Fonzie wrote:^^ No, i hardly see the megadrive cpu doing multithreating
how can i get them both to run?
-
- Very interested
- Posts: 616
- Joined: Thu Nov 30, 2006 6:30 am
Well like I said, subroutines don't allow multiple things to occur at the same time.evildragon wrote:it has gosub, but when i use gosub to start the timer, the "cpu counter" stops...Mask of Destiny wrote:I don't think subroutines are exactly what you're looking for here. A subroutine lets you make a commonly used piece of code re-usable, but it doesn't allow multiple things to occur at the same time.evildragon wrote:i don't think the intel 8086 could either, but they did have subroutines
Anyway, in most BASIC languages I've used you type GOSUB X where X is either a label or a line number to call a subroutine and then use RETURN inside the subroutine to return to the point where the subroutine was called.
There's no reason you couldn't have a multi-threading library on the Megadrive/Genesis. All you need is a CPU that supports interrupts and a timer of some sort that generates interrupts. Now the Megadrive doesn't exactly have a proper interrupt generating timer, but you could use HINTS for that purpose.Fonzie wrote:^^ No, i hardly see the megadrive cpu doing multithreating
how can i get them both to run?
I don't know exactly what you're trying to do, but I'm going to guess the answer to your question is to use the 60/50Hz vertical interrupt (VINT for short). How you do that in Devter's BASIC is beyond me.
-
- Very interested
- Posts: 326
- Joined: Mon Mar 12, 2007 1:53 am
- Contact:
I'm trying to make a benchmark sorta like TmEE's, but in BASIC.Mask of Destiny wrote:I don't know exactly what you're trying to do, but I'm going to guess the answer to your question is to use the 60/50Hz vertical interrupt (VINT for short). How you do that in Devter's BASIC is beyond me.
Basically, count as fast as the 68000 can before a certain time. TmEE did it by 10vints, but I can't seem to do vints at all with BASIC. I posted on their forum about it, hopefully it can be done somehow.
-
- Very interested
- Posts: 326
- Joined: Mon Mar 12, 2007 1:53 am
- Contact:
ehh, on their forum, they dont even know what im talking about.. they want me to put the sleep command in it.. however, if i do that, then i cause the cpu counter to sleep too, when it should continue counting...
i think im going to have to take up a book on 68k assembly...
or better yet, learn how to port cartridges to Sega Loader... i tried to port TmEE's source to it, but i can't get it to run...
i think im going to have to take up a book on 68k assembly...
or better yet, learn how to port cartridges to Sega Loader... i tried to port TmEE's source to it, but i can't get it to run...
-
- Very interested
- Posts: 616
- Joined: Thu Nov 30, 2006 6:30 am
Well, C is an option as well. If you want to stick with assembly, I have a beginner's guide as well. See the tutorials on my Sega CD page (http://www.retrodev.com/segacd.html). They don't get into anything Genesis or Sega CD specific though.evildragon wrote:i think im going to have to take up a book on 68k assembly...