Mercurial > public > hwos_code
comparison src/aa_wordprocessor.asm @ 608:d866684249bd
work on 2.99 stable
author | heinrichsweikamp |
---|---|
date | Mon, 07 Jan 2019 21:13:43 +0100 |
parents | ca4556fb60b9 |
children | c40025d8e750 |
comparison
equal
deleted
inserted
replaced
607:c5151a490d88 | 608:d866684249bd |
---|---|
46 extern aa_font28_block | 46 extern aa_font28_block |
47 extern aa_font36_block | 47 extern aa_font36_block |
48 extern aa_font48_block | 48 extern aa_font48_block |
49 extern aa_font90_block | 49 extern aa_font90_block |
50 | 50 |
51 extern convert_for_display2 | |
52 | |
51 aa_word CODE | 53 aa_word CODE |
52 | 54 |
53 ;------------------------------------------------------------------------------ | 55 ;------------------------------------------------------------------------------ |
54 ; Setup pointers for a char: | 56 ; Setup pointers for a char: |
55 ; Inputs WREG = char to draw, win_font | 57 ; Inputs WREG = char to draw, win_font |
362 movf aa_temp+1,W ; add color/4 | 364 movf aa_temp+1,W ; add color/4 |
363 addwf PRODL,F ; NOTE: 7/31+15/31=22/31, | 365 addwf PRODL,F ; NOTE: 7/31+15/31=22/31, |
364 movf aa_temp+0,W ; hence components won't overlap | 366 movf aa_temp+0,W ; hence components won't overlap |
365 addwfc PRODH,F ; in right order, to propagate carry | 367 addwfc PRODH,F ; in right order, to propagate carry |
366 | 368 |
367 bra aa_decode_3 ; done | 369 aa_decode_12b: |
368 | 370 btfss screen_type2 ; Display 2? |
369 ; ---- Simple BLACK and WHITE cases ------------------------------ | 371 bra aa_decode_3 ; No, Done. |
370 aa_decode_13: ; got a 1xx or a 000 code... | 372 |
371 btfsc win_invert ; inverse video mode? | 373 call convert_for_display2 ; Convert 16Bit RGB b'RRRRRGGG GGGBBBBB' into 24Bit RGB b'RRRRRR00 GGGGGG00 BBBBBB00' |
372 xorlw 0x80 ; YES - invert levels | 374 |
373 bn aa_decode_2 ; then test high bit | 375 bra aa_decode_3 ; Done. |
374 | 376 |
375 ; WHITE pixel (i.e. full color) | 377 ; ---- Simple BLACK and WHITE cases ------------------------------ |
376 bsf tft_rs ; RS_H Data | 378 aa_decode_13: ; Got a 1xx or a 000 code... |
377 movff win_color1,PORTA ; current draw color | 379 btfsc win_invert ; Inverse video mode ? |
378 movff win_color2,PORTH ; (rem: TFT is big endian) | 380 xorlw 0x80 ; YES: invert levels. |
379 bra aa_decode_4 | 381 bn aa_decode_2 ; Then test high bit. |
382 | |
383 ; WHITE pixel (ie. full color) | |
384 movff win_color1,PRODH ; current draw color | |
385 movff win_color2,PRODL ; (rem: DISPLAY is big endian) | |
386 bra aa_decode_12b | |
380 | 387 |
381 aa_decode_2: | 388 aa_decode_2: |
382 bsf tft_rs ; RS_H Data | 389 clrf PRODH ; BLACK pixel |
383 clrf PORTA ; BLACK pixel | 390 clrf PRODL |
384 clrf PORTH | 391 clrf win_color5 |
385 bra aa_decode_4 | 392 clrf win_color4 |
393 clrf win_color3 | |
386 | 394 |
387 aa_decode_3: | 395 aa_decode_3: |
388 bsf tft_rs ; RS_H Data | 396 ;---- PIXEL WRITE LOOP ----------------------------------------------- |
389 movff PRODH,PORTA ; move high byte to PORTA | 397 bsf tft_rs ; Data! |
390 movff PRODL,PORTH ; move low byte to PORTH | 398 |
391 aa_decode_4: | 399 btfsc screen_type2 ; Display 2? |
392 bcf INTCON,GIE | 400 bra aa_decode_3_display2 ; Yes |
393 aa_decode_4a: | 401 |
394 ;---- PIXEL WRITE LOOP ----------------------------------------------- | 402 movff PRODH,PORTA ; Move high byte to PORTA |
395 bcf tft_nwr ; WR_L | 403 movff PRODL,PORTH ; Move low byte to PORTH |
396 bsf tft_nwr ; WR_H tick | 404 aa_decode_3_display0and1: |
397 | 405 bcf tft_nwr |
406 bsf tft_nwr ; Tick | |
398 decf aa_bitlen,F | 407 decf aa_bitlen,F |
399 bnz aa_decode_4a | 408 bnz aa_decode_3_display0and1 |
400 | 409 bra aa_decode_3_done |
401 bsf INTCON,GIE | 410 |
402 ;---- BYTE-CODE LOOP ------------------------------------------------- | 411 aa_decode_3_display2: |
403 ; Are we done ? | 412 movff win_color5,PORTH ; Move high byte to PORTH (DISPLAY is bigendian) |
404 movf TBLPTRL,W ; compare TBLPTR to aa_end | 413 bcf tft_nwr |
405 cpfseq aa_end+0 | 414 bsf tft_nwr ; Tick |
406 bra aa_decode_1 ; loop if LOW is different | 415 movff win_color4,PORTH ; Move low byte to PORTH |
407 movf TBLPTRH,W | 416 bcf tft_nwr |
408 cpfseq aa_end+1 ; loop too if HIGH is different | 417 bsf tft_nwr ; Tick |
409 bra aa_decode_1 | 418 movff win_color3,PORTH ; Move low(est) byte to PORTH |
410 return | 419 bcf tft_nwr |
420 bsf tft_nwr ; Tick | |
421 decf aa_bitlen,F | |
422 bnz aa_decode_3_display2 | |
423 | |
424 aa_decode_3_done: | |
425 ;---- BYTE-CODE LOOP ------------------------------------------------- | |
426 ; Are we done ? | |
427 movf TBLPTRL,W ; Compare TBLPTR to aa_end | |
428 cpfseq aa_end+0 | |
429 bra aa_decode_1 ; Loop if LOW is different | |
430 movf TBLPTRH,W | |
431 cpfseq aa_end+1 ; Loop to if HIGH is different | |
432 bra aa_decode_1 | |
433 return | |
411 | 434 |
412 ;------------------------------------------------------------------------------ | 435 ;------------------------------------------------------------------------------ |
413 ; Setup pointers for a char: | 436 ; Setup pointers for a char: |
414 ; Inputs : buffer : string to print (SHOULD BE NULL TERMINATED) | 437 ; Inputs : buffer : string to print (SHOULD BE NULL TERMINATED) |
415 ; Output : TFT commands on port D + clocks. | 438 ; Output : TFT commands on port D + clocks. |