home *** CD-ROM | disk | FTP | other *** search
/ ticalc.org / ticalc_org_rev_b.iso / archives / 86 / asm / source / ztatuz.asm < prev   
Encoding:
Assembly Source File  |  2001-07-01  |  5.5 KB  |  295 lines

  1. #include "asm86.h"
  2. #include "ti86abs.inc"
  3. #include "ti86asm.inc"
  4. #include "ti86ops.inc"
  5.  
  6. #define adjust $d746 - code
  7.  
  8. .org _asm_exec_ram
  9.  
  10.         res 5,(iy)
  11.         call $49dc
  12.         call _clrscrn
  13.         call _homeup
  14.         ld hl,name
  15.         call _puts
  16.         bit 6,(iy+$24)
  17.         jr z,install_it
  18.         ld hl,removed
  19.         call _puts
  20.         call _newline
  21.         ld hl,$5a92
  22.         rst 20h
  23.         rst 10h
  24.         call _delvar
  25.         res 6,(iy+$24)
  26.         jp $409c
  27. install_it:
  28.         call _puts
  29.         call _newline
  30.         ld hl,$5a92
  31.         rst 20h
  32.         rst 10h
  33.         jr c,install
  34.         call _delvar
  35. install:
  36.         ld hl,code_end-code
  37.         push hl
  38.         call _createprog
  39.         ld a,b
  40.         ex de,hl
  41.         call $4c3f              ;AHL+=2
  42.         call _SET_ABS_DEST_ADDR
  43.         xor a
  44.         pop hl
  45.         call _SET_MM_NUM_BYTES
  46.         ld hl,code
  47.         call _SET_ABS_SRC_ADDR
  48.         call _mm_ldir
  49.         set 6,(iy+$24)
  50.         jp $409c
  51.  
  52. name    .db "TI-86 Status Bar v0.1"
  53.         .db "written by Kirk Meyer"
  54.         .db "has been ",0
  55. active  .db "installed!",0
  56. removed .db "removed!",0      
  57.  
  58. code:
  59.         .db $8e,$28          
  60.         call $479f      ;pop op1
  61.         bit 0,(iy+$20)
  62.         jr nz,code_exit
  63.         ld a,($c1b4)
  64.         cp $01
  65.         jr nz,code_exit
  66.         ld a,($d13e)
  67.         cp 8
  68.         jr c,is_it_shown
  69.         ld a,7
  70.         ld ($d13e),a
  71.         call redraw
  72. is_it_shown:
  73.         ld a,($c21e)
  74.         or a
  75.         jr nz,code_exit
  76.         ld a,(_asm_reg_a)
  77.         cp K_CLEAR
  78.         jr nz,not_clear
  79.  
  80. not_clear:
  81.         cp K_F1
  82.         call z,degrad
  83.         cp K_F2
  84.         call z,normscieng
  85.         cp K_F4
  86.         call z,fixminus
  87.         cp K_F5
  88.         call z,fixplus
  89.         cp K_F3
  90.         call z,decbinocthex
  91.         inc a
  92.         call z,redraw
  93. code_exit:
  94.         ld a,(_asm_reg_a)
  95.         cp a
  96.         ret
  97.  
  98. byte_ext:
  99. byte_int = $ + adjust
  100.         .db 0
  101.  
  102. degrad = $ + adjust
  103.         ld a,255
  104.         bit 2,(iy)
  105.         jr z,degrad_a
  106.         res 2,(iy)
  107.         ret
  108. degrad_a:
  109.         set 2,(iy)
  110.         ret
  111.  
  112. normscieng = $ + adjust
  113.         ld a,255
  114.         bit 0,(iy+10)
  115.         jr z,normscieng_a
  116.         bit 1,(iy+10)
  117.         jr z,normscieng_b
  118.         res 0,(iy+10)
  119.         res 1,(iy+10)
  120.         ret
  121. normscieng_a:
  122.         set 0,(iy+10)
  123.         ret
  124. normscieng_b:
  125.         set 1,(iy+10)
  126.         ret
  127.  
  128. fixminus = $ + adjust
  129.         ld hl,$d148)
  130.         ld a,(hl)
  131.         dec a
  132.         cp 254
  133.         jr nz,fixminus_a
  134.         ld a,11
  135. fixminus_a:
  136.         ld (hl),a
  137.         ld a,255
  138.         ret
  139.  
  140. fixplus = $ + adjust
  141.         ld hl,$d148)
  142.         ld a,(hl)
  143.         inc a
  144.         cp 12
  145.         jr nz,fixplus_a
  146.         ld a,255
  147. fixplus_a:
  148.         ld (hl),a
  149.         ld a,255
  150.         ret
  151.  
  152. decbinocthex = $ + adjust
  153.         ld a,(iy+10)
  154.         rrca
  155.         rrca
  156.         rrca
  157.         ld c,a
  158.         ld a,255
  159.         jr c,decbinocthex_a
  160.         rrc c
  161.         jr c,decbinocthex_b
  162.         rrc c
  163.         jr c,decbinocthex_c
  164.         set 4,(iy+10)
  165.         ret
  166. decbinocthex_a:
  167.         res 2,(iy+10)
  168.         ret
  169. decbinocthex_b:
  170.         res 3,(iy+10)
  171.         set 2,(iy+10)
  172.         ret
  173. decbinocthex_c:
  174.         res 4,(iy+10)
  175.         set 3,(iy+10)
  176.         ret
  177.  
  178.  
  179. redraw = $ + adjust
  180.         ld a,$39
  181.         ld (_penRow),a
  182.  
  183.         ld hl,$ff80
  184.         ld de,$ff81
  185.         ld bc,$000f
  186.         ld (hl),%10101010
  187.         ldir
  188.         inc hl
  189.         inc de
  190.         ld bc,$006f
  191.         ld (hl),$00
  192.         ldir
  193.  
  194.         ld hl,rad_string
  195.         bit 2,(iy)
  196.         jr z,is_radians
  197.         ld hl,deg_string
  198. is_radians:
  199.         call _vputss
  200.  
  201.         ld hl,norm_string
  202.         bit 0,(iy+10)
  203.         jr z,is_norm
  204.         ld hl,sci_string
  205.         bit 1,(iy+10)
  206.         jr z,is_norm
  207.         ld hl,eng_string
  208. is_norm:
  209.         call _vputss
  210.  
  211.         ld a,(iy+10)
  212.         rrca
  213.         rrca
  214.         ld hl,hex_string
  215.         rrca
  216.         jr c,is_base
  217.         ld hl,oct_string
  218.         rrca
  219.         jr c,is_base
  220.         ld hl,bin_string
  221.         rrca
  222.         jr c,is_base
  223.         ld hl,dec_string
  224. is_base:
  225.         call _vputss
  226.  
  227.         ld a,92
  228.         ld (_penCol),a
  229.         ld a,$cf
  230.         call _vputmap
  231.         ld a,123
  232.         ld (_penCol),a
  233.         ld a,5
  234.         call _vputmap
  235.         
  236.         ld a,($d148)
  237.         inc a
  238.         jr z,is_float
  239.         ld c,102
  240.         dec a
  241.         cp 10
  242.         jr c,ten_okay
  243.         ld c,102-2
  244. ten_okay:
  245.         push af
  246.         ld a,c
  247.         ld (_penCol),a
  248.         ld hl,fix_string
  249.         call _vputs
  250.         pop af
  251.         jr c,okay_ten
  252.         push af
  253.         ld a,'1'
  254.         call _vputmap
  255.         pop af
  256.         sub 10
  257. okay_ten:        
  258.         add a,'0'
  259.         jp _vputmap
  260. is_float:
  261.         ld hl,float_string
  262.  
  263. _vputss = $ + adjust
  264.         ld a,(hl)
  265.         ld (_penCol),a
  266.         inc hl
  267.         jp _vputs
  268.  
  269. deg_string = $ + adjust
  270.         .db 0,"Deg",0
  271. rad_string = $ + adjust
  272.         .db 0,"Rad",0
  273. norm_string = $ + adjust
  274.         .db 25,"Norm",0
  275. sci_string = $ + adjust
  276.         .db 29,"Sci",0
  277. eng_string = $ + adjust
  278.         .db 28,"Eng",0
  279. dec_string = $ + adjust
  280.         .db 58,"Dec",0
  281. bin_string = $ + adjust
  282.         .db 59,"Bin",0
  283. oct_string = $ + adjust
  284.         .db 58,"Oct",0
  285. hex_string = $ + adjust
  286.         .db 58,"Hex",0
  287. float_string = $ + adjust
  288.         .db 101,"Float",0
  289. fix_string = $ + adjust
  290.         .db "Fix ",0
  291. code_end:
  292.  
  293. .end
  294.  
  295.