Jump to content
IGNORED

IntyBASIC compiler v1.0 crunchy&tasty :)


nanochess

Recommended Posts

I was thinking about other platforms where it can be faster to act based on the existence/absence of something in a collection, I was wondering if in IntyBASIC something similar exists. I didn't have any sample code, just something I was thinking about. Not a big deal and I am even having a hard time thinking through how to phrase the question, actually...

 

 

No, there doesn't exist these kinds of "higher-level" abstractions.

Link to comment
Share on other sites

I am enjoying this a lot. I am looking for a way to make the music volume much lower than the sound effects, how should I set that?

 

Thanks.

 

 

 

Only editing the volume levels for instruments in intybasic_epilogue.asm, search for bass_volume, piano_volume, flute_volume and clarinet_volume.

Link to comment
Share on other sites

I see the sections, but don't understand how to make the volume lower.

;
        ; Generates a piano
        ; R3 = Frequency
        ; R1 = Waveform position
        ;
        ; Output:
        ; R3 = Frequency.
        ; R1 = Volume.
        ;
_piano_instrument:	PROC
	ADDI #_piano_volume,R1
	MVI@ R1,R1
	JR R5
	ENDP

_piano_volume:	PROC
        DECLE 14,13,13,12,12,11,11,10
        DECLE 10,9,9,8,8,7,7,6
        DECLE 6,6,7,7,6,6,5,5
	ENDP

Thanks.

 

 

 

 

 

 

Only editing the volume levels for instruments in intybasic_epilogue.asm, search for bass_volume, piano_volume, flute_volume and clarinet_volume.

Link to comment
Share on other sites

I see the sections, but don't understand how to make the volume lower.

;
        ; Generates a piano
        ; R3 = Frequency
        ; R1 = Waveform position
        ;
        ; Output:
        ; R3 = Frequency.
        ; R1 = Volume.
        ;
_piano_instrument:	PROC
	ADDI #_piano_volume,R1
	MVI@ R1,R1
	JR R5
	ENDP

_piano_volume:	PROC
        DECLE 14,13,13,12,12,11,11,10
        DECLE 10,9,9,8,8,7,7,6
        DECLE 6,6,7,7,6,6,5,5
	ENDP

Thanks.

 

 

 

 

 

 

The numbers after DECLE, reduce these, 15 is higher volume and 0 is lower volume.

 

Just reduce these by 2 or 3, it should be enough.

  • Like 1
Link to comment
Share on other sites

I'd just thought to post this here: I found this in an Ars Technica article, which mentions our very own nanochess, in an article about the smallest chess program ever made, which broke a 32 year-old record. Alas, that wasn't nanochess'.

 

Cool, mate, you're famous!

 

-dZ.

  • Like 5
Link to comment
Share on other sites

I'd just thought to post this here: I found this in an Ars Technica article, which mentions our very own nanochess, in an article about the smallest chess program ever made, which broke a 32 year-old record. Alas, that wasn't nanochess'.

 

Cool, mate, you're famous!

 

-dZ.

 

Somewhere I have a listing of the KIM-1 chess prpgram, which fit into and ran in the 1k ram KIM-1 system. I'm impressed that this new program is half the size.

 

Unlike these tiny programs, I think Nanochess' Chess game actually plays a good game...

  • Like 2
Link to comment
Share on other sites

I'd just thought to post this here: I found this in an Ars Technica article, which mentions our very own nanochess, in an article about the smallest chess program ever made, which broke a 32 year-old record. Alas, that wasn't nanochess'.

 

Cool, mate, you're famous!

 

-dZ.

Thanks! :)

 

I was busy making a program better and smaller in 481 bytes http://nanochess.org/chess6.html

  • Like 3
Link to comment
Share on other sites

I am trying to understand the relationship between the music notation and PLAY SIMPLE vs PLAY FULL.

 

In the manual.txt, it shows at line 643

 

                MUSIC F4,A4#,C5
                MUSIC S,S,S
                MUSIC -,-,-
This appears to mean that there are 3 voices of music playing. But at line 414

  SOUND 0,[VALUE 12 bits],[VOL 0-15]       Channel A
  SOUND 1,[VALUE 12 bits],[VOL 0-15]       Channel B
  SOUND 2,[VALUE 12 bits],[VOL 0-15]       Channel C
  SOUND 3,[VALUE 16 bits],[TYPE 0-15]      Volume envolvent (frequency/shape)
  SOUND 4,[NOISE 6 bits],[MIX]      Noise and mix register ($38 value by default)

 

I want to have background music as well as sound effects. If PLAY SIMPLE is running the song with 3 voices playing, doesn't that use SOUND channels 0 and 1 and 2, making sound effects impossible? If I have a game with sound effects and background music, should my notation only have two notes on every line?

 

Thanks.

Link to comment
Share on other sites

I am trying to understand the relationship between the music notation and PLAY SIMPLE vs PLAY FULL.

 

In the manual.txt, it shows at line 643

 

 

                MUSIC F4,A4#,C5
                MUSIC S,S,S
                MUSIC -,-,-
This appears to mean that there are 3 voices of music playing. But at line 414

 

 

  SOUND 0,[VALUE 12 bits],[VOL 0-15]       Channel A
  SOUND 1,[VALUE 12 bits],[VOL 0-15]       Channel B
  SOUND 2,[VALUE 12 bits],[VOL 0-15]       Channel C
  SOUND 3,[VALUE 16 bits],[TYPE 0-15]      Volume envolvent (frequency/shape)
  SOUND 4,[NOISE 6 bits],[MIX]      Noise and mix register ($38 value by default)

I want to have background music as well as sound effects. If PLAY SIMPLE is running the song with 3 voices playing, doesn't that use SOUND channels 0 and 1 and 2, making sound effects impossible? If I have a game with sound effects and background music, should my notation only have two notes on every line?

 

Thanks.

 

The MUSIC statement always allows for three notes and one drum indicator, this doesn't change if you use PLAY SIMPLE or FULL.

 

The tracker will still process the three notes BUT for PLAY SIMPLE it will not update the channel C, this means you can put out your sound effects using SOUND 2, also you can mix an volume envolvent using SOUND 3.

 

Another advantage is that you can switch to PLAY FULL if you're not going to use sound effects.

  • Like 1
Link to comment
Share on other sites

Can you explain a bit more about, or show an example using SOUND 3 and music and sound effects?

 

Thanks.

Try this:

 

SOUND 2,1000,48
SOUND 3,500,9
loop:
GOTO loop
And change the 500 in SOUND 3 for different volume frequencies, note how low volumes appear to create instruments.

 

The number 9 can be checked in PSG manual. Check the links in IntyBASIC manual.

  • Like 1
Link to comment
Share on other sites

Can you explain a bit more about, or show an example using SOUND 3 and music and sound effects?

 

Thanks.

 

 

http://spatula-city.org/~im14u2c/intv/jzintv-1.0-beta3/doc/programming/psg.txt

 

The very bottom section explains the envelope generator and how it works. It's one of those things you just kinda have to experiment with (A LOT), to get a feel for it. In simple terms, it allows you to easily make repeating/oscillating/vibrating sounds (one good example is the beat of a helicopter's blades), or rapidly climbing/descending notes. Keep changing the values in SOUND 3,X,Y and you'll see what I mean. X controls period and Y controls shape. This is one of the big reasons I made a button-controllable sound program - so that I could quickly change these values and see what effect they had on the final sound output.

 

The ASCII waveform diagrams at the bottom really helped nail it for me. Basically it's all variations on 2 basic waveforms.

  • Like 2
Link to comment
Share on other sites

How does SCREEN work? I have this (CS mode) background defined in my program, created and copy+pasted from IntyMapper. These are shapes from GROM.

 

myscreen1:
  data $02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9
  data $02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9
  data $02F9,$02F9,$02FC,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9
  data $02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$22F9,$02F9
  data $02F9,$02FC,$02FC,$02FC,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD
  data $02F9,$02FD,$02FD,$02FD,$02F9,$02F9,$02F9,$02F9,$02F9,$22F9
  data $02F9,$02F9,$02FC,$02FC,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD
  data $02F9,$02F9,$02FD,$02FD,$02FD,$02F9,$02F9,$02F9,$02F9,$22F9
  data $0000,$0000,$02FC,$02FC,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD
  data $02FD,$02F9,$02F9,$02FD,$02FD,$02FD,$0000,$0000,$0000,$0000
  data $0000,$0000,$02FC,$02FC,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD
  data $02FD,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD,$0000,$0000,$0000
  data $02FC,$02FC,$02FC,$02FC,$02FC,$02FD,$02FD,$02FD,$02FD,$02FD
  data $02FD,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD,$0000,$0000,$0000
  data $02FC,$02FC,$02FC,$02FC,$02FC,$02FC,$02FD,$02FD,$02FD,$02FD
  data $02FD,$02FD,$02FD,$02FD,$02FD,$02FD,$0000,$0000,$0000,$0000
  data $0000,$0000,$02FD,$02FD,$02FC,$02FC,$02FD,$02FD,$02FD,$02FD
  data $02FD,$02FD,$02FD,$02FD,$02FD,$0000,$0000,$0000,$0000,$0000
  data $0000,$0000,$0000,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD
  data $02FD,$02FD,$02FD,$02FD,$0000,$0000,$0000,$0000,$0000,$0000
  data $0000,$0000,$0000,$0000,$0000,$0000,$0000,$02FD,$02FD,$02FD
  data $02FD,$02FD,$02FD,$0000,$0000,$0000,$0000,$0000,$0000,$0000
  data $0000,$0000,$0000,$0000,$0000,$0000,$0000,$02FD,$02FD,$02FD
  data $02FD,$02FD,$02FD,$02FD,$0000,$0000,$0000,$0000,$0000,$0000

As far as I can tell, there are 240 tiles defined there.

 

The SCREEN command takes an "origin_offset" from 0-199 and a "target_offset" of 0-199. I don't understand how the offsets are used, and what the difference is between origin and target.

 

Can someone share examples/clues?

 

Thanks.

 

Link to comment
Share on other sites

How does SCREEN work? I have this (CS mode) background defined in my program, created and copy+pasted from IntyMapper. These are shapes from GROM.

 

 

myscreen1:  data $02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9  data $02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9  data $02F9,$02F9,$02FC,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9  data $02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$02F9,$22F9,$02F9  data $02F9,$02FC,$02FC,$02FC,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD  data $02F9,$02FD,$02FD,$02FD,$02F9,$02F9,$02F9,$02F9,$02F9,$22F9  data $02F9,$02F9,$02FC,$02FC,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD  data $02F9,$02F9,$02FD,$02FD,$02FD,$02F9,$02F9,$02F9,$02F9,$22F9  data $0000,$0000,$02FC,$02FC,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD  data $02FD,$02F9,$02F9,$02FD,$02FD,$02FD,$0000,$0000,$0000,$0000  data $0000,$0000,$02FC,$02FC,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD  data $02FD,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD,$0000,$0000,$0000  data $02FC,$02FC,$02FC,$02FC,$02FC,$02FD,$02FD,$02FD,$02FD,$02FD  data $02FD,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD,$0000,$0000,$0000  data $02FC,$02FC,$02FC,$02FC,$02FC,$02FC,$02FD,$02FD,$02FD,$02FD  data $02FD,$02FD,$02FD,$02FD,$02FD,$02FD,$0000,$0000,$0000,$0000  data $0000,$0000,$02FD,$02FD,$02FC,$02FC,$02FD,$02FD,$02FD,$02FD  data $02FD,$02FD,$02FD,$02FD,$02FD,$0000,$0000,$0000,$0000,$0000  data $0000,$0000,$0000,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD,$02FD  data $02FD,$02FD,$02FD,$02FD,$0000,$0000,$0000,$0000,$0000,$0000  data $0000,$0000,$0000,$0000,$0000,$0000,$0000,$02FD,$02FD,$02FD  data $02FD,$02FD,$02FD,$0000,$0000,$0000,$0000,$0000,$0000,$0000  data $0000,$0000,$0000,$0000,$0000,$0000,$0000,$02FD,$02FD,$02FD  data $02FD,$02FD,$02FD,$02FD,$0000,$0000,$0000,$0000,$0000,$0000
As far as I can tell, there are 240 tiles defined there.

 

The SCREEN command takes an "origin_offset" from 0-199 and a "target_offset" of 0-199. I don't understand how the offsets are used, and what the difference is between origin and target.

 

Can someone share examples/clues?

 

Thanks.

Let us see SCREEN as a copy of one rectangle for the source (or origin) to the target (the screen)

 

From the start SCREEN was designed to copy a full screen saved in your program to the real screen in order to save countless PRINT statements.

 

Then I added the origin offset, target offset and size in rows/cols.

 

Technically when you use SCREEN without arguments:

 

SCREEN my_screen
You're doing really this:

 

SCREEN my_screen,0,0,20,12
Now if you want to copy only the center 10x6 rectangle of your origin screen into the bottom right of screen.

 

SCREEN my_screen,65,130,10,6
The rectangle 10x6 starts at row 3, column 5, then (3*20)+5=65

 

The destination starts at row 6, column 10, then (6*20)+10=130

 

The 10 and 6 are the size of the rectangle.

 

I hope this clear matters up :)

  • Like 1
Link to comment
Share on other sites

If it is like the score routine I used for Applecatcher, I used mod10 to display 4 numbers.

writescore: procedure

print at 220,(#score/1000%10+16)*8+6
print at 221,(#score/100%10+16)*8+6
print at 222,(#score/10%10+16)*8+6
print at 223,(#score%10+16)*8+6

For to get hex value with 16-bit variables, I would try

 

writescore: procedure

print at 220,(#score/1000%16+16)*8+6
print at 221,(#score/100%16+16)*8+6
print at 222,(#score/10%16+16)*8+6
print at 223,(#score%16+16)*8+6

 

If that doesn't work. 8-bit variable

 

a=variable/16

b=variable%16

print at 220,a+6
print at 221,b+6

Edited by Kiwi
Link to comment
Share on other sites

I am trying to run intycolor in a CMD script but am unable to trap the ERRORLEVEL. I have several screens and i am trying to get them all converted in a batch. All ideas appreciated.

for /f %%G in ('dir /b mypic*.bmp') do (
   cls
   intycolor -b -s145a %%G %%G.bas %%G 
   if errorlevel 0 pause
   if errorlevel 1 exit
   )

Thanks.

Edited by First Spear
Link to comment
Share on other sites

I am trying to run intycolor in a CMD script but am unable to trap the ERRORLEVEL. I have several screens and i am trying to get them all converted in a batch. All ideas appreciated.

for /f %%G in ('dir /b mypic*.bmp') do (
   cls
   intycolor -b -s145a %%G %%G.bas %%G 
   if errorlevel 0 pause
   if errorlevel 1 exit
   )

Thanks.

 

There is no errorlevel support in IntyColor

Link to comment
Share on other sites

So here's a fun one I ran into earlier today, as I was trying to work up an example:

.

        PRINT AT 0 COLOR 7 <5> #A

.

This wouldn't print the value of #A, and I couldn't figure out why. I was all set to send an error report to nanochess, even!

 

When I looked at the generated code, it was computing some crazy boolean logical expression involving 7, 5 and #A, and then writing that to the current color, all without printing anything.

 

And that's when it hit me: I realized I was missing a comma:

.

        PRINT AT 0 COLOR 7, <5> #A

.

Without the comma, IntyBASIC parsed that as COLOR ( (7 < 5) > #A ), which is pretty much never what anybody wants. :D

 

Given the language grammar definition, I don't know how you might go about warning for this sort of error, other than detecting that the < and > operators were used in an "AT" or "COLOR" expression outside of parentheses. This particular error seems to be an unfortunate consequence of using <> to delimit the field size for printing decimal values.

 

Anyway... back to work on LTO Flash! for me. :)

  • Like 3
Link to comment
Share on other sites

Washing a BMP through IntyColor, I got two errors:

More than two colors in block 56,0
Background color not aligned with color stack in block 24,8

I do not understand the block numbering scheme. Is a "block" a "pixel", or is there a block sequence or numbering pattern I am missing?

 

Thanks.

 

It's pixel measurements measured in x,y co-ordinates - you'll notice that all numbers posted are multiples of 8. 0,0 is the top left of the screen. 56,0 is the 57th pixel in the first row - so your error is in the 8th card (cards 0-6 use pixels 0-7, 8-15, 16-23, 24-31, 32-39, 40-47, 48-55). 24,8 is the second row, 4th card from the left. And yeah, it's a bit unintuitive at first but I personally prefer it - because my image editing software shows me the exact same x,y co-ordinates when I hover over any given pixel.

 

Someone correct me if I'm wrong here. It's been a few weeks since I've debugged Intycolor images.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...