Tokugawa Corporate Forums

Retro Japanese Computing
It is currently March 29th, 2024, 5:39 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Sharp X1 PCG
PostPosted: October 18th, 2014, 3:19 pm 
Offline

Joined: September 21st, 2013, 9:33 am
Posts: 6
Hi there,

I'm just wondering if anyone knows how to use the programmable character generator (PCG) from assembly language on the X1? I've been trying for months to get this to work (with very little in the way of documentation or help) and am completely stuck. The code below works in XMillennium and MESS (it displays a character made up of two blue lines) but on a real X1twin it just appears as a solid blue square.

There must be something that I'm missing, but I just don't know what. Any pointers or even source code would be hugely appreciated at this point.

Many thanks.

Code:
        org 0x0000
        ld sp, 0xFFFF
        di

        ;toggle concurrent access mode
        ld bc, 0x1A02
        in a, (c)
        or 0x20
        out (c), a

        ;for X1 turbo
        ld bc, 0x1FD0
        xor a
        out (c), a

; *************************************************

        ;change the Blue PCG entry
        ld bc, 0x1500
        ld e, 0x08
        exx
        ld bc, 0x1A01    ;wait for start of VBLANK
_vbl1:  in a, (c)      ;.
           jp p, _vbl1     ;.
_vbl2:  in a, (c)      ;.
           jp m, _vbl2    ;.
           exx               ;4

SETP:  ld a, 0x88      ;7
          out (c), a          ;12
          inc hl             ;6
          inc bc            ;6
                              ;7+12+6+6=31

          nop         ;4
          inc hl              ;6
          dec hl             ;6
                               ;4+6+6=16

          call DELAY       ;17 + 157
          ld d, 0             ;7
          nop                 ;4
          nop                   ;4
          dec e              ;4
          jp nz, SETP     ;10 + 4 + 4 + 4 + 7 + (17+157) = 203

; *************************************************

        ;char1
        ld bc, 0x3000
        ld a, 0x20
        out (c), a

        ld bc, 0x2000
        ld a, 0x21
        out (c), a

LOOP:   jp LOOP     

; *************************************************

DELAY:  ld a, 0x0A      ;7
_dly:   dec a         ;4
        jp nz, _dly      ;10
        ret         ;10
                                ;7+(4+10)*10 + 10 = 157


Top
 Profile  
 
 Post subject: Re: Sharp X1 PCG
PostPosted: October 19th, 2014, 1:37 pm 
Offline
User avatar

Joined: December 18th, 2011, 2:01 pm
Posts: 23
Try to wait 203 rather than 249 or 250?


Top
 Profile  
 
 Post subject: Re: Sharp X1 PCG
PostPosted: October 20th, 2014, 10:33 am 
Offline

Joined: September 21st, 2013, 9:33 am
Posts: 6
Thanks for the reply.

I tried making the PCG loop 203 cycles instead, but it made no difference. I'm pretty sure the loop is supposed to be exactly 250 cycles but I'll try anything at this point. :-)

Can't believe what a nightmare this is turning into.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group