Posted By
MMS on 2017-01-17 16:52:09
| BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
Dear All,
Time to time there was a question, how we can load efficiently a title bitmap graphics from BASIC. There were some workarounds, and there was a good forum topic on the matter.
That code finetuned further and tested. This will NOT restart the BASIC program after the loading process. You can find the final version in the Encyclopedia in Programming/BASIC as Load HIRES/MULTI Bitmap To The Screen with few easy samples how you can use it.
(certainly it is not made for the ML Masters, GrandMasters and DEMIGODs )
|
|
Posted By
siz on 2017-01-17 09:01:30
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
There is a typo in the text: bitmap data resides from $2000-$3f3f but BASIC will be relocated to $4001 (on a machine with more than 16k RAM) or end of BASIC memory will be adjusted to $3fff (not sure about that) on a machine with 16k. The text in the encyclopedia says $8000 as end of bitmap data.
|
|
Posted By
Mad on 2017-01-17 11:58:36
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
Let's see if the linkage works Load HIRES/MULTI Bitmap To The Screen.. (just put two [ and two ] around the topic.)
|
|
Posted By
Luca on 2017-01-17 09:47:26
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
...And thanks for choose no capitals for the title in the place where all the other titles are all capitals
|
|
Posted By
MMS on 2017-01-17 11:43:05
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
Yeah, thx, I will correct it!
Update: better!
Luca: You're welcome! :-)
|
|
Posted By
George on 2017-01-17 13:17:07
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
Cooly mooly procedure... I needed that solution. But no need to quote me in a knowledgebase The essntial tips in my procedure came mostly from Grandmaster gerliczer.
|
|
Posted By
Mad on 2017-01-17 15:10:11
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
And it can be used (with some modifications of the loadto address) for all "load stuff to a memory address" needs, which could also be pretty cool in basic, for instance you could load also a knaecketraecker tune, but have to set up a irq handler for playing the music in basic, too..
|
|
Posted By
George on 2017-01-17 13:31:58
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
can anybody do an example, how music could be played in BASIC in the background with an irq? Maybe some sound commands in Basic that play in a background-loop?
|
|
Posted By
MMS on 2017-01-17 13:40:13
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
I do remember there was a program that was able to save the music like that (OK, not so fancy, as the newer ones) and there was a player module for that. I will look for the name. I recently tried to create a music in BASIC code, but it was horrible
|
|
Posted By
George on 2017-01-17 13:37:31
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
Not as horrible as mine... My music sound like a 80's Casio-Watch beeping..
|
|
Posted By
MMS on 2017-01-17 14:07:06
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
OFF nope, it is OK: Da-Da-Da
|
|
Posted By
gerliczer on 2017-01-17 15:13:17
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
Whoa! I ascended to grandmaster stage. Then our scene must be full of peerless geniuses, demi-gods and gods.
|
|
Posted By
Csabo on 2017-01-17 15:31:21
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
George, you asked about music playing from IRQ in BASIC. This is pretty simple. The Super-Writer has over 50 examples of it, classic tunes ripped.
Or you could grab any of my tunes (source is released for everything, and they are listed on my page under HVTC), and write a simple IRQ driver for it. I just tried it and works nice, let me know if you want the actual working source (to be honest I don't like anyone posting big chunks of code on the forum, so I'd rather not do it). This is all you need though: an INIT, which calls the music's initialization (a single JSR) and sets up a routine $0314/$0315. In that routine, all you need is: acknowledge the IRQ (ASL $FF09), call the music player (a single JSR) and jump to the default BASIC IRQ (JMP $CE0E).
Otherwise, to get back on topic: good job with the KB entry. I fixed a few minor things. I hope more people will edit stuff!
|
|
Posted By
George on 2017-01-17 16:36:12
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
Csabo, you got email fr0m me.
I tried to understand from Super-Writer, but i have no clue how to extract the source from that programm.
I don't know, how much code the working result would be (you talk of big chunk), but i think posting code in a forum helps people like me (and other here) to get more deeply in the programming. There should be more examples with explanations.
Thank you anyway for your help.
|
|
Posted By
MMS on 2017-01-17 16:49:21
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
Thanks for all the suggestions, help and corrections !
Special thanks for gerliczer who brought light into my head, how we may call KERNAL routines from BASIC.
|
|
Posted By
Mad on 2017-01-17 17:44:07
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
Ups ok.. Csabo already had it working with another tool.. I just compiled some basic lines with MMS load function and a simple IRQ player for knaecketracker through basic data lines. BasicExample with Knaecketracker in the ".zip" is all you need to get it run with knaecketracker.
The whole basic prg looks like this.. But perhaps it's somewhen time to learn machine language aswell, basic is really limiting especially on such a machine.
30 FI$="SNG1AT7000" 4000 REM -= Loader routine by MAD/MMS/gerliczer/George =- 4010 SYS DEC("F2CE"):REM restore system interrupt vectors, for restart 4020 KA=DEC("7000"):REM Knaecketracker Tune Address 4030 SA=DEC("07f2"):SX=SA+1:SY=SX+1:SR=SY+1 4040 TB=DEC("0333"):DRV=8 4050 REM put the file name into FI$ eg.FI$="examplepic" BEFORE calling the Subroutine 4060 FI=LEN(FI$) 4070 FORI=1TOFI:POKETB-1+I,ASC(MID$(FI$,I,1)):NEXT: REM filename to TB store 4080 POKESA,0:POKESX,DRV:POKESY,0:SYSDEC("ffba"): REM DRIVE 8 4090 POKESA,FI:POKESX,TBAND255:POKESY,TB/256:SYSDEC("ffbd"): REM filename KERNAL 4100 POKESA,0:POKESX,KAAND255:POKESY,KA/256:SYSDEC("ffd5"): REM Load from $1800 4200 REM -= Knaecketracker Player by Mad =- 4210 CA=DEC("7FE0"):REM Rasterinterruptstub address 4220 DATA 120,169,68,141,18,3,169,68,141,19,3,88,96,32,68,68,32,68,68,76,66,206 4230 FOR I=0 TO 21:READ V:POKE CA+I,V:NEXT I 4240 POKE CA+2,(CA+13) AND 255:POKE CA+7,(CA+13)/256 4250 POKE CA+14,(KA+3) AND 255:POKE CA+15,(KA+3)/256:REM player tick 4260 POKE CA+17,(KA+6) AND 255:POKE CA+18,(KA+6)/256:REM player output 4270 SYS KA:REM initialize player 4280 SYS CA:REM install new rasterinterrupt
It uses the vertical blank interrupt ($0312/$0313) it seems the rasterinterrupt is used several times a frame in basic. And don't forget the SYS DEC("F2CE") if you call the loading or the player two times (for instance at another "run").
Remove the "MAD" in the loaderroutine I don't know anything about what it does :)
And yes, that's all off topic it was just because of the silly idea to load songs also with this routine by MMS :)
|
|
Posted By
George on 2017-01-17 17:45:51
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
You are crazy guys in a positive way. So helpful, that i feel guilty for my question above. Of course i could use Machine language, but the challenge is to realize it in Basic with its limitations Csabo, Mad, Thank you for your time on this. I will try it out.
|
|
Posted By
MMS on 2017-01-17 18:31:16
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
Guys, I am really impressed
|
|
Posted By
Csabo on 2017-01-17 19:40:38
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
Got your email, reply sent! Otherwise, there's also Interrupt-Sound, which is BASIC, but contains the ML code in DATAs.
For a pure BASIC solution, you should take a look at Foxish and Bit Fox by RoePipi. Both games feature a "music interrupt".
|
|
Posted By
SVS on 2017-01-18 06:02:46
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
@George:
can anybody do an example, how music could be played in BASIC in the background with an irq? Maybe some sound commands in Basic that play in a background-loop?
You can look at my old SVS-OS that implements the new Basic command PLAY, able to play a string of notes, pauses, voices, etc.
|
|
Posted By
George on 2017-01-18 18:47:23
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
The routine of Mad works really fine. The only problem i have, is that i don't know the file-format to generate the tunes automatically. The method typing the tunes by hand is no practical Option for me . Maybe there is a way to import tunes and create the files over Knaecke tracker...
Csabo's Lod-player seems to be the most compatible player with my little Midi-conversion-tool. It uses the same note-duration format. The only change i have to make is to map midi-notes to LOD-notes.
|
|
Posted By
MMS on 2017-01-19 19:43:39
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
Hi SVS,
I checked out the SVS-OS. Really fancy tool. Three questions: 1) Is there any way to get the SVS-OS command syntax in a more readible format? I mean those SEQ files are nice for Plus/4 word editors, but for a real life use and printing something in the Encyclopedia would be nice 2) the PLAY command is nice, and probably very useful. But even the Encyclopedia does not explain, what is the syntax exactly. what is >2? what is /4 ? 3) Is there any way to compile the BASIC programm using the extra SVS OS commands to a program that could be used without SVS OS, I mean just load and run from a D64 as a PRG?
|
|
Posted By
SVS on 2017-01-20 07:32:49
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
@MMS: I'm glad you like SVS-OS! Replaying to your questions:
1) The manual files are in Script+ format. I could convert them to standard ASCII in order to add to the site info. Just let me some time.
2) The PLAY command plays a string (variable or direct) containing the music annotations with these below symbols, separated by spaces. Two voices can be played at the same time. * Notes: DO DO# RE RE# MI FA FA# SOL SOL# LA LA# SI; * Volume: >x (where x is 0...8); * Octave: &x (where x is 1...5); * Tempo: Tx (where x is 1...3; 3 is the slower); * Duration of the note: /x (where x is: 1=1/1; 2=1/2; 4=1/4; 8=1/8; 6=1/16; 3=1/32; 7=1/64); * Pause: *x (x works like duration parameter - i.e. *3=pause of 1/32; **=pause of the same duration as the previous note); Default values: >0 '1 &3 T1 /2.
3) Unfortunately no. You need to load SVS-OS before to use its commands, but maybe you can manage a multiple load with some techniques...
|
|
Posted By
MMS on 2017-01-20 12:32:08
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
1) Thank you for your great support! I know how much time a documenation may take, just take a look on RS232 Mouse big garbage of text :-)
2) (but now it getting competely OFF, moved from graphics to music, ehehehe ) Maybe we should start a new topic, or maybe it was already discussed in details a decade ago ...
Ahh, the DO, RE, etc are the same as I learned in elementary school, except SI we called TI.
Too bad I have to translate them into the notes, as all music uses the C D E F G A H definitions. (you may understand, that I am not a composer, but try to translate readily available musics to Plus/4) Do you think I can predifine and use them in the way the usual musics notes show them?
C Do D Re E Mi F Fa G So A La H Si/Ti
|
|
Posted By
SVS on 2017-01-20 14:39:52
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
Do you think I can predifine and use them in the way the usual musics notes show them?
C Do D Re E Mi F Fa G So A La H Si/Ti
I believe you can write a little routine able to translate the "C D E..." notes onto "DO RE MI...". It is much easier than modify the code of the parser. Keep in mind that the music string could be a string variable.
P.S. - G stands for SOL as classic name P.S.2 - Ti? What's the pronunciation?
|
|
Posted By
JamesC on 2017-01-20 23:13:14
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
@SVS ... Have you never seen "The Sound of Music"?
Doe, a deer, a female deer Ray, a drop of golden sun Me, the name I call myself Fa, a long long way to run Sew, a needle pulling thread Lah, a note to follow Sew (yes, it's nonsense) Tea, I drink with jam on bread And that brings us back to Doe!
|
|
Posted By
SVS on 2017-01-21 03:06:37
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
@JamesC: good one! No I did not know it.
|
|
Posted By
MMS on 2017-01-21 06:40:45
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
-TI: you should spell it like "tea", with short I -Probably we called it SO, as after SOL comes the LA, so your could not distinguish between them
|
|
Posted By
George on 2017-01-24 17:57:18
| Re: BASIC Bitmap loading (KERNAL Subroutine) in the Encyclopedia
I wrote above, that i would do an extension for my experimatal converter for the LOD-Player of Csabo. The Music-Notes were automatically generated from a MIDI file. Here the first promising result:
PsychoFox.PRG
|
|