Very handy indeed but imagine that this 'function' would not exist. How would we write this function then? is there no way around than designing the character sprites ourselves and output those? Or are those sprites also stored somewhere in the calculator? If so, where are they stored then ?
They are definitely stored in memory, since the OS access them, I am just not sure where (but no, they don't exist as an external piece of hardware). I have written a bunch of similar routines, but they are mostly variations of sprite drawing routines. You can also take advantage of the LCD'd 6-bit word mode the way the OS does it for its homescreen drawing. Here is a quick example routine:
DispChar: ;Inputs: ; (curRow), (curCol) ; A is the char to draw ld l,a ld bc,(curRow) ;First set x-increment mode in a,(16) \ add a,a \ jr c,$-3 ;wait for the LCD to be ready ld a,5 out (16),a ;next set 6-bit word mode in a,(16) \ add a,a \ jr c,$-3 ;wait for the LCD to be ready xor a ld h,a ;for later use out (16),a ;Now set LCD Y coordinate (the LCD is rotated, so to use, it is in the left/right direction) ;This must be on [0,15]. If it isn't we will increment C and set our X-coordinate to 0 in a,(16) \ add a,a \ jr c,$-3 ld a,b cp 16 jr c,$+4 xor a inc c ld b,a inc b ld (curRow),bc add a,20h ;add 20h to the coordinate before writing the value to the LCD driver. It takes [20h,33h] for LCD Y out (16),a ;Now set LCD X coordinate (our Y coordinate, times 8) in a,(16) \ add a,a \ jr c,$-3 ld a,c cp 8 ret nc ;can't draw off screen, so exit if A>=8 add a,a add a,a add a,a add a,80h ;[80h,BFh] sets the LCD-X (our Y coordinate) out (16),a ;Now we are ready to draw the char. Assume we have a font of 6x8 letters at _fontset ;H is 0, L is the char number, so do HL*8 to get the offset into the fontset add hl,hl add hl,hl add hl,hl ld bc,_fontset add hl,bc ;HL points to the font data ld bc,0811h ;11h is the LCD Data Port,8 is the number of bytes to draw fontdrawloop: in a,(16) \ add a,a \ jr c,$-3 ;wait for the LCD to be ready outi jr nz,fontdrawloop ret _fontset: .db %00011100 .db %00100010 .db %00100010 .db %00101010 .db %00100010 .db %00100010 .db %00011100 .db %00000000 .db %00001000 .db %00011000 .db %00001000 .db %00001000 .db %00001000 .db %00001000 .db %00111110 .db %00000000
And now with the above routine, you can do something like:
bcall(_RclAns) bcall(_ConvOP1) ld d,8 DispEBinLoop: rlc e ccf ;invert the c flag sbc a,a ;if c flag is set, A=A-A-1=$FF, if c flag is reset, A=A-A-0=$00 inc a call DispChar dec d jr nz,DispEBinLoop ret
(It just displays the lower 8 bits of the number in Ans)
47%? Take a look and try to imagine how cool 100% will be. This has won zContest 2011 and made news on TICalc. This compromise between Assembly and BASIC parses like BASIC and is fast like assembly. Grammer 2