Page 1 of 1

Text mode Character set location

PostPosted: 31 Dec 2011, 20:34
by justine
I am making my own rom and i will be using 80 x 25 text mode at what memory location do i put the character set for this text mode?

Thanx for all your help in advance.

Re: Text mode Character set location

PostPosted: 31 Dec 2011, 22:02
by justine
Am i right in thinking that the character set for text mode is built into the FPGA ?

Re: Text mode Character set location

PostPosted: 01 Jan 2012, 12:58
by DDp
ATM-turbo2 have a singular textmode. %) :crazy: In BASECONF for ZX-Evo is implemented this mode (for compatible).

Code: Select all
Text mode 80x25 (ATM-Turbo2 compatible)

Placement:

For "first" screen (#7FFD bit3 = 0)
Characters - page 5
Attributes - page 1
For "second" screen (#7FFD bit3 = 1)
Characters - page 7
Attributes - page 3

Characters
┌──────┬────┬────┬────┬────┬─..─┬────┬────┐
│columns  0 │  1 │  2 │  3 │ .. │ 78 │ 79 │
├──────┼────┼────┼────┼────┼─..─┼────┼────┤
│row 0 │01C0│21C0│01C1│21C1│ .. │01E7│21E7│
│row 1 │0200│2200│0201│2201│ .. │0227│2227│
│row 2 │0240│2240│0241│2241│ .. │0267│2267│
│row 3 │0280│2280│0281│2281│ .. │02A7│22A7│
...........................................
│row 24│07C0│27C0│07C1│27C1│ .. │07E7│27E7│
└──────┴────┴────┴────┴────┴─..─┴────┴────┘

Attributes
┌──────┬────┬────┬────┬────┬─..─┬────┬────┐
│columns  0 │  1 │  2 │  3 │ .. │ 78 │ 79 │
├──────┼────┼────┼────┼────┼─..─┼────┼────┤
│row 0 │21C0│01C1│21C1│01C2│ .. │21E7│01E8│
│row 1 │2200│0201│2201│0202│ .. │2227│0228│
│row 2 │2240│0241│2241│0242│ .. │2267│0268│
│row 3 │2280│0281│2281│0282│ .. │22A7│02A8│
...........................................
│row 24│27C0│07C1│27C1│07C2│ .. │27E7│07E8│
└──────┴────┴────┴────┴────┴─..─┴────┴────┘

Re: Text mode Character set location

PostPosted: 01 Jan 2012, 16:51
by DimkaM
Code: Select all
settxtmode
   ld a,1 ;set shadow mode
   out (0xBF),a
   ld bc,0xff77 ;set txt mode
   ld a,0x26
   out (c),a
   ld a,5^0xff ;set 5_ram_page to 1 bank z80
   ld bc,0x77f7
   out (c),a
   ld a,1^0xff  ;set 1_ram_page to 2 bank z80
   ld b,0xb7
   out (c),a
   ret

xy2txt_addr   ;input h=x l=y symbol
   ld a,0x07   ;output hl=address
   srl h
   jr nc,.l1
   ld a,0x87
.l1   add a,l
   ld l,h
   ld h,a
   xor a
   srl h
   rr a
   srl h
   rr a
   add a,l
   ld l,a
   set 6,h
   ret
   
xy2attr_addr   ;input h=x l=y symbol
   ld a,0x87    ;output hl=address
   srl h
   jr nc,.l1
   ld a,0x07
   inc h
.l1   add a,l
   ld l,h
   ld h,a
   xor a
   srl h
   rr a
   srl h
   rr a
   add a,l
   ld l,a
   set 7,h
   ret


TXT2ATTR      ;input hl=txt_symb address
   ld a,%11100000      ;output hl=attr_symb address
   xor h
   ld h,a
   bit 5,h
   ret nz
   inc hl
   ret
I'm a little drunk, no comments

Re: Text mode Character set location

PostPosted: 02 Jan 2012, 13:22
by DimkaM
to Support:Неплохо былобы в доки добавлять примеры говнокодинга. Про z-card там только видел.

то Алл: есть у кого оптимальный код конверсии ху_тхт в адрес?

Re: Text mode Character set location

PostPosted: 02 Jan 2012, 18:38
by justine
Thanx for your kind help DimkaM , TSLabs & DDp .

Re: Text mode Character set location

PostPosted: 04 Jan 2012, 17:17
by justine
Give me some documentation on your configuration and i may well try it. ;)

Re: Text mode Character set location

PostPosted: 07 Jan 2012, 18:24
by DimkaM
new txtmode(r530 firmware):
Code: Select all
settxtmode
   ld a,1 ;set shadow mode
   out (0xBF),a
   ld bc,0xff77 ;set new_txt_mode
   ld a,0x27
   out (c),a
   ld a,8^0xff ;set 8_ram_page to 1 bank z80
   ld bc,0x77f7
   out (c),a
   ret


xy2scr         ;input hl=xy
   ld a,0x1c
   srl h
   rr a
   rr a
   add a,l
   ld l,h
   ld h,a
   xor a
   srl h
   rr a
   srl h
   rr a
   add a,l
   ld l,a
   set 6,h
   ret

   
xy2attr
   ld a,0xc7
   srl h
   jr nc,.l1
   ld a,0x87
   inc h
.l1   add a,l
   ld l,h
   ld h,a
   xor a
   srl h
   rr a
   srl h
   rr a
   add a,l
   ld l,a
   set 6,h
   ret

TXT2ATTR      ;input hl=txt_symb address
     ld a,%00110000      ;output hl=attr_symb address
     xor h
     ld h,a
   bit 4,h
   ret nz
   inc hl
   ret