;***********************************************; ; Name: Chem86 ; ; Version: 1.22 ; ; Author: Stephen Hicks ; ; Mailto: shicks@mindspring.com ; ; ICQ: 5453914 ; ; Date: 10/02/97 ; ;-----------------------------------------------; ; Chem86 is copyright (c) 1997 by Stephen Hicks ; ; ; ; You may use any part of this source for the ; ; purpose of learning assembly and may use ; ; small segments in your own programs provided ; ; that you give credit where it is due. ; ; ; ; Note: This code is VERY messy ; ;***********************************************; #include "asm86.h" #include "ti86asm.inc" #include "ti86ops.inc" #include "ti86math.inc" #include "ti86abs.inc" .org _asm_exec_ram Start: nop ;Flag as special jp AsmStart ;Go to normal start Table: ;Table for shells .dw $0001 ;Table Version # .dw TitleTab ;Title ptr .dw IconTab ;Icons ptr .dw $0000 ;Stack space to reserve .dw ProgLen ;Prog Length .dw A86Start ;A86Start ptr .dw ImportTab ;Import table ptr TitleTab: .db "Chem86 v1.21",0 IconTab: .db 2 ;Num of icons .db 16,16 ;width,height .db %11111111,%11111111 .db %10000000,%00000001 .db %10000000,%00001101 .db %10000000,%00010001 .db %10000011,%10011101 .db %10000100,%00010101 .db %10001000,%00001101 .db %10001000,%00000001 .db %10001000,%00000001 .db %10000100,%00000001 .db %10000011,%10000001 .db %10110000,%00000001 .db %10100011,%10010001 .db %10110110,%11111001 .db %10000000,%00000001 .db %11111111,%11111111 .db 8,8 ;width,height .db %11111111 .db %10000011 .db %10011001 .db %10100001 .db %10011001 .db %10000001 .db %10111101 .db %11111111 ImportTab: .db 0 ;Number of imports AsmStart: ;Start when called by Asm( A86Start: ;REAL start-called by A86( ; res curOn,(iy+curflags) ; res curAble,(iy+curflags) ; res shiftAlpha,(iy+shiftflags) ; res shiftLwrAlph,(iy+shiftflags) call _runindicoff call _clrScrn ;Clear Screen res 1,(IY+$0D) ;Don't change text mem ld hl,Title ;Show Title call PutText ; | ld hl,SubT ; | call PutVWidth ; V ld hl,Main1 ;Show Choices call PutVWidth ; | ld hl,Main2 ; | call PutVWidth ; | ld hl,Main3 ; | call PutVWidth ; | ld hl,Main5 ; | call PutVWidth ; V call DisplayMenu ;Display Menu ld hl,MainF1 ; | call PutVWidth ; | ld hl,MainF2 ; | call PutVWidth ; | ld hl,MainF3 ; | call PutVWidth ; | ld hl,MainF5 ; | call PutVWidth ; V KeyLoop: call _getkey jr z,KeyLoop ;Nothing? getkey again cp kExit ;Exit? jp z, Exit ;then goto cleanup/exit cp kF5 ;F5? jp z, Exit ;Same thing cp kF1 ;F1? jr z,PerTable ;Then goto table routine cp kF2 ;F2? jp z,Mass ;Goto Mass routine cp kF3 ;F3? jp z,ENDiff ;Goto EN Difference routine jr KeyLoop ;Otherwise, go back to getkey PerTable: call _clrScrn ;Clear Screen ld hl,PTTitl ;Show Title call PutText ; | ld hl,PTSubT ; | call PutVWidth ; V ld hl,PT1 ;Show Choices call PutVWidth ; | ld hl,PT2 ; | call PutVWidth ; | ld hl,PT5 ; | call PutVWidth ; V call DisplayMenu ;Display Menu ld hl,PTF1 ; | call PutVWidth ; | ld hl,PTF2 ; | call PutVWidth ; | ld hl,PTF5 ; | call PutVWidth ; V KeyLoopPT: call _getkey ;Hmmm.... Look familiar? jr z,KeyLoopPT cp kExit jp z, Exit cp kF5 ;F5? jp z, A86Start ;Go back to main cp kF1 jr z,PTSym ;F1:Get symbol cp kF2 jp z,PTNum ;F2:Get number jr KeyLoopPT PTSym: call _clrLCD ;Clear screen call _homeUp ;And home up ld hl,PTS1 ;(hl)->"Symbol:" call PutText ;Put it call GetSym ld a,d or e jr z,PerTable ;d and e were both 0. (exit pressed) call SrchNum ;Get Num -> b from de ld a,b or a jp nz,Match PutSymErr: push de ;Save symbol (_clrScrn kills de) call _clrScrn ;Clear screen. pop de ;Get symbol back ld hl,Error1 ;(hl)->"Symbol not Found:" call PutText ;Put ld (Err22),de ;(hl)->"xx" ld hl,Error2 ;Put Symbol in place of "xx" call PutText ;Put it. PTSEKeyLoop: call _getkey jr z,PTSEKeyLoop ;Wait jp PerTable PTNum: ;We want to get a number. call _clrLCD ;So, clear screen. ld hl,PTN1 ;(hl)->"Number:" call PutText ;Put ld b,0 ;So far, # is 0 ; set curAble,(iy+curflags) ; set curOn,(iy+curflags) PTNLoop: push bc call GET_KEY ;Get key - destroys bc! pop bc or a jr z, PTNLoop ;0? back. cp K_EXIT jp z,Exit cp K_ENTER ;Enter? jr z,DoneNumIn ;Done. ld hl,NumTable ;(hl)->Numtable ld e,a ;de<-keypress(a) ld d,0 ; " " add hl,de ;(hl)->NumTable[a] ld a,(hl) ;a-># pressed. cp $FF ;Is it $FF? (not a number) jr z,PTNLoop ;Then go back push af ;save last # pressed SP:Num\Num push af ;twice ld a,b ;Put total in a for use. B:Total add a,a ;2b add a,a ;4b add a,b ;5b add a,a ;10b ld b,a ;10b->b B:10Total pop af ;Get back a (#) for the 1st time A:Num add a,b ;Plus just inputted #. A:New tot! ld b,a ;And save it in b B:New tot! pop af ;Now get it back again add a,$30 ;"0"+#. call _putc ;Put jr PTNLoop ;Get next DoneNumIn: ; res curOn,(iy+curflags) ; res curAble,(iy+curflags) ld a,b ;Get ready to check input range cp 0 ;Is it 0? call z,FixTo1 ;That's bad. We fix it cp 110 ;Is it >=110? call nc,FixTo109 ;That bad too. We fix that call SrchSym ;Put symbol in de jr Match FixTo1: ;Bad input, set to 1 ld b,1 ret FixTo109: ;Bad input, set to 109 ld b,109 ret Match: ;Now, b=# and de=Sym push bc push de call _clrLCD ;Clear screen pop de ;Get symbol back ld hl,$0503 ;Set cursor ld (_curRow),hl ; " " ld a,e ;first letter->a call _putc ;Put ld a,d ;second letter->a call _putc ;Put ld hl,$1400 ;Set cursor (wraps around to 2nd line) ld (_curRow),hl ; " " pop bc ;Get # back push bc ;And save it for later push bc ;again ld l,b ;And put b into low byte of hl ld h,0 ;And 0 out high byte xor a ;And 0 out a call _dispHL ;And put at. # ld hl,$0204 ;Set cursor ld (_curRow),hl ; " " ld hl,Offsets ;(hl)->Offset of names pop bc ;Get # back ld e,b ;de-># dec e ;Subtract 1 (e.g. H=0) ld d,0 ; " " sla e ;Multiply by 2 add hl,de ;Get offset ld e,(hl) ;Get low byte of offset inc hl ;Point to next byte ld d,(hl) ;And finish storing in de ld hl,Names ;(hl)->Names add hl,de ;Now, (hl)->specfic name call _puts ;Put name ld hl,AM ;(hl)->atomic mass chart pop bc ;Get at. # back again! push bc ;And save it for E.N. dec b ;Don't want to add anything for H... ld e,b ;Put it in de ld d,0 ;Same ex de,hl call _multHLby10 ex de,hl ;Now, de=10*(num-1) add hl,de ;(hl)->Mass of thingy ld bc,10 ;10 reps ld de,_OP1 ;get ready ldir ;And zap the mass into op1 ld hl,$0701 ;Set cursor ld (_curRow),hl ;Same call DispOP1 ;Show OP1 with Bill Nagel's routine. ld hl,EN ;(hl)->E.N. chart pop bc ;Get at. # back again! push bc ;And save it for something... dec b ;Don't want to add anything for H... ld e,b ;Put it in de ld d,0 ;Same ex de,hl call _multHLby10 ex de,hl ;Now, de=10*(num-1) add hl,de ;(hl)->e.n. of thingy ld bc,10 ;10 reps ld de,_OP1 ;get ready ldir ;And zap the mass into op1 ld hl,$0802 ;Set cursor ld (_curRow),hl ;Same call DispOP1 ld hl,PNF2 ;Display Menu call PutVWidth ; | ld hl,PNF3 ; | call PutVWidth ; | ld hl,PNF4 ; | call PutVWidth ; | call DisplayMenu ; | ld hl,PNF1 ; | call PutVWidth ; | ld hl,PNF5 ; | call PutVWidth ; V pop bc ;maybe take out? KeyLoopPN: call _getkey jr z,KeyLoopPN ;Nothing? getkey again cp kExit ;Exit? jp z, Exit ;then goto cleanup/exit cp kF1 ;F1? jp z,PTSym ;Then goto get Sym cp kF2 ;F2? jp z,PTNum ;Goto get Num cp kF3 ;F3? jp z,A86Start ;Back to main cp kF4 ;F4? jr z,DecNum ;Goto DecNum cp kF5 ;F5? jr z,IncNum ;Goto IncNum jr KeyLoopPN ;Otherwise, go back to getkey DecNum: dec b ;Previous element jp DoneNumIn ;Get next record IncNum: inc b ;Next element jp DoneNumIn ;Get next record Mass: call _clrLCD ld b,24 ld hl,Compound push hl ZeroOLoop: ld (hl),$20 inc hl djnz ZeroOLoop ld hl,StrLen ld (hl),0 ld hl,MC1 ;"Compound:" call PutText pop hl ;(hl)->Compound (string, 21 max) CpdGetUpCase: push hl ; push bc ; ld a,(_curRow) ;Save Cursor ; ld b,a ; ld a,(_curCol) ; ld c,a ; ld hl,$1407 ;cursor=(8,21) ; ld (_curRow),hl ; ld a,'A' ;Disp "A" at lower-right ; call _putmap ;but DON'T update cursor!!! ; ld a,b ;Restore cursor ; ld (_curRow),a ; ld a,c ; ld (_curCol),a ; pop bc ; set curOn,(iy+curflags) ; set curAble,(iy+curflags) ; set shiftAlpha,(iy+shiftflags) ; res shiftLwrAlph,(iy+shiftflags) call GET_KEY ;Get key pop hl ;Because we're going to do some jumps... or a ;Update flags for a jr z,CpdGetUpCase cp K_EXIT ;Exit? jp z,A86Start cp K_ENTER ;Enter? jp z,DoneCpdIn cp K_ALPHA ;Alpha? jr z,CpdGetLowCase ;Then they want a lowercase letter... cp K_SECOND ;Second? jp z,CpdGetNumCase cp K_DEL ;Del? call z,CpdDel cp K_DEL jr z,CpdGetUpCase push hl ;Save it again ld hl,AlphaTable ;(hl)->alphatable ld e,a ;de=a ld d,0 add hl,de ;(hl)->letter ld a,(hl) ;a=letter's # pop hl ;More jumps... :-( or a jr z,CpdGetUpCase ;Not a letter... add a,$40 ;Add "A"-1 ld (hl),a ;Store it in the string inc hl ;And point (hl)->next letter push hl ;Save it AGAIN! call _putc ;Disp the letter ld a,(StrLen) inc a ;a=char # just inputted ld (StrLen),a cp 21 ;Is it #21? jp z,DoneCpdIn ;Then we done. pop hl jr CpdGetUpCase CpdGetLowCase: push hl ; push bc ; ld a,(_curRow) ;Save Cursor ; ld b,a ; ld a,(_curCol) ; ld c,a ; ld hl,$1407 ;cursor=(8,21) ; ld (_curRow),hl ; ld a,'a' ;Disp "a" at lower-right ; call _putmap ;but DON'T update cursor!!! ; ld a,b ;Restore cursor ; ld (_curRow),a ; ld a,c ; ld (_curCol),a ; pop bc ; set curOn,(iy+curflags) ; set curAble,(iy+curflags) ; res shiftAlpha,(iy+shiftflags) ; set shiftLwrAlph,(iy+shiftflags) call GET_KEY ;Get key pop hl ;Because we're going to do some jumps... or a ;Update flags for a jr z,CpdGetLowCase cp K_EXIT ;Exit? jp z,A86Start cp K_ENTER ;Enter? jp z,DoneCpdIn cp K_ALPHA ;Alpha? jp z,CpdGetUpCase ;Then they want an uppercase letter... cp K_SECOND ;Second? jr z,CpdGetNumCase cp K_DEL ;Del? call z,CpdDel cp K_DEL jr z,CpdGetLowCase push hl ;Save it again ld hl,AlphaTable ;(hl)->alphatable ld e,a ;de=a ld d,0 add hl,de ;(hl)->letter ld a,(hl) ;a=letter's # pop hl ;More jumps... :-( or a jr z,CpdGetLowCase ;Not a letter... add a,$60 ;Add "a"-1 ld (hl),a ;Store it in the string inc hl ;And point (hl)->next letter push hl ;Save it AGAIN! call _putc ;Disp the letter ld a,(StrLen) inc a ;a=char # just inputted ld (StrLen),a cp 21 ;Is it letter #21? jp z,DoneCpdIn ;Then we done. pop hl jr CpdGetLowCase CpdGetNumCase: push hl ; push bc ; ld a,(_curRow) ;Save Cursor ; ld b,a ; ld a,(_curCol) ; ld c,a ; ld hl,$1407 ;cursor=(8,21) ; ld (_curRow),hl ; ld a,$81 ;Disp "1" at lower-right ; call _putmap ;but DON'T update cursor!!! ; ld a,b ;Restore cursor ; ld (_curRow),a ; ld a,c ; ld (_curCol),a ; pop bc ; set curOn,(iy+curflags) ; set curAble,(iy+curflags) ; res shiftAlpha,(iy+shiftflags) ; res shiftLwrAlph,(iy+shiftflags) call GET_KEY ;Get key pop hl ;Because we're going to do some jumps... or a ;Update flags for a jr z,CpdGetNumCase cp K_EXIT ;Exit? jp z,A86Start cp K_ENTER ;Enter? jp z,DoneCpdIn cp K_ALPHA ;Alpha? jp z,CpdGetUpCase ;Then they want an uppercase letter... cp K_DEL ;Del? call z,CpdDel cp K_DEL jr z,CpdGetNumCase cp K_LEFTPAR jr z,CpdAddLPar cp K_RIGHTPAR jr z,CpdAddRPar push hl ;Save it again ld hl,NumTable ;(hl)->numtable ld e,a ;de=a ld d,0 add hl,de ;(hl)->number ld a,(hl) ;a=number's # pop hl ;More jumps... :-( cp $FF jr z,CpdGetNumCase ;Not a number... add a,$80 ;Add "0" StoreNum: ld (hl),a ;Store it in the string inc hl ;And point (hl)->next letter push hl ;Save it AGAIN! call _putc ;Disp the letter ld a,(StrLen) inc a ;a=char # just inputted ld (StrLen),a cp 21 ;Is it #21? jr z,DoneCpdIn ;Then we done. pop hl jr CpdGetNumCase CpdDel: push af push hl ld a,(StrLen) or a jr z,NoLen ld a,(_curCol) or a ;Update flags cp 0 ;Is it 0? jr z,BackLine ;col=0 - goto BackLine dec a ld (_curCol),a FinishDel: ld a,' ' call _putmap pop hl dec hl ld (hl),' ' ld a,(StrLen) dec a ld (StrLen),a pop af ret NoLen: pop hl pop af ret BackLine: ld a,(_curRow) dec a ld (_curRow),a ld a,21 ld (_curCol),a jr FinishDel CpdAddLPar: ld a,LlParen jr StoreNum CpdAddRPar: ld a,LrParen jr StoreNum DoneCpdIn: ; res curOn,(iy+curflags) ; res curAble,(iy+curflags) ; res shiftAlpha,(iy+shiftflags) ; res shiftLwrAlph,(iy+shiftflags) call _OP1SET0 ;OP1=Mass ld de,MassCum call _MOVFROP1 ld hl,Compound CpdParseLoop: ld a,(hl) cp LlParen jr z,CpdOpenPar cp LrParen jp z,CpdClosePar call CheckCase ld a,c or a jp z,CpdDoneParse cp $20 jp z,CpdDoneParse cp 1 jr z,CpdCheckForLow jp CpdError CpdOpenPar: push hl ld hl,MassCum ld de,MassPar ld bc,10 ldir ;Transfer Cumulative Mass to temp var ld de,MassCum call _OP1SET0 call _MOVFROP1 pop hl inc hl ;hl->next letter jr CpdParseLoop CpdClosePar: push hl ld hl,MassCum ;MassCum->Inside parenthesis ld de,MassCur ;Make that into one element, sort of ld bc,10 ldir ld hl,MassPar ;MassPar->Mass BEFORE parenthesis ld de,MassCum ;Put that into MassCum, where it should be ld bc,10 ldir pop hl inc hl ;Point hl-># jr CpdGetNum ;And get the number CpdCheckForLow: inc hl ld a,(hl) call CheckCase ld a,c cp 2 jr z,TwoLetterElem dec hl ld a,(hl) ld e,a ld d,' ' push hl call SrchNum pop hl ld a,b or a jp z,PutSymErr push hl ;Save compoind pointer... B=# ld hl,AM ;(hl)->atomic mass chart dec b ;Don't want to add anything for H... ld e,b ;Put it in de ld d,0 ;Same ex de,hl call _multHLby10 ex de,hl ;Now, de=10*(num-1) add hl,de ;(hl)->Mass of thingy ld bc,10 ;10 reps ld de,MassCur ;get ready ldir ;And zap the mass into MassCur pop hl ;Get hl back inc hl ;(hl)-># (if any) jr CpdGetNum TwoLetterElem: dec hl ld a,(hl) ld e,a inc hl ld a,(hl) ld d,a push hl call SrchNum pop hl ld a,b or a jp z,PutSymErr push hl ;Save compoind pointer... B=# ld hl,AM ;(hl)->atomic mass chart dec b ;Don't want to add anything for H... ld e,b ;Put it in de ld d,0 ;Same ex de,hl call _multHLby10 ex de,hl ;Now, de=10*(num-1) add hl,de ;(hl)->Mass of thingy ld bc,10 ;10 reps ld de,MassCur ;get ready ldir ;And zap the mass into MassCur pop hl ;Get hl back inc hl CpdGetNum: ;(hl)->#, if any ld a,(hl) call CheckCase ;Is it a #? ld a,c cp 3 ;if 3, then yes jr nz,CpdOnlyOne ;otherwise, only 1 of that elem. ld a,(hl) sub Lsub0 ;a=# ld b,a ;b=# push bc ;save total CpdGetNumNext: inc hl ;Next char ld a,(hl) call CheckCase ld a,c pop bc ;get total back cp 3 jr nz,CpdMultDone ;Is next char a #? If not, then done, else: ld a,b ;Put total in a for use. B:Total add a,a ;2b add a,a ;4b add a,b ;5b add a,a ;10b ld b,a ;10b->b B:10Total ld a,(hl) sub Lsub0 add a,b ld b,a ;b=total push bc ;dunno... Whatever's wrong, it's really screwey. jr CpdGetNumNext CpdMultDone: push hl push bc call _OP2SET1 call _OP1SET0 pop bc CpdDJNZLoop: push bc call _OP2SET1 call _FPADD pop bc djnz CpdDJNZLoop call _OP1TOOP2 ld hl,MassCur call _MOV10TOOP1 call _FPMULT ld hl,MassCum call _MOV10TOOP2 call _FPADD ld de,MassCum call _MOVFROP1 pop hl jp CpdParseLoop CpdOnlyOne: push hl ld hl,MassCum call _MOV10TOOP1 ld hl,MassCur call _MOV10TOOP2 call _FPADD ;OP1 (Total)=OP1+OP2 (Current) ld de,MassCum call _MOVFROP1 pop hl jp CpdParseLoop ;Goto next element CpdDoneParse: ld hl,$0002 ld (_curRow),hl ld hl,MassCum call _MOV10TOOP1 call DispOP1 ld hl,CPDF1 ;Put Menu call PutVWidth ; | ld hl,CPDF2 ; | call PutVWidth ; | ld hl,CPDF3 ; | call PutVWidth ; | ld hl,CPDF4 ; | call PutVWidth ; | ld hl,CPDF5 ; | call PutVWidth ; | call DisplayMenu ; | ld hl,CPDF1 ; | call PutVWidth ; | ld hl,CPDF2 ; | call PutVWidth ; | ld hl,CPDF3 ; | call PutVWidth ; | ld hl,CPDF4 ; | call PutVWidth ; | ld hl,CPDF5 ; | call PutVWidth ; V CpdGTKLoop: call _getkey jr z,CpdGTKLoop cp kF1 jr z,StoA cp kF2 jr z,StoB cp kF3 jp z,StoC cp kF4 jp z,StoD cp kF5 jp z,A86Start jr CpdGTKLoop CpdError: ret StoA: call _ZEROOP1 ld hl,_OP1 inc hl ld (hl),1 inc hl ld (hl),'A' call _FINDSYM jr c,SkipDelA call _delvar SkipDelA: call _ZEROOP1 ld hl,_OP1 inc hl ld (hl),1 inc hl ld (hl),'A' call _CREATEREAL ex de,hl ld a,b call _SET_ABS_DEST_ADDR ld hl,MassCum xor a call _SET_ABS_SRC_ADDR ld hl,10 xor a call _SET_MM_NUM_BYTES call _mm_ldir jr CpdGTKLoop StoB: call _ZEROOP1 ld hl,_OP1 inc hl ld (hl),1 inc hl ld (hl),'B' call _FINDSYM jr c,SkipDelB call _delvar SkipDelB: call _ZEROOP1 ld hl,_OP1 inc hl ld (hl),1 inc hl ld (hl),'B' call _CREATEREAL ex de,hl ld a,b call _SET_ABS_DEST_ADDR ld hl,MassCum xor a call _SET_ABS_SRC_ADDR ld hl,10 xor a call _SET_MM_NUM_BYTES call _mm_ldir jp CpdGTKLoop StoC: call _ZEROOP1 ld hl,_OP1 inc hl ld (hl),1 inc hl ld (hl),'C' call _FINDSYM jr c,SkipDelC call _delvar SkipDelC: call _ZEROOP1 ld hl,_OP1 inc hl ld (hl),1 inc hl ld (hl),'C' call _CREATEREAL ex de,hl ld a,b call _SET_ABS_DEST_ADDR ld hl,MassCum xor a call _SET_ABS_SRC_ADDR ld hl,10 xor a call _SET_MM_NUM_BYTES call _mm_ldir jp CpdGTKLoop StoD: call _ZEROOP1 ld hl,_OP1 inc hl ld (hl),1 inc hl ld (hl),'D' call _FINDSYM jr c,SkipDelD call _delvar SkipDelD: call _ZEROOP1 ld hl,_OP1 inc hl ld (hl),1 inc hl ld (hl),'D' call _CREATEREAL ex de,hl ld a,b call _SET_ABS_DEST_ADDR ld hl,MassCum xor a call _SET_ABS_SRC_ADDR ld hl,10 xor a call _SET_MM_NUM_BYTES call _mm_ldir jp CpdGTKLoop ENDiff: call _clrLCD ;Clear screen call _homeUp ;And home up ld hl,ENS1 ;(hl)->"Symbol 1:" call PutText ;Put it call GetSym ld a,d or e jp z,A86Start ;d and e were both 0. call SrchNum ;Get Num -> b from de ld a,b ;Was there an error? or a jr nz,NextSym push de ;Save symbol (_clrScrn kills de) call _clrScrn ;Clear screen. pop de ;Get symbol back ld hl,Error1 ;(hl)->"Symbol not Found:" call PutText ;Put ld (Err22),de ;(hl)->"xx" ld hl,Error2 ;Put Symbol in place of "xx" call PutText ;Put it. KeyPressLoop1: call _getkey jr z,KeyPressLoop1 call _clrLCD call _homeUp jr ENDiff NextSym: ld de,EN ;de=EN chart start ld l,b ;hl=b-1 ld h,0 dec l call _multHLby10 ;hl=10(b-1) add hl,de ;No point in switching them... call _MOV10TOOP1 ;Now OP1=EN1 ld de,EN_OP call _MOVFROP1 ;(EN_OP)=En1 ld hl,ENS2 ;(hl)->"Symbol 2:" call PutText ;Put it call GetSym ld a,d or e jp z,A86Start ;d and e were both 0. call SrchNum ;Get Num -> b from de ld a,b or a jr nz,ENDiff2 push de ;Save symbol (_clrScrn kills de) call _clrScrn ;Clear screen. pop de ;Get symbol back ld hl,Error1 ;(hl)->"Symbol not Found:" call PutText ;Put ld (Err22),de ;(hl)->"xx" ld hl,Error2 ;Put Symbol in place of "xx" call PutText ;Put it. KeyPressLoop2: call _getkey jr z,KeyPressLoop2 call _clrLCD call _homeUp jr NextSym ENDiff2: ld de,EN ;de=EN chart start ld l,b ;hl=b-1 ld h,0 dec l call _multHLby10 ;hl=10(b-1) add hl,de ;No point in switching them... call _MOV10TOOP1 ;Now OP1=EN2 ld hl,EN_OP call _MOV10TOOP2 ;Now, OP2=EN1 call _FPSUB ;OP1=ENDiff ld hl,_OP1 ;(hl)->OP1 Sign byte res 7,(hl) ;Sign is now (+) ld hl,END1 call PutText ld hl,$0502 call DispOP1 ;Display OP1 call _OP1TOOP4 ;OP4=EN call _OP1SET1 ;OP1=1 call _TIMESPT5 ;OP1=0.5 call _OP1TOOP5 ;Store for later call _OP4TOOP2 ;OP2=EN call _CPOP1OP2 ;OP1-OP2=0.5-EN, cf res if EN<=0.5 (nonpolar) jr nc,ENNonP ;Display "Non-polar" call _OP2TOOP6 ;OP6=EN call _OP1SET1 ;OP1=1 call _OP2SET5 ;OP2=5 call _FPDIV ;OP1=.2 call _OP5TOOP2 ;OP2=.5 call _FPADD ;OP1=.7 call _OP2SET1 ;OP2=1 call _FPADD ;OP1=1.7! call _OP6TOOP2 ;OP2=EN call _CPOP1OP2 ;OP1-OP2=1.7-EN, cf set if EN>1.7 (ionic) jr c,ENIonic ;Display "Ionic" ENPolar: ld hl,END2P ;Get ready to put it on screen call PutText jr ENMenu ENIonic: ld hl,END2I ;Get ready to put it on screen call PutText jr ENMenu ENNonP: ld hl,END2N ;Get ready to put it on screen call PutText ENMenu: ld hl,ENF3 call PutVWidth ld hl,ENF5 call PutVWidth call DisplayMenu ld hl,ENF5 call PutVWidth KeyLoopEN: call _getkey jr z,KeyLoopEN ;Nothing? getkey again cp kExit ;Exit? jp z, Exit ;then goto cleanup/exit cp kF3 ;F3? jp z,ENDiff ;Then goto ENDiff cp kF5 ;F5? jp z,A86Start ;Goto A86Start jr KeyLoopEN ;Otherwise, go back to getkey KeyloopQ: ;Temp routine call _getkey jr z,KeyloopQ Exit: call _clrLCD call _clrScrn ; res curOn,(iy+curflags) ; res curAble,(iy+curflags) ; res shiftAlpha,(iy+shiftflags) ; res shiftLwrAlph,(iy+shiftflags) jp _homeUp ;jp so ret in homeUp quits... ;**********************Get Symbol Routine************************ ;Description: Gets input of symbol from user ;Parameters: none ;Output: de=symbol (ex, "He"-> d="e",e="H") ;Destroys: hl, bc, a ;Notes: returns d=" " for one-letter symbols. GetSym: GTSLoop1: ; set curAble,(iy+curflags) ; set curOn,(iy+curflags) ; set shiftAlpha,(iy+shiftflags) call GET_KEY ;key->a Use ASM86 getkey routine. or a jr z, GTSLoop1 ;If nothing, then back cp K_EXIT ;Exit? jr z,ExitGTS ;Exit the call, and reset de. ld hl,AlphaTable ;(hl)->Alphatable ld e,a ;de<-a ld d,0 ; " add hl,de ;(hl)->Alphatable entry ld a,(hl) ;a is now # of letter (a=1,b=2,c=3) or a ;Update flags jr z,GTSLoop1 ;Is it 0 (not a letter)?, then go back add a,$40 ;Else, add $40 ("A"-1) call _putc ;And disp it. ld c,a ;Then save it in c GTSLoop2: ;Gets second letter ; res shiftAlpha,(iy+shiftflags) ; set shiftLwrAlph,(iy+shiftflags) call GET_KEY ;Get key or a jr z, GTSLoop2 ;0? Go back cp K_EXIT jr z,ExitGTS cp K_ENTER ;Enter? jr z,OneLetter ;Then it's only 1 letter, so done ld hl,AlphaTable ;Otherwise, (hl)->Alphatable ld e,a ;And de<-a ld d,0 ;again add hl,de ;Now, (hl)->Alphatable[a] ld a,(hl) ;a->letter's # or a ;Update flags jr z,GTSLoop2 ;0? Not a letter - Go back add a,$60 ;Else add $60 ('a'-1) call _putc ;And put it ld b,a ;Then save it in b jr DoneSTSIn ;Done. OneLetter: ;It was one letter, ld b,' ' ;so second letter should be " ". DoneSTSIn: push bc ;Symbol->Stack pop de ;Stack->de ; res shiftLwrAlph,(iy+shiftflags) ; res shiftAlpha,(iy+shiftflags) ; res curAble,(iy+curflags) ; res curOn,(iy+curflags) ret ExitGTS: xor a ld d,a ld e,a ; res shiftLwrAlph,(iy+shiftflags) ; res shiftAlpha,(iy+shiftflags) ; res curAble,(iy+curflags) ; res curOn,(iy+curflags) ret ;**********************Search Symbol Routine********************** ;Description: Searches for atomic number given symbol ;Parameters: de=symbol ;Output: b=number, 0 if failed. ;Destroys: hl, a ;Notes: none SrchNum: ;Searches for symbol ld hl,Sym ;(hl)->Table (Init search) ld b,1 ;b->Atomic # CmpElem: ld a,b ;Put # in a cp 110 ;Make sure not too high jr z,NotFound ;If so, then not found. ld a,(hl) ;First letter->a cp e ;Is it right? jr nz,Next ;If not, goto next element inc hl ;Point to next letter ld a,(hl) ;Second letter->a cp d ;Is THIS one right? jr nz,NotSecond ;Nope ret ;Yay! Now we done... Next: inc hl ;Point hl to next element NotSecond: inc hl inc b ;Next at. number, too jr CmpElem ;And do it all over again! NotFound: ;We couldn't find it. ;-( ld b,0 ret ;**********************Search Number Routine********************** ;Description: Searches for symbol given atomic number ;Parameters: b=number ;Output: de=symbol ;Destroys: hl, c, a ;Notes: none SrchSym: push bc ;Save ld hl,Sym ;(hl)->Symbol chart dec hl ;Put it back two so that the first dec hl ;inc hl\inc hl doesn't skip "H " DJNZLoop1: inc hl ;Get next symbol inc hl djnz DJNZLoop1 ;until the b is 0 (repeat # times) ld e,(hl) ;(hl)->First letter->e inc hl ;(hl)->Second letter ld d,(hl) ;de->Sym pop bc ;b->Num (Get it back) scf ;set cf ccf ;clear cf ret ;**********************Check Case Routine********************** ;Description: Returns the case of a ;Parameters: a=char ;Output: c=set (1=Upper,2=Lower,3=Subscript,4=Coeff) ;Destroys: none ;Notes: none CheckCase: ld c,0 cp $41 jr c,NotUpCase cp $5B jr nc,NotUpCase ld c,1 ret NotUpCase: cp $61 jr c,NotLowCase cp $7B jr nc,NotLowCase ld c,2 ret NotLowCase: cp $80 jr c,NotSubCase cp $8A jr nc,NotSubCase ld c,3 ret NotSubCase: cp $31 ret c cp $3B ret nc ld c,2 ret ;***********************Display Text Routines********************** ;Description: Draws text on the screen. ;Parameters: hl -> Text struct (Row,Col,String,0) ;Output: to screen only ;Destroys: none ;Notes: PutText -> Normal (big) Font ; PutVWidth -> Variable Width (small/graph) Font PutText: push bc ;Save bc ld c,(hl) ;Load Row -> c inc hl ;(hl) -> Column ld b,(hl) ;Load Column -> b inc hl ;Point (hl) -> Text ld (_curRow),bc ;Load bc -> Cursor register call _puts ;Put string pop bc ;Restore bc ret ;Done PutVWidth: push bc ;Save bc ld b,(hl) ;Load Row -> b inc hl ;(hl) -> Col ld c,(hl) ;Load Col -> c inc hl ;Point (hl) -> Text ld (_penCol),bc ;Load bc -> Pen register call _vputs ;Put V-width string pop bc ;Restore bc ret ;Done ;***********************Display OP1 Routine********************** ;Description: Displays OP1 on the screen. ;Parameters: OP1=Real number to print ;Output: to screen only ;Destroys: a, hl, OP3 ;Author: Bill Nagel DispOP1: ld a,$30 ;Dunno, but it worked in ZReduce call $5191 ;Same ld hl,_OP3 ;hmmmm... call _puts ;??? Might work... ret ;********************* Display Menu routine ************************* ;Description: Draws the menu bar at the bottom of the screen ;Parameters: none ;Output: none ;Destroys: a, b, hl ;Author: Alan Bailey ;Note: F1(58,3);F2(58,28);F3(58,53);F4(58,78);F5(58,103) DisplayMenu: ld hl, VIDEO_MEM+$380 ld b, 32 displaymenuloop1: ld (hl), $FF inc hl djnz displaymenuloop1 ld b, 36 ld a, $C0 displaymenuloop2: ld (hl), a inc hl inc hl inc hl rra cp 3 jr nz, displaymenuloop2 ld a, $C0 dec hl dec hl djnz displaymenuloop2 ld a, $FE ld (VIDEO_MEM+$38F), a ld (VIDEO_MEM+$39F), a ret ;************* ;ROM EQUATES: ;************* ;VIDEO_MEM .equ $FC00 _homeUp .equ $4A95 _multHLby10 .equ $41BF _divHLby10 .equ $4044 _dispHL .equ $4A33 _CPOP1OP2 equ $41FB ;****** ;TEXT: ;****** ;Row,Col Title: .db 1,7,"CHEM-86",0 SubT: .db 15,28,"v1.2 by Stephen Hicks",0 Main1: .db 23,15,"F1.........." .db "..........Periodic Table",0 Main2: .db 29,15,"F2.........." .db ".... Mass of Compound",0 Main3: .db 35,15,"F3.........." .db ".........E.N. Difference",0 Main5: .db 47,15,"F5..................." .db ".................. Exit",0 MainF1: .db 58,4,"PTABL",0 MainF2: .db 58,30,"MASS",0 MainF3: .db 58,56,LcapDelta,"EN",0 MainF5: .db 58,107,"QUIT",0 PTTitl: .db 1,3,"PERIODIC TABLE",0 PTSubT: .db 15,48,"Input:",0 PT1: .db 23,15,"F1..............." .db "................Symbol",0 PT2: .db 29,15,"F2..............." .db "...............Number",0 PT5: .db 47,15,"F5..............." .db ".................... Back",0 PTF1: .db 58,7,"SYM",0 PTF2: .db 58,32,"NUM",0 PTF5: .db 58,106,"BACK",0 PTS1: .db 0,0,"Symbol:",0 PTN1: .db 0,0,"Number:",0 PNF1: .db 58,7,"SYM",0 PNF2: .db 58,32,"NUM",0 PNF3: .db 58,56,"BACK",0 PNF4: .db 58,81,"PREV",0 PNF5: .db 58,106,"NEXT",0 MC1: .db 0,0,"Compound:",0 MCF1: .db 58,13,"A",0 MCF2: .db 58,38,"a",0 MCF3: .db 58,63,"1",0 MCF5: .db 58,106,"BACK",0 CPDF1: .db 58,8,"->A",0 CPDF2: .db 58,33,"->B",0 CPDF3: .db 58,58,"->C",0 CPDF4: .db 58,83,"->D",0 CPDF5: .db 58,106,"BACK",0 ENS1: .db 0,0,"Symbol 1:",0 ENS2: .db 1,0,"Symbol 2:",0 END1: .db 2,0,LcapDelta,"E.N.=",0 END2I: .db 3,0,"Ionic",0 END2N: .db 3,0,"Non-Polar",0 END2P: .db 3,0,"Polar",0 ENF3: .db 58,56,LcapDelta,"EN",0 ENF5: .db 58,106,"BACK",0 Error1: .db 0,0,"Element Not Found:",0 Error2: .db 1,14 Err22: .db " ",0 ;*********** ;VARIABLES: ;*********** Compound: .db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 StrLen: .db 0 EN_OP: .db 0,0,0,0,0,0,0,0,0,0 MassCum: .db 0,0,0,0,0,0,0,0,0,0 MassCur: .db 0,0,0,0,0,0,0,0,0,0 MassPar: .db 0,0,0,0,0,0,0,0,0,0 ;******** ;TABLES: ;******** ;These scancode tables are for use with GET_KEY, not _getkey AlphaTable: ;Converts Scancode -> Letter .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$18,$14,$0F,$0A,$05,$00 .db $00,$00,$17,$13,$0E,$09,$04,$00,$00,$1A,$16,$12,$0D,$08,$03,$00 .db $00,$19,$15,$11,$0C,$07,$02,$00,$00,$00,$00,$10,$0B,$06,$01,$00 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 NumTable: ;Converts Scancode -> Number .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF .db $FF,$FF,$03,$06,$09,$FF,$FF,$FF,$FF,$FF,$02,$05,$08,$FF,$FF,$FF .db $FF,$00,$01,$04,$07,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF HexTable: ;Converts Scancode -> Hex .db $FF,$FF,$FF,$FF,$FF,$FF,$0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$0E,$FF .db $FF,$FF,$03,$06,$09,$FF,$0D,$FF,$FF,$FF,$02,$05,$08,$FF,$0C,$FF .db $FF,$00,$01,$04,$07,$FF,$0B,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$0A,$FF .db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF AM: .db $00,$00,$FC,$10,$07,$90,$00,$00,$00,$00 ;Hydrogen, 1 .db $00,$00,$FC,$40,$02,$60,$00,$00,$00,$00 ;Helium, 2 .db $00,$00,$FC,$69,$41,$00,$00,$00,$00,$00 .db $00,$00,$FC,$90,$12,$18,$00,$00,$00,$00 .db $00,$01,$FC,$10,$81,$00,$00,$00,$00,$00 .db $00,$01,$FC,$12,$01,$10,$00,$00,$00,$00 .db $00,$01,$FC,$14,$00,$67,$00,$00,$00,$00 .db $00,$01,$FC,$15,$99,$94,$00,$00,$00,$00 .db $00,$01,$FC,$18,$99,$84,$03,$00,$00,$00 .db $00,$01,$FC,$20,$17,$90,$00,$00,$00,$00 ;Neon, 10 .db $00,$01,$FC,$22,$98,$97,$70,$00,$00,$00 .db $00,$01,$FC,$24,$30,$50,$00,$00,$00,$00 .db $00,$01,$FC,$26,$98,$15,$40,$00,$00,$00 .db $00,$01,$FC,$28,$08,$55,$00,$00,$00,$00 .db $00,$01,$FC,$30,$97,$37,$60,$00,$00,$00 .db $00,$01,$FC,$32,$06,$00,$00,$00,$00,$00 .db $00,$01,$FC,$35,$45,$30,$00,$00,$00,$00 .db $00,$01,$FC,$39,$94,$80,$00,$00,$00,$00 ;Argon, 18 .db $00,$01,$FC,$39,$09,$83,$00,$00,$00,$00 .db $00,$01,$FC,$40,$08,$00,$00,$00,$00,$00 .db $00,$01,$FC,$44,$95,$59,$00,$00,$00,$00 .db $00,$01,$FC,$47,$90,$00,$00,$00,$00,$00 .db $00,$01,$FC,$50,$94,$15,$00,$00,$00,$00 .db $00,$01,$FC,$51,$99,$60,$00,$00,$00,$00 .db $00,$01,$FC,$54,$93,$80,$00,$00,$00,$00 .db $00,$01,$FC,$55,$84,$70,$00,$00,$00,$00 .db $00,$01,$FC,$58,$93,$32,$00,$00,$00,$00 .db $00,$01,$FC,$58,$70,$00,$00,$00,$00,$00 .db $00,$01,$FC,$63,$54,$60,$00,$00,$00,$00 .db $00,$01,$FC,$65,$38,$00,$00,$00,$00,$00 .db $00,$01,$FC,$69,$72,$00,$00,$00,$00,$00 .db $00,$01,$FC,$72,$59,$00,$00,$00,$00,$00 .db $00,$01,$FC,$74,$92,$16,$00,$00,$00,$00 .db $00,$01,$FC,$78,$96,$00,$00,$00,$00,$00 .db $00,$01,$FC,$79,$90,$40,$00,$00,$00,$00 .db $00,$01,$FC,$83,$80,$00,$00,$00,$00,$00 ;Krypton, 36 .db $00,$01,$FC,$85,$46,$78,$00,$00,$00,$00 .db $00,$01,$FC,$87,$62,$00,$00,$00,$00,$00 .db $00,$01,$FC,$88,$90,$59,$00,$00,$00,$00 .db $00,$01,$FC,$91,$22,$00,$00,$00,$00,$00 .db $00,$01,$FC,$92,$90,$64,$00,$00,$00,$00 .db $00,$01,$FC,$95,$94,$00,$00,$00,$00,$00 .db $00,$01,$FC,$98,$00,$00,$00,$00,$00,$00 .db $00,$02,$FC,$10,$10,$70,$00,$00,$00,$00 .db $00,$02,$FC,$10,$29,$05,$50,$00,$00,$00 .db $00,$02,$FC,$10,$64,$00,$00,$00,$00,$00 .db $00,$02,$FC,$10,$78,$68,$00,$00,$00,$00 .db $00,$02,$FC,$11,$24,$10,$00,$00,$00,$00 .db $00,$02,$FC,$11,$48,$20,$00,$00,$00,$00 .db $00,$02,$FC,$11,$86,$90,$00,$00,$00,$00 .db $00,$02,$FC,$12,$17,$50,$00,$00,$00,$00 .db $00,$02,$FC,$12,$76,$00,$00,$00,$00,$00 .db $00,$02,$FC,$12,$69,$04,$50,$00,$00,$00 .db $00,$02,$FC,$13,$13,$00,$00,$00,$00,$00 ;Xenon, 54 .db $00,$02,$FC,$13,$29,$05,$40,$00,$00,$00 .db $00,$02,$FC,$13,$73,$30,$00,$00,$00,$00 .db $00,$02,$FC,$13,$89,$05,$50,$00,$00,$00 ;Lanthanum, 57 .db $00,$02,$FC,$14,$01,$20,$00,$00,$00,$00 .db $00,$02,$FC,$14,$09,$07,$70,$00,$00,$00 .db $00,$02,$FC,$14,$42,$40,$00,$00,$00,$00 .db $00,$02,$FC,$14,$50,$00,$00,$00,$00,$00 .db $00,$02,$FC,$15,$04,$00,$00,$00,$00,$00 .db $00,$02,$FC,$15,$19,$60,$00,$00,$00,$00 .db $00,$02,$FC,$15,$72,$50,$00,$00,$00,$00 .db $00,$02,$FC,$15,$89,$25,$40,$00,$00,$00 .db $00,$02,$FC,$16,$25,$00,$00,$00,$00,$00 .db $00,$02,$FC,$16,$49,$30,$40,$00,$00,$00 .db $00,$02,$FC,$16,$72,$60,$00,$00,$00,$00 .db $00,$02,$FC,$16,$89,$34,$20,$00,$00,$00 .db $00,$02,$FC,$17,$30,$40,$00,$00,$00,$00 .db $00,$02,$FC,$17,$49,$67,$00,$00,$00,$00 ;Lutetium, 71 .db $00,$02,$FC,$17,$84,$90,$00,$00,$00,$00 .db $00,$02,$FC,$18,$09,$47,$90,$00,$00,$00 .db $00,$02,$FC,$18,$38,$50,$00,$00,$00,$00 .db $00,$02,$FC,$18,$62,$07,$00,$00,$00,$00 .db $00,$02,$FC,$19,$02,$00,$00,$00,$00,$00 .db $00,$02,$FC,$19,$22,$20,$00,$00,$00,$00 .db $00,$02,$FC,$19,$50,$90,$00,$00,$00,$00 .db $00,$02,$FC,$19,$69,$66,$50,$00,$00,$00 .db $00,$02,$FC,$20,$05,$90,$00,$00,$00,$00 .db $00,$02,$FC,$20,$43,$70,$00,$00,$00,$00 .db $00,$02,$FC,$20,$72,$00,$00,$00,$00,$00 .db $00,$02,$FC,$20,$89,$80,$40,$00,$00,$00 .db $00,$02,$FC,$20,$90,$00,$00,$00,$00,$00 .db $00,$02,$FC,$21,$00,$00,$00,$00,$00,$00 .db $00,$02,$FC,$22,$20,$00,$00,$00,$00,$00 ;Radon, 86 .db $00,$02,$FC,$22,$30,$00,$00,$00,$00,$00 .db $00,$02,$FC,$22,$60,$25,$40,$00,$00,$00 .db $00,$02,$FC,$22,$70,$27,$80,$00,$00,$00 ;Actinium, 89 .db $00,$02,$FC,$23,$20,$38,$10,$00,$00,$00 .db $00,$02,$FC,$23,$10,$35,$90,$00,$00,$00 .db $00,$02,$FC,$23,$80,$29,$00,$00,$00,$00 .db $00,$02,$FC,$23,$70,$48,$20,$00,$00,$00 .db $00,$02,$FC,$24,$40,$00,$00,$00,$00,$00 .db $00,$02,$FC,$24,$30,$00,$00,$00,$00,$00 .db $00,$02,$FC,$24,$70,$00,$00,$00,$00,$00 .db $00,$02,$FC,$24,$70,$00,$00,$00,$00,$00 .db $00,$02,$FC,$25,$10,$00,$00,$00,$00,$00 .db $00,$02,$FC,$25,$20,$00,$00,$00,$00,$00 .db $00,$02,$FC,$25,$70,$00,$00,$00,$00,$00 .db $00,$02,$FC,$25,$80,$00,$00,$00,$00,$00 .db $00,$02,$FC,$25,$90,$00,$00,$00,$00,$00 .db $00,$02,$FC,$26,$00,$00,$00,$00,$00,$00 ;Lawrencium, 103 .db $00,$02,$FC,$26,$10,$00,$00,$00,$00,$00 .db $00,$02,$FC,$26,$20,$00,$00,$00,$00,$00 .db $00,$02,$FC,$26,$30,$00,$00,$00,$00,$00 .db $00,$02,$FC,$26,$20,$00,$00,$00,$00,$00 .db $00,$02,$FC,$26,$50,$00,$00,$00,$00,$00 .db $00,$02,$FC,$26,$60,$00,$00,$00,$00,$00 EN: .db $00,$00,$FC,$22,$00,$00,$00,$00,$00,$00 ;Hydrogen, 1 .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 ;Helium, 2 .db $00,$FF,$FB,$98,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$15,$70,$00,$00,$00,$00,$00 .db $00,$00,$FC,$20,$40,$00,$00,$00,$00,$00 .db $00,$00,$FC,$25,$50,$00,$00,$00,$00,$00 .db $00,$00,$FC,$30,$40,$00,$00,$00,$00,$00 .db $00,$00,$FC,$34,$40,$00,$00,$00,$00,$00 .db $00,$00,$FC,$39,$80,$00,$00,$00,$00,$00 .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 ;Neon, 10 .db $00,$FF,$FB,$93,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$13,$10,$00,$00,$00,$00,$00 .db $00,$00,$FC,$16,$10,$00,$00,$00,$00,$00 .db $00,$00,$FC,$19,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$21,$90,$00,$00,$00,$00,$00 .db $00,$00,$FC,$25,$80,$00,$00,$00,$00,$00 .db $00,$00,$FC,$31,$60,$00,$00,$00,$00,$00 .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 ;Argon, 18 .db $00,$FF,$FB,$82,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$10,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$13,$60,$00,$00,$00,$00,$00 .db $00,$00,$FC,$15,$40,$00,$00,$00,$00,$00 .db $00,$00,$FC,$16,$30,$00,$00,$00,$00,$00 .db $00,$00,$FC,$16,$60,$00,$00,$00,$00,$00 .db $00,$00,$FC,$15,$50,$00,$00,$00,$00,$00 .db $00,$00,$FC,$18,$30,$00,$00,$00,$00,$00 .db $00,$00,$FC,$18,$80,$00,$00,$00,$00,$00 .db $00,$00,$FC,$19,$10,$00,$00,$00,$00,$00 .db $00,$00,$FC,$19,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$16,$50,$00,$00,$00,$00,$00 .db $00,$00,$FC,$18,$10,$00,$00,$00,$00,$00 .db $00,$00,$FC,$20,$10,$00,$00,$00,$00,$00 .db $00,$00,$FC,$21,$80,$00,$00,$00,$00,$00 .db $00,$00,$FC,$25,$50,$00,$00,$00,$00,$00 .db $00,$00,$FC,$29,$60,$00,$00,$00,$00,$00 .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 ;Krypton, 36 .db $00,$FF,$FB,$82,$00,$00,$00,$00,$00,$00 .db $00,$FF,$FB,$95,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$12,$20,$00,$00,$00,$00,$00 .db $00,$00,$FC,$13,$30,$00,$00,$00,$00,$00 .db $00,$00,$FC,$16,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$21,$60,$00,$00,$00,$00,$00 .db $00,$00,$FC,$19,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$22,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$22,$80,$00,$00,$00,$00,$00 .db $00,$00,$FC,$22,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$19,$30,$00,$00,$00,$00,$00 .db $00,$00,$FC,$16,$90,$00,$00,$00,$00,$00 .db $00,$00,$FC,$17,$80,$00,$00,$00,$00,$00 .db $00,$00,$FC,$19,$60,$00,$00,$00,$00,$00 .db $00,$00,$FC,$20,$50,$00,$00,$00,$00,$00 .db $00,$00,$FC,$21,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$26,$60,$00,$00,$00,$00,$00 .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 ;Xenon, 54 .db $00,$FF,$FB,$79,$00,$00,$00,$00,$00,$00 .db $00,$FF,$FB,$89,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$11,$00,$00,$00,$00,$00,$00 ;Lanthanum, 57 .db $00,$00,$FC,$11,$20,$00,$00,$00,$00,$00 .db $00,$00,$FC,$11,$30,$00,$00,$00,$00,$00 .db $00,$00,$FC,$11,$40,$00,$00,$00,$00,$00 .db $00,$00,$FC,$11,$30,$00,$00,$00,$00,$00 .db $00,$00,$FC,$11,$70,$00,$00,$00,$00,$00 .db $00,$00,$FC,$12,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$12,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$12,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$12,$20,$00,$00,$00,$00,$00 .db $00,$00,$FC,$12,$30,$00,$00,$00,$00,$00 .db $00,$00,$FC,$12,$40,$00,$00,$00,$00,$00 .db $00,$00,$FC,$12,$50,$00,$00,$00,$00,$00 .db $00,$00,$FC,$11,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$12,$70,$00,$00,$00,$00,$00 ;Lutetium, 71 .db $00,$00,$FC,$13,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$15,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$23,$60,$00,$00,$00,$00,$00 .db $00,$00,$FC,$19,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$22,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$22,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$22,$80,$00,$00,$00,$00,$00 .db $00,$00,$FC,$25,$40,$00,$00,$00,$00,$00 .db $00,$00,$FC,$20,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$20,$40,$00,$00,$00,$00,$00 .db $00,$00,$FC,$23,$30,$00,$00,$00,$00,$00 .db $00,$00,$FC,$20,$20,$00,$00,$00,$00,$00 .db $00,$00,$FC,$20,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$22,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 ;Radon, 86 .db $00,$FF,$FB,$70,$00,$00,$00,$00,$00,$00 .db $00,$FF,$FB,$90,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$11,$00,$00,$00,$00,$00,$00 ;Actinium, 89 .db $00,$00,$FC,$13,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$15,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$13,$80,$00,$00,$00,$00,$00 .db $00,$00,$FC,$13,$60,$00,$00,$00,$00,$00 .db $00,$00,$FC,$12,$80,$00,$00,$00,$00,$00 .db $00,$00,$FC,$13,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$13,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$13,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$13,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$13,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$13,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$13,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$13,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 ;Lawrencium, 103 .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 .db $00,$00,$FC,$00,$00,$00,$00,$00,$00,$00 Sym: .db "H HeLiBeB C N O F Ne" .db "NaMgAlSiP S ClArK Ca" .db "ScTiV CrMnFeCoNiCuZn" .db "GaGeAsSeBrKrRbSrY Zr" .db "NbMoTcRuRhPdAgCdInSn" .db "SbTeI XeCsBaLaCePrNd" .db "PmSmEuGdTbDyHoErTmYb" .db "LuHfTaW ReOsIrPtAuHg" .db "TlPbBiPoAtRnFrRaAcTh" .db "PaU NpPuAmCmBkCfEsFm" .db "MdNoLrRfDbSgBhHsMt" Names: .db "Hydrogen",0 .db "Helium",0 .db "Lithium",0 .db "Beryllium",0 .db "Boron",0 .db "Carbon",0 .db "Nitrogen",0 .db "Oxygen",0 .db "Flourine",0 .db "Neon",0 .db "Sodium",0 .db "Magnesium",0 .db "Aluminum",0 .db "Silicon",0 .db "Phosphorus",0 .db "Sulfur",0 .db "Chlorine",0 .db "Argon",0 .db "Potassium",0 .db "Calcium",0 .db "Scandium",0 .db "Titanium",0 .db "Vanadium",0 .db "Chromium",0 .db "Manganese",0 .db "Iron",0 .db "Cobalt",0 .db "Nickel",0 .db "Copper",0 .db "Zinc",0 .db "Gallium",0 .db "Germanium",0 .db "Arsenic",0 .db "Selenium",0 .db "Bromine",0 .db "Krypton",0 .db "Rubidium",0 .db "Strontium",0 .db "Yttrium",0 .db "Zirconium",0 .db "Niobium",0 .db "Molybdenum",0 .db "Technetium",0 .db "Ruthenium",0 .db "Rhodium",0 .db "Palladium",0 .db "Silver",0 .db "Cadmium",0 .db "Indium",0 .db "Tin",0 .db "Antimony",0 .db "Tellurium",0 .db "Iodine",0 .db "Xenon",0 .db "Cesium",0 .db "Barium",0 .db "Lanthanum",0 .db "Cerium",0 .db "Praseodymium",0 .db "Neodymium",0 .db "Promethium",0 .db "Samarium",0 .db "Europium",0 .db "Gadolinium",0 .db "Terbium",0 .db "Dysoprosium",0 .db "Holmium",0 .db "Erbium",0 .db "Thulium",0 .db "Ytterblum",0 .db "Lutetium",0 .db "Halfnium",0 .db "Tantalum",0 .db "Tunsten",0 .db "Rhenium",0 .db "Osmium",0 .db "Iridium",0 .db "Platinum",0 .db "Gold",0 .db "Mercury",0 .db "Thallium",0 .db "Lead",0 .db "Bismuth",0 .db "Polonium",0 .db "Astatine",0 .db "Radon",0 .db "Francium",0 .db "Radium",0 .db "Actinium",0 .db "Thorium",0 .db "Protactinium",0 .db "Uranium",0 .db "Neptunium",0 .db "Plutonium",0 .db "Americium",0 .db "Curium",0 .db "Berkelium",0 .db "Californium",0 .db "Einsteiniun",0 .db "Fermium",0 .db "Mendelevium",0 .db "Nobelium",0 .db "Lawrencium",0 .db "Rutherfordium",0 ;I just looked on the .db "Dubnium",0 ;internet and I believe .db "Seaborgium",0 ;that these are the most .db "Bohrium",0 ;recent names. .db "Hassium",0 ;I have, however, seen both .db "Meitnerium",0 ;Dubnium AND Hahnium for ;element 105. The others ;I'm pretty confident are ;correct. Offsets: ;Stored Low-High (word), Add to "Names" .db $00,$00,$09,$00,$10,$00,$18,$00,$22,$00 ;1-5 .db $28,$00,$2F,$00,$38,$00,$3F,$00,$48,$00 ;6-10 .db $4D,$00,$54,$00,$5E,$00,$67,$00,$6F,$00 ;11 .db $7A,$00,$81,$00,$8A,$00,$90,$00,$9A,$00 ;16 .db $A2,$00,$AB,$00,$B4,$00,$BD,$00,$C6,$00 ;21 .db $D0,$00,$D5,$00,$DC,$00,$E3,$00,$EA,$00 .db $EF,$00,$F7,$00,$01,$01,$09,$01,$12,$01 ;31 .db $1A,$01,$22,$01,$2B,$01,$35,$01,$3D,$01 .db $47,$01,$4F,$01,$5A,$01,$65,$01,$6F,$01 ;41 .db $77,$01,$81,$01,$88,$01,$90,$01,$97,$01 .db $9B,$01,$A4,$01,$AE,$01,$B5,$01,$BB,$01 .db $C2,$01,$C9,$01,$D3,$01,$DA,$01,$E7,$01 .db $F1,$01,$FC,$01,$05,$02,$0E,$02,$19,$02 ;61 .db $21,$02,$2D,$02,$35,$02,$3C,$02,$44,$02 .db $4E,$02,$57,$02,$60,$02,$69,$02,$71,$02 .db $79,$02,$80,$02,$88,$02,$91,$02,$96,$02 .db $9E,$02,$A7,$02,$AC,$02,$B4,$02,$BD,$02 ;81 .db $C6,$02,$CC,$02,$D5,$02,$DC,$02,$E5,$02 .db $ED,$02,$FA,$02,$02,$03,$0C,$03,$16,$03 .db $20,$03,$27,$03,$31,$03,$3D,$03,$49,$03 .db $51,$03,$5D,$03,$66,$03,$71,$03,$7F,$03 ;101-105 .db $87,$03,$92,$03,$9A,$03,$A2,$03 ;106-109 ProgLen: .end