diff options
| author | cheapie <cheapiephp@gmail.com> | 2026-09-25 22:02:25 -0500 |
|---|---|---|
| committer | cheapie <cheapiephp@gmail.com> | 2026-09-25 22:02:25 -0500 |
| commit | 4190b2f69583c87ff586b99c8453c09f2063e28e (patch) | |
| tree | 4927f8979dd5de7be1ec57a7269ce079b84a61dd /assembly/win95/win95.S | |
| parent | 7a3f6969c84db263bdfd0284db2bc9e58f28e61f (diff) | |
| download | rvcontroller-4190b2f69583c87ff586b99c8453c09f2063e28e.tar rvcontroller-4190b2f69583c87ff586b99c8453c09f2063e28e.tar.gz rvcontroller-4190b2f69583c87ff586b99c8453c09f2063e28e.tar.bz2 rvcontroller-4190b2f69583c87ff586b99c8453c09f2063e28e.tar.xz rvcontroller-4190b2f69583c87ff586b99c8453c09f2063e28e.zip | |
Add Windows 95 upgrade password generator
Diffstat (limited to 'assembly/win95/win95.S')
| -rw-r--r-- | assembly/win95/win95.S | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/assembly/win95/win95.S b/assembly/win95/win95.S new file mode 100644 index 0000000..0ecd394 --- /dev/null +++ b/assembly/win95/win95.S @@ -0,0 +1,161 @@ +_start: + +# Clear the input buffer +la t0,inputbuf +sd x0,0(t0) +sd x0,2(t0) +sd x0,4(t0) +sw x0,6(t0) + +# Print "Enter key: " message +li a7,4 +la a0,keypromptmsg +ecall + +# Read the user's input +li a7,8 +la a0,inputbuf +li a1,7 +ecall + +# Print it back, followed by a line feed +li a7,4 +la a0,inputbuf +ecall +li a7,11 +li a0,'\n' +ecall + +# Check if all characters are digits +la t0,inputbuf +li t1,5 +1: +add t2,t0,t1 +lb t3,0(t2) +li t4,0x30 # 0 +blt t3,t4,invalidinput # too low +li t4,0x39 # 9 +blt t4,t3,invalidinput # too high +addi t1,t1,-1 +bnez t1,1b + +# Convert the key into a decimal number, but backwards +# Could I make this a loop? Probably. Does it matter? Not really. +la t0,inputbuf + +lb s0,0(t0) # 1s place +addi s0,s0,-0x30 + +lb t1,1(t0) # 10s place +addi t1,t1,-0x30 +li t2,10 +mul t1,t1,t2 +add s0,s0,t1 + +lb t1,2(t0) # 100s place +addi t1,t1,-0x30 +li t2,100 +mul t1,t1,t2 +add s0,s0,t1 + +lb t1,3(t0) # 1000s place +addi t1,t1,-0x30 +li t2,1000 +mul t1,t1,t2 +add s0,s0,t1 + +lb t1,4(t0) # 10000s place +addi t1,t1,-0x30 +li t2,10000 +mul t1,t1,t2 +add s0,s0,t1 + +lb t1,5(t0) # 100000s place +addi t1,t1,-0x30 +li t2,100000 +mul t1,t1,t2 +add s0,s0,t1 + +# Calculate the password +li t0,0x414d57 +xor s0,s0,t0 +li t0,1000000 +rem s0,s0,t0 + +# Print out the password one character at a time +# Yes, RVController has a function to print integers, but I wanted to have some fun here +li a7,4 +la a0,passwordheadermsg +ecall + +li t0,100000 +div a0,s0,t0 +addi a0,a0,0x30 +li a7,11 +ecall + +li t0,10000 +div a0,s0,t0 +li t0,10 +rem a0,a0,t0 +addi a0,a0,0x30 +li a7,11 +ecall + +li t0,1000 +div a0,s0,t0 +li t0,10 +rem a0,a0,t0 +addi a0,a0,0x30 +li a7,11 +ecall + +li t0,100 +div a0,s0,t0 +li t0,10 +rem a0,a0,t0 +addi a0,a0,0x30 +li a7,11 +ecall + +li t0,10 +div a0,s0,t0 +li t0,10 +rem a0,a0,t0 +addi a0,a0,0x30 +li a7,11 +ecall + +li t0,10 +rem a0,s0,t0 +addi a0,a0,0x30 +li a7,11 +ecall + +# Wait for user to press any key before clearing the screen and restarting +li a7,4 +la a0,anykeymsg +ecall +li a7,8 +la a0,inputbuf +li a1,7 +ecall +li a7,4 +la a0,clearscreenmsg +ecall +j _start + +invalidinput: +# Print error message and jump back to the start so the user can try again +li a7,4 +la a0,inputerrormsg +ecall +j _start + +keypromptmsg: .asciz "Enter key: " +passwordheadermsg: .asciz "Password: " +inputerrormsg: .asciz "Invalid entry\n\n" +anykeymsg: .asciz "\n\nPress any key..." +clearscreenmsg: .asciz "\n\n\n\n\n\n" +inputbuf: .skip 7 +.globl _start |
