Hi I am using asm and I was able to get stuff of my stack a very round about way by first putting the value of the stack into a register e.g cx then doing mov al,cl then calling int 10 to display the hex value ascii code letter.
Anyway I wanted to make it so I did mov al,[bp+4] int 10h but it wont work, Ive been at other places and they said try doing mov ax,cx then int 10 but that doesnt work either here is the whole code below its the 1 value push 45h that should be the only thing on the stack and maybe a pointer to the stack function. The code is much simpler than words see below and check this pastebin if you want to see earlier versions
; --------------------------------------------
; Here is the operating system entry point
; --------------------------------------------
begin:
mov ax, cs ; Get the current segment
mov ds, ax ; The data is in this segment
cli ; disable interrupts while changing stack
mov ss, ax ; We'll use this segment for the stack too
mov sp, 0xfffe ; Start the stack at the top of the segment
sti ; Reenable interrupts
call zap
mov si, msg
; load address of our message
call sortcursor
call putstr ; print the message
call getcurspos
push bp ; save bp
mov bp,sp ; put sp into bp
push 45h
call showstack
hang:
jmp hang ; just loop forever.
; --------------------------------------------
; data for our program
msg db 'Zeon', 0
stx db 'ReadyFI', 0
; ---------------------------------------------
; Print a null-terminated string on the screen
; ---------------------------------------------
zap:
mov ah,06
mov al,00
mov bh,07
mov cx,00
mov dx,184fh
int 10h
retn
putstr:
lodsb ; AL = [DS:SI]
or al, al ; Set zero flag if al=0
jz putstrd ; jump to putstrd if zero flag is set
mov ah, 0x0e ; video function 0Eh (print char)
mov bx, 0x0007 ; color
int 0x10
jmp putstr
putstrd:
retn
sortcursor:
mov ah,02
mov dl,30
mov bh,00
mov dx,00
int 10h
retn
getcurspos:
mov ah,03h
mov bh,00h
int 10h
retn
;Return
;CH = Start scan line
;CL = End scan line
;DH = Row
;DL = Column
showstack:
mov al, [bp+4] ;
mov ah, 0x0e ; video function 0Eh (print char)
mov bx, 0x0007 ; color
int 0x10
;jmp showstack
retn
putstkd:
retn
Thanks in advance if anyone helps Ive just wasted a whole night on this silly problem. Its enough to , drive a man either insane or to the drink lol
Anyway I wanted to make it so I did mov al,[bp+4] int 10h but it wont work, Ive been at other places and they said try doing mov ax,cx then int 10 but that doesnt work either here is the whole code below its the 1 value push 45h that should be the only thing on the stack and maybe a pointer to the stack function. The code is much simpler than words see below and check this pastebin if you want to see earlier versions
; --------------------------------------------
; Here is the operating system entry point
; --------------------------------------------
begin:
mov ax, cs ; Get the current segment
mov ds, ax ; The data is in this segment
cli ; disable interrupts while changing stack
mov ss, ax ; We'll use this segment for the stack too
mov sp, 0xfffe ; Start the stack at the top of the segment
sti ; Reenable interrupts
call zap
mov si, msg
; load address of our message
call sortcursor
call putstr ; print the message
call getcurspos
push bp ; save bp
mov bp,sp ; put sp into bp
push 45h
call showstack
hang:
jmp hang ; just loop forever.
; --------------------------------------------
; data for our program
msg db 'Zeon', 0
stx db 'ReadyFI', 0
; ---------------------------------------------
; Print a null-terminated string on the screen
; ---------------------------------------------
zap:
mov ah,06
mov al,00
mov bh,07
mov cx,00
mov dx,184fh
int 10h
retn
putstr:
lodsb ; AL = [DS:SI]
or al, al ; Set zero flag if al=0
jz putstrd ; jump to putstrd if zero flag is set
mov ah, 0x0e ; video function 0Eh (print char)
mov bx, 0x0007 ; color
int 0x10
jmp putstr
putstrd:
retn
sortcursor:
mov ah,02
mov dl,30
mov bh,00
mov dx,00
int 10h
retn
getcurspos:
mov ah,03h
mov bh,00h
int 10h
retn
;Return
;CH = Start scan line
;CL = End scan line
;DH = Row
;DL = Column
showstack:
mov al, [bp+4] ;
mov ah, 0x0e ; video function 0Eh (print char)
mov bx, 0x0007 ; color
int 0x10
;jmp showstack
retn
putstkd:
retn
Thanks in advance if anyone helps Ive just wasted a whole night on this silly problem. Its enough to , drive a man either insane or to the drink lol