home *** CD-ROM | disk | FTP | other *** search
- ;------------------------------------------
- ;ASCII Finder 1.1
- ;by Andreas Finne
- ;a_finne@hotmail.com
- ;Copyright (C) 1998
- ;
- ;I have tried to comment everything.
- ;If you use anything from this source,
- ;please give me and anyone else who
- ;I credited in this source some credit.
- ;If you have any ideas, suggestions, comments
- ;or questions please e-mail me.
- ;Please don't change anything in this source.
- ;------------------------------------------
-
- #include "asm86.h"
- #include "ti86asm.inc"
-
- .org _asm_exec_ram
-
- ;------------------AShell / Rascall Description-------------------------
- nop ;Identifies the table
- jp Start ;Since it must be jp you can as well
- .dw $0000 ;Version # of Table ;take advantage of it
- .dw Title ;Absolute pointer to program description
-
- ;These are here so I can use as many
- ;jr's as possible. (jr's are 1 byte smaller than jp's)
-
- IncOne: ;Routine to increase to the next ascii number
- ld a,(Nyt) ;Load current ascii number into a
- cp 236 ;Is it 236 (maximum)?
- jr z,KeyLoop ;If so, jump to check keys again
- inc a ;Otherwise, increase a
- ld (Nyt),a ;Load the new ascii number into variable
- jr DispEveryth ;Put everything out on the screen
-
- DecOne: ;Routine to decrease to the previous ascii number
- ld a,(Nyt) ;Load current ascii number into a
- dec a ;Decrease it
- or a ;Did it become zero?
- jr z,KeyLoop ;If so, jump to check keys again
- ld (Nyt),a ;Otherwise, load new ascii number into variable
- jr DispEveryth ;Put everything out on the screen
-
- IncTen: ;Routine to increase ascii number with ten
- ld a,(Nyt) ;Load current ascii number into a
- cp 227 ;Compare to 227 (9 from maximum)
- call nc,Max ;If number >= 227 call routine to make it maximum
- add a,10 ;Add 10 to a
- ld (Nyt),a ;Load new ascii number into variable
- jr DispEveryth ;Put everything out on the screen
-
- DecTen: ;Routine to decrease ascii number with ten
- ld a,(Nyt) ;Load current ascii number into a
- cp 11 ;Compare to 11 (10 from minimum)
- call c,Min ;If number < 11 call routine to make it minimum
- sub 10 ;Subtract 10 from a
- ld (Nyt),a ;Load new ascii number into variable
- jr DispEveryth ;Put everything out on the screen
-
- Start: ;This is where it all begins
- call _runindicoff ;Turn off that little thing
- call _flushallmenus ;Remove all visible menus
- call EmptyUndel ;Call routine to empty the undel. mem.
- ld a,1 ;Load 1 into a (minimum value)
- ld (Nyt),a ;Load a into variable
- call ScreenSetup ;Call routine to put title and other text
-
- KeyLoop: ;Routine to wait for a key
- call _getkey ;Call a ROM routine that waits for a key to be pressed
- cp kRight ;A key has been pressed. Is it RIGHT?
- jr z,IncOne ;If so, jump to the routine to increase number by 1
- cp kLeft ;Is it LEFT?
- jr z,DecOne ;If so, jump to the routine to decrease number by 1
- cp kUp ;Is it UP?
- jr z,IncTen ;If so, jump to the routine to increase number by 10
- cp kDown ;Is it DOWN?
- jr z,DecTen ;If so, jump to the routine to decrease number by 10
- cp kExit ;Is it EXIT?
- jr z,Quit ;Then jump to exit routine
- cp kNext ;Is it MORE?
- jp z,View ;Then display the contents of the undel. mem.
- cp kF1 ;Is it F1?
- jr z,Help ;Then jump to help
- cp kEnter ;Is it ENTER?
- jp z,CopyChar ;Then copy the current character to undel. mem.
- cp kClear ;Is it CLEAR?
- jp z,Clear ;Then clear the undel. mem.
- jr KeyLoop ;None of these keys were pressed, check for keys again
-
- DispEveryth: ;Routine to display current ascii number and char
- ld hl,$0901 ;Loads $09 into h and $01 into l
- ld (_curRow),hl ;Loads $01 into _curRow and $09 into _curCol
- ld hl,Empty ;Point hl to the text
- call _puts ;Put it out
- ld hl,$0803 ;Same thing here
- ld (_curRow),hl ;This is done to get rid of the old ascii number
- ld hl,Empty ;
- call _puts ;
- ld hl,10*256+48 ;This is a little trick
- ld (_penCol),hl ;Loads 10 into _penRow and 48 into _penCol
- ld a,(Nyt) ;Ascii number into a
- call DispA ;Routine to display a @ _penCol,_penRow
- ld hl,$0703 ;
- ld (_curRow),hl ;Coordinates into _curRow and _curCol
- ld a,(Nyt) ;Ascii number into a
- call _putmap ;ROM routine to display the char loaded into a
- cp 32 ;If the number is 32 (Space)
- jr z,Space ;Then print 'space'
- cp 214 ;Is it 214 (Enter)
- jr nz,KeyLoop ;If not, check keys again
- ld hl,24*256+50 ;Number was 214
- ld (_penCol),hl ;24 into _penRow and 50 into _penCol
- ld hl,EnterTxt ;Point hl to the text
- call _vputs ;Put it out @ _penCol,_penRow in the small font
- jr KeyLoop ;Check keys again
-
- Space: ;Ascii number was 32
- ld hl,24*256+50 ;
- ld (_penCol),hl ;24 into _penRow and 50 into _penCol
- ld hl,SpaceTxt ;Point hl to the text
- call _vputs ;Put it out
- jp KeyLoop ;Check keys again
-
- Quit: ;Exit routine
- call _clrScrn ;If I use _clrLCD, everything isn't cleared
- call _homeup ;Cursor into top left corner
- ret ;Return from program
-
- Help: ;Display the help text
- call CEETAA ;Clear Everything Except Title And Author :)
- ld hl,17*256+1 ;
- ld (_penCol),hl ;Display text
- ld hl,ClearTxt ;
- call _vputs ;
- ld bc,24*256+1 ;I use bc instead of hl, because hl already points
- ld (_penCol),bc ;to the next text to print
- ;ld hl,CopyTxt ;HL already points to text, that's why it's commented out
- call _vputs ;
- ld bc,31*256+1 ;
- ld (_penCol),bc ;
- ;ld hl,ViewTxt ;HL points here already
- call _vputs ;
- ld bc,38*256+1 ;
- ld (_penCol),bc ;
- ;ld hl,QuitTxt ;
- call _vputs ;
- call _getkey ;Wait for a keypress
- call ScreenSetup ;Reprint everything on the previous screen
- jp KeyLoop ;Check keys again
-
- CopyChar: ;Routine to copy char to undel. mem.
- ld hl,$C012 ;$C012 contains the length of the undel. buffer
- ld a,(hl) ;Load a with length
- cp 84 ;Is it 84 (maximum)?
- jp z,KeyLoop ;If so, don't copy any more, check keys again
- inc a ;Otherwise, increase a
- ld (hl),a ;Load new length into $C012
- ld hl,(Current) ;Load current address into hl
- inc hl ;Increase it
- ld (Current),hl ;Load new address into current
- ld a,(Nyt) ;Load ascii number into a
- ld (hl),a ;Load it in at the new address
- jp KeyLoop ;Check keys again
-
- View: ;Displays the contents of undel. mem.
- call CEETAA ; :)
- ld hl,$0815 ;
- ld (_penCol),hl ;Display text
- ld hl,ContentsTxt ;
- call _vputs ;
- ld a,($C012) ;Load length into a
- or a ;Set flag if zero
- jr z,EmptyMem ;If zero flag is set then the mem is empty
- ld hl,$0002 ;Begin to print it at 0,2
- ld (_curRow),hl ;
- ld b,a ;A was the length of the buffer, now b also contains it
- ld hl,$C013 ;$C013 is the address of the first char of the undel mem
- ViewLoop:
- ld a,(hl) ;Load a with the char hl points to
- call _putc ;Put it out at _curCol,_curRow and advance cursor
- inc hl ;Increase hl so it points to the next char
- djnz ViewLoop ;Decrease b, if not zero, jump to ViewLoop
- call _getkey ;Wait for a keypress
- call ScreenSetup ;Reprint everything on the previous screen
- jp KeyLoop ;Check keys again
-
- Clear: ;Clear the undel mem
- call CEETAA ;
- ld hl,$0B01 ;
- ld (_penCol),hl ;
- ld hl,ClearQTxt ;Print text
- call _vputs ;
- ld bc,$0404 ;I use bc because hl points to the next text
- ld (_curRow),bc ;
- ;ld hl,Yes ;
- call _puts ;Put it out
- ld a,$0D ;
- ld (_curCol),a ;New X-Coord for text
- ;ld hl,No ;
- call _puts ;Put it out
- ClearLoop:
- call _getkey ;Wait for a key to be pressed
- cp kDown ;Is it DOWN?
- jr z,GoBack ;If so then don't clear the undel mem
- cp kUp ;Check if it is UP
- jr nz,ClearLoop ;If not, jump to ClearLoop
- call EmptyUndel ;Routine to empty undel mem
- call CEETAA ;
- EmptyMem:
- ld hl,$0804 ;
- ld (_curRow),hl ;
- ld hl,EmptyTxt ;Displays the text 'Empty!'
- call _puts ;
- call _getkey ;Wait for a keypress
- GoBack:
- call ScreenSetup ;Reprint everything on the previous screen
- jp KeyLoop ;Check keys
-
- Max: ;Sets a to max-10
- ld a,226 ;226 into a
- ld (Nyt),a ;Load a into variable
- ret ;Return from call
- Min: ;Sets a to min+10
- ld a,11 ;11 into a
- ld (Nyt),a ;Load a into variable
- ret ;Return from call
-
- CEETAA: ;Clear Everything Except Title And Author :)
- ld hl,$FCA0 ;Address to clear pixel before the ones to be cleared
- ld de,$FCA0+1 ;Next pixel
- ld bc,$025F ;607 pixels to be cleared
- ldir ;ld (de),(hl)/inc de/inc hl, bc times
- ret ;Return from call
-
- ScreenSetup:
- call _clrLCD ;Clear the screen
- set textInverse,(iy+textflags) ;White text on black
- ld hl,$0000 ;
- ld (_curRow),hl ;
- ld hl,Empty ;
- call _puts ;
- ld a,$10 ;
- ld (_curCol),a ;
- ld hl,Empty ;
- call _puts ;Display text
- ld bc,$0200 ;
- ld (_curRow),bc ;
- ;ld hl,Title ;
- call _puts ;
- ld bc,$0005 ;
- ld (_curRow),bc ;
- ;ld hl,ChooseTxt ;
- call _puts ;
- res textInverse,(iy+textflags) ;Back to normal mode (black on white)
- ld bc,10*256+1
- ld (_penCol),bc
- ;ld hl,Text
- call _vputs
- ld bc,24*256+1
- ld (_penCol),bc
- ;ld hl,Chartxt
- call _vputs
- ld bc,32*256+1
- ld (_penCol),bc
- ;ld hl,HelpTxt
- call _vputs ;More text
- ld bc,51*256+27
- ld (_penCol),bc
- ;ld hl,Author
- call _vputs
- ld bc,57*256+27
- ld (_penCol),bc
- ;ld hl,Email
- call _vputs
- ld hl,$0703
- ld (_curRow),hl
- ld a,(Nyt) ;Load a with the ascii number
- call _putc ;Put it out
- ld hl,10*256+48
- ld (_penCol),hl
- ;ld a,(Nyt)
- call DispA ;Also display the number
- ret
-
-
- DispA: ;Routine to Display A [By: Matthew Shepcar]
- ld l,a ;Loads a into l
- ld h,0 ;0 into H
- DispHL: ;Displays HL [By: Matthew Shepcar]
- xor a ;Loads 0 into A
- ld de,-1 ;Loads -1 into DE
- ld (_curRow),de ;Loads de into CurRow
- call 4A33h ;Calls 4A33h
- dec hl ;Decrease it
- jp _vputs ;Put on screen and return
-
- EmptyUndel: ;Routine to empty the undel mem
- ld hl,$C012 ;Point hl to $C012 (length of undel buffer)
- ld (Current),hl ;Load that address into current
- xor a ;Same as ld a,0
- ld (hl),a ;Load that into length
- ret ;Return from call
-
- ;****** Start of text ******
- ;The texts must be in this order
- ;or else hl points to the wrong text
-
- Empty:
- .db " ",0
-
- Title:
- .db "ASCII Finder 1.1",0
-
- ChooseTxt:
- .db " ",207,5," +/- 1"
- .db " ",6,7," +/- 10 ",0
-
- Text:
- .db "ASCII Number:",0
-
- Chartxt:
- .db "Character:",0
-
- HelpTxt:
- .db "Press F1 for help!",0
-
- Author:
- .db "Made by Andreas Finne",0
- Email:
- .db "a_finne@hotmail.com",0
-
- SpaceTxt:
- .db "<SPACE>",0
-
- EnterTxt:
- .db "<ENTER>",0
-
- ContentsTxt:
- .db "Contents of undel. mem:",0
-
- ClearTxt:
- .db "Clear: Clear undel. mem",0
-
- CopyTxt:
- .db "Enter: Copy character to"
- .db " undel. mem",0
- ViewTxt:
- .db "More: View contents of"
- .db " undel. mem",0
-
- QuitTxt:
- .db "Exit: Quit",0
-
- ClearQTxt:
- .db "Do you want"
- .db " to clear the undel. mem?",0
- Yes: .db 6," Yes",0
- No: .db 7," No",0
-
- EmptyTxt:
- .db "Empty!",0
-
- Current: ;Holds the address of current place to copy into
- .dw $0000
- Nyt: ;Contains the ascii number
- .db 0
-
- .end
-