src/mess/video/rm380z.c
| r14073 | r14074 | |
| 238 | 238 | return state->m_mainVideoram[offset]; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | | void rm380z_state::putChar(int charnum,int attribs,int x,int y,UINT16* pscr,unsigned char* chsb,int vmode) |
| 241 | void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bitmap,unsigned char* chsb,int vmode) |
| 242 | 242 | { |
| 243 | 243 | //bool attrDim=false; |
| 244 | 244 | bool attrRev=false; |
| r14073 | r14074 | |
| 257 | 257 | int basex=RM380Z_CHDIMX*(charnum/RM380Z_NCY); |
| 258 | 258 | int basey=RM380Z_CHDIMY*(charnum%RM380Z_NCY); |
| 259 | 259 | |
| 260 | | int inix=x*(RM380Z_CHDIMX+1); |
| 261 | | int iniy=y*(RM380Z_CHDIMX+1)*RM380Z_SCREENCOLS*(RM380Z_CHDIMY+1); |
| 262 | | |
| 263 | 260 | for (int r=0;r<RM380Z_CHDIMY;r++) |
| 264 | 261 | { |
| 265 | 262 | for (int c=0;c<RM380Z_CHDIMX;c++) |
| r14073 | r14074 | |
| 280 | 277 | else chval=1; |
| 281 | 278 | } |
| 282 | 279 | } |
| 283 | | |
| 284 | | pscr[(inix+c)+(iniy+(r*(RM380Z_CHDIMX+1)*RM380Z_SCREENCOLS))]=chval; |
| 280 | |
| 281 | UINT16 *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+c); |
| 282 | *dest=chval; |
| 285 | 283 | } |
| 286 | 284 | } |
| 287 | 285 | |
| 288 | 286 | // last pixel of underline |
| 289 | | if (attrUnder) |
| 287 | if (attrUnder&&(!attrRev)) |
| 290 | 288 | { |
| 291 | | pscr[(inix+RM380Z_CHDIMX)+(iniy+((RM380Z_CHDIMY-1)*(RM380Z_CHDIMX+1)*RM380Z_SCREENCOLS))]=attrRev?0:1; |
| 289 | UINT16 *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+(RM380Z_CHDIMY-1),(x*(RM380Z_CHDIMX+1))+RM380Z_CHDIMX); |
| 290 | *dest=attrRev?0:1; |
| 292 | 291 | } |
| 293 | 292 | |
| 294 | 293 | // if reversed, print another column of pixels on the right |
| r14073 | r14074 | |
| 296 | 295 | { |
| 297 | 296 | for (int r=0;r<RM380Z_CHDIMY;r++) |
| 298 | 297 | { |
| 299 | | pscr[(inix+RM380Z_CHDIMX)+(iniy+(r*(RM380Z_CHDIMX+1)*RM380Z_SCREENCOLS))]=1; |
| 298 | UINT16 *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+RM380Z_CHDIMX); |
| 299 | *dest=1; |
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | } |
| r14073 | r14074 | |
| 305 | 305 | int basex=RM380Z_CHDIMX*(charnum/RM380Z_NCY); |
| 306 | 306 | int basey=RM380Z_CHDIMY*(charnum%RM380Z_NCY); |
| 307 | 307 | |
| 308 | | int inix=(x*(RM380Z_CHDIMX+1)*2); |
| 309 | | int iniy=y*(RM380Z_CHDIMX+1)*(RM380Z_SCREENCOLS)*(RM380Z_CHDIMY+1); |
| 310 | | |
| 311 | 308 | for (int r=0;r<RM380Z_CHDIMY;r++) |
| 312 | 309 | { |
| 313 | 310 | for (int c=0;c<(RM380Z_CHDIMX*2);c+=2) |
| r14073 | r14074 | |
| 329 | 326 | } |
| 330 | 327 | } |
| 331 | 328 | |
| 332 | | pscr[(inix+c)+(iniy+(r*(RM380Z_CHDIMX+1)*(RM380Z_SCREENCOLS)))]=chval; |
| 333 | | pscr[(inix+c+1)+(iniy+(r*(RM380Z_CHDIMX+1)*(RM380Z_SCREENCOLS)))]=chval; |
| 329 | UINT16 *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c); |
| 330 | UINT16 *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c+1); |
| 331 | *dest=chval; |
| 332 | *dest2=chval; |
| 334 | 333 | } |
| 335 | 334 | } |
| 336 | 335 | |
| 337 | 336 | // last 2 pixels of underline |
| 338 | 337 | if (attrUnder) |
| 339 | 338 | { |
| 340 | | pscr[(inix+(RM380Z_CHDIMX*2))+(iniy+((RM380Z_CHDIMY-1)*(RM380Z_CHDIMX+1)*(RM380Z_SCREENCOLS)))]=attrRev?0:1; |
| 341 | | pscr[(inix+(RM380Z_CHDIMX*2)+1)+(iniy+((RM380Z_CHDIMY-1)*(RM380Z_CHDIMX+1)*(RM380Z_SCREENCOLS)))]=attrRev?0:1; |
| 339 | UINT16 *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+RM380Z_CHDIMY-1 , ((x*(RM380Z_CHDIMX+1))*2)+(RM380Z_CHDIMX*2)); |
| 340 | UINT16 *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+RM380Z_CHDIMY-1 , ((x*(RM380Z_CHDIMX+1))*2)+(RM380Z_CHDIMX*2)+1); |
| 341 | *dest=attrRev?0:1; |
| 342 | *dest2=attrRev?0:1; |
| 342 | 343 | } |
| 343 | 344 | |
| 344 | 345 | // if reversed, print another 2 columns of pixels on the right |
| r14073 | r14074 | |
| 346 | 347 | { |
| 347 | 348 | for (int r=0;r<RM380Z_CHDIMY;r++) |
| 348 | 349 | { |
| 349 | | pscr[(inix+(RM380Z_CHDIMX*2))+(iniy+(r*(RM380Z_CHDIMX+1)*(RM380Z_SCREENCOLS)))]=1; |
| 350 | | pscr[(inix+(RM380Z_CHDIMX*2)+1)+(iniy+(r*(RM380Z_CHDIMX+1)*(RM380Z_SCREENCOLS)))]=1; |
| 350 | UINT16 *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+((RM380Z_CHDIMX)*2)); |
| 351 | UINT16 *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+((RM380Z_CHDIMX)*2)+1); |
| 352 | *dest=1; |
| 353 | *dest2=1; |
| 351 | 354 | } |
| 352 | 355 | } |
| 353 | 356 | } |
| r14073 | r14074 | |
| 357 | 360 | // graphic chars: 0x80-0xbf is "dimmed", 0xc0-0xff is full bright |
| 358 | 361 | if (vmode==RM380Z_VIDEOMODE_80COL) |
| 359 | 362 | { |
| 360 | | int inix=x*(RM380Z_CHDIMX+1); |
| 361 | | int iniy=y*(RM380Z_CHDIMX+1)*RM380Z_SCREENCOLS*(RM380Z_CHDIMY+1); |
| 362 | | |
| 363 | 363 | for (int r=0;r<(RM380Z_CHDIMY+1);r++) |
| 364 | 364 | { |
| 365 | 365 | for (int c=0;c<RM380Z_CHDIMX;c++) |
| 366 | 366 | { |
| 367 | | pscr[(inix+c)+(iniy+(r*(RM380Z_CHDIMX+1)*RM380Z_SCREENCOLS))]=m_graphic_chars[charnum&0x3f][c+(r*(RM380Z_CHDIMX+1))]; |
| 367 | UINT16 *dest=&bitmap.pix16((y*(RM380Z_CHDIMY+1))+r,(x*(RM380Z_CHDIMX+1))+c); |
| 368 | *dest=m_graphic_chars[charnum&0x3f][c+(r*(RM380Z_CHDIMX+1))]; |
| 368 | 369 | } |
| 369 | 370 | } |
| 370 | 371 | } |
| 371 | 372 | else |
| 372 | 373 | { |
| 373 | | int inix=(x*(RM380Z_CHDIMX+1)*2); |
| 374 | | int iniy=y*(RM380Z_CHDIMX+1)*(RM380Z_SCREENCOLS)*(RM380Z_CHDIMY+1); |
| 375 | | |
| 376 | 374 | for (int r=0;r<RM380Z_CHDIMY;r++) |
| 377 | 375 | { |
| 378 | 376 | for (int c=0;c<(RM380Z_CHDIMX*2);c+=2) |
| 379 | 377 | { |
| 380 | | pscr[(inix+c)+(iniy+(r*(RM380Z_CHDIMX+1)*(RM380Z_SCREENCOLS)))]=m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; |
| 381 | | pscr[(inix+c+1)+(iniy+(r*(RM380Z_CHDIMX+1)*(RM380Z_SCREENCOLS)))]=m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; |
| 378 | UINT16 *dest=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c); |
| 379 | UINT16 *dest2=&bitmap.pix16( (y*(RM380Z_CHDIMY+1))+r,((x*(RM380Z_CHDIMX+1))*2)+c+1); |
| 380 | *dest=m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; |
| 381 | *dest2=m_graphic_chars[charnum&0x3f][(c/2)+(r*(RM380Z_CHDIMX+1))]; |
| 382 | 382 | } |
| 383 | 383 | } |
| 384 | 384 | } |
| r14073 | r14074 | |
| 388 | 388 | void rm380z_state::update_screen(bitmap_ind16 &bitmap) |
| 389 | 389 | { |
| 390 | 390 | unsigned char* pChar=machine().region("gfx")->base(); |
| 391 | | UINT16* scrptr = &bitmap.pix16(0); |
| 392 | | |
| 393 | | // blank screen |
| 394 | | memset(scrptr,0,(RM380Z_SCREENCOLS*(RM380Z_CHDIMX+1))*(RM380Z_SCREENROWS*(RM380Z_CHDIMY+1))*2); |
| 395 | 391 | |
| 396 | 392 | int lineWidth=0x80; |
| 397 | 393 | int ncols=80; |
| r14073 | r14074 | |
| 402 | 398 | ncols=40; |
| 403 | 399 | } |
| 404 | 400 | |
| 401 | // blank screen |
| 402 | bitmap.fill(0); |
| 403 | |
| 405 | 404 | for (int row=0;row<RM380Z_SCREENROWS;row++) |
| 406 | 405 | { |
| 407 | 406 | for (int col=0;col<ncols;col++) |
| 408 | 407 | { |
| 409 | 408 | UINT8 curch,attribs; |
| 410 | 409 | decode_videoram_char((row*lineWidth)+col,curch,attribs); |
| 411 | | putChar(curch,attribs,col,row,scrptr,pChar,m_videomode); |
| 410 | putChar(curch,attribs,col,row,bitmap,pChar,m_videomode); |
| 411 | //putChar(0x44,0x00,10,10,bitmap,pChar,m_videomode); |
| 412 | 412 | } |
| 413 | 413 | } |
| 414 | 414 | } |