Exploring MIOS...

Hi *!

I want to get on with my MIDIBOX skills - someday I hope to find a way for Interfacing the AY-3-8912 Soundchip via MBHP, MIOS and Assembler.

=> http://en.wikipedia.org/wiki/AY-3-8912

My “MidiBox AY” (prototype) [just a MidiBoxKB and an MIDImon with no AY-3-8912 interface yet]

related => http://www.midibox.org/dokuwiki/doku.php?id=midiboxkb_-_using_a_c64_keyboard_as_input

related => http://www.midibox.org/dokuwiki/midibox_pokey

I never did programming in Assembler yet. But I want to! :slight_smile:

So I’m thrilled to explore the PIC 18F452, Assembler and MIOS - step by step.

Here my first beginner question:


THE MIOS MEMORY MAP

Is this sketch ok?

Thats a good starting point! :slight_smile:

Note that 0x000..0x002 is reserved for MIOS internal variables, and 0x03..0x0f is allocated by MIOS_PARAMETER[123], TMP[12345] and IRQ_TMP[12345]

So, free application space starts at 0x010

Best Regards, Thorsten.

Thank You Thorsten!  :slight_smile:

MIOS is a text adventure 

yes, it is! :wink:

next step: exploring the application-code

MIOS - the MIDIbox Operating System [http://www.ucapps.de/mios_download.html]

=> skeleton_v1_9

…my speculations about mios.h

;; ==========================================================================
;;  MIOS Special Function Registers
;; ==========================================================================

MIOS_BOX_CFG0	EQU	0x000
MIOS_BOX_CFG1	EQU	0x001
MIOS_BOX_STAT	EQU	0x002
MIOS_PARAMETER1	EQU    0x003
MIOS_PARAMETER2	EQU	0x004
MIOS_PARAMETER3	EQU	0x005

;; ==========================================================================
;;  temporary registers for main programs
;; ==========================================================================
TMP1 EQU	0x006
TMP2 EQU	0x007
TMP3 EQU	0x008
TMP4 EQU	0x009
TMP5 EQU	0x00a

;; ==========================================================================
;;  temporary registers for IRQs
;; ==========================================================================
IRQ_TMP1	EQU	0x00b
IRQ_TMP2	EQU	0x00c
IRQ_TMP3	EQU	0x00d
IRQ_TMP4	EQU	0x00e
IRQ_TMP5	EQU	0x00f

;; ==========================================================================
;;  free memory space for user application:
;; ==========================================================================
;; 0x010-0x37f

no problem so far…

;; ==========================================================================
;;  General constants
;; ==========================================================================

;; used by MIOS_MIDI_Interface*
MIOS_MIDI_INTERFACE_COMMON	EQU	0x00
MIOS_MIDI_INTERFACE_TO_HOST	EQU	0x01

;; used by MIOS_MIDI_Merger*
MIOS_MIDI_MERGER_DISABLED	EQU	0x00
MIOS_MIDI_MERGER_ENABLED	EQU	0x01
MIOS_MIDI_MERGER_MBLINK_EP	EQU	0x02
MIOS_MIDI_MERGER_MBLINK_FP	EQU	0x03

;; used by MIOS_ENC_PIN_TABLE
MIOS_ENC_MODE_NON_DETENTED	EQU	0x00
MIOS_ENC_MODE_DETENTED   EQU	  0x80
MIOS_ENC_MODE_DETENTED2	          EQU	  0x81

;; used by MIOS_ENC_Speed*
MIOS_ENC_SPEED_SLOW EQU 0
MIOS_ENC_SPEED_NORMAL EQU	1
MIOS_ENC_SPEED_FAST   EQU	  2

;; used by MIOS_LCD_Type*
MIOS_LCD_TYPE_CLCD EQU	0x00
MIOS_LCD_TYPE_GLCD0 EQU	0x01
MIOS_LCD_TYPE_GLCD1 EQU	0x02
MIOS_LCD_TYPE_GLCD2 EQU	0x03
MIOS_LCD_TYPE_GLCD3 EQU	0x04
MIOS_LCD_TYPE_GLCD4 EQU	0x05
MIOS_LCD_TYPE_MLCD EQU	0x06
MIOS_LCD_TYPE_GLCD_CUSTOM  EQU	  0x07

but…

MIOS_MIDI_INTERFACE_COMMON  EQU  0x00   => [Location: ?]

MIOS_ENC_MODE_DETENTED EQU   0x80 => [Location: ?]

MIOS_ENC_MODE_DETENTED2  EQU   0x81 => [Location: ?]

MIOS_ENC_SPEED_SLOW  EQU  0 => [Location: ?..]

MIOS_GLCD_FONT EQU 0x7cfc => [Location: ?..]

speculations ::slight_smile: :

MIOS_BOX_CFG0 EQU 0x000 is a DATA RAM address assignment - right?

Is MIOS_ENC_SPEED_SLOW  EQU 0 and

MIOS_ENC_MODE_DETENTED2 EQU 0x81 a DATA RAM byte-content assignment? [somewhere within the MIOS DATA RAM area?]

Is MIOS_GLCD_FONT EQU 0x7cfc a PROGRAM MEMORY address assignment?

In general it has to be considered, that constant definitions (EQU) can either be addresses or just values which are used for different purposes. The assembler doesn’t make a difference here.

In distance to “#define”, which you will also find sometimes in my applications, an EQU statement makes the definition public over the whole code. The assembler will replace the name by the constant definition during a second pass.

A #define statement works only “below” the statement - therefore I’m only using it when I’m sure that it is defined early enough (inconsistently)

MIOS_BOX_CFG0: yes, an address in data RAM

MIOS_ENC_SPEED*: these are values which are used in mios_tables.inc (encoder speed modes)

MIOS_GLCD_FONT: yes, thats an address in program memory

Best Regards, Thorsten.

Sorry TK,

I don’t want to steal your precious time with basic assembler-questions  :wink:

So perhaps I should read this first:

MPASM Assembler Overview: MPASM™ Assembler, MPLINK™ Object Linker, MPLIB™ Object Librarian User’s Guide

http://ww1.microchip.com/downloads/en/DeviceDoc/33014J.pdf

PIC18FXX2 - Data Sheet:

http://ww1.microchip.com/downloads/en/DeviceDoc/39564c.pdf

Are there other usefull resources in this context ?

Best Regards,

  • Lemonhorse

TK:

MIOS & Applications Re-Released for GPUTILS

« on: 20.01.2008 at 16:33 »

In order to get rid of the windows propritary MPASM assembler, I started to migrate MIOS and most of the applications to the GPUTILS toolchain. This freeware is available for all major operating systems (including Windows/Linux/Mac OS), and therefore should allow everbody to customize and rebuild an application without Windows installation.

[…]

http://www.midibox.org/forum/index.php/topic,10552.msg80333.html#msg80333

He he - I’ll never will keep step with You TK!  :wink:

I’m absolutely happy about the GPUTILS adoption - because now I can carry out my MIOS experiments on Linux!  :smiley:

But - is there a chance that:

http://www.ucapps.de/mios/sm_example1_v2.zip +

http://www.ucapps.de/mios/sm_example2_v1.zip

will be merged to GPUTILS compatibility? (now the code is just MPASM compatible right?)

If TK’s scripts don’t convert those with ease, I will help you to do it manually… it’s not so hard, just a bit of search’n’replace (kinda) :slight_smile:

You don’t need to do this, Stryd - I’m planning an official re-release of these applications as well - very soon (not today, as I got too many emails due to other issues… :-/)

Best Regards, Thorsten.

Ok, conversion for these particular applications already done:

http://www.ucapps.de/mios/sm_example1_v2a.zip

http://www.ucapps.de/mios/sm_example2_v1a.zip

Best Regards, Thorsten.

…Thanks Stryd!

Ok, conversion for these particular applications already done:

http://www.ucapps.de/mios/sm_example1_v2a.zip

http://www.ucapps.de/mios/sm_example2_v1a.zip

Best Regards, Thorsten.

I just installed GPUTILS. sm_example1_v2a is up and running :slight_smile:

Thanks TK! 8)

Note:

gputils (0.13.2)

James Bowman and Craig Franklin, May 5, 2005

http://gputils.sourceforge.net/gputils.pdf

The direct execution of “gpasm” is not recommented, instead just type “make” to process the Makefile.

There are some applications, which got additional parameters in this file.

Another point is, that I’m planning to change the file structure of applications soon (uniformed structure, hostet on a SVN server, include files like “mios.h” or “mios_vectors.inc” won’t be located in the application main directory anymore)

So, please wait a little bit with such docs, they will be expired once the update has been done.

Best Regards, Thorsten.

sorry - do you want me to remove the picture to minimize the confusion TK?

or sould i post a update of this diagram later on?

(I just thought perhaps my MIOS notes are usefull for other MIOS asm newbies… )

Please update the diagrams later - they are great, and they are definitely useful for newbies! :slight_smile:

Best Regards, Thorsten.

P.S.: I hope, that after the upcoming changes no additional changes have to be expected anymore

(I just thought perhaps my MIOS notes are usefull for other MIOS asm newbies… )

Definitely! thankyou! :slight_smile:

Another EXPLORATION SNAPSHOT (BASIC INTERNAL DATA FLOW, SYMBOLIC, DETAIL)

A  MIOS/asm detail map :wink: (any errors, suggestion?..)

Thats perrty.

As far as I can see, no errors.. I made a suggestion then realised it’s already there :smiley:

ADD: [WREG]<---->[PC] ?