MSX (1) System Variables in Work Area

Página 5/7
1 | 2 | 3 | 4 | | 6 | 7

Por erwinmusik

Master (140)

Imagen del erwinmusik

16-06-2014, 21:25

Autoincrement works, as I guessed, it was a mistake by me.

First set the Adress with HL

VIOUT:  LD        a,l
        OUT       (VOUT),A
        LD        a,h
        AND       63     ; 00111111  zeroe bit7 8, leave 1-5 as they are
        OR        64      ; set the 6th BIT
        OUT       (VOUT),A
        RET

then send data in a row.....

          LD a,0                 ; get A
LOOPM:    OUT       (VDAT),A
          INC       A
          CP        0FEh
          JP        NZ,LOOPM

VDAT is OUT(98h)

better coding is OUTI for shure, I have to learn......this is why I´m doing this old fashioned way, modern languages like arduino delivers no Feeling about timig and coding economical. ios is the top of no experience, absolutely no feeling and fun

Por erwinmusik

Master (140)

Imagen del erwinmusik

17-06-2014, 21:07

erwinmusik wrote:

Whats wrong with this part?
I´ll use the BIOS Routine to check if the keyboardbuffer is filled....
But never come back to BIOS, that means that the Zflag is never set

mainloop:
          Call CHSNS ;EQU 09Ch 
          Call Z, RTBIOS ; my return routine
          
          JP mainloop

A look at the BIOS listing shows it uses two variables PUTPNT and GETPNT

I found a description about these pointers:

FBF0H 	KEYBUF: DEFS 40 
This buffer contains the decoded keyboard characters produced by the interrupt handler. Note that the buffer is organized as a circular queue driven by GETPNT and PUTPNT and consequently has no fixed starting point. 

the part in the BIOS:

 0D62 2A F3FA LD HL,(GETPNT) ;Load GETPNT
 0D65 3A FBFB LD A, (PUTPNT) ;Load lower 8 bit of PUTPNT
 0D68 95 SUB L ;Check if same
 0D69 C9 RET

Z is set if both the same or if L is higher then A because of negative? I´m right?
one explanation says: Z-flag is set if buffer is filled

I have no idea why it wont work....

Por hit9918

Prophet (2897)

Imagen del hit9918

17-06-2014, 21:14

By the way, the port 99 setup can go without the and 63 or 64 ado.

If you imagine the vram addresses at 0x4000 to 0x7fff are "write zone".
Those adresses can be sent straight to port 99 and result in write mode.

example usage

	ld hl,string
	ld b,(hl)	;size of string
	inc hl
	
	ld de,(screen)
	ld c,0x99
	out (c),e
	out (c),d	;de in "0x4000-0x7ffff address range" = modi bits properly set
	dec c		;port to 0x98
loop:	outi		;outi does out (c),(hl) : inc hl : dec b and set flag
	jp nz,loop
	
	...


screen dw 0x4000+6144	;usual address + 0x4000

string: db stringend-stringstart
stringstart: "blablabla"
stringend:

Por hit9918

Prophet (2897)

Imagen del hit9918

17-06-2014, 21:19

SUB L makes zeroflag when A = L
what does the CALL to RTBIOS do. maybe that does not work. should it maybe be JP.

Por erwinmusik

Master (140)

Imagen del erwinmusik

17-06-2014, 21:26

hit9918 wrote:

SUB L makes zeroflag when A = L
what does the CALL to RTBIOS do. maybe that does not work. should it maybe be JP.

Thats a oint I´ve struggled days before I´ve tried CHSNS.
But it´s solved, I make a POP AF to "kill" the return adress to my mainloop and my RTBIOS returns to bios. This works fine, i´ve tested it a lot of times with other things in mainloop.
Here is my RTBIOS:

RTBIOS:   POP AF     ; !!!!!!!!!! for return to basic not to mainloop
          LD  A,(SAVEFGR)
          LD  (FORCLR),A
          LD  A,(SAVEBKG)
          LD  (BAKCLR),A
          LD  A,(SAVEBDR)
          LD  (BDRCLR),A
          CALL CHGCLR              ; all colors to original
          CALL KILBUF                   ; Flush Keyboardbuffer
          CALL DSPFNK                   ; show Function Keys
        RET 

The Point is, it never reaches the RTBIOS

Por erwinmusik

Master (140)

Imagen del erwinmusik

17-06-2014, 21:33

OK, I´m thinking about that and wondering becasue of the easy way with jump z to RTBIOS.....
It was never in my mind to use that simple way, oh oh

Por erwinmusik

Master (140)

Imagen del erwinmusik

17-06-2014, 21:41

This returns to BIOS immedetaly:

         
......................
 call KILBUF    <- this changes nothing

mainloop:
          call CHSNS
          jp Z, RTBIOS

          ;CALL UPDATESCREEN
          JP mainloop

Por erwinmusik

Master (140)

Imagen del erwinmusik

17-06-2014, 21:50

GOT IT!
It´s reverse to what the description says:
Z-flag is set if the buffer is EMPTY!!!!

Thats clear, if both pointers the same, buffer is empty and Z-flag is set

This works fine:

mainloop:
          call CHSNS    ; Z-flag is set if buffer is empty
          jp NZ, RTBIOS

          ;CALL UPDATESCREEN
          JP mainloop

Por flyguille

Prophet (3028)

Imagen del flyguille

17-06-2014, 21:54

yes, normally when two pointers match is because the buffer contains no data.

DATA END - DATA START = 0 = MATCH = (ZF = 1)

then with JR Z, will jump if the ZF is set.

Por hit9918

Prophet (2897)

Imagen del hit9918

17-06-2014, 21:57

maybe it is jp nz,rtbios
edit: ah you found it.

Página 5/7
1 | 2 | 3 | 4 | | 6 | 7