LET A= USR (2545)

Everything about programming, including VDP and Sound programming.
Post Reply
Potholepete
Posts: 94
Joined: 11 Aug 2012 22:13

LET A= USR (2545)

Post by Potholepete »

Trying to figure out what this line does on the MTX: LET A= USR (2545)
Any idea? It is at the end of the basic Envosound listing and its not clear what it is supposed to do? the Envosound assembler code still runs as it should so does this line stop interrupts or something?

Any thoughts?
Martin A
Posts: 888
Joined: 09 Nov 2013 21:03

Re: LET A= USR (2545)

Post by Martin A »

It's calling the rom at 2545 :)
Potholepete
Posts: 94
Joined: 11 Aug 2012 22:13

Re: LET A= USR (2545)

Post by Potholepete »

:lol:
Bill B
Posts: 703
Joined: 26 Jan 2014 16:31

Re: LET A= USR (2545)

Post by Bill B »

Which is not a valid routine entry point. 2545 = 0x9F1, so entering at the final byte of the jump:

Code: Select all

09EF C3 11 1C     		JP	enterin
09F2 E5           breakmon:	PUSH	HL
09F3 21 81 FD     		LD	HL, BREAK
09F6 CB 46        		BIT	0, (HL)
09F8 E1           		POP	HL
09F9 C9           		RET
Potholepete
Posts: 94
Joined: 11 Aug 2012 22:13

Re: LET A= USR (2545)

Post by Potholepete »

these are the two lines in basic that follow the 100 ASSEM Envosound routine:

10000 LET A= USR (2545)
10010 STOP

does that make any more sense?

edit: I suspect it might be something to do with stopping interrupts as I remember if this line was not included and I ran the assembly a few times it would eventually freeze the MTX?
Bill B
Posts: 703
Joined: 26 Jan 2014 16:31

Re: LET A= USR (2545)

Post by Bill B »

The final byte of the jump is 0x1C, which translates to INC E, so the code actually executed is:

Code: Select all

09F1 1C           		INC     E
09F2 E5           breakmon:	PUSH	HL
09F3 21 81 FD     		LD	HL, BREAK
09F6 CB 46        		BIT	0, (HL)
09F8 E1           		POP	HL
09F9 C9           		RET
So I have no idea what the intention was, but I would say that it effectively does nothing.
Potholepete
Posts: 94
Joined: 11 Aug 2012 22:13

Re: LET A= USR (2545)

Post by Potholepete »

thats odd then as I cannot see why it would be there? Is it possible to rewrite that code area from within the envosound assembly somehow? That said I have had a decent look and there is no obvious reference to such happening?
Bill B
Posts: 703
Joined: 26 Jan 2014 16:31

Re: LET A= USR (2545)

Post by Bill B »

My guess is that it was probably meant to call one of:
  • killsnd at 0x093A = 2362
  • ijinit at 0x097F = 2431
  • init125 at 0x0996 = 2454
Looking at that list, typing 2545 in error for 2454 is the most likely.

Code: Select all

0996 F3           init125:        DI                            ; Configure 1/125s Interrupt
0997 E5                           PUSH    HL
0998 21 80 07                     LD      HL, vdpint            ; Initialise interrupt vectors
099B 22 F0 FF                     LD      (IJTABLE), HL
099E 21 11 1C                     LD      HL, enterin
09A1 22 F4 FF                     LD      (IJTABLE+4), HL
09A4 E1                           POP     HL
09A5 3E A5                        LD      A, 0A5H               ; Enable interrupts, timer, 256 pre-scale
09A7 D3 08                        OUT     (08H), A
09A9 3E 7D                        LD      A, 7DH                ; Time constant
09AB D3 08                        OUT     (08H), A
09AD FB                           EI
09AE ED 4D                        RETI
Potholepete
Posts: 94
Joined: 11 Aug 2012 22:13

Re: LET A= USR (2545)

Post by Potholepete »

the interrupt one makes the most sense and agree maybe the number in the code was mixed up. Thanks Bill :-)
Potholepete
Posts: 94
Joined: 11 Aug 2012 22:13

Re: LET A= USR (2545)

Post by Potholepete »

would appear that I had already covered this with my post re killing the interrupts, sorry Bill. Just trying to work through getting an MTX template in place for using in Visual Studio Code and the z80 Macro Assembler.
Post Reply