Reading defined bytes that i loaded into a different segment
Posted: Sun Nov 29, 2020 10:28 pm
[NASM, real mode]
I loaded this code off of the disk at 0x1000:0x0000
Here is the memory address of "wtf" being pushed onto the stack in segment 0x1000, then returning to segment 0:
(i pop it in segment 0, then print the value on screen)
and here is me trying to access the memory address from segment 0
im using 0x004e because that is the value that got pushed onto the stack with "push wtf". However, int 0x10 outputs null and still moves the cursor. The expected output would be 'h'... What is going on here?
I loaded this code off of the disk at 0x1000:0x0000
Here is the memory address of "wtf" being pushed onto the stack in segment 0x1000, then returning to segment 0:
(i pop it in segment 0, then print the value on screen)
Code: Select all
mov ax, wtf
push ax
push ds
mov ax, 0
push ax
mov ax, word [ds:0x1000]
push ax
retf ;going back to segment 0
wtf db 'hi', 0
Code: Select all
mov ax, 0x1000
mov ds, ax
mov ah, 0x0e
mov al, byte [ds:0x004e]
int 0x10