Jump to content

Recommended Posts

I use the following settings for Screen mode 2:

 

 

WRITE_REGISTER:  EQU $1fd9

;
; Setup Screen 2,2
SETSCREEN2:
    LD BC,0002h	;Reg 0: Mode 2
    CALL WRITE_REGISTER
    LD BC,0206h        ; Name table 1800h
    CALL WRITE_REGISTER
    LD BC,03ffh        ; Colour table 2000h
    CALL WRITE_REGISTER
    LD BC,0403h        ; Pattern table 0000h
    CALL WRITE_REGISTER
    LD BC,0536h        ; Sprite attribute table 1b00h
    CALL WRITE_REGISTER
    LD BC,0607h        ; Sprite pattern table 3800h
    CALL WRITE_REGISTER
    LD BC,0700h        ; Base colours
    CALL WRITE_REGISTER
    LD BC,01c2h	;Reg 1: Mode 2, 16k, no interrupts, 16x16 sprites
    CALL WRITE_REGISTER
    RET

 

You then need to populate both the pattern and colour tables 3 x 256 x 8 and set the values in the name table (matching the pattern numbers you want to display).

  • Like 1
  • 2 weeks later...

Tony's way is the easiest and strait forward but here is an alternative that I switched over to only because I had to reference the book so many times that I found it easier just to do it in binary.

 

GRAPHICS_MODE_2:               ; SET SCREEN MODE TO 32 COLUMN TEXT BY SENDING 16 BYTES TO THE VIDEO CONTROL PORT
    LD C, CTRL_PORT
    LD B, $10                          ; 16 BYTES
    LD HL, MODE_2_REGISTERS
    OTIR
RET

 

MODE_2_REGISTERS:
    DB %00000010, 128+0  ; REG 0: MODE 2
    DB %11000000, 128+1  ; REG 1: MODE 2, 16K, NO INTERRUPTS
    DB %00000110, 128+2  ; REG 2: NAME TABLE $1800
    DB %11111111, 128+3  ; REG 3: COLOR TABLE $2000
    DB %00000011, 128+4  ; REG 4: PATTERN TABLE $0000
    DB %00110110, 128+5  ; REG 5: SPRITE ATTRIBUTE TABLE $1B00
    DB %00000111, 128+6  ; REG 6: SRITE PATTERN TABLE $3800
    DB %11110000, 128+7  ; REG 7: BACKGROUND COLOR

 

 

TMS9928A.pdf

Edited by Captain Cozmos

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...