;Number Base Toggler ;By Chicane ;This program is largely based on concepts from trigtogg and trigmode #include ti86asm.inc fmtflags equ 10 fmtHex equ 2 ; 1=hexadecimal fmtOct equ 3 ; 1=octal fmtBin equ 4 ; 1=binary>if all=0 then dec mode is set _user_int_ram equ $d2fd .org _asm_exec_ram ;---------------------------------Identification Junk------------ nop jp ASMstart .dw $0000 .dw Descript ;----------------------------------------------------------------- ASMstart: res 2,(iy+$23) ;turn user int off so it won't get called by accident ld hl,int ;copy prog to user int buffer ld de,_user_int_ram+1 ld bc,int_end-int ldir ld a,(_user_int_ram+1) ;set up checksum byte ld hl,_user_int_ram+($28*1) add a,(hl) ld hl,_user_int_ram+($28*2) add a,(hl) ld hl,_user_int_ram+($28*3) add a,(hl) ld hl,_user_int_ram+($28*4) add a,(hl) ld hl,_user_int_ram+($28*5) add a,(hl) ld (_user_int_ram),a set 2,(iy+$23) ;turn user int back on ret Descript: .db "Number Base Interrupt",0 int: push bc push hl ;save registers push af bit shiftAlpha,(iy+shiftflags) ;check if in alpha mode jr z,NoChange ;if not in alpha mode, no changes bit onInterrupt,(iy+onflags) ;check if on was pressed if not, jr z,NoChange ;no change was made jr Change NoChange: bit fmtBin,(iy+fmtflags) ;if binary is set jr nz,setbin ;jump to setbin bit fmtOct,(iy+fmtflags) ;if octal is set jr nz,setoct ;jump to setoct bit fmtHex,(iy+fmtflags) ;if hex is set jr nz,sethex ;jump to sethex jr setdec ;if none are set, then dec is the mode Change: bit fmtBin,(iy+fmtflags) ;If Bin was set, jr nz,SetOct ;jump here and set it to Oct bit fmtOct,(iy+fmtflags) ;If Octal was set jr nz,SetHex ;jump here and change to hex bit fmtHex,(iy+fmtflags) ;If Hex was set jr nz,SetDec ;then jump here and change to dec jr SetBin ;If dec was set (none were set) then bin is the new mode SetDec: res fmtBin,(iy+fmtflags) res fmtOct,(iy+fmtflags) ;reset all the flags (000=dec) res fmtHex,(iy+fmtflags) setdec: ld de,decimal ;load the decimal char jr PutChar SetBin: set fmtBin,(iy+fmtflags) res fmtOct,(iy+fmtflags) ;reset the flags to 001 res fmtHex,(iy+fmtflags) setbin: ld de,binary ;load the binary char jr PutChar SetOct: res fmtBin,(iy+fmtflags) set fmtOct,(iy+fmtflags) ;reset the flags to 010 res fmtHex,(iy+fmtflags) setoct: ld de,octal ;load the decimal char jr PutChar SetHex: set fmtHex,(iy+fmtflags) res fmtOct,(iy+fmtflags) ;set the flags to 100 res fmtBin,(iy+fmtflags) sethex: ld de,hex ;load the hexidecimal char jr PutChar PutChar: ld hl,$FC00+15 ;Video Mem+15= position for char ld b,6 ;how many lines? PutMap: ld a,(de) ;load a line of the char to a inc de ;point de to the next line ld (hl),a ;load the number in a to the address in hl push de ;save de ld de,16 ;load de with 16 add hl,de ;add 16 to the Vid Mem position pop de ;get de back djnz PutMap ;decriment bc, jump non-zero to PutMap ending: pop bc pop hl ;restore vars pop af ret ;*********************Character Maps*************************** decimal equ $-int+_user_int_ram+1 .db %00000110 .db %00000110 .db %00011110 .db %00100110 .db %00100110 .db %00011110 hex equ $-int+_user_int_ram+1 .db %00110000 .db %00110000 .db %00111100 .db %00110010 .db %00110010 .db %00110010 binary equ $-int+_user_int_ram+1 .db %00110000 .db %00110000 .db %00111100 .db %00110010 .db %00110010 .db %00111100 octal equ $-int+_user_int_ram+1 .db %00011100 .db %00110010 .db %00110010 .db %00110010 .db %00110010 .db %00011100 int_end: .END