A83: Can someone check this code out


[Prev][Next][Index][Thread]

A83: Can someone check this code out




here it is, by the way what is the equate for 2nd key.


-Phelan 'Amen' Wolf

.nolist
#define equ .equ
#define EQU .equ
_cls    .equ 475Dh
_homeup         .equ 4775h
_puts           .equ 470Dh
_putc           .equ 4705h
_vputs  .equ 4781h
_dispHL  .equ 4709h
_newline        .equ 473Dh
_chkfindsym     .equ 442Ah
_zeroOP1        .equ 428Eh
_errUndefined   .equ 467Bh
_errSyntax .equ 466Ch
_getkey  .equ 4cfeh
shiftflags      EQU       18          ; IY OFFSET VALUE
shift2nd        EQU       3
shiftAlpha      EQU       4
shiftALock      EQU       6
k2nd        EQU            ?

.list
.org $9327
;start of porgram
;;;;;;revision 2
 di   ;supposedly speeds up the prog
;;;;;;end revision
 call _cls   ;clear screen
begin_code:
 ld ix,password_flag  ;check password flag(if set yet)
;;;;;revision 1
 dec (ix)
;;;;;end revision
 jp nz,change_password
 ld hl,text
 call _cls
 call _homeup
 call _puts
;;;;;revision 4
_loop:
 set shiftflags,(IY+shift2nd)
 call _getkey
 cp k2nd
 jr z,next
 jr _loop
next:
 res shiftflags,(IY+shift2nd)
;;;;;end revision
 ld hl,passcode_temp
 ld b,8
start:
 call getkey
 ld a,b
 jp z,done
 jp start

getkey:
 call _getkey
 ld (hl),a
 inc hl
 dec b
 ret

done:
 ld de,passcode_temp
 ld hl,passcode_real
 sub hl,de
;;;;;revision 3
 push af  ;slow down  i.e. checking password
 push af
 pop af
 pop af
;;;;;end revision
 jp z,correct
 jr off

correct:
;;;;;;revision 2
 ei  ;reenable interupts
;;;;;;end revision
 ret

off:
;;;;;;revision 2
 ei  ;reenable the interupts
;;;;;;end revision
 call _off
 jp begin_code

change_password:
 ld hl,text
 call _homeup
 call _puts
 ld hl,password_real
 ld b,8
change_loop:
 call getkey
 ld a,b
 jp z,done_changing
 jp change_loop

done_changing:
 call _cls
 ld hl,done_text
 call _homeup
 call _puts
 ld hl,password_flag
 inc (hl)
;;;;;;revision 2
 ei  ;reenable the interupts
;;;;;;end revision
 ret

_off:
 DI  ; disable interrupts
 LD A,001H
 OUT (003H),A ; turn off screen
 LD A,000H
 OUT (004H),A
 EX AF,AF'
 EXX
 EI  ; enable interrupts

passcode_flag:
 .db $00,$FF,0
passcode_temp:
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$FF,0
passcode_real:
 .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$FF,0
text:
 .db "Enter Password",0
done_text:
 .db "Password Set",0

.end
End