Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

256x256x256 Mode Q

256x256x256 Mode Q

256x256x256 Mode Q

Does ne1 know how to get this in qbasic?

RE: 256x256x256 Mode Q

no, i don't know.  it's not possible in pure qb (i think) without some asm.  (why'd you want 256x256x256 anyways?)

RE: 256x256x256 Mode Q

I've looked at the specs for ModeQ, and I'm almost positive I can get this running. Please give me a few days, and I will try to get some sample code running. Looks like it should run fast. :)

RE: 256x256x256 Mode Q

Yep, I think I have it. I just need to test it on another machine, and if that works, I'll post the code here for you to see. It's quite simple, since mode Q is a chained mode.

RE: 256x256x256 Mode Q

'SJ Zeros PureQB ModeQ graphics routines

'This is just a very simple batch of routines I
'slapped together to show that ModeQ can be done
'in PureQB. To use them, set the video mode using
'setModeQ, put dots on the screen using putd(x,y,colour)
'exit the program at the end using deinit, or you'll
'be stuck in modeQ.

'I left out a PUT compatible statement and text stuff
'but if there's demand I'll release a new one later.
'Trust me when I say, it's an easy piece of code to

DECLARE SUB deinit ()
DECLARE SUB putd (x%, y%, colr%)



c = INT(RND(1) * 255)
FOR a = 0 TO 255
FOR b = 0 TO 255
putd a, b, c



SUB deinit ()


STATIC SUB putd (x, y, colr)

POKE (x * 256&) + y, colr


SUB setModeQ ()
DEF SEG = &HA000
'begin with standard 320x200x256 mode

'to reprogram the CRT controller,
'remove write protect from the registers
OUT &H3D4, &H11: OUT &H3D5, INP(&H3D5) AND &H7F

OUT &H3D4, &H0: OUT &H3D5, &H5F 'Hor. Total
OUT &H3D4, &H1: OUT &H3D5, &H3F 'Hor. Display enable end
OUT &H3D4, &H2: OUT &H3D5, &H40 'blank start
OUT &H3D4, &H3: OUT &H3D5, &H82 'blank end
OUT &H3D4, &H4: OUT &H3D5, &H4E 'retrace start
OUT &H3D4, &H5: OUT &H3D5, &H9A 'retrace end
OUT &H3D4, &H6: OUT &H3D5, &H23 'vertical total
OUT &H3D4, &H7: OUT &H3D5, &HB2 'overflow register
OUT &H3D4, &H8: OUT &H3D5, &H0 'preset row scan
OUT &H3D4, &H9: OUT &H3D5, &H61 'max scan line/char height
OUT &H3D4, &H10: OUT &H3D5, &HA 'vertical retrace start
OUT &H3D4, &H11: OUT &H3D5, &HAC 'vertical retrace end
OUT &H3D4, &H12: OUT &H3D5, &HFF 'vertical display enable end
OUT &H3D4, &H13: OUT &H3D5, &H20 'offset/logical width
OUT &H3D4, &H14: OUT &H3D5, &H40 'underlinde location
OUT &H3D4, &H15: OUT &H3D5, &H7 'vertical blank start
OUT &H3D4, &H16: OUT &H3D5, &H17 'vertical blank end
OUT &H3D4, &H17: OUT &H3D5, &HA3 'mode control

OUT &H3C4, &H1: OUT &H3C5, &H1 'clock mode register
OUT &H3C4, &H4: OUT &H3C5, &HE 'memory mode register

OUT &H3CE, &H5: OUT &H3CF, &H40 'mode register
OUT &H3CE, &H6: OUT &H3CF, &H5 'misc. register

OUT &H3C0, &H10 + 32: OUT &H3C1, &H41 'mode control

'reprotect the registers
OUT &H3D4, &H11: OUT &H3D5, INP(&H3D5) OR &H80


RE: 256x256x256 Mode Q

You see I'm going to be writing an NES emulator and I heard this is the best Mode for one. Well, I searched everywhere trying to find specs on Mode Q and only found one place (that didn't explain it well). Thx SJZero, but I sort of wanted to write the whole routine and things myself and just get the info on how to initialize it here after all I don't just wanna rip your routine (since I truly want to understand the whole thing and if I take some1 elses code I wouldn't learn). Could you tell me where you find the info on it since I could barely find any. Thx

RE: 256x256x256 Mode Q

Unfortnately, the only thing I could find on modeQ myself was  a poorly documented pascal program, which I based the init code on. Take what you see above, by all means. It's in the public domain for everyone to use now. :)

If you're interested in how to plot a pixel, my putd statement covers it pretty simply: memory location(past 0xa000, which the setModeQ command sets with the DEF SEG, along with setting up the video mode) = x * 256 + y. It's so simple because it's a chained mode, meaning the video memory is set up so you can just write the colour of the pixel in, unlike ModeX, where you have to switch planes around.

RE: 256x256x256 Mode Q

wow.  really sj, you should write a tutorial on setting new screen modes (modex, etc. etc.) and how memory works. make it well and it could be a winner.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close