The original code at 04000h does not work....
I get this
[ img ] http://picasaweb.google.it/lh/photo/PPCTYqcjEvFGVPBcUSnI7A?feat=directlink [ /img ]
I did a COM file withe this pset function (ram table at 4000h)
psect text,class=CODE
global _pset,_NameTableInit
;Y -> C (ex H)
;X -> E (ex L)
_pset:
ld H,C
ld L,E
ld de,_tmp
EX DE,HL
LD (HL),D
LD A,E
AND 7
LD B,A
XOR E
OR 2
RRD
OUT (99h),A
LD E,A
LD A,(HL)
RLCA
OUT (99h),A
LD D,A
LD H,0c0h
LD A,(DE)
LD L,B
OR (HL)
LD (DE),A
OUT (98h),A
RET
_NameTableInit:
LD hl,04000h
LD de,04001h
ld (hl),0
ld bc,6*1024
ldir
LD HL,5800h
LD C,99h
OUT (C),L
OUT (C),H
DEC C
LOOP:
LD A,5Bh
CP H
RET Z
LD A,L
CALL COMP
LD A,L
JR NZ,SKIP
XOR 33
SKIP: OUT (C),A
INC HL
JP LOOP
COMP:
AND 33
DEC A
RET Z
CP 31
RET
psect bss,class=DATA
global _tmp
_tmp: defs 1
callled by this:
#include <stdio.h>
#include <sys.h>
#define di() asm("di")
#define ei() asm("ei")
void NameTableInit();
void vdpsetreg (unsigned char regno, unsigned char value)
{
di();
outp(0x99, value);
outp(0x99, regno | 0x80);
ei();
}
unsigned char vrampeek(unsigned int addr)
{
di();
outp(0x99, addr & 255);
outp(0x99, (addr >> 8) & 0x3f);
ei();
return inp(0x98);
}
void vrampoke(unsigned int addr, unsigned char byte)
{
di();
outp(0x99, addr & 255);
outp(0x99, 0x40 | ((addr >> 8) & 0x3f));
ei();
outp(0x98, byte);
}
void sc2()
{
unsigned char r;
unsigned int counter;
static unsigned char vdpregs[] = {0x02,0x60,0x06,0xFF, 0x03, 0x36, 0x07,0x04};
for (r =0;r
Possible I did something wrong?
Note that teh compiler passes the parameters to functions in C and E
this is the full rar of sorces and .com
I think you forgot:
LD A,1 LD HL,0C000H .LOOP LD (HL),A INC L ADD A,A JR NC,.LOOP
thanks! I'll try tonight
Humm : this is the result
[ img ] http://picasaweb.google.it/lh/photo/mf1z9TfnOXELI2xxnaKnTw?feat=directlink [ /img ]
image curtesy of Huey :P
where am i wrong this time ?

I think you forgot:
LD A,1 LD HL,0C000H .LOOP LD (HL),A INC L ADD A,A JR NC,.LOOP
hah!
this time it is not my fault!
the init code that i have forgotter was this
LD A,128 LD HL,0C000H 1: LD (HL),A INC L rra JR Nz,1b
With this reverted table your code rocks!!!
Thanks!

[ img ] https://docs.google.com/leaf?id=0Bx4kWAc-fapqNWJmZWVkNTYtMjA1MS00OGRmLWExOWYtNWMzMTg3MjBmZjVi&hl=en&authkey=CJb09LYI [ /img ]
HA! Good to see it solved.
Now make something incredible with it
I think you forgot:
LD A,1 LD HL,0C000H .LOOP LD (HL),A INC L ADD A,A JR NC,.LOOP
hah!
this time it is not my fault!
the init code that i have forgotter was this
LD A,128 LD HL,0C000H 1: LD (HL),A INC L rra JR Nz,1b
With this reverted table your code rocks!!!
Thanks!

[ img ] https://docs.google.com/leaf?id=0Bx4kWAc-fapqNWJmZWVkNTYtMjA1MS00OGRmLWExOWYtNWMzMTg3MjBmZjVi&hl=en&authkey=CJb09LYI [ /img ]
WARNING
replace RRA by RR A
They do NOT set the same flags, RRA hangs!!
