UpdateBuff: DI LD HL,1B00h ; point to start of SA in vram. LD A,L OUT (99h),A LD A,H OR $40 EI OUT (99h),A LD B,128 (127?) ; amount of bytes to output. LD C,98h ; destination is vdp data port. LD HL,C000h ; source is start of sat buffer. UpdateBuff_Loop: OUTI JR NZ,UpdateBuff_Loop RET
or:
xor a di ; set VRAM address to 1800h out (99h),a ; lower byte 00 ld a,1Bh + 040h ; upper byte 1Bh with flag to set the bus in write mode (1B00-1B7F VRAM: Sprite Attributes (128)) ei out (99h),a ; note that this is protected by the ei instruction LD B,128 (127?) LD C,98h ld hl,C000h ; 128 byte Sprite Attributes Buffer in WRAM loop: outi ; send the data (HL) to port 98h (podobnie jak w SMS mialem OTIR i byl problem, musialem OUTI uzyc wolniejsze) jp nz,loop ; the inner loop is exactly 29 cycles. If you are not in VBLANK this is the max speed for msx1.
Both are correct but the second is better (faster)
JP nz is faster than JR nz when a jump occurs
Note that :
B as to be 128, not 127
you can load 128 in B while loading 98h in C using BC in this way
ld bc,8098h
OUT (99h),A
Another tip is that the VDP I/O port must be obtained from the VDP.DR and VDP.RW values of the BIOS.
I am a little surprised that first thing you teach a beginning programmer is to bypass one of the foundations of the MSX standard, the BIOS. I think there is no need to do that, unless you want to squice 100% out of the hardware. But for a beginning programer this is not very important. Or am I missing something ?
You miss reading. He asks to not use the BIOS
You miss reading. He asks to not use the BIOS
Ok, I missed that. But I think we should advice against bypassing the BIOS, at least to beginning programers
I have no intention of bypassing the BIOS. I just wanted to know how to perform a given operation without it
@siudym
this will work on any msx1 (and upper)
xor a di ; set VRAM address to 1800h out (99h),a ; lower byte 00 ld a,1Bh + 040h ; upper byte 1Bh with flag to set the bus in write mode (1B00-1B7F VRAM: Sprite Attributes (128)) ei out (99h),a ; note that this is protected by the ei instruction ld bc,8098h ld hl,C000h ; 128 byte Sprite Attributes Buffer in WRAM loop: outi ; send the data (HL) to port 98h jp nz,loop ; the inner loop is exactly 29 cycles.
The update satbuffer code works.
I would like to change the BACKGROUND color to black, but I have no idea how it works?
CHGCLR (0062H) *1
Function: changes the screen colour
Input:
A for the mode
FORCLR (F3E9H) for foreground color
BAKCLR (F3EAH) for background color
BDRCLR (F3EBH) for border colour
Output: none
Registers: all
ld a,colvalue?
call 0062H
What is "F3EBH"? Do I need to write value in this address?
I noticed that the sprite screen position starts with X. $ 20 on the left edge of the screen. The maximum value to the right is FF and it does not reach the right edge of the screen (mode0 / screen 1)
From what I can see the XY coordinates are 8 bits so I wonder how to set the sprite on the right edge of the screen?
BIOS routine CHGCLR uses FORCLR, BAKCLR and BDRCLR values.
Therefore, it is used like this:
ld a, 12 ; dark green, for example ld (BDRCLR), a call CHGCLR
Please note that BDRCLR is applied immediately, and BAKCLR will be seen when you change screen mode (not sure if also in SCREEN 0/1). FORCLR makes sense in SCREEN 0/1 if you use BIOS routines to print text, for example.