;;; -*- TI-Asm -*- ;;; ;;; Mimas - Assembly language IDE for the TI-83 Plus ;;; ;;; Copyright (C) 2010 Benjamin Moody ;;; ;;; This program is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as ;;; published by the Free Software Foundation; either version 3 of the ;;; License, or (at your option) any later version. ;;; ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;; General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with this program. If not, see . ;; ClearBufferSetGraph: ;; ;; Select plotSScreen as the current screen buffer, and clear it. ;; Also set penRow to zero. ;; ;; Destroys: ;; - AF, BC, DE, HL ClearBufferSetGraph: ld hl,plotSScreen ld (curScreenBuffer),hl BCALL _BufClr xor a ld (penRow),a ret ;; Invert7Rows: ;; ;; Invert 7 pixel rows of the current screen buffer. ;; ;; Input: ;; - A = Y coordinate of top of area to invert ;; - (curScreenBuffer) = address of screen buffer ;; ;; Destroys: ;; - AF, BC, DE, HL Invert7Rows: ld e,a xor a call GetPixel ld b,84 Invert7Rows_Loop: ld a,(hl) cpl ld (hl),a inc hl djnz Invert7Rows_Loop ret ;; BufVPutS: ;; ;; Display a zero-terminated string in the small font on the current ;; screen buffer. ;; ;; Input: ;; - HL = address of string ;; - (curScreenBuffer) = address of screen buffer ;; ;; Output: ;; - Carry flag set if string does not fit on screen ;; ;; Destroys: ;; - AF, HL BufVPutS: push de ld d,SCREEN_WIDTH + 1 call BufVPutSLimit pop de ret ;; BufVPutSN: ;; ;; Display a (possibly zero-terminated) string in the small font on ;; the current screen buffer. ;; ;; Input: ;; - HL = address of string ;; - B = maximum number of characters to display ;; - (curScreenBuffer) = address of screen buffer ;; ;; Output: ;; - Carry flag set if string does not fit on screen ;; ;; Destroys: ;; - AF, B, HL BufVPutS8: ld b,8 BufVPutSN: ld a,(hl) inc hl call BufVPutMapSave ret c djnz BufVPutSN ret ;; BufVPutSLimit: ;; ;; Display a zero-terminated string in the small font on the current ;; screen buffer. Stop at the specified limit column. ;; ;; Input: ;; - HL = address of string ;; - D = limit column ;; - (curScreenBuffer) = address of screen buffer ;; ;; Output: ;; - Carry flag set if string does not fit on screen ;; ;; Destroys: ;; - AF, HL BufVPutSLimit: ld a,(hl) inc hl push de call BufVPutMapLimit pop de jr nc,BufVPutSLimit ret ;; BufVPutMap: ;; ;; Display a character in the small font on the current screen buffer. ;; ;; Input: ;; - A = character ;; ;; Output: ;; - Carry flag set if character does not fit on screen ;; - (curScreenBuffer) = address of screen buffer ;; ;; Destroys: ;; - AF, DE BufVPutBlank: ld a,' ' BufVPutMap: ld d,SCREEN_WIDTH + 1 BufVPutMapLimit: cp 1 ret c push ix push hl push bc push de BCALL _LoadPattern pop de ld a,(penCol) add a,(hl) cp d ccf jr c,BufVPutMap_Done ld (penCol),a call PutCharBitmap_Right or a BufVPutMap_Done: pop bc pop hl pop ix ret ;; PutCharBitmap: ;; ;; Display a small font bitmap on the graph buffer. ;; ;; Input: ;; - HL = address of bitmap in TI font format ;; - A = X coordinate of left edge of bitmap ;; - (penRow) = Y coordinate of top of bitmap ;; - textInverse, (iy + textFlags) = 1 to display in reverse video ;; - textEraseBelow, (iy + textFlags) = 1 to display 7 pixel rows ;; - (curScreenBuffer) = address of screen buffer ;; ;; Destroys: ;; - AF, BC, DE, HL, IX PutCharBitmap: add a,(hl) PutCharBitmap_Right: push hl pop ix ld hl,(penRow) call GetPixelPS ld b,a ld a,(ix) xor 7 call GetPixelBitMask dec a ; A = mask of bits used by character ld d,b ; D = shift control bit PutCharBitmap_ShiftMaskLoop: add a,a rl b jr nc,PutCharBitmap_ShiftMaskLoop ld c,a ; BC = shifted mask ld e,7 ; E = height of bitmap bit textEraseBelow,(iy + textFlags) jr z,PutCharBitmap_LoopDec PutCharBitmap_Loop: push de ex de,hl ; DE = buffer address, H = shift control bit ld l,(ix + 1) PutCharBitmap_ShiftLoop: add hl,hl jr nc,PutCharBitmap_ShiftLoop ld a,(de) or c xor l bit textInverse,(iy + textFlags) jr z,PutCharBitmap_NotInverse ld (de),a dec de ld a,(de) or b jr PutCharBitmap_FinishRow PutCharBitmap_NotInverse: xor c ld (de),a dec de ld a,(de) or b xor b PutCharBitmap_FinishRow: xor h ld (de),a ld hl,13 add hl,de inc ix pop de PutCharBitmap_LoopDec: dec e jr nz,PutCharBitmap_Loop ret ; PutCharBitmap: ; push af ; ld de,sFont_record ; push de ; BCALL _Mov8B ; pop hl ; pop af ; PutCharBitmapRAM: ; ld b,a ; ld a,(penCol) ; push af ; ld a,b ; ld (penCol),a ; BCALL _UserPutMap ; pop af ; ld (penCol),a ; ret ;; XBufCpy: ;; ;; Copy active screen buffer to the LCD. ;; ;; Input: ;; - (curScreenBuffer) = address of screen buffer ;; - LCD driver in standard (down) mode ;; ;; Destroys: ;; - AF, BC, DE, HL XBufCpy: ld a,i push af di ld a,80h call 000Bh out (10h),a res indicInUse,(iy + indicFlags) ld hl,(curScreenBuffer) ld de,11 ld a,20h ld c,11h jr XBufCpy_Begin XBufCpy_Loop: dec h dec h dec h inc hl XBufCpy_Begin: call 000Bh out (10h),a inc a ld b,64 XBufCpy_SubLoop: call 000Bh outi add hl,de jr nz,XBufCpy_SubLoop cp 2Ch jr c,XBufCpy_Loop pop af ret po ei ret