I am a 1337 haxxer!
Moderator: CS Admin
I am a 1337 haxxer!
For serious. I code you up.
while(true)
{
if(0x2B)
{
System.exit(0);
}
else if(!0x2B)
{
System.out.println("Sauce");
}
}
while(true)
{
if(0x2B)
{
System.exit(0);
}
else if(!0x2B)
{
System.out.println("Sauce");
}
}
I have hacked the gibson!
Here it is:
; Using GNU Development Chain for 68HC11:
; Assemble with : as -o lab1.o lab1.s
; Link with : ld -T ../fox11w.x -o lab1.elf lab1.o
; Convert to S19 : objcopy -O srec lab1.elf lab1.s19
; Create a listing: objdump -d lab1.elf > lab1.rst
;Name of Program: Car n' Box API vers 4.0
;@author Cat
;@date March 30 2007
;@purpose: GIBSON
motorport = 0x7000 ;address of motor control
portE = 0x100A ;addres of portE
toc1vector = 0x00E0
toc2vector = 0x00DD
tctl1 = 0x1020
oc1m = 0x100C
toc1 = 0x1016
toc2 = 0x1018
tflg1 = 0x1023
tmsk1 = 0x1022
option = 0x1039
adctl = 0x1030
ad4 = 0x1034
.section .data
.global motorsaver
motorsaver: .byte 1 ;This is the program's saved represenation of the bits in motorport since I can't read
period: .word 2 ;The period for speed modulation.
ontime: .word 2 ;Ontime for speed modulation.
brighter: .byte 1
rotcount: .word 2
holder: .byte 1
;-------------MAIN-----------
; Main code, entry point for program.
;---------------------------
.section .text
.global _start ; exported entry point expected by GNU as
_start:
ldaa option
oraa #0x80
staa option
pshx
ldx #100
jsr wait
pulx
ldaa #0x23
staa adctl
sei ;disable interrupts while setting up my own
;
lds #_stack ;Load stack pointer
;
;
ldd #toc1_isr ;Initialize interrupts
std toc1vector ;
ldd #toc2_isr ;
std toc2vector ;
;
clr oc1m ;clear oc1m flag
;
;
ldd #0 ;
std toc1 ; Store 0 in toc1 as a starting point to count
;
ldaa tctl1 ;
anda #0b00111111 ; Disconnect timer from output pin.
staa tctl1 ;
;
;
ldd #0xF000 ; Initial 50 percent duty cycle
std ontime ;
std toc2 ;
;
ldd #0xFFFF ; Initalize period to FFFF
staa period ;
;
;
ldaa tflg1 ;
oraa #0b11000000 ; Set flag up to clear
staa tflg1 ; Clear the flag
;
;
ldaa tmsk1 ;
oraa #0b11000000 ; Enable toc1 and toc2
staa tmsk1 ;
;
cli ; Enable interrupts
ldaa #0b00000000
staa motorsaver ;Initialize the motorsaver value
staa rotcount ;Initliaze the rotation count
ldaa #0b00000000
staa motorport ;Stop all motors before program begins
ldaa #0xFF
staa brighter ;Initialize brightest value to FF
pshx
ldx #500
jsr wait
pulx
1:jsr lturn
pshx
ldx #1
jsr wait
pulx
ldx rotcount
inx
stx rotcount
jsr pollq
ldd rotcount
cmpd #5000
beq 4f
bra 1b
4:jsr rturn
pshx
ldx #1
jsr wait
pulx
ldaa ad4
cmpa brighter
beq 99f
bra 4b
99:jsr halt
jsr onward
pshx
ldx 100
jsr wait
pulx
jsr halt
bra .
rts
;---------TOC1_ISR----------
; Interrupt service routine that turns motors on as part of the
; pulse width modulation. Using the program variable motorsaver
; the ISR can turn on all motors that are supposed to be running and
; in the proper direction.
;---------------------------
toc1_isr:
ldaa motorsaver ;
staa motorport ;Enable all motors that should be on according to motorsaver
;
ldaa tflg1 ;
oraa #0b11000000 ; Clear all flags
staa tflg1 ;
;
ldd #0 ;
std toc1 ;Reset toc1 to zero
ldd ontime ;
std toc2 ;Set toc2 to trigger ontime
;
rti ;
;---------TOC2_ISR----------
; Interrupt service routine that turns motors off as part of the
; pulse width modulation.
;---------------------------
toc2_isr:
ldaa #0b00000000 ;
staa motorport ; Turn off all motors
;
ldaa tflg1 ;
oraa #0b01000000 ;
staa tflg1 ;Clear flag so it can start over
;
rti
;----------POLLQ------------
; This routine polls AD4 to see what the value is from the IR sensor.
; If the value is lower (brighter source) than the one currently stored
; in brighter then overwrite it with the new value.
;---------------------------
.section .text
pollq: ldaa ad4
cmpa brighter
blo 1f
bra 99f
1: staa brighter
bra 99f
99: rts
;------------LIGHTER---------
; The lighter function is a polling function that looks into portE to assertain
; the condition of the line tracker that should be attached to it. After reading
; values from portE it stores a value in accumulator A signaling the combination of lights lit.
;
; Black: 0
;L Black: 1
; C Black: 2
; R Black: 3
;LC Black: 4
;L R Black: 5
; CR Black: 6
;LCR Black: 7
;----------------------------
.section .text
lighter:
ldaa portE ;poll portE
cmpa #0xF8 ;All lines white
beq 1f ;
cmpa #0xF9 ;Right line black
beq 2f ;
cmpa #0xFA ;Center line black
beq 3f ;
cmpa #0xFB ;Center and right lines black
beq 4f ;
cmpa #0xFC ;Left line black
beq 5f ;
cmpa #0xFD ;Left and right lines black
beq 6f ;
cmpa #0xFE ;Left and center lines black
beq 7f ;
cmpa #0xFF ;All lines black
beq 8f ;
beq 99f ;If none of the conditions are met jump to rts
;
;
1: ldaa #0 ;___
bra 99f ;
2: ldaa #3 ; R
bra 99f ;
3: ldaa #2 ; C
bra 99f ;
4: ldaa #6 ; CR
bra 99f ;
5: ldaa #1 ;L
bra 99f ;
6: ldaa #5 ;L R
bra 99f ;
7: ldaa #4 ;LC
bra 99f ;
8: ldaa #7 ;LCR
bra 99f
99: rts
;-----------FSPEED----------
; Turns motors on full speed ahead.
;---------------------------
.section .text
fspeed: ldd #0xFFFF
std ontime
rts
;-----------MSPEED----------
; Turns motors on medium speed.
;---------------------------
.section .text
mspeed: ldd #0x8000
std ontime
rts
;-----------LTURN-----------
; Turns on motor 1 reverse and motor 2 forward
; and calls wait as many times as are in
; accumulator A
;---------------------------
.section .text
lturn: jsr m1b
jsr m2f
1: cmpb #0
ble 99f
pshx
ldx #250
jsr wait
pulx
decb
bra 1b
99: rts
;-----------RTURN-----------
; Turns on motor 1 forward and motor 2 backward
; and calls wait as many times as are in
; accumulator A
;---------------------------
.section .text
rturn: jsr m1f
jsr m2b
1: cmpb #0
ble 99f
pshx
ldx #250
jsr wait
pulx
decb
bra 1b
99: rts
;-----------ONWARD-----------
; Turns both motors on forward.
;---------------------------
.section .text
onward: jsr m1f
jsr m2f
rts
;-----------RETREAT---------
; Turns both motors on backward.
;---------------------------
.section .text
retreat: jsr m1b
jsr m2b
rts
;-----------HALT-----------
; Turns both motors off or stops.
;---------------------------
.section .text
halt: jsr m1s
jsr m2s
rts
;-----------INITM-----------
; This function makes sure motorport and motorsaver are both set to 0 when the
; program executes.
;---------------------------
.section .text
;Set all zeros at 0x7000
initm: ldaa #0x00
staa motorport
staa motorsaver
;-------------M1B-----------
; Causes motor 1 to move backward.
;---------------------------
.section .text
m1b: ldaa motorsaver
oraa #0b00010001
;anda #0b11111101
staa motorport
staa motorsaver
rts
;-------------M1F-----------
; Causes motor 1 to move forward.
;---------------------------
.section .text
m1f: ldaa motorsaver
oraa #0b00010010
anda #0b11111110
;staa motorport
staa motorsaver
rts
;-------------M1S-----------
; Causes motor 1 to stop movement.
;---------------------------
.section .text
m1s: ldaa motorsaver
oraa #0b00010000
anda #0b11110011
;staa motorport
staa motorsaver
rts
;-----------ALLSTOP---------
; Stops all motors
;---------------------------
.section .text
allstop:ldaa #0
staa motorsaver
rts
;-------------M2F-----------
; Causes motor 2 to move forward.
;---------------------------
.section .text
m2f: ldaa motorsaver
oraa #0b00100000
anda #0b11111101
staa motorport
staa motorsaver
rts
;-------------M2B-----------
; Causes motor 2 to move backward.
;---------------------------
.section .text
m2b: ldaa motorsaver
oraa #0b00100010
;anda #0b11111111
staa motorport
staa motorsaver
rts
;-------------M2S-----------
; Causes motor 2 to stop movement.
;---------------------------
.section .text
m2s: ldaa motorsaver
oraa #0b00100000
anda #0b11111100
staa motorsaver
staa motorport
rts
.section .text
; subroutine wait - waits 250 ms - modifies nothing
wait: psha ; save A
tpa ; save condition codes
psha ; "
;pshx ; save X
;ldx #250 ; wait 250 milliseconds
1: bsr wait1ms ; local label
dex
bne 1b
;pulx ; restore X
pula ; restore condition codes
tap ; "
pula ; restore a
rts
wait1ms:psha ; 1 ms wait
tpa
psha
pshx
ldx #200
2: dex
nop
nop
bne 2b
pulx
pula
tap
pula
rts
; Using GNU Development Chain for 68HC11:
; Assemble with : as -o lab1.o lab1.s
; Link with : ld -T ../fox11w.x -o lab1.elf lab1.o
; Convert to S19 : objcopy -O srec lab1.elf lab1.s19
; Create a listing: objdump -d lab1.elf > lab1.rst
;Name of Program: Car n' Box API vers 4.0
;@author Cat
;@date March 30 2007
;@purpose: GIBSON
motorport = 0x7000 ;address of motor control
portE = 0x100A ;addres of portE
toc1vector = 0x00E0
toc2vector = 0x00DD
tctl1 = 0x1020
oc1m = 0x100C
toc1 = 0x1016
toc2 = 0x1018
tflg1 = 0x1023
tmsk1 = 0x1022
option = 0x1039
adctl = 0x1030
ad4 = 0x1034
.section .data
.global motorsaver
motorsaver: .byte 1 ;This is the program's saved represenation of the bits in motorport since I can't read
period: .word 2 ;The period for speed modulation.
ontime: .word 2 ;Ontime for speed modulation.
brighter: .byte 1
rotcount: .word 2
holder: .byte 1
;-------------MAIN-----------
; Main code, entry point for program.
;---------------------------
.section .text
.global _start ; exported entry point expected by GNU as
_start:
ldaa option
oraa #0x80
staa option
pshx
ldx #100
jsr wait
pulx
ldaa #0x23
staa adctl
sei ;disable interrupts while setting up my own
;
lds #_stack ;Load stack pointer
;
;
ldd #toc1_isr ;Initialize interrupts
std toc1vector ;
ldd #toc2_isr ;
std toc2vector ;
;
clr oc1m ;clear oc1m flag
;
;
ldd #0 ;
std toc1 ; Store 0 in toc1 as a starting point to count
;
ldaa tctl1 ;
anda #0b00111111 ; Disconnect timer from output pin.
staa tctl1 ;
;
;
ldd #0xF000 ; Initial 50 percent duty cycle
std ontime ;
std toc2 ;
;
ldd #0xFFFF ; Initalize period to FFFF
staa period ;
;
;
ldaa tflg1 ;
oraa #0b11000000 ; Set flag up to clear
staa tflg1 ; Clear the flag
;
;
ldaa tmsk1 ;
oraa #0b11000000 ; Enable toc1 and toc2
staa tmsk1 ;
;
cli ; Enable interrupts
ldaa #0b00000000
staa motorsaver ;Initialize the motorsaver value
staa rotcount ;Initliaze the rotation count
ldaa #0b00000000
staa motorport ;Stop all motors before program begins
ldaa #0xFF
staa brighter ;Initialize brightest value to FF
pshx
ldx #500
jsr wait
pulx
1:jsr lturn
pshx
ldx #1
jsr wait
pulx
ldx rotcount
inx
stx rotcount
jsr pollq
ldd rotcount
cmpd #5000
beq 4f
bra 1b
4:jsr rturn
pshx
ldx #1
jsr wait
pulx
ldaa ad4
cmpa brighter
beq 99f
bra 4b
99:jsr halt
jsr onward
pshx
ldx 100
jsr wait
pulx
jsr halt
bra .
rts
;---------TOC1_ISR----------
; Interrupt service routine that turns motors on as part of the
; pulse width modulation. Using the program variable motorsaver
; the ISR can turn on all motors that are supposed to be running and
; in the proper direction.
;---------------------------
toc1_isr:
ldaa motorsaver ;
staa motorport ;Enable all motors that should be on according to motorsaver
;
ldaa tflg1 ;
oraa #0b11000000 ; Clear all flags
staa tflg1 ;
;
ldd #0 ;
std toc1 ;Reset toc1 to zero
ldd ontime ;
std toc2 ;Set toc2 to trigger ontime
;
rti ;
;---------TOC2_ISR----------
; Interrupt service routine that turns motors off as part of the
; pulse width modulation.
;---------------------------
toc2_isr:
ldaa #0b00000000 ;
staa motorport ; Turn off all motors
;
ldaa tflg1 ;
oraa #0b01000000 ;
staa tflg1 ;Clear flag so it can start over
;
rti
;----------POLLQ------------
; This routine polls AD4 to see what the value is from the IR sensor.
; If the value is lower (brighter source) than the one currently stored
; in brighter then overwrite it with the new value.
;---------------------------
.section .text
pollq: ldaa ad4
cmpa brighter
blo 1f
bra 99f
1: staa brighter
bra 99f
99: rts
;------------LIGHTER---------
; The lighter function is a polling function that looks into portE to assertain
; the condition of the line tracker that should be attached to it. After reading
; values from portE it stores a value in accumulator A signaling the combination of lights lit.
;
; Black: 0
;L Black: 1
; C Black: 2
; R Black: 3
;LC Black: 4
;L R Black: 5
; CR Black: 6
;LCR Black: 7
;----------------------------
.section .text
lighter:
ldaa portE ;poll portE
cmpa #0xF8 ;All lines white
beq 1f ;
cmpa #0xF9 ;Right line black
beq 2f ;
cmpa #0xFA ;Center line black
beq 3f ;
cmpa #0xFB ;Center and right lines black
beq 4f ;
cmpa #0xFC ;Left line black
beq 5f ;
cmpa #0xFD ;Left and right lines black
beq 6f ;
cmpa #0xFE ;Left and center lines black
beq 7f ;
cmpa #0xFF ;All lines black
beq 8f ;
beq 99f ;If none of the conditions are met jump to rts
;
;
1: ldaa #0 ;___
bra 99f ;
2: ldaa #3 ; R
bra 99f ;
3: ldaa #2 ; C
bra 99f ;
4: ldaa #6 ; CR
bra 99f ;
5: ldaa #1 ;L
bra 99f ;
6: ldaa #5 ;L R
bra 99f ;
7: ldaa #4 ;LC
bra 99f ;
8: ldaa #7 ;LCR
bra 99f
99: rts
;-----------FSPEED----------
; Turns motors on full speed ahead.
;---------------------------
.section .text
fspeed: ldd #0xFFFF
std ontime
rts
;-----------MSPEED----------
; Turns motors on medium speed.
;---------------------------
.section .text
mspeed: ldd #0x8000
std ontime
rts
;-----------LTURN-----------
; Turns on motor 1 reverse and motor 2 forward
; and calls wait as many times as are in
; accumulator A
;---------------------------
.section .text
lturn: jsr m1b
jsr m2f
1: cmpb #0
ble 99f
pshx
ldx #250
jsr wait
pulx
decb
bra 1b
99: rts
;-----------RTURN-----------
; Turns on motor 1 forward and motor 2 backward
; and calls wait as many times as are in
; accumulator A
;---------------------------
.section .text
rturn: jsr m1f
jsr m2b
1: cmpb #0
ble 99f
pshx
ldx #250
jsr wait
pulx
decb
bra 1b
99: rts
;-----------ONWARD-----------
; Turns both motors on forward.
;---------------------------
.section .text
onward: jsr m1f
jsr m2f
rts
;-----------RETREAT---------
; Turns both motors on backward.
;---------------------------
.section .text
retreat: jsr m1b
jsr m2b
rts
;-----------HALT-----------
; Turns both motors off or stops.
;---------------------------
.section .text
halt: jsr m1s
jsr m2s
rts
;-----------INITM-----------
; This function makes sure motorport and motorsaver are both set to 0 when the
; program executes.
;---------------------------
.section .text
;Set all zeros at 0x7000
initm: ldaa #0x00
staa motorport
staa motorsaver
;-------------M1B-----------
; Causes motor 1 to move backward.
;---------------------------
.section .text
m1b: ldaa motorsaver
oraa #0b00010001
;anda #0b11111101
staa motorport
staa motorsaver
rts
;-------------M1F-----------
; Causes motor 1 to move forward.
;---------------------------
.section .text
m1f: ldaa motorsaver
oraa #0b00010010
anda #0b11111110
;staa motorport
staa motorsaver
rts
;-------------M1S-----------
; Causes motor 1 to stop movement.
;---------------------------
.section .text
m1s: ldaa motorsaver
oraa #0b00010000
anda #0b11110011
;staa motorport
staa motorsaver
rts
;-----------ALLSTOP---------
; Stops all motors
;---------------------------
.section .text
allstop:ldaa #0
staa motorsaver
rts
;-------------M2F-----------
; Causes motor 2 to move forward.
;---------------------------
.section .text
m2f: ldaa motorsaver
oraa #0b00100000
anda #0b11111101
staa motorport
staa motorsaver
rts
;-------------M2B-----------
; Causes motor 2 to move backward.
;---------------------------
.section .text
m2b: ldaa motorsaver
oraa #0b00100010
;anda #0b11111111
staa motorport
staa motorsaver
rts
;-------------M2S-----------
; Causes motor 2 to stop movement.
;---------------------------
.section .text
m2s: ldaa motorsaver
oraa #0b00100000
anda #0b11111100
staa motorsaver
staa motorport
rts
.section .text
; subroutine wait - waits 250 ms - modifies nothing
wait: psha ; save A
tpa ; save condition codes
psha ; "
;pshx ; save X
;ldx #250 ; wait 250 milliseconds
1: bsr wait1ms ; local label
dex
bne 1b
;pulx ; restore X
pula ; restore condition codes
tap ; "
pula ; restore a
rts
wait1ms:psha ; 1 ms wait
tpa
psha
pshx
ldx #200
2: dex
nop
nop
bne 2b
pulx
pula
tap
pula
rts
-
- Newbie
- Posts: 17
- Joined: Mon Apr 02, 2007 1:25 pm
Re: I have hacked the gibson!
i am a jock and you are a nerdCat wrote:heheheeeee programzzzz dewd
-
- Newbie
- Posts: 24
- Joined: Fri Mar 10, 2000 4:33 am