Jump to content
IGNORED

Colossal Cave Adventure diary


vprette

Recommended Posts

Well

tracker still does not sing for me :-).....

 

I try to resume:

 

1- I included all the tracker files

INCLUDE "tracker.asm"

INCLUDE "tracker.mac"

INCLUDE "demosong.asm"

in the p-math.asm

no error, so I proceed

2- I call the initializations in the PROC ST_LVL_INIT inside "st_level.asm" as

 

CALL TRKINIT ; initialize tracker

CALL TRKSNGINIT ; initialize song

 

3- I call the song in ST_WAIT_ENGINE in the "engine_util.asm" as

; --------------------------------------

; This is a good place to update music

; and sound effects states, too.

; --------------------------------------

CALL TRKPLAY

 

this is not working, the rom is killed after title screen.... I maybe tired and need to sleep :-)

 

Valter,

 

The ST_WAIT_ENGINE routine is only called during wait delays. To play music during the "game-play" level, you need to add it to the ST_LVL_PLAY routine. That's the actual handler of the play state. Putting it in both allows for seamless music to play during state transitions.

 

It will look like this:

 


;; ======================================================================== ;;
;;  ST_LVL_ENGINE: ISR routine to handle a game level.                      ;;
;; ======================================================================== ;;
ST_LVL_PLAY     PROC
               ; --------------------------------------
               ; These access GRAM or the STIC, and so
               ; need to run as soon as possible at the
               ; top of the ISR routine.
               ; --------------------------------------
               ISR_ENABLE_DISPLAY
               CALL    POST_STIC_X

               ; --------------------------------------
               ; Perfom all engine tasks or add them
               ; to the task queue as necessary:
               ;   - Update STIC
               ;   - Update PSG
               ;   - Cycle GRAM cards
               ;   - Update score display
               ;   - Move all sprites
               ;   - Check collisions
               ;   - Animate sprites
               ;   - etc.
               ; --------------------------------------
               CALL TRKPLAY                                 ; Update tracker state

               ; --------------------------------------
               ; Process all timed tasks and counters.
               ; --------------------------------------
               DCALL   DOTIMER, iEnabled
               CALL    PAUSE_GAME                      ; Check for pause
               IRET
               ENDP

 

Also, make sure that your call to TRKSNGINIT includes a pointer to the song you want to initialize. For instance,

 

               CALL    TRKSNGINIT
               DECLE  MYSONG

 

Can you send me by e-mail your "st_level.asm" and "st_title.asm" files to see if there's anything wrong?

 

-dZ.

Link to comment
Share on other sites

Working on the background song :-)

I made a song called shadows originally using 7 channels, I work hard to compact it in only 3 channels :-| see what quality can I reach.

When done, I'll find out how to convert in decles thanks to Arnaud and DZj

 

this is the status

 

- INTRO: ok

- INIT: implement background music by integrating the Chevallier tracker, this should loop forever

- FONT: implement custom font

- PLAY ENGINE: implement level to level to show several text description when pushing the disc or a key (like pages of a book)

- PLAY ENGINE: implement inputs from keypad (8 directions, music pause and disc touch)

- PLAY ENGINE: implement text input from keyboard

- PLAY ENGINE: implement the parser to reconnaise text commands inserted

- CONTENTS: insert all text description and usable words 10%

- SCORE: implement scoring

- BOX: 80%

- OVERLAYS:

- MANUAL:

Edited by vprette
Link to comment
Share on other sites

OK, I'm back after carefully setup the environemt following the PART I and PART II of tutorial

 

now the code is cleaner and I'm at the INIT state, where I want to include the tracker

I will sing the demosong.asm just as in the tracker package of Arnaud.

 

See if I do the right things:

1 - insert

INCLUDE "tracker.asm"

INCLUDE "tracker.mac"

INCLUDE "demosong.asm"

in the main program p-math.asm

 

2 - I get errors from not having defined several symbols. those are in the tracker_demo source of Arnaud package, so I copy all of that in the main program p-math.asm

G_FAD RMB 1

REF_M RMB 1

NOTE_A RMB 1

NOTE_B RMB 1

NOTE_C RMB 1

REF_A RMB 1

etc....

etc...

 

3 - I initialize the tracker and point to the song

I put the following code

CALL TRKINIT

CALL TRKSNGINIT ; initialize song

DECLE SONG00

in the procedure ST_LVL_INIT in the "st_level.asm"

 

4 - I call the player during game-play level

So I put

CALL TRKPLAY

in procedure ST_LVL_PLAY in the "st_level.asm"

 

Something wrong since no music is played :-)

Edited by vprette
Link to comment
Share on other sites

OK, I'm back after carefully setup the environemt following the PART I and PART II of tutorial

 

now the code is cleaner and I'm at the INIT state, where I want to include the tracker

I will sing the demosong.asm just as in the tracker package of Arnaud.

 

See if I do the right things:

1 - insert

INCLUDE "tracker.asm"

INCLUDE "tracker.mac"

INCLUDE "demosong.asm"

in the main program p-math.asm

 

2 - I get errors from not having defined several symbols. those are in the tracker_demo source of Arnaud package, so I copy all of that in the main program p-math.asm

G_FAD RMB 1

REF_M RMB 1

NOTE_A RMB 1

NOTE_B RMB 1

NOTE_C RMB 1

REF_A RMB 1

REF_B RMB 1

REF_C RMB 1

VOL_A RMB 1

VOL_B RMB 1

VOL_C RMB 1

INSTR_A RMB 1

INSTR_B RMB 1

INSTR_C RMB 1

COUNT_A RMB 1

COUNT_B RMB 1

COUNT_C RMB 1

COUNT_M RMB 1

COUNT_P RMB 1

PAT RMB 1

SONG RMB 1

INS_PTR RMB 1

POS_A RMB 1

POS_B RMB 1

POS_C RMB 1

 

Valter,

 

The P-Machinery framework uses the "Cart.mac" macro library to allocate variables in RAM. You should then use these for any variables you need to assign. The "Cart.mac" macros keep track of the available RAM and all that.

 

The two main macros you would use are SCRATCH and SYSTEM, which define a variable in either 8-bit RAM or 16-bit RAM, respectively.

 

 

Therefore, instead of using the code you posted, you should use something like the following. By the way, I learned that there are many versions of Arnauld's tracker around, and I don't know which one you're using, but the definitions below are taken from the one I use in Christmas Carol.

 


; --------------------------------------
; Music Tracker Engine
; --------------------------------------
               ; System RAM variables
SONG            SYSTEM  1
INS_PTR         SYSTEM  1
POS_A           SYSTEM  1
POS_B           SYSTEM  1
POS_C           SYSTEM  1

               ; Scratch RAM variables
G_FAD           SCRATCH 1
REF_M           SCRATCH 1
NOTE_A          SCRATCH 1
NOTE_B          SCRATCH 1
NOTE_C          SCRATCH 1
REF_A           SCRATCH 1
REF_B           SCRATCH 1
REF_C           SCRATCH 1
VOL_A           SCRATCH 1
VOL_B           SCRATCH 1
VOL_C           SCRATCH 1
INSTR_A         SCRATCH 1
INSTR_B         SCRATCH 1
INSTR_C         SCRATCH 1
COUNT_A         SCRATCH 1
COUNT_B         SCRATCH 1
COUNT_C         SCRATCH 1
COUNT_M         SCRATCH 1
COUNT_P         SCRATCH 1
PAT             SCRATCH 1

 

Not using the memory allocation macros, you cannot guarantee that you won't overwrite memory allocated already by P-Machinery.

 

-dZ.

Edited by DZ-Jay
Link to comment
Share on other sites

By the way, I didn't include Arnauld's tracker in P-Machinery because the engine should be agnostic to whatever sound effects or music tracker you want to use. However, since Arnauld's seems to be the de facto standard, I may as well include it.

 

-dZ.

Link to comment
Share on other sites

OK, I'm back after carefully setup the environemt following the PART I and PART II of tutorial

 

now the code is cleaner and I'm at the INIT state, where I want to include the tracker

I will sing the demosong.asm just as in the tracker package of Arnaud.

 

See if I do the right things:

1 - insert

INCLUDE "tracker.asm"

INCLUDE "tracker.mac"

INCLUDE "demosong.asm"

in the main program p-math.asm

 

2 - I get errors from not having defined several symbols. those are in the tracker_demo source of Arnaud package, so I copy all of that in the main program p-math.asm

G_FAD RMB 1

REF_M RMB 1

NOTE_A RMB 1

NOTE_B RMB 1

NOTE_C RMB 1

REF_A RMB 1

REF_B RMB 1

REF_C RMB 1

VOL_A RMB 1

VOL_B RMB 1

VOL_C RMB 1

INSTR_A RMB 1

INSTR_B RMB 1

INSTR_C RMB 1

COUNT_A RMB 1

COUNT_B RMB 1

COUNT_C RMB 1

COUNT_M RMB 1

COUNT_P RMB 1

PAT RMB 1

SONG RMB 1

INS_PTR RMB 1

POS_A RMB 1

POS_B RMB 1

POS_C RMB 1

 

Valter,

 

The P-Machinery framework uses the "Cart.mac" macro library to allocate variables in RAM. You should then use these for any variables you need to assign. The "Cart.mac" macros keep track of the available RAM and all that.

 

The two main macros you would use are SCRATCH and SYSTEM, which define a variable in either 8-bit RAM or 16-bit RAM, respectively.

 

 

Therefore, instead of using the code you posted, you should use something like the following. By the way, I learned that there are many versions of Arnauld's tracker around, and I don't know which one you're using, but the definitions below are taken from the one I use in Christmas Carol.

 


; --------------------------------------
; Music Tracker Engine
; --------------------------------------
			; System RAM variables
SONG			SYSTEM  1
INS_PTR		 SYSTEM  1
POS_A		   SYSTEM  1
POS_B		   SYSTEM  1
POS_C		   SYSTEM  1

			; Scratch RAM variables
G_FAD		   SCRATCH 1
REF_M		   SCRATCH 1
NOTE_A		  SCRATCH 1
NOTE_B		  SCRATCH 1
NOTE_C		  SCRATCH 1
REF_A		   SCRATCH 1
REF_B		   SCRATCH 1
REF_C		   SCRATCH 1
VOL_A		   SCRATCH 1
VOL_B		   SCRATCH 1
VOL_C		   SCRATCH 1
INSTR_A		 SCRATCH 1
INSTR_B		 SCRATCH 1
INSTR_C		 SCRATCH 1
COUNT_A		 SCRATCH 1
COUNT_B		 SCRATCH 1
COUNT_C		 SCRATCH 1
COUNT_M		 SCRATCH 1
COUNT_P		 SCRATCH 1
PAT			 SCRATCH 1

 

Not using the memory allocation macros, you cannot guarantee that you won't overwrite memory allocated already by P-Machinery.

 

-dZ.

 

that hint was simply magic !! :-0 !!

 

the song is playing now!

Link to comment
Share on other sites

OK, I'm back after carefully setup the environemt following the PART I and PART II of tutorial

 

now the code is cleaner and I'm at the INIT state, where I want to include the tracker

I will sing the demosong.asm just as in the tracker package of Arnaud.

 

See if I do the right things:

1 - insert

INCLUDE "tracker.asm"

INCLUDE "tracker.mac"

INCLUDE "demosong.asm"

in the main program p-math.asm

 

2 - I get errors from not having defined several symbols. those are in the tracker_demo source of Arnaud package, so I copy all of that in the main program p-math.asm

G_FAD RMB 1

REF_M RMB 1

NOTE_A RMB 1

NOTE_B RMB 1

NOTE_C RMB 1

REF_A RMB 1

REF_B RMB 1

REF_C RMB 1

VOL_A RMB 1

VOL_B RMB 1

VOL_C RMB 1

INSTR_A RMB 1

INSTR_B RMB 1

INSTR_C RMB 1

COUNT_A RMB 1

COUNT_B RMB 1

COUNT_C RMB 1

COUNT_M RMB 1

COUNT_P RMB 1

PAT RMB 1

SONG RMB 1

INS_PTR RMB 1

POS_A RMB 1

POS_B RMB 1

POS_C RMB 1

 

Valter,

 

The P-Machinery framework uses the "Cart.mac" macro library to allocate variables in RAM. You should then use these for any variables you need to assign. The "Cart.mac" macros keep track of the available RAM and all that.

 

The two main macros you would use are SCRATCH and SYSTEM, which define a variable in either 8-bit RAM or 16-bit RAM, respectively.

 

 

Therefore, instead of using the code you posted, you should use something like the following. By the way, I learned that there are many versions of Arnauld's tracker around, and I don't know which one you're using, but the definitions below are taken from the one I use in Christmas Carol.

 


; --------------------------------------
; Music Tracker Engine
; --------------------------------------
			; System RAM variables
SONG			SYSTEM  1
INS_PTR		 SYSTEM  1
POS_A		   SYSTEM  1
POS_B		   SYSTEM  1
POS_C		   SYSTEM  1

			; Scratch RAM variables
G_FAD		   SCRATCH 1
REF_M		   SCRATCH 1
NOTE_A		  SCRATCH 1
NOTE_B		  SCRATCH 1
NOTE_C		  SCRATCH 1
REF_A		   SCRATCH 1
REF_B		   SCRATCH 1
REF_C		   SCRATCH 1
VOL_A		   SCRATCH 1
VOL_B		   SCRATCH 1
VOL_C		   SCRATCH 1
INSTR_A		 SCRATCH 1
INSTR_B		 SCRATCH 1
INSTR_C		 SCRATCH 1
COUNT_A		 SCRATCH 1
COUNT_B		 SCRATCH 1
COUNT_C		 SCRATCH 1
COUNT_M		 SCRATCH 1
COUNT_P		 SCRATCH 1
PAT			 SCRATCH 1

 

Not using the memory allocation macros, you cannot guarantee that you won't overwrite memory allocated already by P-Machinery.

 

-dZ.

 

that hint was simply magic !! :-0 !!

 

the song is playing now!

 

Great! Then it is apparent that your tracker variables were being overwritten with the engine's data. Just keep this in mind. All RAM variables in your game must be allocated using the SCRATCH or SYSTEM, or any of the other allocation macros included in "Cart.mac."

 

By the way, did you take my suggestion of calling TRKSNGINIT from ST_LVL_INIT? If you're planning on playing the song during the "game play" state (i.e. "level"), then you should initialize it during that state.

 

-dZ.

Link to comment
Share on other sites

Great! Then it is apparent that your tracker variables were being overwritten with the engine's data. Just keep this in mind. All RAM variables in your game must be allocated using the SCRATCH or SYSTEM, or any of the other allocation macros included in "Cart.mac."

 

is this concerning also the font to be written in the RAM? my next step is to use the fonts of you, so I have to understand where I set GRAM offset and call your LETTERS proc

 

By the way, did you take my suggestion of calling TRKSNGINIT from ST_LVL_INIT?

yes

Link to comment
Share on other sites

Great! Then it is apparent that your tracker variables were being overwritten with the engine's data. Just keep this in mind. All RAM variables in your game must be allocated using the SCRATCH or SYSTEM, or any of the other allocation macros included in "Cart.mac."

 

is this concerning also the font to be written in the RAM? my next step is to use the fonts of you, so I have to understand where I set GRAM offset and call your LETTERS proc

 

Yes. P-Machinery includes macros to allocate GRAM. The idea is to statically allocate the GRAM that you will need for each state, so that the framework can keep track of how much is available. Also, by encapsulating the GRAM allocation, it makes it easier to control access to it. To this end, there are macros that support loading sprite graphics and displaying background tiles. These are all within the "graphix.mac" file.

 

Take a look at the GRAM_BLOCK definition in the main source file. It contains commentary on how to allocation GRAM tiles for sprites and general use.

 

In your case, you want to allocate a block of GRAM for the fonts, so you will use the DEFINE_GRAM_BLOCK() macro. You'll have something like this:

 


               ; =============================================================
               ; The GRAM_BLOCK structure defines symbols that represent
               ; pointers to the various graphic assets in GRAM.
               ;
               ; P-Mach offers a complimentary set of macros and sub-routines
               ; that use the GRAM_BLOCK structure to manage and manipulate
               ; the GRAM.
               ; =============================================================
GRAM_BLOCK      STRUCT  0
               RESET_GRAM

               ; NOTE: YRES (Double vertical resolution) sprites need to start
               ;       on an even numbered GRAM card.  We define these first to
               ;       ensure that they start on card number zero, which is even.

               ; SPRITE BLOCKS:
               ;   Use the DEFINE_SPRITE_GRAM() macro to
               ;   allocate GRAM blocks for game sprites.
               ; --------------------------------------
               ; DEFINE_SPRITE_GRAM(Sprite0,     vDouble)
               ; DEFINE_SPRITE_GRAM(Sprite1,     vDouble)
               ; DEFINE_SPRITE_GRAM(Sprite2,     vDouble)
               ; DEFINE_SPRITE_GRAM(Sprite3,     vDouble)
               ; DEFINE_SPRITE_GRAM(Sprite4,     vDouble)
               ; DEFINE_SPRITE_GRAM(Sprite5,     vDouble)
               ; DEFINE_SPRITE_GRAM(Sprite6,     vDouble)
               ; DEFINE_SPRITE_GRAM(Sprite7,     vSingle)
               ; --------------------------------------

               ; BACKGROUND BLOCKS:
               ;   Use the DEFINE_GRAM_BLOCK() macro to
               ;   allocate GRAM blocks for the background
               ;   and other assets.
               ; --------------------------------------
               ; DEFINE_GRAM_BLOCK(PlayField, 240)
               ; --------------------------------------

               DEFINE_GRAM_BLOCK(Font, 26)

               ENDS

 

That will allocate 26 cards in GRAM to a label called "Font". From then on, you can refer to that block by the label "GRAM_BLOCK.Font".

 

You'll also notice in the "graphix.mac" file that some macros accept a "block" as an argument, for instance, GRAM_BASE_CARD(block). Whenever you see something requiring a "block" you only need to provide the label of your allocated GRAM_BLOCK. So, if you wanted to know the base card number in GRAM for your fonts block, you would use it like this:

 

   MVII    #GRAM_BASE_CARD(Font), R1

 

The macro will expand the label "Font" to "GRAM_BLOCK.Font".

 

 

Now, DEFINE_GRAM_BLOCK() only allocates the memory; you still need to load the fonts from ROM into GRAM. For this, you use the family of macros included in "load_data.mac". The basic load macro is LOAD_DATA(), which just performs a block-copy. However, to simplify loading to GRAM, there is another macro called LOAD_GRAM_BLOCK(). The usage is,

 


;; ======================================================================== ;;
;;  LOAD_GRAM_BLOCK(source, dest)                                           ;;
;;  Loads a complete block of data into GRAM.                               ;;
;;                                                                          ;;
;;  ARGUMENTS                                                               ;;
;;      source  The name of the source block in ROM to load.  The name      ;;
;;              corresponds to the label pointing to the start of the data  ;;
;;              source block.                                               ;;
;;                                                                          ;;
;;      dest    A GRAM_BLOCK record field that contains the pointer to the  ;;
;;              destination. The Macro will expand it to GRAM_BLOCK.%dest%. ;;
;; ======================================================================== ;;

 

For this to work, you'll need to define your ROM data blocks like this:

 


; ===================================================================
FONTS           PROC
               ; GRAM Tile: 65
               ; --------------------------------
                           ; ........ - %00000000
               DECLE $0000 ; ........ - %00000000
                           ; .######. - %01111110
               DECLE $827E ; #.....#. - %10000010
                           ; #.....#. - %10000010
               DECLE $8682 ; #....##. - %10000110
                           ; .####.#. - %01111010
               DECLE $007A ; ........ - %00000000
               ; --------------------------------

               ; GRAM Tile: 66
               ; --------------------------------
                           ; #....... - %10000000
               DECLE $8080 ; #....... - %10000000
                           ; #.####.. - %10111100
               DECLE $C2BC ; ##....#. - %11000010
                           ; #.....#. - %10000010
               DECLE $8282 ; #.....#. - %10000010
                           ; ######.. - %11111100
               DECLE $00FC ; ........ - %00000000
               ; --------------------------------

@@data_size     EQU     ($ - FONTS)
               ENDP
; ===================================================================

 

 

Notice the bottom: The @@data_size label defines the length of the block. Saying ($ - FONTS) is the same as saying "the current address pointer minus the beginning of the block," which will yield the word size of the block.

 

This is important, because the LOAD_DATA() macros need to know how much data to load. The LOAD_GRAM_BLOCK() macro expects this label to be defined in the source block. It simplifies and automates loading without having to really know or keep track of the length of data.

 

And lastly, when should you call the LOAD_GRAM_BLOCK() macro? Well, during initialization, of course!

 

-dZ.

Link to comment
Share on other sites

I read now and see how to use fonts...

in the maintime one comment and one question.

 

comment: do you plan to make a web page with your P-Machinery Part I-II-etc tutorials, or should be the intelliwiki the good place? your tutorial are very precious and must be easy to find in my opinion :-)

 

question about the mek of the music: Intv has only 3 channels, but ECS provides 6, rights? so it would have sense to have double song, a 3 channel and a 6 channel ones when ECS is detected.... this is just a general question, is it possible to handle this difference? it would need specific code or just a call to a different song description?

Link to comment
Share on other sites

I read now and see how to use fonts...

in the maintime one comment and one question.

 

comment: do you plan to make a web page with your P-Machinery Part I-II-etc tutorials, or should be the intelliwiki the good place? your tutorial are very precious and must be easy to find in my opinion :-)

 

I was planning on compiling all the tutorials and post them on my hosted site. I'll probably do that this weekend.

 

question about the mek of the music: Intv has only 3 channels, but ECS provides 6, rights? so it would have sense to have double song, a 3 channel and a 6 channel ones when ECS is detected.... this is just a general question, is it possible to handle this difference? it would need specific code or just a call to a different song description?

 

For that to work, the tracker code would have to support the ECS extra PSG (sound chip). I'm pretty sure it does not. I guess you could instantiate two trackers, however I see that Arnauld's tracker library is hard-code to use the main PSG registers. You would have to modify the code to either be more flexible or to maintain two sets of tracker codes.

 

I really don't think you want to get into that right now. You have plenty of challenges ahead. P-Machinery eases some parts, but you still need to write a parser and tokenizer, and all game logic, yourself.

 

If this is your first game, I suggest you keep it simple--especially if you're learning assembly too. Or else you run the risk of never delivering a full game. That's kind of the trouble I'm in right now: I could tweak Christmas Carol and continue adding features and niceties forever, but at some point you just need to narrow down your specifications, and ship a product.

 

-dZ.

Link to comment
Share on other sites

And lastly, when should you call the LOAD_GRAM_BLOCK() macro? Well, during initialization, of course!

 

So I defined the block with label font_belli and having your .asm with fonts that is describing the proc "LETTERS", I need to call in ST_TTL_INIT this way

LOAD_GRAM_BLOCK(LETTERS,font_belli)

?

 

I have some trouble with a proc called MEMUNPK

Edited by vprette
Link to comment
Share on other sites

If this is your first game, I suggest you keep it simple--especially if you're learning assembly too. Or else you run the risk of never delivering a full game. That's kind of the trouble I'm in right now: I could tweak Christmas Carol and continue adding features and niceties forever, but at some point you just need to narrow down your specifications, and ship a product.

 

-dZ.

 

Carol is good product right now to be delivered :-)

and yes, this is my first game and also learning assembler, even if I have previous dev experience in visualbasic and C

 

If I can try to develop an intv game.... most of you CAN DO!

none wan to try? let share efforts! someone could practice in making background pictures, I need one for the intro :-)

Edited by vprette
Link to comment
Share on other sites

And lastly, when should you call the LOAD_GRAM_BLOCK() macro? Well, during initialization, of course!

 

So I defined the block with label font_belli and having your .asm with fonts that is describing the proc "LETTERS", I need to call in ST_TTL_INIT this way

LOAD_GRAM_BLOCK(LETTERS,font_belli)

?

 

I have some trouble with a proc called MEMUNPK

 

Forgive me, I forgot to mention that in order to use the "load_data.mac" library, you need to include "memunpk.asm" from the SDK. If you followed the configuration instructions I posted, you should just be able to do,

 

INCLUDE "memunpk.asm"

 

without qualification.

 

Also, don't forget to add the "@@data_size" label to the LETTERS block! I don't think I added it when I posted it. Something like:

 

...
@@data_size  EQU ($ - LETTERS)
     ENDP

 

-dZ.

Edited by DZ-Jay
Link to comment
Share on other sites

And lastly, when should you call the LOAD_GRAM_BLOCK() macro? Well, during initialization, of course!

 

So I defined the block with label font_belli and having your .asm with fonts that is describing the proc "LETTERS", I need to call in ST_TTL_INIT this way

LOAD_GRAM_BLOCK(LETTERS,font_belli)

?

 

I have some trouble with a proc called MEMUNPK

 

Forgive me, I forgot to mention that in order to use the "load_data.mac" library, you need to include "memunpk.asm" from the SDK. If you followed the configuration instructions I posted, you should just be able to do,

 

INCLUDE "memunpk.asm"

 

without qualification.

 

Also, don't forget to add the "@@data_size" label to the LETTERS block! I don't think I added it when I posted it. Something like:

 

...
@@data_size  EQU ($ - LETTERS)
  ENDP

 

-dZ.

 

OK, what I miss here probably is to tell the rom to use the GRAM location I just populated when I define attributes of the rom in the ROMSETUP? the fonts are charged in the Gram but the PRINT is still using the original location to find the cards I guess...

Link to comment
Share on other sites

And lastly, when should you call the LOAD_GRAM_BLOCK() macro? Well, during initialization, of course!

 

So I defined the block with label font_belli and having your .asm with fonts that is describing the proc "LETTERS", I need to call in ST_TTL_INIT this way

LOAD_GRAM_BLOCK(LETTERS,font_belli)

?

 

I have some trouble with a proc called MEMUNPK

 

Forgive me, I forgot to mention that in order to use the "load_data.mac" library, you need to include "memunpk.asm" from the SDK. If you followed the configuration instructions I posted, you should just be able to do,

 

INCLUDE "memunpk.asm"

 

without qualification.

 

Also, don't forget to add the "@@data_size" label to the LETTERS block! I don't think I added it when I posted it. Something like:

 

...
@@data_size  EQU ($ - LETTERS)
  ENDP

 

-dZ.

 

OK, what I miss here probably is to tell the rom to use the GRAM location I just populated when I define attributes of the rom in the ROMSETUP? the fonts are charged in the Gram but the PRINT is still using the original location to find the cards I guess...

 

No. That's not how it works. Unfortunately, I did not prepare routines to encapsulate using custom fonts in P-Machinery, so you'll have to use the ones in the SDK, like PRINT.FLS. You'll have to set the attributes in a way that tells the routine to use your GRAM fonts instead of the standard ROM fonts.

 

Check the header comments in the "print.asm" file. Keep in mind that there are 255 GROM cards, so GRAM cards start at 256. The macro GRAM_BASE_CARD() gives you the card number in GRAM where your block is allocated.

 

You'll have to do something like this:

(character_number - 32) + (format_word SHR 3) = card_number.
(65 - 32) + (format_word SHR 3) = (256 + GRAM_BASE_CARD(LETTERS))
(format_word SHR 3) = (256 + GRAM_BASE_CARD(LETTERS)) - 33

 

Solving for the format_word gives us,

format_word = (223 + GRAM_BASE_CARD(LETTERS)) SHL 3

 

When you call the PRINT routine, include the format word above.

 


               CALL    PRINT.FLS
               DECLE   ((223 + GRAM_BASE_CARD(LETTERS)) SHL 3)
               DECLE  $0200
               STRING  'Test'
               BYTE    0

 

This is just an example. I haven't tested it, but it gives you an idea. It should work, though.

 

-dZ.

Link to comment
Share on other sites

Developing int asm is very stressful :-(

the more I work on this project the more I admire you people that already have developed games for intv

 

adding custom fonts should be easy since described by the procedure PRINT.FLS...

the procedure should be followed by format,location and string being the format something like the pointer to the memory place where I have my custom sprites/fonts

 

this is what I write:

 

1. DEFINE_GRAM_BLOCK(font_belli, 26) in GRAM_BLOCK in p-match.asm to define my label for the memory area where I want to load fonts

2. LOAD_GRAM_BLOCK(LETTERS,font_belli) in ST_TTL_INIT in st_title.asm to put the fonts described by LETTERS in the gram at the location identified by my label (note this give a compiler warning "forward reference to SET/EQU symbol")

3. CALL PRINT.FLS

DECLE ((223 + GRAM_BASE_CARD(font_belli)) SHL 3)

DECLE C_GRN, $0200

STRING 'Test'

BYTE 0

 

in st_level.asm to write 'Test' using the custom fonts

 

NOTE to DZj: writing DECLE ((223 + GRAM_BASE_CARD(LETTERS)) SHL 3) as you mentioned is not pointing to the label and give me an error...

 

result is black screen:-|

just to test in chinese whaterver style: if I put DECLE C_GRN, $0200 before DECLE ((223 + GRAM_BASE_CARD(font_belli)) SHL 3) one char from the font list is written on the screen, then the text 'Test' is written....

Edited by vprette
Link to comment
Share on other sites

Developing int asm is very stressful :-(

the more I work on this project the more I admire you people that already have developed games for intv

 

adding custom fonts should be easy since described by the procedure PRINT.FLS...

the procedure should be followed by format,location and string being the format something like the pointer to the memory place where I have my custom sprites/fonts

 

this is what I write:

 

1. DEFINE_GRAM_BLOCK(font_belli, 26) in GRAM_BLOCK in p-match.asm to define my label for the memory area where I want to load fonts

2. LOAD_GRAM_BLOCK(LETTERS,font_belli) in ST_TTL_INIT in st_title.asm to put the fonts described by LETTERS in the gram at the location identified by my label (note this give a compiler warning "forward reference to SET/EQU symbol")

3. CALL PRINT.FLS

DECLE ((223 + GRAM_BASE_CARD(font_belli)) SHL 3)

DECLE C_GRN, $0200

STRING 'Test'

BYTE 0

 

in st_level.asm to write 'Test' using the custom fonts

 

NOTE to DZj: writing DECLE ((223 + GRAM_BASE_CARD(LETTERS)) SHL 3) as you mentioned is not pointing to the label and give me an error...

 

result is black screen:-|

just to test in chinese whaterver style: if I put DECLE C_GRN, $0200 before DECLE ((223 + GRAM_BASE_CARD(font_belli)) SHL 3) one char from the font list is written on the screen, then the text 'Test' is written....

 

Valter,

 

Making old-school games is not easy. Which it why it has been a dream of many but the life of few. Welcome to a most exclusive club. :)

 

First, I'll say that helping you on this project has provided some insight into what is needed for a better equipped game development framework. I'll make sure to add an easier mechanism to display text in custom fonts in P-Machinery, and to include instructions in another tutorial.

 

Now, on to your issue. You have an extra argument word in your call to PRINT.FLS. Originally you had:

CALL PRINT.FLS
DECLE C_GRN, $0200
STRING 'Test'
BYTE 0

 

That is, the first two arguments are the attribute word (C_GRN), and the position ($0200). Separating words by commas in a DECLE is the same as including more than one DECLE. What you should do now, is replace your attribute word with the one that contains the reference to the custom font.

CALL PRINT.FLS
DECLE ((223 + GRAM_BASE_CARD(font_belli)) SHL 3) OR C_GRN
DECLE $0200
STRING 'Test'
BYTE 0

 

Notice that I "OR"ed the color to the attribute. The attribute word represents all attributes for the text, including color, card number, GRAM bit, etc. For more information on how to prepare the attribute word, check out the SDK documentation on the STIC. In particular, look for the BACKTAB word definition. Also, check the documentation comments for the PRINT routine in "print.asm."

 

I have just tested the code above and it works. The only thing you must remember is that the formula "((223 + GRAM_BASE_CARD(font_belli)) SHL 3)" will only work for GRAM cards. That means that if you plan to include any punctuation symbols--including the blank space--you must either use the ones in ROM, or include them in the GRAM set. However, GRAM only has 64 cards available.

 

-dZ.

Link to comment
Share on other sites

Note that you won't be able to include spaces in your text since you don't have a "blank" GRAM card in your set. You'll have to use the space in ROM.

 

The easiest way is to include a "blank" in your GRAM set, right before the first letter. In the ASCII character set, this particular slot is taken by the symbol "@".

 

Add this before the first letter in the LETTERS data block:


               ; GRAM Tile: 0
               ; --------------------------------
                           ; ........ - %00000000
               DECLE $0000 ; ........ - %00000000
                           ; ........ - %00000000
               DECLE $0000 ; ........ - %00000000
                           ; ........ - %00000000
               DECLE $0000 ; ........ - %00000000
                           ; ........ - %00000000
               DECLE $0000 ; ........ - %00000000
               ; --------------------------------

 

Also, since the set is now 27 tiles long, you have to modify the GRAM block definition:

DEFINE_GRAM_BLOCK(font_belli, 27)

 

And finally, since the position of the first letter (A) is changed, we need to modify the format word formula:

    DECLE  ((224 + GRAM_BASE_CARD(Fonts)) SHL 3) OR C_GRN

 

Now you can print spaces with the symbol "@":


CALL PRINT.FLS
DECLE ((224 + GRAM_BASE_CARD(font_belli)) SHL 3) OR C_GRN
DECLE $0200
STRING 'THIS@IS@A@TEST'
BYTE 0

 

Also, remember that you can only use UPPER-CASE LETTERS, since your set does not contain lower-case letters and GRAM is not big enough to contain both. (Well it is, but you'll have to load to different sets and use two different format word formulae).

 

I've tested this code and it works.

 

-dZ.

Link to comment
Share on other sites

Ok

I will add , . ? > ] and maybe a custom arrow following this procedure... I let you know tomorrow if I succeed or I become crazy :-)

 

NOTE:

I try to write all the letters for check, the last 3 letters are not printed

 

If I add a tile like for the BLANK in your example... I lost one more letter.... I can print only 23 custom chars... no matter what number I write in DEFINE_GRAM_BLOCK

Edited by vprette
Link to comment
Share on other sites

I have defined 14 new fonts :-)

 

I have attached the updated custom font file

 

 

what is still NOT WORKING is that If I add a tile I lost one more letter.... I can print only 23 custom chars... no matter what number I write in DEFINE_GRAM_BLOCK

 

for each new font I add I lost one letter at the end of the list...

fonts_belli.zip

Edited by vprette
Link to comment
Share on other sites

This is update status of project, I take it serioulsy :-)

 

- TITLE SCREEN: ok (custom screen)

- INTRO: ok (welcome message)

- INIT: ok (integrate tracker and start music)

- FONT: implement custom font 90%

- CONTENTS: insert all level message text descriptions 10%

- MUSIC: translate mod to decles

- PLAY ENGINE1: implement level to level to show several text description when pushing the disc or a key (like pages of a book)

- PLAY ENGINE2: implement inputs from keypad (8 directions, music pause and disc touch)

- PLAY ENGINE3: implement text input from keyboard

- PLAY ENGINE4: implement the parser to reconnaise text commands inserted

- SCORE: implement scoring

- BOX: 80%

- OVERLAYS:

- MANUAL: 5%

- (potential) ONE GRAPHIC PAGE FOR INTRO AND ONE FOR SUCCESSFULL END:

 

Overall: 5%

Edited by vprette
Link to comment
Share on other sites

I have defined 14 new fonts :-)

 

I have attached the updated custom font file

 

 

what is still NOT WORKING is that If I add a tile I lost one more letter.... I can print only 23 custom chars... no matter what number I write in DEFINE_GRAM_BLOCK

 

for each new font I add I lost one letter at the end of the list...

 

This is a mystery!

 

Could you upload the statistics (starting with "; RAM: Used" ) at the end of the "pmach-test.ls" file (or whatever it is called now). In my unmodified version, they look like this:

 

	; RAM: Used

AVAILABLE RAM:
 16-bit System RAM: 35 words.
 8-bit Scratch RAM: 204 bytes.

GRAM USAGE:
 Used: 0 tiles.
 Free: 64 tiles.

ROM USAGE:
	  ; ROM: Used
 Used:
   Segment 0  (8K): 1218 words.
   Segment 1  (4K): 0 words.
  IF (_m.map = _m.42K)
	   SMSG $("	  Segment 2 (", $#(.s2_size),"K): ", $#(_m.2sz), " words.")
	   SMSG $("	  Segment 3  (", $#(.s3_size),"K): ", $#(_m.3sz), " words.")
	   SMSG $("	  Segment 4  (", $#(.s4_size),"K): ", $#(_m.4sz), " words.")
	   SMSG $("	  Segment 5  (", $#(.s5_size),"K): ", $#(_m.5sz), " words.")
   ELSE
   Segment 2  (4K): 0 words.
   ENDI
		   TOTAL: 1218 words.

	 ; ROM: Available
 Available:
   Segment 0  (8K): 6974 words.
   Segment 1  (4K): 4096 words.
 IF (_m.map = _m.42K)
	   SMSG $("	  Segment 2 (", $#(.s2_size),"K): ", $#(_m.2av), " words.")
	   SMSG $("	  Segment 3  (", $#(.s3_size),"K): ", $#(_m.3av), " words.")
	   SMSG $("	  Segment 4  (", $#(.s4_size),"K): ", $#(_m.4av), " words.")
	   SMSG $("	  Segment 5  (", $#(.s5_size),"K): ", $#(_m.5av), " words.")
   ELSE
   Segment 2  (4K): 4096 words.
   ENDI
	  TOTAL: 15169 words.

 

This might give us a clue...

Edited by catsfolly
Link to comment
Share on other sites

mine is:

 

AVAILABLE RAM:

16-bit System RAM: 35 words.

8-bit Scratch RAM: 204 bytes.

 

GRAM USAGE:

Used: 37 tiles.

Free: 27 tiles.

 

ROM USAGE:

 

; ROM: Used

Used:

Segment 0 (8K): 6225 words.

Segment 1 (4K): 0 words.

 

IF (_m.map = _m.42K)

SMSG $(" Segment 2 (", $#(.s2_size),"K): ", $#(_m.2sz), " words.")

SMSG $(" Segment 3 (", $#(.s3_size),"K): ", $#(_m.3sz), " words.")

SMSG $(" Segment 4 (", $#(.s4_size),"K): ", $#(_m.4sz), " words.")

SMSG $(" Segment 5 (", $#(.s5_size),"K): ", $#(_m.5sz), " words.")

ELSE

Segment 2 (4K): 0 words.

ENDI

 

TOTAL: 6225 words.

 

 

; ROM: Available

Available:

Segment 0 (8K): 1967 words.

Segment 1 (4K): 4096 words.

 

IF (_m.map = _m.42K)

SMSG $(" Segment 2 (", $#(.s2_size),"K): ", $#(_m.2av), " words.")

SMSG $(" Segment 3 (", $#(.s3_size),"K): ", $#(_m.3av), " words.")

SMSG $(" Segment 4 (", $#(.s4_size),"K): ", $#(_m.4av), " words.")

SMSG $(" Segment 5 (", $#(.s5_size),"K): ", $#(_m.5av), " words.")

ELSE

Segment 2 (4K): 4096 words.

ENDI

 

TOTAL: 10162 words.

Link to comment
Share on other sites

I have defined 14 new fonts :-)

 

I have attached the updated custom font file

 

 

what is still NOT WORKING is that If I add a tile I lost one more letter.... I can print only 23 custom chars... no matter what number I write in DEFINE_GRAM_BLOCK

 

for each new font I add I lost one letter at the end of the list...

 

This is a mystery!

 

Could you upload the statistics (starting with "; RAM: Used" ) at the end of the "pmach-test.ls" file (or whatever it is called now). In my unmodified version, they look like this:

 

	; RAM: Used

AVAILABLE RAM:
 16-bit System RAM: 35 words.
 8-bit Scratch RAM: 204 bytes.

GRAM USAGE:
 Used: 0 tiles.
 Free: 64 tiles.

ROM USAGE:
	  ; ROM: Used
 Used:
   Segment 0  (8K): 1218 words.
   Segment 1  (4K): 0 words.
  IF (_m.map = _m.42K)
	   SMSG $("	  Segment 2 (", $#(.s2_size),"K): ", $#(_m.2sz), " words.")
	   SMSG $("	  Segment 3  (", $#(.s3_size),"K): ", $#(_m.3sz), " words.")
	   SMSG $("	  Segment 4  (", $#(.s4_size),"K): ", $#(_m.4sz), " words.")
	   SMSG $("	  Segment 5  (", $#(.s5_size),"K): ", $#(_m.5sz), " words.")
   ELSE
   Segment 2  (4K): 0 words.
   ENDI
		   TOTAL: 1218 words.

	 ; ROM: Available
 Available:
   Segment 0  (8K): 6974 words.
   Segment 1  (4K): 4096 words.
 IF (_m.map = _m.42K)
	   SMSG $("	  Segment 2 (", $#(.s2_size),"K): ", $#(_m.2av), " words.")
	   SMSG $("	  Segment 3  (", $#(.s3_size),"K): ", $#(_m.3av), " words.")
	   SMSG $("	  Segment 4  (", $#(.s4_size),"K): ", $#(_m.4av), " words.")
	   SMSG $("	  Segment 5  (", $#(.s5_size),"K): ", $#(_m.5av), " words.")
   ELSE
   Segment 2  (4K): 4096 words.
   ENDI
	  TOTAL: 15169 words.

 

This might give us a clue...

 

Wow, does it really display all that crap? The macro should have suppressed its code of "IF (...) SMSG ..." In fact, it does not show on mine. I'll have to check that.

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...