home *** CD-ROM | disk | FTP | other *** search
- ;-----------------------------------------------------------
- ;
- ; RESISTOR COLORS v1.0 (OShell)
- ; BY RAVON/INFINITY
- ;
- ; Have you ever tried to make a circuit of something and you
- ; just neeeeeed that little resistor, even though you didn't
- ; pay any attention on the Electronic lessions? You just don't
- ; know what color that is what number on those pesky little things.
- ;
- ; This is a REALLY simple, yet quite useful, program that gives
- ; us that valuable (?) information.
- ;
- ;
- ; ravon@kurir.net
- ; http://consolemidis.home.ml.org
- ;
- ;-----------------------------------------------------------
-
-
- #INCLUDE "TI-82.h"
- .org 0
- .db "Resistor Codes",0
-
- init:
- ROM_CALL(CLEARLCD) ;Clear the LCD display
- ld DE,(PROGRAM_ADDR) ;Load our program's start location into DE
- ld c,0
-
- ;--------------
- ; Display the
- ; title
- ;--------------
- set 3,(IY+05) ;White text on black background;
- ld HL,$0000 ;The title will be at X=0 and Y=0
- ld ($800C),HL
- ld HL,diz ;Point HL at the 'diz'-text
- add HL,DE ;Add the program's start location
- ROM_CALL(D_ZT_STR) ;Show it
-
- res 3,(IY+05) ;Black text...
-
-
- ;-------------------------
- ; I want to save space...
- ; By putting this function
- ; up here I save both a
- ; JP REDRAW and a RET
- ;
- ; This function checks how
- ; many rows you have scrolled
- ;-------------------------
- redraw:
- ld HL,$0001 ;X=0 Y=1
- ld ($800C),HL
-
- push DE ;Put DE on the stack for later usage
- ld HL,codes ;Point HL at all the color codes
- add HL,DE
- ld b,c
- ld a,c ;If c=0 (the "cursor" is on top of
- cp 0 ;the text) then don't perform a
- jr z,noadd ;"scroll" (eh...)
-
- ld DE,16 ;We want to skip 16 letters (one row)
- addloop:
- add HL,DE
- djnz addloop ;Loop while b>0
- noadd:
- pop DE ;Get DE from the stack
- ROM_CALL(D_ZT_STR) ;View the zero terminated string
-
-
-
- loop:
- ;------------------------
- ; KEYBOARD ROUTINE
- ; TAKEN FROM PONG 1.3.
- ; BY SCOOBIE
- ;------------------------
- sub a
- out (1),A
- in A,(1)
- xor 255
- or A
- jr z,loop
-
- bit 6,A
- jr nz,end
- bit 3,A
- jr nz,up
- bit 0,A
- jr nz,down
-
- jr loop
-
-
- end:
- RET ;Return to OShell
-
- down:
- ld a,c
- cp 10 ;Check if we have scrolled 10 lines
- jr z,loop ;... if not...
- inc c ;Then add one line to C
- jr redraw ;And redraw the text
- up:
- ld a,c ;Check if we are at the beginning
- cp 0 ;of the text
- jr z,loop ;... if not...
- dec c ;Decrease one line from C
- jr redraw ;Redraw it...
-
-
- ;-------------
- ; THE CODES
- ;-------------
- codes .db "Black 0"
- .db "Brown 1"
- .db "Red 2"
- .db "Orange 3"
- .db "Yellow 4"
- .db "Green 5"
- .db "Blue 6"
- .db "Purple 7"
- .db "Grey 8"
- .db "White 9"
- .db " "
- .db " Tolerance "
- .db " "
- .db "Brown +- 1%"
- .db "Red +- 2%"
- .db "Gold +- 5%"
- .db "Silver +- 10%",0
-
- ;---------------
- ; TITLE.......
- ;---------------
- diz .db "Color Number",0
-
-
- .END
-