home *** CD-ROM | disk | FTP | other *** search
- people have been requesting the source for the april fool's joke so here it
- is. i'm sure i could have optimized, etc. but i wanted to get it to you
- before when you needed to use it :) probably look at it in
- courier/monospaced font or notepad or something for best clarity kirk
-
- === begin source code
-
- #include "asm86.h"
- #include "ram86.inc"
- #include "ti86abs.inc"
- #include "ti86asm.inc"
- #include "ti86ops.inc"
- .org _asm_exec_ram
- Start:
- ld hl,op_info-1 ;this sees if (sqrt)KEY already exists
- rst 20h
- call _findsym
- jr c,Install
- call _delvar ;if so, delete it :)
- Install:
- ld hl,code_end-code ;hl = size of program
- push hl ;we need this value again, so save it
- call $474f ;creates program (name already was in OP1)
- ld a,b
- ex de,hl
- call $4c3f
- call _SET_ABS_DEST_ADDR
- xor a
- pop hl ;get back our saved value
- call _SET_MM_NUM_BYTES
- ld hl,code ;point to the code
- call _SET_ABS_SRC_ADDR
- call _mm_ldir ;copy the program to (sqrt)KEY
- res 0,(iy+$25) ;set the user-defined flag
- set 6,(iy+$24) ;enable (sqrt)KEY
- jp $409c ;return
- op_info:
- .db $4,$10
- .db "KEY",0
- code:
- .db $8e,$28
- call $479f ;a call used in TI's demo program
- ld a,(_asm_reg_a) ;get saved value of A - its the key code pressed
- push af ;save this value
- bit 0,(iy+$20)
- jr nz,code_exit ;i dunno but i think it must be there
- ld a,(_CXCURAPP) ;load the current screen of the calculator
- cp $20 ;if they're not looking at the RAM...
- jr nz,code_exit ;then skip everything
- pop af ;get our getkey value back
- push af ;then save it again
- cp K_MORE ;if they aren't pushing MORE at this screen
- jr nz,code_exit ;then skip everything
- bit 0,(iy+$25) ;if it's already enabled, disable it
- jr nz,is_going
- set 0,(iy+$25) ;otherwise, enable it
- call _clrScrn ;clear the screen
- call _homeup ;and display the message
- ld hl,the_message
- call _puts
- call _homeup
- call $4ab5 ;this copies _textShadow to _cmdShadow i think
- jp $409C ;return
- is_going:
- res 0,(iy+$25) ;reset the user flag
- ld a,$1F ;something extra not in the release version
- ld ($C008),a ;this turns the contrast all the way down but tells
- xor a ;the 86 that it's all the way up. the effect is that
- out (2),a ;they must turn the contrast down to turn it up :)
- code_exit:
- pop af ;pop our saved getkey
- bit 0,(iy+$25) ;look at the user flag
- jr z,code_done ;if not set, go to the ending
- ld hl,key_table ;point to the translator table
- ld d,0 ;de = the key pressed
- ld e,a
- add hl,de ;get offset into table
- ld a,(hl) ;and get a byte
- code_done:
- cp a ;if the zero flag is set upon returning from
- ;(sqrt)KEY then it takes the value in A and makes
- ;that into the key that was pressed. if the not zero
- ;flag is set, then i think (i haven't tested this)
- ;that the value in A is taken as the key that was
- ;pressed also. however - when the zero flag is set,
- ;the key is a code associated with _getky (the
- ;one that doesn't loop). when the not zero flag is
- ;set, the key is a code associated with _getkey (the
- ;one that does loop and also saves energy).
- ret ;return - could also use jp $409C if i felt like it
- :)
- the_message = $ - code + $D746
- ;123456789012345678901
- .db " Hah! Did you forget "
- .db "about April Fool",39,"s???"
- .db " I rearranged your "
- .db "keyboard for you. You"
- .db "can eliminate this by"
- .db " pushing MORE at the "
- .db "memory check screen!!",0
- ;this is the table for the keyremapping
- key_table = $ - code + $D746
- .db $00
- .db $13
- .db $04
- .db $09
- .db $15
- .db 0,0,0,0
- .db $14
- .db $02
- .db $22
- .db $27
- .db $16
- .db $1F
- .db $19
- .db 0
- .db $0C
- .db $0D
- .db $17
- .db $1C
- .db $01
- .db $0A
- .db $0B
- .db 0
- .db $21
- .db $33
- .db $26
- .db $34
- .db $25
- .db $1D
- .db $23
- .db $1A
- .db $1B
- .db $35
- .db $1E
- .db $0E
- .db $36
- .db $2C
- .db $32
- .db $37
- .db 0
- .db $24
- .db $20
- .db $2D
- .db $28
- .db $2A
- .db $12
- .db $38
- .db $2E
- .db $2B
- .db $0F
- .db $11
- .db $2F
- .db $30
- .db $31
- .db $03
- code_end:
- .end