Both the previous replies are bang on the money. The Beeb has flexible (up to a point) display hardware, but there are still some severe limitations.
The routines I have used here as my examples exactly duplicate the example given, just in a slightly different format.
The code I use to generate a mono display of 256 * 192, 6144 byte display. (In BeebASM assembler syntax). Could be changed to 'mode 1' to approximate some Spectrum games with a little bit of jiggery pokery. The CRTC registers are massaged to centre the display on the screen, meaning you have now got a wide distracting border around your picture. (Well, it's not that bad really).
Code:
;
; mode_setup
;
; setup 256 * 192 video resolution
; and other video chip settings
;
.mode_setup
ldy #52
.vdu_loop
lda vdu_stream-1,Y
jsr oswrch%
dey
bne vdu_loop
rts
; video chip settings
.vdu_stream
; alter v_sync to center the screen vertically
equb &00,&00,&00,&00,&00,&00,&1E,&07,&00,&17
; display height = 24 (characters)
equb &00,&00,&00,&00,&00,&00,&18,&06,&00,&17
; change h_sync to center the display horizontally
equb &00,&00,&00,&00,&00,&00,&2D,&02,&00,&17
; display width = 32 (characters)
equb &00,&00,&00,&00,&00,&00,&20,&01,&00,&17
; turn off cursor
equb &00,&00,&00,&00,&00,&00,&20,&0A,&00,&17
; mode 4
equb &04,&16
Here's a 'widescreen' low res four colour setup for a stalled project of mine. Reducing the screen resolution by so much meant I could have two screen buffers in a 32k Beeb. It initially used a line doubling routine to make the pixels square. (included). Not ideal or optimised, as I would draw the pixels on the odd lines then call the doubler routine. Very slow, as even the un-changed areas on screen are copied.
You will find it quicker for your routines to store the pixel data in consecutive screen addresses when plotting.
Either of these solutions is about the only way you will get a square display in the wide pixel modes with the Beeb hardware.
Unfortunately, this looks severely letterboxed, which is what I was aiming at, but may annoy some!
Code:
; set up 160 * 192 real pixel mode
.chunky_mode
; stream vdu chontrol codes to change to our new mode
ldy #34
.my_mode
lda vdu_stream-1,Y
jsr oswrch%
dey
bne my_mode
rts
.table_data
; data blocks for previous chunks of program that can
; also be destroyed once used.
.vdu_stream
; set colours
equb &00,&00,&00,&06,&02,&13
equb &00,&00,&00,&04,&01,&13
; alter video chip settings
; v_sync to centre screen vertically
equb &00,&00,&00,&00,&00,&00,&1E,&07,&00,&17
; vertical size (characters)
equb &00,&00,&00,&00,&00,&00,&18,&06,&00,&17
; mode 5
equb &05,&16
;
; make pixels in demo mode (160*96) square by copying raster lines
; expects 'screen' start address to be in zero page
; address pointed to by screen%
;
.double
ldx #&1E
ldy #&00
.double_loop
lda (screen%),y
iny
sta (screen%),y
iny
lda (screen%),y
iny
sta (screen%),y
iny
lda (screen%),y
iny
sta (screen%),y
iny
lda (screen%),y
iny
sta (screen%),y
iny
lda (screen%),y
iny
sta (screen%),y
iny
lda (screen%),y
iny
sta (screen%),y
iny
lda (screen%),y
iny
sta (screen%),y
iny
lda (screen%),y
iny
sta (screen%),y
iny
bne double_loop
dex
beq double_exit
inc screen%+1
bne double_loop
.double_exit
rts
Up to you to furnish the plotting routines, otherwise you will just have blank black screens which do not help to demonstrate success. Also, you have to alter HIMEM and other system values if working in BASIC... or if your code tanks and the error message is displayed via the OS it will of course 'write' it on screen at TAB(0,0), start address of the originally selected donor mode... Demonstrated by repeated pressing of the <return> key until the screen 'wraparound' occurs and the message is displayed - depending on the number of lines you have taken off the display, you won't see the prompt appear until you have hit the <return> this number of times, very frustrating when the program has found itself in another near infinite loop and you don't get the prompt to appear after a hundred presses :o| (Can be fixed with handy pokes).